mts-booking-library 1.2.16 → 1.2.17

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.
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.17",
4
4
  "description": "Library for use MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",