mts-booking-library 1.2.32 → 1.2.33
Sign up to get free protection for your applications and to get access to all the features.
package/lib/booking/booking.js
CHANGED
@@ -207,7 +207,7 @@ var Booking = /** @class */ (function () {
|
|
207
207
|
}
|
208
208
|
issueStep = this.bookingStepsToStatus.get(Booking.BookingSteps.ISSUE);
|
209
209
|
if (!issueStep)
|
210
|
-
throw Error("Booking step not found!");
|
210
|
+
throw Error("Booking step: ".concat(Booking.BookingSteps.ISSUE, " not found!"));
|
211
211
|
if (!!issueStep[0]) return [3 /*break*/, 5];
|
212
212
|
_b = [Booking.BookingSteps.SEATS_SELECTION, Booking.BookingSteps.EXTRAS, Booking.BookingSteps.DISCOUNTS];
|
213
213
|
_c = [];
|
@@ -230,13 +230,13 @@ var Booking = /** @class */ (function () {
|
|
230
230
|
return [3 /*break*/, 1];
|
231
231
|
case 4:
|
232
232
|
// Check again if the issue step is accessible
|
233
|
-
issueStep = this.bookingStepsToStatus.get(Booking.BookingSteps.
|
233
|
+
issueStep = this.bookingStepsToStatus.get(Booking.BookingSteps.ISSUE);
|
234
234
|
if (!issueStep || !issueStep[0]) {
|
235
235
|
throw Error("The status of the cart does not allow to call this API");
|
236
236
|
}
|
237
237
|
_e.label = 5;
|
238
238
|
case 5:
|
239
|
-
url = "".concat(this.config.API_ENDPOINT, "/booking/sellers/").concat(this.sellerId, "/gateways?
|
239
|
+
url = "".concat(this.config.API_ENDPOINT, "/booking/sellers/").concat(this.sellerId, "/gateways?");
|
240
240
|
// We use directly makeGet because we don't want to add sellerId to the query string (it is already present in the url)
|
241
241
|
return [2 /*return*/, (0, apiCall_1.makeGet)(url).then(function (response) {
|
242
242
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
|
@@ -620,7 +620,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
620
620
|
JourneyBooking.prototype.useWallet = function () {
|
621
621
|
var _a;
|
622
622
|
return __awaiter(this, void 0, void 0, function () {
|
623
|
-
var
|
623
|
+
var issueStep, _b, _c, _d, _i, step, url;
|
624
624
|
var _this = this;
|
625
625
|
return __generator(this, function (_e) {
|
626
626
|
switch (_e.label) {
|
@@ -629,11 +629,11 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
629
629
|
if (!this.cartId || this.cartId === 0) {
|
630
630
|
throw Error("Cart is not initialized yet");
|
631
631
|
}
|
632
|
-
|
633
|
-
if (!
|
634
|
-
throw Error("Booking step not found!");
|
635
|
-
if (!!
|
636
|
-
_b = [booking_1.Booking.BookingSteps.SEATS_SELECTION, booking_1.Booking.BookingSteps.EXTRAS];
|
632
|
+
issueStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.ISSUE);
|
633
|
+
if (!issueStep)
|
634
|
+
throw Error("Booking step: ".concat(booking_1.Booking.BookingSteps.ISSUE, " not found!"));
|
635
|
+
if (!!issueStep[0]) return [3 /*break*/, 5];
|
636
|
+
_b = [booking_1.Booking.BookingSteps.SEATS_SELECTION, booking_1.Booking.BookingSteps.EXTRAS, booking_1.Booking.BookingSteps.DISCOUNTS];
|
637
637
|
_c = [];
|
638
638
|
for (_d in _b)
|
639
639
|
_c.push(_d);
|
@@ -654,9 +654,9 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
654
654
|
return [3 /*break*/, 1];
|
655
655
|
case 4:
|
656
656
|
// Check again if the discounts step is accessible
|
657
|
-
|
658
|
-
if (!
|
659
|
-
throw Error("The status of the cart does not allow to call
|
657
|
+
issueStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.ISSUE);
|
658
|
+
if (!issueStep || !issueStep[0]) {
|
659
|
+
throw Error("The status of the cart does not allow to call the API: booking/cart/".concat(this.cartId, "/payment/wallet"));
|
660
660
|
}
|
661
661
|
_e.label = 5;
|
662
662
|
case 5:
|
@@ -492,7 +492,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
492
492
|
ServiceBooking.prototype.useWallet = function () {
|
493
493
|
var _a;
|
494
494
|
return __awaiter(this, void 0, void 0, function () {
|
495
|
-
var
|
495
|
+
var issueStep, _b, _c, _d, _i, step, url;
|
496
496
|
var _this = this;
|
497
497
|
return __generator(this, function (_e) {
|
498
498
|
switch (_e.label) {
|
@@ -501,11 +501,11 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
501
501
|
if (!this.cartId || this.cartId === 0) {
|
502
502
|
throw Error("Cart is not initialized yet");
|
503
503
|
}
|
504
|
-
|
505
|
-
if (!
|
506
|
-
throw Error("Booking step not found!");
|
507
|
-
if (!!
|
508
|
-
_b = [booking_1.Booking.BookingSteps.SEATS_SELECTION, booking_1.Booking.BookingSteps.EXTRAS];
|
504
|
+
issueStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.ISSUE);
|
505
|
+
if (!issueStep)
|
506
|
+
throw Error("Booking step: ".concat(booking_1.Booking.BookingSteps.ISSUE, " not found!"));
|
507
|
+
if (!!issueStep[0]) return [3 /*break*/, 5];
|
508
|
+
_b = [booking_1.Booking.BookingSteps.SEATS_SELECTION, booking_1.Booking.BookingSteps.EXTRAS, booking_1.Booking.BookingSteps.DISCOUNTS];
|
509
509
|
_c = [];
|
510
510
|
for (_d in _b)
|
511
511
|
_c.push(_d);
|
@@ -526,9 +526,9 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
526
526
|
return [3 /*break*/, 1];
|
527
527
|
case 4:
|
528
528
|
// Check again if the discounts step is accessible
|
529
|
-
|
530
|
-
if (!
|
531
|
-
throw Error("The status of the cart does not allow to call
|
529
|
+
issueStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.ISSUE);
|
530
|
+
if (!issueStep || !issueStep[0]) {
|
531
|
+
throw Error("The status of the cart does not allow to call the API: booking/cart/".concat(this.cartId, "/payment/wallet"));
|
532
532
|
}
|
533
533
|
_e.label = 5;
|
534
534
|
case 5:
|
@@ -567,7 +567,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
567
567
|
SubscriptionBooking.prototype.useWallet = function () {
|
568
568
|
var _a;
|
569
569
|
return __awaiter(this, void 0, void 0, function () {
|
570
|
-
var
|
570
|
+
var issueStep, _b, _c, _d, _i, step, url;
|
571
571
|
var _this = this;
|
572
572
|
return __generator(this, function (_e) {
|
573
573
|
switch (_e.label) {
|
@@ -576,11 +576,11 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
576
576
|
if (!this.cartId || this.cartId === 0) {
|
577
577
|
throw Error("Cart is not initialized yet");
|
578
578
|
}
|
579
|
-
|
580
|
-
if (!
|
581
|
-
throw Error("Booking step not found!");
|
582
|
-
if (!!
|
583
|
-
_b = [booking_1.Booking.BookingSteps.SEATS_SELECTION, booking_1.Booking.BookingSteps.EXTRAS];
|
579
|
+
issueStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.ISSUE);
|
580
|
+
if (!issueStep)
|
581
|
+
throw Error("Booking step: ".concat(booking_1.Booking.BookingSteps.ISSUE, " not found!"));
|
582
|
+
if (!!issueStep[0]) return [3 /*break*/, 5];
|
583
|
+
_b = [booking_1.Booking.BookingSteps.SEATS_SELECTION, booking_1.Booking.BookingSteps.EXTRAS, booking_1.Booking.BookingSteps.DISCOUNTS];
|
584
584
|
_c = [];
|
585
585
|
for (_d in _b)
|
586
586
|
_c.push(_d);
|
@@ -601,9 +601,9 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
601
601
|
return [3 /*break*/, 1];
|
602
602
|
case 4:
|
603
603
|
// Check again if the discounts step is accessible
|
604
|
-
|
605
|
-
if (!
|
606
|
-
throw Error("The status of the cart does not allow to call
|
604
|
+
issueStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.ISSUE);
|
605
|
+
if (!issueStep || !issueStep[0]) {
|
606
|
+
throw Error("The status of the cart does not allow to call the API: booking/cart/".concat(this.cartId, "/payment/wallet"));
|
607
607
|
}
|
608
608
|
_e.label = 5;
|
609
609
|
case 5:
|
package/lib/config.js
CHANGED
@@ -32,7 +32,7 @@ var setConfig = function (env, sub_key, debug, access_token) {
|
|
32
32
|
default:
|
33
33
|
throw new Error("Invalid environment");
|
34
34
|
}
|
35
|
-
// Set
|
35
|
+
// Set OCP and access token
|
36
36
|
config.OCP_SUBSCRIPTION_KEY = sub_key;
|
37
37
|
config.ACCESS_TOKEN = access_token;
|
38
38
|
// Set debug
|