tripstorekrabi-shared 1.22.4 → 1.22.6
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 +4 -4
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -47,7 +47,7 @@ function calculateSellingPrice(commissionRate = 0, price) {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function
|
|
50
|
+
export function calculateInflatedSellingPrice(price, config) {
|
|
51
51
|
if (!config || !config.inflatedPrices) {
|
|
52
52
|
return price;
|
|
53
53
|
}
|
|
@@ -96,13 +96,13 @@ function calculateProductPrice(booking, pricing, options = { mode: SELLING_MODE
|
|
|
96
96
|
const commissionRate = pricing.commissionRates?.[bookingSourceKey];
|
|
97
97
|
const baseNetPriceAdult = customPricing.adult.partnerNetPrice;
|
|
98
98
|
const baseRetailPriceAdult = calculateSellingPrice(commissionRate, baseNetPriceAdult);
|
|
99
|
-
const finalPriceAdult =
|
|
99
|
+
const finalPriceAdult = calculateInflatedSellingPrice(baseRetailPriceAdult, customPricing);
|
|
100
100
|
|
|
101
101
|
let finalPriceChild = 0;
|
|
102
102
|
if (pricing.ageBands.child.active && volume.child && booking.children) {
|
|
103
103
|
const baseNetPriceChild = customPricing.child.partnerNetPrice;
|
|
104
104
|
const baseRetailPriceChild = calculateSellingPrice(commissionRate, baseNetPriceChild);
|
|
105
|
-
finalPriceChild =
|
|
105
|
+
finalPriceChild = calculateInflatedSellingPrice(baseRetailPriceChild, customPricing);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
total = booking.adults * finalPriceAdult + (booking.children ? booking.children * finalPriceChild : 0);
|
|
@@ -136,7 +136,7 @@ function calculateProductPrice(booking, pricing, options = { mode: SELLING_MODE
|
|
|
136
136
|
const commissionRate = pricing.commissionRates?.[bookingSourceKey];
|
|
137
137
|
const baseNetPrice = customPricing.partnerNetPrice;
|
|
138
138
|
const baseRetailPrice = calculateSellingPrice(commissionRate, baseNetPrice);
|
|
139
|
-
const finalPrice =
|
|
139
|
+
const finalPrice = calculateInflatedSellingPrice(baseRetailPrice, customPricing);
|
|
140
140
|
total = finalPrice;
|
|
141
141
|
} else if (options.mode === PARTNER_MODE) {
|
|
142
142
|
total = customPricing.partnerNetPrice
|