mts-booking-library 2.2.0 → 2.2.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.
@@ -132,27 +132,31 @@ var JourneyBooking = /** @class */ (function (_super) {
132
132
  };
133
133
  JourneyBooking.prototype.fetchAndSetCart = function (cartGuid, options) {
134
134
  return __awaiter(this, void 0, void 0, function () {
135
- var _this = this;
135
+ var cart, cartDueDate;
136
136
  return __generator(this, function (_a) {
137
- return [2 /*return*/, this.fetchCart(cartGuid, options).then(function (cart) {
137
+ switch (_a.label) {
138
+ case 0: return [4 /*yield*/, this.fetchCart(cartGuid, options)];
139
+ case 1:
140
+ cart = _a.sent();
138
141
  if (cart) {
139
- var cartDueDate = new Date();
142
+ cartDueDate = new Date();
140
143
  cartDueDate.setSeconds(cartDueDate.getSeconds() + cart.bookingDueDateRemainingSeconds);
141
144
  if (cartDueDate > new Date() && !cart.hasIssuedTickets) {
142
- _this.cart = cart;
143
- _this.cartGuid = cart.guid;
144
- _this.bookingDueDate = cartDueDate; // See Booking class
145
+ this.cart = cart;
146
+ this.cartGuid = cart.guid;
147
+ this.bookingDueDate = cartDueDate; // See Booking class
145
148
  // Update the sellerId. This is particularly important in Linkavel
146
- _this.updateSellerId(cart.sellerId);
149
+ this.updateSellerId(cart.sellerId);
147
150
  // Fill the booking process status
148
- _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
151
+ this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
149
152
  }
150
153
  else {
151
154
  // This should never happen, but just in case
152
- _this.resetBooking();
155
+ this.resetBooking();
153
156
  }
154
157
  }
155
- })];
158
+ return [2 /*return*/];
159
+ }
156
160
  });
157
161
  });
158
162
  };
@@ -301,7 +305,7 @@ var JourneyBooking = /** @class */ (function (_super) {
301
305
  throw new Error("Could not fetch cart");
302
306
  }
303
307
  // Update storage
304
- this.getStorage().getState().updateCartGuid(response.cart.guid);
308
+ this.getStorage().getState().updateCartGuid(response.cartGuid);
305
309
  return [2 /*return*/, this.cart];
306
310
  }
307
311
  });
@@ -132,27 +132,31 @@ var ServiceBooking = /** @class */ (function (_super) {
132
132
  };
133
133
  ServiceBooking.prototype.fetchAndSetCart = function (cartGuid, options) {
134
134
  return __awaiter(this, void 0, void 0, function () {
135
- var _this = this;
135
+ var cart, cartDueDate;
136
136
  return __generator(this, function (_a) {
137
- return [2 /*return*/, this.fetchCart(cartGuid, options).then(function (cart) {
137
+ switch (_a.label) {
138
+ case 0: return [4 /*yield*/, this.fetchCart(cartGuid, options)];
139
+ case 1:
140
+ cart = _a.sent();
138
141
  if (cart) {
139
- var cartDueDate = new Date();
142
+ cartDueDate = new Date();
140
143
  cartDueDate.setSeconds(cartDueDate.getSeconds() + cart.bookingDueDateRemainingSeconds);
141
144
  if (cartDueDate > new Date() && !cart.hasIssuedTickets) {
142
- _this.cart = cart;
143
- _this.cartGuid = cart.guid;
144
- _this.bookingDueDate = cartDueDate; // See Booking class
145
+ this.cart = cart;
146
+ this.cartGuid = cart.guid;
147
+ this.bookingDueDate = cartDueDate; // See Booking class
145
148
  // Update the sellerId. This is particularly important in Linkavel
146
- _this.updateSellerId(cart.sellerId);
149
+ this.updateSellerId(cart.sellerId);
147
150
  // Fill the booking process status
148
- _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
151
+ this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
149
152
  }
150
153
  else {
151
154
  // This should never happen, but just in case
152
- _this.resetBooking();
155
+ this.resetBooking();
153
156
  }
154
157
  }
155
- })];
158
+ return [2 /*return*/];
159
+ }
156
160
  });
157
161
  });
158
162
  };
@@ -302,7 +306,7 @@ var ServiceBooking = /** @class */ (function (_super) {
302
306
  throw new Error("Could not fetch cart");
303
307
  }
304
308
  // Update storage
305
- this.getStorage().getState().updateCartGuid(response.cart.guid);
309
+ this.getStorage().getState().updateCartGuid(response.cartGuid);
306
310
  return [2 /*return*/, this.cart];
307
311
  }
308
312
  });
