ordering-ui-react-native 0.18.34 → 0.18.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -101,12 +101,26 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
101
101
|
const loyalBusinessIds = creditPointPlan?.businesses?.filter((b: any) => b.accumulates).map((item: any) => item.business_id) ?? []
|
|
102
102
|
const creditPointPlanOnBusiness = businessIds.every((bid: any) => loyalBusinessIds.includes(bid)) && creditPointPlan
|
|
103
103
|
|
|
104
|
-
const loyaltyRewardValue = creditPointPlanOnBusiness?.accumulation_rate
|
|
105
|
-
? Math.round(openCarts.reduce((sum: any, cart: any) => sum + cart?.subtotal, 0) / creditPointPlanOnBusiness?.accumulation_rate) : 0
|
|
106
|
-
|
|
107
104
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
108
105
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
109
106
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
107
|
+
|
|
108
|
+
const getIncludedTaxes = (cart: any) => {
|
|
109
|
+
if (cart?.taxes === null || !cart?.taxes) {
|
|
110
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
111
|
+
} else {
|
|
112
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
113
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
114
|
+
}, 0)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const loyaltyRewardValue = creditPointPlanOnBusiness?.accumulation_rate
|
|
119
|
+
? Math.round(
|
|
120
|
+
openCarts.reduce((sum: any, cart: any) => sum + cart?.subtotal + getIncludedTaxes(cart), 0) /
|
|
121
|
+
creditPointPlanOnBusiness?.accumulation_rate
|
|
122
|
+
) : 0
|
|
123
|
+
|
|
110
124
|
const handleMomentClick = () => {
|
|
111
125
|
if (isPreOrder) {
|
|
112
126
|
navigation.navigate('MomentOption')
|
|
@@ -62,7 +62,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
62
62
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
63
63
|
|
|
64
64
|
const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
|
|
65
|
-
const loyaltyRewardValue = Math.round(cart?.subtotal / loyaltyRewardRate)
|
|
66
65
|
|
|
67
66
|
const walletName: any = {
|
|
68
67
|
cash: {
|
|
@@ -73,6 +72,18 @@ const OrderSummaryUI = (props: any) => {
|
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
|
|
75
|
+
const getIncludedTaxes = () => {
|
|
76
|
+
if (cart?.taxes === null || !cart?.taxes) {
|
|
77
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
78
|
+
} else {
|
|
79
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
80
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
81
|
+
}, 0)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const loyaltyRewardValue = Math.round((cart?.subtotal + getIncludedTaxes()) / loyaltyRewardRate)
|
|
86
|
+
|
|
76
87
|
const handleDeleteClick = (product: any) => {
|
|
77
88
|
removeProduct(product, cart)
|
|
78
89
|
}
|
|
@@ -89,16 +100,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
89
100
|
})
|
|
90
101
|
}
|
|
91
102
|
|
|
92
|
-
const getIncludedTaxes = () => {
|
|
93
|
-
if (cart?.taxes === null || !cart?.taxes) {
|
|
94
|
-
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
95
|
-
} else {
|
|
96
|
-
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
97
|
-
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
98
|
-
}, 0)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
103
|
const getIncludedTaxesDiscounts = () => {
|
|
103
104
|
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
104
105
|
}
|