This commit is contained in:
shafi54 2026-02-01 18:57:23 +05:30
parent 001dd62aa5
commit 38060e78ff
2 changed files with 19 additions and 9 deletions

View file

@ -260,15 +260,25 @@ const placeOrderUtil = async (params: {
); );
const orderGroupProportion = orderTotal / totalAmount; const orderGroupProportion = orderTotal / totalAmount;
const { finalOrderTotal } = applyDiscountToOrder(
orderTotal,
totalAmount,
appliedCoupon,
orderGroupProportion
);
// const orderGroupProportion = orderTotal / totalAmount; const orderTotalAmount = isFirstOrder ? totalWithDelivery : totalAmount;
// const { finalOrderTotal } = applyDiscountToOrder(
// orderTotal,
// totalAmount,
// appliedCoupon,
// orderGroupProportion
// );
const { finalOrderTotal: finalOrderAmount } = applyDiscountToOrder(
orderTotal,
orderTotalAmount,
appliedCoupon,
orderGroupProportion
);
console.log({orderTotalAmount, finalOrderAmount})
// Create order record // Create order record
const [order] = await tx const [order] = await tx
.insert(orders) .insert(orders)
@ -279,7 +289,7 @@ const placeOrderUtil = async (params: {
isCod: paymentMethod === "cod", isCod: paymentMethod === "cod",
isOnlinePayment: paymentMethod === "online", isOnlinePayment: paymentMethod === "online",
paymentInfoId: sharedPaymentInfoId, paymentInfoId: sharedPaymentInfoId,
totalAmount: isFirstOrder ? totalWithDelivery.toString() : finalOrderTotal.toString(), totalAmount: finalOrderAmount.toString(),
deliveryCharge: isFirstOrder ? expectedDeliveryCharge.toString() : '0', deliveryCharge: isFirstOrder ? expectedDeliveryCharge.toString() : '0',
readableId: currentReadableId++, readableId: currentReadableId++,
userNotes: userNotes || null, userNotes: userNotes || null,

View file

@ -65,7 +65,7 @@ const isDevMode = Constants.executionEnvironment !== "standalone";
// const BASE_API_URL = 'http://192.168.100.101:4000'; // const BASE_API_URL = 'http://192.168.100.101:4000';
// const BASE_API_URL = 'http://192.168.1.7:4000'; // const BASE_API_URL = 'http://192.168.1.7:4000';
let BASE_API_URL = "https://mf.freshyo.in"; let BASE_API_URL = "https://mf.freshyo.in";
// let BASE_API_URL = 'http://192.168.100.103:4000'; // let BASE_API_URL = 'http://192.168.100.104:4000';
// let BASE_API_URL = 'http://192.168.29.176:4000'; // let BASE_API_URL = 'http://192.168.29.176:4000';
// if(isDevMode) { // if(isDevMode) {