tripstorekrabi-shared 1.20.2 → 1.20.4

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.
Files changed (3) hide show
  1. package/package.json +2 -2
  2. package/price.js +2 -2
  3. package/utils.js +6 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.20.2",
3
+ "version": "1.20.4",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "dayjs": "^1.11.13",
19
- "libphonenumber-js": "^1.12.6",
19
+ "libphonenumber-js": "^1.12.8",
20
20
  "nanoid": "^5.1.5"
21
21
  },
22
22
  "scripts": {
package/price.js CHANGED
@@ -384,9 +384,9 @@ function calculateStartEndPointPrice(people, startEndPoint, options = { mode: SE
384
384
  let isSelling = options.mode in [SELLING_MODE, PARTNER_MODE];
385
385
  if (pricing) {
386
386
  if (pricing.type === "group") {
387
- return (isSelling ? pricing.sellingPrice : pricing.operatorNetPrice) * Math.ceil((people.adults + people.children) / pricing.max);
387
+ return (isSelling ? (pricing.sellingPrice ?? pricing.amount) : pricing.operatorNetPrice) * Math.ceil((people.adults + people.children) / pricing.max);
388
388
  } else if (pricing.type === "person") {
389
- return (isSelling ? pricing.sellingPrice : pricing.operatorNetPrice) * (people.adults + people.children);
389
+ return (isSelling ? (pricing.sellingPrice ?? pricing.amount) : pricing.operatorNetPrice) * (people.adults + people.children);
390
390
  } else {
391
391
  return 0;
392
392
  }
package/utils.js CHANGED
@@ -724,6 +724,10 @@ export function isCivitatisBooking(referenceNumber) {
724
724
  return referenceNumber.startsWith('CIV-');
725
725
  }
726
726
 
727
+ export function isCuriosidad(referenceNumber) {
728
+ return referenceNumber.startsWith('CUR-');
729
+ }
730
+
727
731
  export function isTSKBooking(referenceNumber) {
728
732
  return referenceNumber.startsWith('TSK');
729
733
  }
@@ -747,6 +751,8 @@ export function getBookingType(referenceNumber) {
747
751
  return 'air';
748
752
  } else if (isTiqetsBooking(referenceNumber)) {
749
753
  return 'tiq';
754
+ } else if (isCuriosidad(referenceNumber)) {
755
+ return 'cur';
750
756
  } else if (isTSKBooking(referenceNumber)) {
751
757
  return 'tsk';
752
758
  }