From 38060e78ff8f97742243b6235b22e98f7b05d783 Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Sun, 1 Feb 2026 18:57:23 +0530 Subject: [PATCH] enh --- apps/backend/src/trpc/user-apis/order.ts | 26 ++++++++++++++++-------- packages/ui/index.ts | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/apps/backend/src/trpc/user-apis/order.ts b/apps/backend/src/trpc/user-apis/order.ts index 7038db8..b7b7119 100644 --- a/apps/backend/src/trpc/user-apis/order.ts +++ b/apps/backend/src/trpc/user-apis/order.ts @@ -260,15 +260,25 @@ const placeOrderUtil = async (params: { ); 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 const [order] = await tx .insert(orders) @@ -279,7 +289,7 @@ const placeOrderUtil = async (params: { isCod: paymentMethod === "cod", isOnlinePayment: paymentMethod === "online", paymentInfoId: sharedPaymentInfoId, - totalAmount: isFirstOrder ? totalWithDelivery.toString() : finalOrderTotal.toString(), + totalAmount: finalOrderAmount.toString(), deliveryCharge: isFirstOrder ? expectedDeliveryCharge.toString() : '0', readableId: currentReadableId++, userNotes: userNotes || null, diff --git a/packages/ui/index.ts b/packages/ui/index.ts index 461c3d5..a75fab3 100755 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -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.1.7:4000'; 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'; // if(isDevMode) {