mts-booking-library 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,13 +22,22 @@
22
22
  // }
23
23
  // test("search_tpl", async () => {
24
24
  // const booking = new SubscriptionBooking(MTSEnvs.TEST, sub_key!, true, SubscriptionBooking.Languages.EN, access_token, sellerId);
25
- // // First, get the departures
25
+ // // First, get the departures and destinations
26
26
  // const departures = await booking.getSubscriptionsDepartures() as string[];
27
27
  // expect(departures.length).toBeGreaterThan(0);
28
- // expect(departures).toContain("APT TREVISO CANOVA");
29
- // const selectedDeparture = "APT TREVISO CANOVA";
30
- // const destinations = await booking.getJourneysDestinations(selectedDeparture);
31
- // expect(destinations).toContain("MESTRE FFSS");
28
+ // expect(departures).toContain("BARDOLINO AUTOSTAZIONE");
29
+ // const selectedDeparture = "BARDOLINO AUTOSTAZIONE";
30
+ // const destinations = await booking.getSubscriptionsDestinations(selectedDeparture) as string[];
31
+ // expect(destinations.length).toBeGreaterThan(0);
32
+ // expect(destinations).toContain("GARDA AUTOSTAZIONE");
33
+ // const selectedDestination = "GARDA AUTOSTAZIONE";
34
+ // // Then get the validity types
35
+ // const validityTypes = await booking.getSubscriptionsValidityTypes(selectedDeparture, selectedDestination) as SubscriptionBooking.ValidityTypes[];
36
+ // expect(validityTypes.length).toBeGreaterThan(0);
37
+ // for (const validityType of validityTypes) {
38
+ // // Check that all returned validity types are valid
39
+ // expect(Object.values(SubscriptionBooking.ValidityTypes).includes(validityType)).toBe(true);
40
+ // }
32
41
  // }, timeOut);
33
42
  // const createCart = async (booking: ServiceBooking): Promise<ServiceCart> => {
34
43
  // const servicesResponse = await booking.getServices(ServiceBooking.Currencies.EUR);
@@ -274,7 +274,9 @@ var JourneyBooking = /** @class */ (function (_super) {
274
274
  _this.getStorage().getState().updateCartId(response.cart.id);
275
275
  // Fill the booking process status
276
276
  _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(response.cart.stepsToStatus);
277
- _this.bookingDueDate = new Date(response.cart.bookingDueDate);
277
+ var cartDueDate = new Date();
278
+ cartDueDate.setSeconds(cartDueDate.getSeconds() + response.cart.bookingDueDateRemainingSeconds);
279
+ _this.bookingDueDate = cartDueDate;
278
280
  // Update the sellerId. This is particularly important in Linkavel
279
281
  _this.updateSellerId(response.cart.sellerId);
280
282
  return response.cart;
@@ -275,7 +275,9 @@ var ServiceBooking = /** @class */ (function (_super) {
275
275
  _this.getStorage().getState().updateCartId(response.cart.id);
276
276
  // Fill the booking process status
277
277
  _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(response.cart.stepsToStatus);
278
- _this.bookingDueDate = new Date(response.cart.bookingDueDate);
278
+ var cartDueDate = new Date();
279
+ cartDueDate.setSeconds(cartDueDate.getSeconds() + response.cart.bookingDueDateRemainingSeconds);
280
+ _this.bookingDueDate = cartDueDate;
279
281
  // Update the sellerId. This is particularly important in Linkavel
280
282
  _this.updateSellerId(response.cart.sellerId);
281
283
  return response.cart;
@@ -329,7 +329,9 @@ var SubscriptionBooking = /** @class */ (function (_super) {
329
329
  _this.getStorage().getState().updateCartId(response.cart.id);
330
330
  // Fill the booking process status
331
331
  _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(response.cart.stepsToStatus);
332
- _this.bookingDueDate = new Date(response.cart.bookingDueDate);
332
+ var cartDueDate = new Date();
333
+ cartDueDate.setSeconds(cartDueDate.getSeconds() + response.cart.bookingDueDateRemainingSeconds);
334
+ _this.bookingDueDate = cartDueDate;
333
335
  // Update the sellerId. This is particularly important in Linkavel
334
336
  _this.updateSellerId(response.cart.sellerId);
335
337
  return response.cart;
@@ -308,7 +308,9 @@ var TplBooking = /** @class */ (function (_super) {
308
308
  _this.getStorage().getState().updateCartId(response.cart.id);
309
309
  // Fill the booking process status
310
310
  _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(response.cart.stepsToStatus);
311
- _this.bookingDueDate = new Date(response.cart.bookingDueDate);
311
+ var cartDueDate = new Date();
312
+ cartDueDate.setSeconds(cartDueDate.getSeconds() + response.cart.bookingDueDateRemainingSeconds);
313
+ _this.bookingDueDate = cartDueDate;
312
314
  // Update the sellerId. This is particularly important in Linkavel
313
315
  _this.updateSellerId(response.cart.sellerId);
314
316
  return response.cart;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "@types/jest": "^29.5.12",
18
18
  "jest": "^29.7.0",
19
19
  "ts-jest": "^29.1.2",
20
- "typescript": "^5.4.3"
20
+ "typescript": "^5.4.4"
21
21
  },
22
22
  "files": [
23
23
  "lib/**/*"