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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/price.js +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.22.4",
3
+ "version": "1.22.6",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/price.js CHANGED
@@ -47,7 +47,7 @@ function calculateSellingPrice(commissionRate = 0, price) {
47
47
  );
48
48
  }
49
49
 
50
- function applyPromotionDiscount(price, config) {
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 = applyPromotionDiscount(baseRetailPriceAdult, customPricing);
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 = applyPromotionDiscount(baseRetailPriceChild, customPricing);
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 = applyPromotionDiscount(baseRetailPrice, customPricing);
139
+ const finalPrice = calculateInflatedSellingPrice(baseRetailPrice, customPricing);
140
140
  total = finalPrice;
141
141
  } else if (options.mode === PARTNER_MODE) {
142
142
  total = customPricing.partnerNetPrice