tripstorekrabi-shared 1.13.52 → 1.13.54

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 +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.13.52",
3
+ "version": "1.13.54",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/price.js CHANGED
@@ -145,7 +145,8 @@ export function countMaxPeople(pricing) {
145
145
  }
146
146
 
147
147
  export function getTotalAmountToBeReceived(booking, options = {}) {
148
- return booking.customerPaymentStatus === "Refunded" ? 0 : booking.partnerNetPrice + calculateExtraPayments(booking, { mode: SELLING_MODE, ...options })
148
+ let filter = (item) => (!options.filter || options.filter(item)) && !item.disabled && item.paymentMethod !== PAY_ON_TOUR;
149
+ return booking.customerPaymentStatus === "Refunded" ? 0 : booking.partnerNetPrice + calculateExtraPayments(booking, { ...options, mode: SELLING_MODE, filter })
149
150
  }
150
151
 
151
152
  export function calculatePartnerNetPrice(booking, product) {
@@ -358,4 +359,8 @@ export function findAddOn(id, addOns) {
358
359
  return addOns.find((item) =>
359
360
  item.id === id
360
361
  );
362
+ }
363
+
364
+ export function inRange(expected, actual, boundary = 10) {
365
+ return ((expected - boundary) <= actual) && ((expected + boundary) >= actual);
361
366
  }