tripstorekrabi-shared 1.13.33 → 1.13.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 +1 -1
- package/price.js +16 -0
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -20,6 +20,14 @@ export const EXTRA_PAYMENT_CATEGORIES = [STARTING_POINT_EXTRA_PAYMENT,
|
|
|
20
20
|
ADD_ON_EXTRA_PAYMENT,
|
|
21
21
|
OTHER_EXTRA_PAYMENT];
|
|
22
22
|
|
|
23
|
+
export function calculateProductPartnerNetPrice(booking, pricing) {
|
|
24
|
+
return calculateProductPrice(booking, pricing, { paymentMode: PARTNER_PAYMENT_MODE });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function calculateProductOperatorPrice(booking, pricing) {
|
|
28
|
+
return calculateProductPrice(booking, pricing, { paymentMode: OPERATOR_PAYMENT_MODE });
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
export function calculateProductPrice(booking, pricing, options = { paymentMode: SELLING_PAYMENT_MODE }) {
|
|
24
32
|
function calculateRetailPrice(commissionRate, price) {
|
|
25
33
|
return Math.floor(
|
|
@@ -152,6 +160,14 @@ export function calculatePartnerNetPrice(booking, product) {
|
|
|
152
160
|
);
|
|
153
161
|
}
|
|
154
162
|
|
|
163
|
+
export function calculateTotalOperatorPrice(booking, product) {
|
|
164
|
+
return calculateTotalPrice(booking, product, options = { paymentMode: OPERATOR_PAYMENT_MODE });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function calculateTotalPartnerNetPrice(booking, product) {
|
|
168
|
+
return calculateTotalPrice(booking, product, options = { paymentMode: PARTNER_PAYMENT_MODE });
|
|
169
|
+
}
|
|
170
|
+
|
|
155
171
|
export function calculateTotalPrice(booking, product, options = { paymentMode: SELLING_PAYMENT_MODE }) {
|
|
156
172
|
let total = calculateProductPrice(booking, product.pricing, options);
|
|
157
173
|
total += calculateStartEndPointPrice(booking, findStartingPoint(product, booking.startingPointId, false), options);
|