tripstorekrabi-shared 1.13.43 → 1.13.45

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 +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.13.43",
3
+ "version": "1.13.45",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/price.js CHANGED
@@ -137,13 +137,13 @@ export function countMaxPeople(pricing) {
137
137
  return volume ? volume.reduce((p, v) => p > v ? p : v) : MAX_PAX;
138
138
  }
139
139
 
140
- export function getTotalAmountToBeReceived(booking) {
140
+ export function getTotalAmountToBeReceived(booking, options = {}) {
141
141
  let total;
142
142
 
143
143
  if (booking.customerPaymentStatus === "Refunded") {
144
144
  total = 0;
145
145
  } else {
146
- total = booking.partnerNetPrice + calculateExtraPayments(booking);
146
+ total = booking.partnerNetPrice + calculateExtraPayments(booking, { mode: SELLING_MODE, ...options });
147
147
  }
148
148
 
149
149
  return total;
@@ -220,7 +220,15 @@ function getExtraPaymentPrice(item, options) {
220
220
  }
221
221
  }
222
222
 
223
- export function calculateExtraPayments(booking, options = { mode: SELLING_MODE }) {
223
+ export function calculateTotalExtraPaymentsSellingPrice(booking) {
224
+ return calculateExtraPayments(booking, { mode: SELLING_MODE });
225
+ }
226
+
227
+ export function calculateTotalExtraPaymentsOperatorPrice(booking) {
228
+ return calculateExtraPayments(booking, { mode: OPERATOR_MODE });
229
+ }
230
+
231
+ function calculateExtraPayments(booking, options = { mode: SELLING_MODE }) {
224
232
  let filter = options.filter ?? ((item) => !item.disabled);
225
233
  let getPrice = options.getPrice ?? getExtraPaymentPrice;
226
234