tripstorekrabi-shared 1.18.0 → 1.18.2
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 +8 -2
- package/utils.js +0 -6
package/package.json
CHANGED
package/price.js
CHANGED
|
@@ -49,8 +49,14 @@ function calculateSellingPrice(commissionRate, price) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function calculateProductPrice(booking, pricing, options = { mode: SELLING_MODE }) {
|
|
52
|
-
if (pricing.promotion
|
|
53
|
-
|
|
52
|
+
if (pricing.promotion) {
|
|
53
|
+
let departureDate = booking.departureDate instanceof Date ? dayjs(booking.departureDate) : typeof booking.departureDate.toDate === 'function' ? dayjs(booking.departureDate.toDate()) : null;
|
|
54
|
+
let startDate = pricing.promotion.startDate instanceof Date ? pricing.promotion.startDate : typeof pricing.promotion.startDate.toDate === 'function' ? pricing.promotion.startDate.toDate() : null;
|
|
55
|
+
let endDate = pricing.promotion.endDate instanceof Date ? pricing.promotion.endDate : typeof pricing.promotion.endDate.toDate === 'function' ? pricing.promotion.endDate.toDate() : null;
|
|
56
|
+
|
|
57
|
+
if (departureDate?.isBetween(startDate, endDate, "day", "[]")) {
|
|
58
|
+
pricing = { ...pricing, volumes: pricing.promotion.volumes };
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
let type = pricing.type;
|
package/utils.js
CHANGED
|
@@ -690,10 +690,6 @@ export function isAirbnbBooking(referenceNumber) {
|
|
|
690
690
|
return referenceNumber.startsWith('Airbnb-');
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
-
export function isKKdayBooking(referenceNumber) {
|
|
694
|
-
return referenceNumber.startsWith('KKday-');
|
|
695
|
-
}
|
|
696
|
-
|
|
697
693
|
export function isTiqetsBooking(referenceNumber) {
|
|
698
694
|
return referenceNumber.startsWith('TIQ-');
|
|
699
695
|
}
|
|
@@ -723,8 +719,6 @@ export function getBookingType(referenceNumber) {
|
|
|
723
719
|
return 'mus';
|
|
724
720
|
} else if (isAirbnbBooking(referenceNumber)) {
|
|
725
721
|
return 'air';
|
|
726
|
-
} else if (isKKdayBooking(referenceNumber)) {
|
|
727
|
-
return 'kkday';
|
|
728
722
|
} else if (isTiqetsBooking(referenceNumber)) {
|
|
729
723
|
return 'tiq';
|
|
730
724
|
} else if (isTSKBooking(referenceNumber)) {
|