Inventoty will be updated right after an newItem/updateItem/deleteItem for pre pay orders
inventoryObj() {
const changeInQuantity = -this.item.count;
const inventoryItemId = this.item.priceId;
return { changeInQuantity, inventoryItemId };
}
inventoryObj() {
const changeInQuantity = this.currentItem.quantity - this.item.count;
const inventoryItemId = this.item.priceId;
return { changeInQuantity, inventoryItemId };
}
inventoryObj() {
return {
changeInQuantity: this.item.quantity,
inventoryItemId: this.item.inventoryId,
};
}
async updateInventory() {
const updatedItems = this.updatedInventory.map((item) => (
InventoryItems.query(this.transaction).patch({
quantity: raw(`quantity + ${item.changeInQuantity}`),
}).findById(item.inventoryItemId)
));
await Promise.all(updatedItems);
}
we won't be updating the inventory for POST-PAY orders during order adjustment. will make necessary changes in the payment processor not to update the inventory of products if the order is adjusted and of type post-pay