mts-booking-library 1.2.16 → 1.2.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -477,7 +477,7 @@ var JourneyBooking = /** @class */ (function (_super) {
477
477
  throw Error("The status of the cart does not allow to call this API");
478
478
  }
479
479
  url = "".concat(this.config.API_ENDPOINT, "/booking/cart/").concat(this.cart.id, "/seats");
480
- return [2 /*return*/, this.callPostApi(url, { tripId: tripId, seatsIds: newSeatsIds }).then(function (response) {
480
+ return [2 /*return*/, this.callPostApi(url, { tripId: tripId, newSeatsIds: newSeatsIds }).then(function (response) {
481
481
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
482
482
  return response;
483
483
  }
package/lib/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export { JourneyCart, JourneyBookingType, CreateJourneyCartRequest, TripBookingI
14
14
  export { JourneyInfo } from "./types/journeys/JourneyInfo";
15
15
  export { JourneySearchRequest, JourneySearchResult, DEFAULT_JOURNEY_SEARCH } from "./types/journeys/JourneySearch";
16
16
  export { Stop } from "./types/journeys/Stop";
17
- export { Trip } from "./types/journeys/Trip";
17
+ export { Trip, CartTrip, ReductionTrip } from "./types/journeys/Trip";
18
18
  export { Line } from "./types/services/Line";
19
19
  export { Service, ServiceTrip } from "./types/services/Service";
20
20
  export { ServiceCart, ServiceBookingType, CreateServiceCartRequest } from "./types/services/ServiceCart";
@@ -2,6 +2,7 @@ import { Booking } from "../../booking/booking";
2
2
  import { Cart } from "../common/Cart";
3
3
  import { TariffsMatrix, TariffSummary } from "../common/Tariffs";
4
4
  import { Stop } from "./Stop";
5
+ import { CartTrip } from "./Trip";
5
6
  /**
6
7
  * @description Object containing information about a trip of a selected journey. This object is part of the {@link CreateJourneyCartRequest} object
7
8
  * and describes a single trip of the journey (either outbound or return).
@@ -48,12 +49,17 @@ export type JourneyCart = Cart & {
48
49
  * @description Represents a `JourneyBooking`, which contains information about a journey booking.
49
50
  *
50
51
  * @property {Booking.BookingTypes} type - The type of booking. For journeys, this is always `Booking.BookingTypes.MLP`.
52
+ * @property {boolean} isOutbound - If true, this is an outbound journey booking. Otherwise, it is a return journey booking.
51
53
  * @property {TariffSummary[]} summary - An array of {@link TariffSummary} objects representing the tariff summary
52
54
  * associated with this journey booking.
53
55
  * @property {Stop[]} info - An array of {@link Stop} objects representing the stops associated with this journey booking.
56
+ * @property {CartTrip[]} trips - An array of {@link CartTrip} objects representing the trips associated with this journey booking.
57
+ * Note that its lenght is always `info.length - 1`.
54
58
  */
55
59
  export type JourneyBookingType = {
56
60
  type: Booking.BookingTypes;
61
+ isOutbound: boolean;
57
62
  summary: TariffSummary[];
58
63
  info: Stop[];
64
+ trips: CartTrip[];
59
65
  };
@@ -18,3 +18,16 @@ export type ReductionTrip = {
18
18
  id: number;
19
19
  name: string;
20
20
  };
21
+ /**
22
+ * This type is used to represent a trip in the cart. This only makes sense for a JourneyBooking.
23
+ * @property { number } id - The id of the trip
24
+ * @property { string } name - The name of the trip
25
+ * @property { number } departureStopId - The id of the departure stop (same of the type {@link Stop})
26
+ * @property { number } destinationStopId - The id of the destination stop (same of the type {@link Stop})
27
+ */
28
+ export type CartTrip = {
29
+ id: number;
30
+ name: string;
31
+ departureStopId: number;
32
+ destinationStopId: number;
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "description": "Library for use MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",