tripstorekrabi-shared 1.13.23 → 1.13.24

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 +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.13.23",
3
+ "version": "1.13.24",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/price.js CHANGED
@@ -194,6 +194,19 @@ export function calculateExtraPayments(booking, selling = true, calculationMode
194
194
  export function getExtraPaymentsPaidWithPartner(booking, product) {
195
195
  let startingPoint = findStartingPoint(product, booking.startingPointId);
196
196
  let endPoint = findEndPoint(product, booking.endPointId);
197
+ let addOnDefs = product.addOns ?? {};
198
+ let addOns = Object.keys(booking.addOns).filter((id) => addOnDefs[id] != null).map(([id, addOn]) => {
199
+ let addOnDef = addOnDefs[id];
200
+
201
+ return {
202
+ category: ADD_ON_EXTRA_PAYMENT,
203
+ description: addOnDef.title,
204
+ price: addOn.adults * addOnDef.pricing.adult.sellingPrice +
205
+ (addOn.children ?? 0) * addOnDef.pricing.child.sellingPrice,
206
+ operatorPrice: addOn.adults * addOnDef.pricing.adult.operatorNetPrice +
207
+ (addOn.children ?? 0) * addOnDef.pricing.child.operatorNetPrice
208
+ }
209
+ });
197
210
 
198
211
  return [
199
212
  {
@@ -214,6 +227,7 @@ export function getExtraPaymentsPaidWithPartner(booking, product) {
214
227
  price: calculateNationalParkFee(booking, product),
215
228
  operatorPrice: calculateNationalParkFee(booking, product),
216
229
  },
230
+ ...addOns
217
231
  ].filter(
218
232
  (item) =>
219
233
  (item.price > 0 || item.operatoPrice > 0) &&