tripstorekrabi-shared 1.13.30 → 1.13.32
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 +2 -2
- package/price.js +9 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tripstorekrabi-shared",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.32",
|
|
4
4
|
"description": "Shared library for Trip Store Krabi",
|
|
5
5
|
"author": "Stefan Sommer <tonprince@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"./product": "./product.js"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"dayjs": "^1.11.
|
|
18
|
+
"dayjs": "^1.11.9"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"deploy": "npm publish"
|
package/price.js
CHANGED
|
@@ -198,7 +198,7 @@ export function getExtraPaymentsPaidWithPartner(booking, product) {
|
|
|
198
198
|
(product.addOns ?? []).forEach((addOn) => {
|
|
199
199
|
addOnDefs[addOn.id] = addOn;
|
|
200
200
|
});
|
|
201
|
-
let addOns = Object.entries(booking.addOns).filter(([id]) => addOnDefs[id] != null).map(([id, addOn]) => {
|
|
201
|
+
let addOns = Object.entries(booking.addOns ?? {}).filter(([id]) => addOnDefs[id] != null).map(([id, addOn]) => {
|
|
202
202
|
let addOnDef = addOnDefs[id];
|
|
203
203
|
|
|
204
204
|
return {
|
|
@@ -243,16 +243,14 @@ export function getExtraPaymentsPaidWithPartner(booking, product) {
|
|
|
243
243
|
|
|
244
244
|
export function calculateAddOnsPrice(booking, product, selling = true) {
|
|
245
245
|
let total = 0;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
.
|
|
253
|
-
|
|
254
|
-
.operatorNetPrice) : 0);
|
|
255
|
-
}
|
|
246
|
+
for (const [id, addOn] of Object.entries(booking.addOns ?? {})) {
|
|
247
|
+
let addOnDef = findAddOn(id, product.addOns ?? []);
|
|
248
|
+
if (addOnDef) {
|
|
249
|
+
total += addOn.adults * (selling ? addOnDef.pricing.adult
|
|
250
|
+
.sellingPrice : addOnDef.pricing.adult
|
|
251
|
+
.operatorNetPrice) + (addOn.children > 0 ? addOn.children * (selling ? addOnDef.pricing.child
|
|
252
|
+
.sellingPrice : addOnDef.pricing.child
|
|
253
|
+
.operatorNetPrice) : 0);
|
|
256
254
|
}
|
|
257
255
|
}
|
|
258
256
|
return total;
|