tripstorekrabi-shared 1.7.2 → 1.7.5
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 +3 -2
- package/utils.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tripstorekrabi-shared",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "Shared library for Trip Store Krabi",
|
|
5
5
|
"author": "Stefan Sommer <tonprince@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"./availability": "./availability.js"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"dayjs": "^1.11.
|
|
16
|
+
"dayjs": "^1.11.5",
|
|
17
|
+
"node-fetch": "^3.2.10"
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
19
20
|
"deploy": "npm publish"
|
package/utils.js
CHANGED
|
@@ -5,6 +5,7 @@ import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js";
|
|
|
5
5
|
import utc from 'dayjs/plugin/utc.js';
|
|
6
6
|
import timezone from 'dayjs/plugin/timezone.js';
|
|
7
7
|
import { findEndPoint, findStartingPoint } from "./price.js";
|
|
8
|
+
import fetch from "node-fetch";
|
|
8
9
|
|
|
9
10
|
dayjs.extend(customParseFormat);
|
|
10
11
|
dayjs.extend(advancedFormat);
|
|
@@ -461,7 +462,7 @@ function checkTime(pickupTimeValue, departureTimeValue, context) {
|
|
|
461
462
|
let departureTimeValues = departureTimeValue.split(":");
|
|
462
463
|
let departureTime = dayjs().hour(departureTimeValues[0]).minute(departureTimeValues[1]).second(0);
|
|
463
464
|
|
|
464
|
-
return pickupTime.isSameOrBefore(departureTime) ? true : context.createError({ message: "Pickup time
|
|
465
|
+
return pickupTime.isSameOrBefore(departureTime) ? true : context.createError({ message: "Pickup time should be before or equals departure time", path: context.path, params: { status: "warning" } });
|
|
465
466
|
} catch (e) {
|
|
466
467
|
return false;
|
|
467
468
|
}
|
|
@@ -479,7 +480,7 @@ export function createVoucherRequest(booking, product) {
|
|
|
479
480
|
let request = {
|
|
480
481
|
booking: {
|
|
481
482
|
referenceNumber: booking.referenceNumber,
|
|
482
|
-
specialRequirements: booking.specialRequirements,
|
|
483
|
+
specialRequirements: booking.specialRequirements ? booking.specialRequirements.toUpperCase() : "",
|
|
483
484
|
nationalParkFee:
|
|
484
485
|
product && product.nationalPark
|
|
485
486
|
? "NATIONAL PARK ENTRANCE FEE: " +
|