tripstorekrabi-shared 1.13.14 → 1.13.16
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 +10 -10
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -117,7 +117,7 @@ export function getTotalAmountToBeReceived(booking) {
|
|
|
117
117
|
if (booking.customerPaymentStatus === "Refunded") {
|
|
118
118
|
total = 0;
|
|
119
119
|
} else {
|
|
120
|
-
total = calculateExtraPayments(booking, true);
|
|
120
|
+
total = booking.partnerNetPrice + calculateExtraPayments(booking, true);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
return total;
|
|
@@ -129,7 +129,7 @@ export function getTotalOperatorNetPrice(booking) {
|
|
|
129
129
|
if (booking.operatorPaymentStatus === "No Charge") {
|
|
130
130
|
total = 0;
|
|
131
131
|
} else {
|
|
132
|
-
total = calculateExtraPayments(booking, false);
|
|
132
|
+
total = booking.operatorNetPrice + calculateExtraPayments(booking, false);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
return total;
|
|
@@ -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
|
|
154
|
+
for (const item of Object.values(booking.extraPayments ?? {}).filter((item) => !item.disabled)) {
|
|
155
155
|
if (selling) {
|
|
156
|
-
if (
|
|
156
|
+
if (item.paymentMethod === PAY_ON_TOUR) {
|
|
157
157
|
if (calculationMode && item.category !== "OTHER") {
|
|
158
|
-
total -=
|
|
158
|
+
total -= item.price;
|
|
159
159
|
}
|
|
160
160
|
} else if (!calculationMode || item.category === "OTHER") {
|
|
161
|
-
total +=
|
|
161
|
+
total += item.receivedAmount ? item.receivedAmount : item.price;
|
|
162
162
|
}
|
|
163
163
|
} else {
|
|
164
|
-
if (
|
|
164
|
+
if (item.paymentMethod === PAY_ON_TOUR) {
|
|
165
165
|
if (calculationMode && item.category !== "OTHER") {
|
|
166
|
-
total -=
|
|
166
|
+
total -= item.operatorPrice;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
let ourCommission =
|
|
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 +=
|
|
174
|
+
total += item.operatorPrice;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|