apply coupon discount
This commit is contained in:
@@ -35,6 +35,7 @@ export default function useOrder() {
|
||||
orderType,
|
||||
giftDetails,
|
||||
location,
|
||||
discount,
|
||||
} = useAppSelector(selectCart);
|
||||
const highestLoyaltyItem = useAppSelector(selectHighestPricedLoyaltyItem);
|
||||
const { useLoyaltyPoints } = useAppSelector(selectCart);
|
||||
@@ -57,8 +58,6 @@ export default function useOrder() {
|
||||
const handleCreateOrder = useCallback(() => {
|
||||
createOrder({
|
||||
phone: mobilenumber || phone || giftDetails?.senderPhone,
|
||||
couponID: coupon,
|
||||
discountAmount: 0,
|
||||
comment: specialRequest,
|
||||
delivery_method: getDeliveryMethod(),
|
||||
timeslot: "",
|
||||
@@ -75,7 +74,9 @@ export default function useOrder() {
|
||||
})),
|
||||
office_no: officeDetails?.officeNo || "",
|
||||
vatvalue: 0,
|
||||
discountGiftCode: "",
|
||||
...(discount.isDiscount ? { couponID: coupon } : {}),
|
||||
...(discount.isGift ? { discountGiftCode: coupon } : {}),
|
||||
discountAmount: discount.value || 0,
|
||||
paymentType: "cod",
|
||||
uuid: user_uuid,
|
||||
pickup_comments: "",
|
||||
@@ -123,37 +124,6 @@ export default function useOrder() {
|
||||
.catch((error: any) => {
|
||||
console.error("Create Order failed:", error);
|
||||
});
|
||||
}, [
|
||||
createOrder,
|
||||
mobilenumber,
|
||||
phone,
|
||||
giftDetails?.senderPhone,
|
||||
giftDetails?.receiverName,
|
||||
giftDetails?.receiverPhone,
|
||||
giftDetails?.message,
|
||||
giftDetails?.isSecret,
|
||||
giftDetails?.senderEmail,
|
||||
giftDetails?.senderName,
|
||||
coupon,
|
||||
specialRequest,
|
||||
tables,
|
||||
orderType,
|
||||
restaurantID,
|
||||
items,
|
||||
officeDetails?.officeNo,
|
||||
user_uuid,
|
||||
estimateTime,
|
||||
orderPrice,
|
||||
useLoyaltyPoints,
|
||||
highestLoyaltyItem,
|
||||
tip,
|
||||
location?.lat,
|
||||
location?.lng,
|
||||
location?.address,
|
||||
t,
|
||||
navigate,
|
||||
subdomain,
|
||||
dispatch,
|
||||
]);
|
||||
}, [createOrder, mobilenumber, phone, giftDetails?.senderPhone, giftDetails?.receiverName, giftDetails?.receiverPhone, giftDetails?.message, giftDetails?.isSecret, giftDetails?.senderEmail, giftDetails?.senderName, specialRequest, getDeliveryMethod, tables, orderType, restaurantID, items, officeDetails?.officeNo, discount.isDiscount, discount.isGift, discount.value, coupon, user_uuid, estimateTime, orderPrice, useLoyaltyPoints, highestLoyaltyItem, tip, location?.lat, location?.lng, location?.address, t, navigate, subdomain, dispatch]);
|
||||
return { handleCreateOrder };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user