tripstorekrabi-shared 1.13.7 → 1.13.8

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 +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.13.7",
3
+ "version": "1.13.8",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/price.js CHANGED
@@ -124,6 +124,7 @@ export function calculateTotalPrice(booking, product, mode = "retail") {
124
124
  total += calculateStartEndPointPrice(booking, findStartingPoint(product, booking.startingPointId, false), mode === "retail" || mode === "partner");
125
125
  total += calculateStartEndPointPrice(booking, findEndPoint(product, booking.endPointId, false), mode === "retail" || mode === "partner");
126
126
  total += calculateNationalParkFee(booking, product);
127
+ total += calculateExtraPayments(data, mode === "retail" || mode === "partner", true);
127
128
  total += calculateAddOnsPrice(booking, product, mode === "retail" || mode === "partner");
128
129
  return total;
129
130
  }
@@ -132,10 +133,10 @@ export function calculateNationalParkFee(booking, product) {
132
133
  return booking.nationalParkFee === ALREADY_PAID && product.nationalPark ? product.nationalPark.pricing.adult * booking.adults + product.nationalPark.pricing.child * booking.children : 0;
133
134
  }
134
135
 
135
- export function calculateExtraPayments(booking, selling = true) {
136
+ export function calculateExtraPayments(booking, selling = true, excludePaymentsWithCategory = false) {
136
137
  let total = 0;
137
138
  if (booking.extraPayments) {
138
- for (const extraPayment of Object.values(booking.extraPayments).filter((item) => !item.disabled && item.paymentMethod !== PAY_ON_TOUR)) {
139
+ for (const extraPayment of Object.values(booking.extraPayments).filter((item) => !item.disabled && item.paymentMethod !== PAY_ON_TOUR && (!excludePaymentsWithCategory || !item.category))) {
139
140
  total += selling ? (extraPayment.receivedAmount ? extraPayment.receivedAmount : extraPayment.price) : extraPayment.operatorPrice;
140
141
  }
141
142
  }