tripstorekrabi-shared 1.13.6 → 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.
- package/package.json +1 -1
- package/price.js +5 -4
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -112,11 +112,11 @@ export function countMaxPeople(pricing) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export function getTotalAmountToBeReceived(booking) {
|
|
115
|
-
return booking.partnerNetPrice + calculateExtraPayments(booking, true);
|
|
115
|
+
return booking.customerPaymentStatus === "Refunded" ? 0 : booking.partnerNetPrice + calculateExtraPayments(booking, true);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export function getTotalOperatorNetPrice(booking) {
|
|
119
|
-
return booking.operatorNetPrice + calculateExtraPayments(booking, false);
|
|
119
|
+
return booking.operatorPaymentStatus === "No Charge" ? 0 : booking.operatorNetPrice + calculateExtraPayments(booking, false);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export function calculateTotalPrice(booking, product, mode = "retail") {
|
|
@@ -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
|
}
|