mts-booking-library 1.2.31 → 1.2.33

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.DISCOUNTS);
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?language=").concat(this.language);
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;
@@ -58,13 +58,13 @@ export declare class JourneyBooking extends Booking {
58
58
  getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
59
59
  /**
60
60
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
61
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
62
- * A linkavelCardNumber is a string of 9 digits.
63
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
61
+ * @param {string} [linkavelCard=undefined] The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
62
+ * A linkavelCard number is a string of 9 digits.
63
+ * @param {string} [phoneNumber=undefined] The phone number of the buyer. This parameter is required if linkavelCard is not set.
64
64
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
65
65
  * as well as a list of the available tariffs for each trip.
66
66
  */
67
- getBuyerFromLinkavelCard(linkavelCardNumber?: string, linkavelCardPhoneNumber?: string): Promise<ErrorResponse | Person>;
67
+ getBuyerFromLinkavelCard(linkavelCard?: string, phoneNumber?: string): Promise<ErrorResponse | Person>;
68
68
  /**
69
69
  * @description This methosd shall be called when the user wants to update the buyer and the passengers information.
70
70
  * @param {EditPassengersDetailsRequest} passengersDetails The object containing the buyer and the passengers information.
@@ -328,13 +328,13 @@ var JourneyBooking = /** @class */ (function (_super) {
328
328
  };
329
329
  /**
330
330
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
331
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
332
- * A linkavelCardNumber is a string of 9 digits.
333
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
331
+ * @param {string} [linkavelCard=undefined] The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
332
+ * A linkavelCard number is a string of 9 digits.
333
+ * @param {string} [phoneNumber=undefined] The phone number of the buyer. This parameter is required if linkavelCard is not set.
334
334
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
335
335
  * as well as a list of the available tariffs for each trip.
336
336
  */
337
- JourneyBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCardNumber, linkavelCardPhoneNumber) {
337
+ JourneyBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCard, phoneNumber) {
338
338
  return __awaiter(this, void 0, void 0, function () {
339
339
  var buyerPassengersDetails, searchParams, url;
340
340
  return __generator(this, function (_a) {
@@ -346,10 +346,10 @@ var JourneyBooking = /** @class */ (function (_super) {
346
346
  if (!buyerPassengersDetails || !buyerPassengersDetails[0]) {
347
347
  throw Error("The status of the cart does not allow to call this API");
348
348
  }
349
- if (!linkavelCardNumber && !linkavelCardPhoneNumber) {
350
- throw Error("At least one of the parameters linkavelCardNumber and linkavelCardPhoneNumber must be set");
349
+ if (!linkavelCard && !phoneNumber) {
350
+ throw Error("At least one of the parameters linkavelCard or phoneNumber must be set");
351
351
  }
352
- searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCardNumber && { linkavelCardNumber: linkavelCardNumber })), (linkavelCardPhoneNumber && { linkavelCardPhoneNumber: linkavelCardPhoneNumber })));
352
+ searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCard && { linkavelCard: linkavelCard })), (phoneNumber && { phoneNumber: phoneNumber })));
353
353
  url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams);
354
354
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
355
355
  // Check for errors
@@ -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 discountsStep, _b, _c, _d, _i, step, url;
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
- discountsStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.DISCOUNTS);
633
- if (!discountsStep)
634
- throw Error("Booking step not found!");
635
- if (!!discountsStep[0]) return [3 /*break*/, 5];
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
- discountsStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.DISCOUNTS);
658
- if (!discountsStep || !discountsStep[0]) {
659
- throw Error("The status of the cart does not allow to call this API");
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 discountsStep, _b, _c, _d, _i, step, url;
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
- discountsStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.DISCOUNTS);
505
- if (!discountsStep)
506
- throw Error("Booking step not found!");
507
- if (!!discountsStep[0]) return [3 /*break*/, 5];
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
- discountsStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.DISCOUNTS);
530
- if (!discountsStep || !discountsStep[0]) {
531
- throw Error("The status of the cart does not allow to call this API");
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 discountsStep, _b, _c, _d, _i, step, url;
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
- discountsStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.DISCOUNTS);
580
- if (!discountsStep)
581
- throw Error("Booking step not found!");
582
- if (!!discountsStep[0]) return [3 /*break*/, 5];
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
- discountsStep = this.bookingStepsToStatus.get(booking_1.Booking.BookingSteps.DISCOUNTS);
605
- if (!discountsStep || !discountsStep[0]) {
606
- throw Error("The status of the cart does not allow to call this API");
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 OCT and access token
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.2.31",
3
+ "version": "1.2.33",
4
4
  "description": "Library for use MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",