@@ -132,27 +132,31 @@ var SubscriptionBooking = /** @class */ (function (_super) {
132
132
  };
133
133
  SubscriptionBooking.prototype.fetchAndSetCart = function (cartGuid, options) {
134
134
  return __awaiter(this, void 0, void 0, function () {
135
- var _this = this;
135
+ var cart, cartDueDate;
136
136
  return __generator(this, function (_a) {
137
- return [2 /*return*/, this.fetchCart(cartGuid, options).then(function (cart) {
137
+ switch (_a.label) {
138
+ case 0: return [4 /*yield*/, this.fetchCart(cartGuid, options)];
139
+ case 1:
140
+ cart = _a.sent();
138
141
  if (cart) {
139
- var cartDueDate = new Date();
142
+ cartDueDate = new Date();
140
143
  cartDueDate.setSeconds(cartDueDate.getSeconds() + cart.bookingDueDateRemainingSeconds);
141
144
  if (cartDueDate > new Date() && !cart.hasIssuedTickets) {
142
- _this.cart = cart;
143
- _this.cartGuid = cart.guid;
144
- _this.bookingDueDate = cartDueDate; // See Booking class
145
+ this.cart = cart;
146
+ this.cartGuid = cart.guid;
147
+ this.bookingDueDate = cartDueDate; // See Booking class
145
148
  // Update the sellerId. This is particularly important in Linkavel
146
- _this.updateSellerId(cart.sellerId);
149
+ this.updateSellerId(cart.sellerId);
147
150
  // Fill the booking process status
148
- _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
151
+ this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
149
152
  }
150
153
  else {
151
154
  // This should never happen, but just in case
152
- _this.resetBooking();
155
+ this.resetBooking();
153
156
  }
154
157
  }
155
- })];
158
+ return [2 /*return*/];
159
+ }
156
160
  });
157
161
  });
158
162
  };
@@ -360,7 +364,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
360
364
  throw new Error("Could not fetch cart");
361
365
  }
362
366
  // Update storage
363
- this.getStorage().getState().updateCartGuid(response.cart.guid);
367
+ this.getStorage().getState().updateCartGuid(response.cartGuid);
364
368
  return [2 /*return*/, this.cart];
365
369
  }
366
370
  });
@@ -132,27 +132,31 @@ var TplBooking = /** @class */ (function (_super) {
132
132
  };
133
133
  TplBooking.prototype.fetchAndSetCart = function (cartGuid, options) {
134
134
  return __awaiter(this, void 0, void 0, function () {
135
- var _this = this;
135
+ var cart, cartDueDate;
136
136
  return __generator(this, function (_a) {
137
- return [2 /*return*/, this.fetchCart(cartGuid, options).then(function (cart) {
137
+ switch (_a.label) {
138
+ case 0: return [4 /*yield*/, this.fetchCart(cartGuid, options)];
139
+ case 1:
140
+ cart = _a.sent();
138
141
  if (cart) {
139
- var cartDueDate = new Date();
142
+ cartDueDate = new Date();
140
143
  cartDueDate.setSeconds(cartDueDate.getSeconds() + cart.bookingDueDateRemainingSeconds);
141
144
  if (cartDueDate > new Date() && !cart.hasIssuedTickets) {
142
- _this.cart = cart;
143
- _this.cartGuid = cart.guid;
144
- _this.bookingDueDate = cartDueDate; // See Booking class
145
+ this.cart = cart;
146
+ this.cartGuid = cart.guid;
147
+ this.bookingDueDate = cartDueDate; // See Booking class
145
148
  // Update the sellerId. This is particularly important in Linkavel
146
- _this.updateSellerId(cart.sellerId);
149
+ this.updateSellerId(cart.sellerId);
147
150
  // Fill the booking process status
148
- _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
151
+ this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(cart.stepsToStatus);
149
152
  }
150
153
  else {
151
154
  // This should never happen, but just in case
152
- _this.resetBooking();
155
+ this.resetBooking();
153
156
  }
154
157
  }
155
- })];
158
+ return [2 /*return*/];
159
+ }
156
160
  });
157
161
  });
158
162
  };
@@ -359,7 +363,7 @@ var TplBooking = /** @class */ (function (_super) {
359
363
  throw new Error("Could not fetch cart");
360
364
  }
361
365
  // Update storage
362
- this.getStorage().getState().updateCartGuid(response.cart.guid);
366
+ this.getStorage().getState().updateCartGuid(response.cartGuid);
363
367
  return [2 /*return*/, this.cart];
364
368
  }
365
369
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",