tripstorekrabi-shared 1.13.14 → 1.13.15

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 +8 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.13.14",
3
+ "version": "1.13.15",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/price.js CHANGED
@@ -151,27 +151,27 @@ export function calculateNationalParkFee(booking, product) {
151
151
 
152
152
  export function calculateExtraPayments(booking, selling = true, calculationMode = false) {
153
153
  let total = 0;
154
- for (const extraPayment of Object.values(booking.extraPayments ?? {}).filter((item) => !item.disabled)) {
154
+ for (const item of Object.values(booking.extraPayments ?? {}).filter((item) => !item.disabled)) {
155
155
  if (selling) {
156
- if (extraPayment.paymentMethod === PAY_ON_TOUR) {
156
+ if (item.paymentMethod === PAY_ON_TOUR) {
157
157
  if (calculationMode && item.category !== "OTHER") {
158
- total -= extraPayment.price;
158
+ total -= item.price;
159
159
  }
160
160
  } else if (!calculationMode || item.category === "OTHER") {
161
- total += extraPayment.receivedAmount ? extraPayment.receivedAmount : extraPayment.price;
161
+ total += item.receivedAmount ? item.receivedAmount : item.price;
162
162
  }
163
163
  } else {
164
- if (extraPayment.paymentMethod === PAY_ON_TOUR) {
164
+ if (item.paymentMethod === PAY_ON_TOUR) {
165
165
  if (calculationMode && item.category !== "OTHER") {
166
- total -= extraPayment.operatorPrice;
166
+ total -= item.operatorPrice;
167
167
  }
168
168
 
169
- let ourCommission = extraPayment.price - extraPayment.operatorPrice;
169
+ let ourCommission = item.price - item.operatorPrice;
170
170
  if (ourCommission > 0) {
171
171
  total -= ourCommission;
172
172
  }
173
173
  } else if (!calculationMode || item.category === "OTHER") {
174
- total += extraPayment.operatorPrice;
174
+ total += item.operatorPrice;
175
175
  }
176
176
  }
177
177
  }