tripstorekrabi-shared 1.13.47 → 1.13.49
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 +1 -1
- package/price.js +9 -17
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -22,15 +22,15 @@ const PARTNER_MODE = 1;
|
|
|
22
22
|
const OPERATOR_MODE = 2;
|
|
23
23
|
|
|
24
24
|
export function calculateProductSellingPrice(booking, pricing) {
|
|
25
|
-
return calculateProductPrice(booking, pricing, { mode: SELLING_MODE });
|
|
25
|
+
return booking.customerPaymentStatus === "Refunded" ? 0 : calculateProductPrice(booking, pricing, { mode: SELLING_MODE });
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function calculateProductPartnerNetPrice(booking, pricing) {
|
|
29
|
-
return calculateProductPrice(booking, pricing, { mode: PARTNER_MODE });
|
|
29
|
+
return booking.customerPaymentStatus === "Refunded" ? 0 : calculateProductPrice(booking, pricing, { mode: PARTNER_MODE });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function calculateProductOperatorPrice(booking, pricing) {
|
|
33
|
-
return calculateProductPrice(booking, pricing, { mode: OPERATOR_MODE });
|
|
33
|
+
return booking.operatorPaymentStatus === "No Charge" ? 0 : calculateProductPrice(booking, pricing, { mode: OPERATOR_MODE });
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function calculateSellingPrice(commissionRate, price) {
|
|
@@ -139,15 +139,7 @@ export function countMaxPeople(pricing) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
export function getTotalAmountToBeReceived(booking, options = {}) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (booking.customerPaymentStatus === "Refunded") {
|
|
145
|
-
total = 0;
|
|
146
|
-
} else {
|
|
147
|
-
total = booking.partnerNetPrice + calculateExtraPayments(booking, { mode: SELLING_MODE, ...options });
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return total;
|
|
142
|
+
return booking.customerPaymentStatus === "Refunded" ? 0 : booking.partnerNetPrice + calculateExtraPayments(booking, { mode: SELLING_MODE, ...options })
|
|
151
143
|
}
|
|
152
144
|
|
|
153
145
|
export function calculatePartnerNetPrice(booking, product) {
|
|
@@ -164,15 +156,15 @@ export function calculatePartnerNetPrice(booking, product) {
|
|
|
164
156
|
}
|
|
165
157
|
|
|
166
158
|
export function calculateTotalSellingPrice(booking, product) {
|
|
167
|
-
return calculateTotalPrice(booking, product, { mode: SELLING_MODE });
|
|
159
|
+
return booking.customerPaymentStatus === "Refunded" ? 0 : calculateTotalPrice(booking, product, { mode: SELLING_MODE });
|
|
168
160
|
}
|
|
169
161
|
|
|
170
|
-
export function
|
|
171
|
-
return calculateTotalPrice(booking, product, { mode:
|
|
162
|
+
export function calculateTotalPartnerNetPrice(booking, product) {
|
|
163
|
+
return booking.customerPaymentStatus === "Refunded" ? 0 : calculateTotalPrice(booking, product, { mode: PARTNER_MODE });
|
|
172
164
|
}
|
|
173
165
|
|
|
174
|
-
export function
|
|
175
|
-
return calculateTotalPrice(booking, product, { mode:
|
|
166
|
+
export function calculateTotalOperatorPrice(booking, product) {
|
|
167
|
+
return booking.operatorPaymentStatus === "No Charge" ? 0 : calculateTotalPrice(booking, product, { mode: OPERATOR_MODE });
|
|
176
168
|
}
|
|
177
169
|
|
|
178
170
|
function calculateTotalPrice(booking, product, options = { mode: SELLING_MODE }) {
|