tripstorekrabi-shared 1.13.18 → 1.13.19
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 +30 -12
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -134,18 +134,6 @@ export function getTotalAmountToBeReceived(booking) {
|
|
|
134
134
|
return total;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
export function getTotalOperatorNetPrice(booking) {
|
|
138
|
-
let total;
|
|
139
|
-
|
|
140
|
-
if (booking.operatorPaymentStatus === "No Charge") {
|
|
141
|
-
total = 0;
|
|
142
|
-
} else {
|
|
143
|
-
total = booking.operatorNetPrice + calculateExtraPayments(booking, false);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return total;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
137
|
export function calculateTotalPrice(booking, product, mode = "retail") {
|
|
150
138
|
let total = calculateProductPrice(booking, product.pricing, mode);
|
|
151
139
|
total += calculateStartEndPointPrice(booking, findStartingPoint(product, booking.startingPointId, false), mode === "retail" || mode === "partner");
|
|
@@ -189,6 +177,36 @@ export function calculateExtraPayments(booking, selling = true, calculationMode
|
|
|
189
177
|
return total;
|
|
190
178
|
}
|
|
191
179
|
|
|
180
|
+
export function getExtraPaymentsPaidWithPartner(booking, product) {
|
|
181
|
+
return [
|
|
182
|
+
{
|
|
183
|
+
category: STARTING_POINT_EXTRA_PAYMENT,
|
|
184
|
+
description: startingPoint.name,
|
|
185
|
+
price: calculateStartEndPointPrice(booking, startingPoint, true),
|
|
186
|
+
operatorPrice: calculateStartEndPointPrice(booking, startingPoint, false),
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
category: END_POINT_EXTRA_PAYMENT,
|
|
190
|
+
description: endPoint.name,
|
|
191
|
+
price: calculateStartEndPointPrice(booking, endPoint, true),
|
|
192
|
+
operatorPrice: calculateStartEndPointPrice(booking, endPoint, false),
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
category: NATIONAL_PARK_FEE_EXTRA_PAYMENT,
|
|
196
|
+
description: `Entrance fee to ${product.nationalPark?.title}`,
|
|
197
|
+
price: calculateNationalParkFee(booking, product),
|
|
198
|
+
operatorPrice: calculateNationalParkFee(booking, product),
|
|
199
|
+
},
|
|
200
|
+
].filter(
|
|
201
|
+
(item) =>
|
|
202
|
+
(item.price > 0 || item.operatoPrice > 0) &&
|
|
203
|
+
Object.values(data.extraPayments ?? {}).find(
|
|
204
|
+
(extraPayment) =>
|
|
205
|
+
extraPayment.category === item.category && !item.disabled
|
|
206
|
+
) == null
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
192
210
|
export function calculateAddOnsPrice(booking, product, selling = true) {
|
|
193
211
|
let total = 0;
|
|
194
212
|
if (booking.addOns) {
|