tripstorekrabi-shared 1.13.21 → 1.13.23
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 +16 -2
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -134,6 +134,20 @@ export function getTotalAmountToBeReceived(booking) {
|
|
|
134
134
|
return total;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
export function calculatePartnerNetPrice(booking, product) {
|
|
138
|
+
return getExtraPaymentsPaidWithPartner(
|
|
139
|
+
booking,
|
|
140
|
+
product
|
|
141
|
+
).reduce(
|
|
142
|
+
(prev, curr) => prev + curr.price,
|
|
143
|
+
calculateProductPrice(
|
|
144
|
+
booking,
|
|
145
|
+
product.pricing,
|
|
146
|
+
'partner'
|
|
147
|
+
)
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
137
151
|
export function calculateTotalPrice(booking, product, mode = "retail") {
|
|
138
152
|
let total = calculateProductPrice(booking, product.pricing, mode);
|
|
139
153
|
total += calculateStartEndPointPrice(booking, findStartingPoint(product, booking.startingPointId, false), mode === "retail" || mode === "partner");
|
|
@@ -150,7 +164,7 @@ export function calculateNationalParkFee(booking, product) {
|
|
|
150
164
|
|
|
151
165
|
export function calculateExtraPayments(booking, selling = true, calculationMode = false) {
|
|
152
166
|
let total = 0;
|
|
153
|
-
for (const item of Object.values(booking.extraPayments
|
|
167
|
+
for (const item of Object.values(booking.extraPayments).filter((item) => !item.disabled)) {
|
|
154
168
|
if (selling) {
|
|
155
169
|
if (item.paymentMethod === PAY_ON_TOUR) {
|
|
156
170
|
if (calculationMode && item.category !== OTHER_EXTRA_PAYMENT) {
|
|
@@ -203,7 +217,7 @@ export function getExtraPaymentsPaidWithPartner(booking, product) {
|
|
|
203
217
|
].filter(
|
|
204
218
|
(item) =>
|
|
205
219
|
(item.price > 0 || item.operatoPrice > 0) &&
|
|
206
|
-
Object.values(booking.extraPayments
|
|
220
|
+
Object.values(booking.extraPayments).find(
|
|
207
221
|
(extraPayment) =>
|
|
208
222
|
extraPayment.category === item.category && !item.disabled
|
|
209
223
|
) == null
|