mts-booking-library 1.1.8 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,6 +58,11 @@ export declare class SubscriptionBooking extends Booking {
58
58
  * @returns {GetSubscriptionAvailabilityResponse} The availability of the subscription for the given parameters
59
59
  */
60
60
  getSubscriptionAvailabilities(request: GetSubscriptionAvailabilityRequest): Promise<GetSubscriptionAvailabilityResponse>;
61
+ /**
62
+ * This method creates a subscription cart for the given parameters.
63
+ * @param {CreateSubscriptionCartRequest} request the request object containing the parameters for the availability check
64
+ * @returns
65
+ */
61
66
  createSubscriptionCart(request: CreateSubscriptionCartRequest): Promise<SubscriptionCart>;
62
67
  }
63
68
  export declare namespace SubscriptionBooking {
@@ -219,6 +219,11 @@ var SubscriptionBooking = /** @class */ (function (_super) {
219
219
  });
220
220
  });
221
221
  };
222
+ /**
223
+ * This method creates a subscription cart for the given parameters.
224
+ * @param {CreateSubscriptionCartRequest} request the request object containing the parameters for the availability check
225
+ * @returns
226
+ */
222
227
  SubscriptionBooking.prototype.createSubscriptionCart = function (request) {
223
228
  return __awaiter(this, void 0, void 0, function () {
224
229
  var url;
package/lib/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { JourneyBooking } from "./booking/journeyBooking";
3
3
  export { ServiceBooking } from "./booking/serviceBooking";
4
4
  export { SubscriptionBooking } from "./booking/subscriptionBooking";
5
5
  export { Person, PassengersDetails, DEFAULT_PERSON } from "./types/common/Person";
6
- export { TariffMatrix, TariffSummary, TariffType, TermsType } from "./types/common/Tariffs";
6
+ export { Tariff, TariffsMatrix, TariffSummary, TariffType, TermsType } from "./types/common/Tariffs";
7
7
  export { JourneyCart, JourneyBookingType, CreateJourneyCartRequest, TripBookingInfo, DEFAULT_CREATE_JOURNEY_CART } from "./types/journeys/JourneyCart";
8
8
  export { JourneyInfo } from "./types/journeys/JourneyInfo";
9
9
  export { JourneySearchRequest, JourneySearchResult, DEFAULT_JOURNEY_SEARCH } from "./types/journeys/JourneySearch";
@@ -1,9 +1,30 @@
1
- export type TariffMatrix = {
1
+ /**
2
+ * This represents a tariff, a part of a {@link TariffsMatrix} (returned when searching Journeys or Services).
3
+ * @param {number} tariffTypeId - The id of the tariff type.
4
+ * @param {number} termsTypeId - The id of the terms type.
5
+ * @param {number} value - The value of the tariff (in the currency specified in the {@link Booking} object).
6
+ * @param {number} quantity - The number of passengers to which this tariff applies.
7
+ */
8
+ export type Tariff = {
2
9
  tariffTypeId: number;
3
10
  termsTypeId: number;
4
11
  value: number;
5
12
  quantity: number;
6
- }[][];
13
+ };
14
+ /**
15
+ * This represents a tariff matrix, returned when searching Journeys or Services.
16
+ * It is a 2D array of {@link Tariff} objects. On the rows, there are the terms types, while on the columns there are the tariff types.
17
+ */
18
+ export type TariffsMatrix = Tariff[][];
19
+ /**
20
+ * This represents a tariff type, returned when searching Journeys or Services. This shall be used the build the header of the tariff matrix.
21
+ * @param {string} name - The name of the tariff type.
22
+ * @param {string} description - The description of the tariff type.
23
+ * @param {boolean} requiredPassengersName - Whether the passengers' names are required for this tariff type.
24
+ * @param {number} numberOfOccupiedSeats - The number of seats occupied by this tariff type.
25
+ * @param {string} bookingProcessDescription - A message to be shown to the user during the booking process that describes the tariff type,
26
+ * including info on the rules that apply to it.
27
+ */
7
28
  export type TariffType = {
8
29
  name: string;
9
30
  description: string;
@@ -11,6 +32,16 @@ export type TariffType = {
11
32
  numberOfOccupiedSeats: number;
12
33
  bookingProcessDescription: string;
13
34
  };
35
+ /**
36
+ * This represents a terms type, returned when searching Journeys or Services. This shall be used the build the header of the rows of the tariff matrix.
37
+ * @param {string} name - The name of the terms type.
38
+ * @param {string} description - The description of the terms type.
39
+ * @param {boolean} isRefundAllowed - Whether tickets refunds are allowed for this terms type.
40
+ * @param {boolean} isChangeAllowed - Whether changing the ticket is allowed for this terms type.
41
+ * @param {string} validationRulesString - A string containing the validation rules that apply to this terms type.
42
+ * @param {string} bookingProcessDescription - A message to be shown to the user during the booking process that describes the terms type,
43
+ * including info on the rules that apply to it.
44
+ */
14
45
  export type TermsType = {
15
46
  name: string;
16
47
  description: string;
@@ -1,6 +1,6 @@
1
1
  import { Booking } from "../../booking/booking";
2
2
  import { Cart } from "../common/Cart";
3
- import { TariffMatrix, TariffSummary } from "../common/Tariffs";
3
+ import { TariffsMatrix, TariffSummary } from "../common/Tariffs";
4
4
  import { Stop } from "./Stop";
5
5
  /**
6
6
  * @description Object containing information about a trip of a selected journey. This object is part of the {@link CreateJourneyCartRequest} object
@@ -9,13 +9,13 @@ import { Stop } from "./Stop";
9
9
  * @property {number} tripId - The unique identifier for the trip.
10
10
  * @property {number} departureStopId - The unique identifier for the departure stop.
11
11
  * @property {number} destinationStopId - The unique identifier for the destination stop.
12
- * @property {TariffMatrix} tariffsMatrix - The tariff matrix for pricing the outbound journey.
12
+ * @property {TariffsMatrix} tariffsMatrix - The tariff matrix for pricing the outbound journey.
13
13
  */
14
14
  export type TripBookingInfo = {
15
15
  tripId: number;
16
16
  departureStopId: number;
17
17
  destinationStopId: number;
18
- tariffsMatrix: TariffMatrix;
18
+ tariffsMatrix: TariffsMatrix;
19
19
  };
20
20
  /**
21
21
  * @description This is the object to be passed to `JourneyBooking.createJourneyCart`, containing information about the selected service.
@@ -1,10 +1,10 @@
1
- import { TariffMatrix, TariffType, TermsType } from "../common/Tariffs";
1
+ import { TariffsMatrix, TariffType, TermsType } from "../common/Tariffs";
2
2
  export type Trip = {
3
3
  id: number;
4
4
  date: Date;
5
5
  departureStopName: string;
6
6
  destinationStopName: string;
7
- tariffsMatrix: TariffMatrix;
7
+ tariffsMatrix: TariffsMatrix;
8
8
  tariffTypes: TariffType[];
9
9
  termsTypes: TermsType[];
10
10
  };
@@ -1,4 +1,4 @@
1
- import { TariffMatrix, TariffType, TermsType } from "../common/Tariffs";
1
+ import { TariffsMatrix, TariffType, TermsType } from "../common/Tariffs";
2
2
  import { Line } from "./Line";
3
3
  import { ServiceInfo } from "./ServiceInfo";
4
4
  /**
@@ -8,7 +8,7 @@ import { ServiceInfo } from "./ServiceInfo";
8
8
  * @property {number} id - The unique identifier for the service.
9
9
  * @property {Line} line - Information about the line or route associated with the service.
10
10
  * @property {ServiceInfo} info - Information about the service itself.
11
- * @property {TariffMatrix} tariffsMatrix - The tariff matrix for pricing.
11
+ * @property {TariffsMatrix} tariffsMatrix - The tariff matrix for pricing.
12
12
  * @property {TariffType[]} tariffTypes - An array of tariff types available for the service.
13
13
  * @property {TermsType[]} termsTypes - An array of terms types related to the service.
14
14
  * @property {boolean} isDateOptional - Indicates whether a date can be optionally specified for this service.
@@ -19,7 +19,7 @@ export type Service = {
19
19
  id: number;
20
20
  line: Line;
21
21
  info: ServiceInfo;
22
- tariffsMatrix: TariffMatrix;
22
+ tariffsMatrix: TariffsMatrix;
23
23
  tariffTypes: TariffType[];
24
24
  termsTypes: TermsType[];
25
25
  isDateOptional: boolean;
@@ -1,6 +1,6 @@
1
1
  import { Booking } from "../../booking/booking";
2
2
  import { Cart } from "../common/Cart";
3
- import { TariffMatrix, TariffSummary } from "../common/Tariffs";
3
+ import { TariffsMatrix, TariffSummary } from "../common/Tariffs";
4
4
  import { ServiceTrip } from "./Service";
5
5
  /**
6
6
  * @description This is the object to be passed to `ServiceBooking.createServiceCart`, containing information about the selected service.
@@ -8,7 +8,7 @@ import { ServiceTrip } from "./Service";
8
8
  * @property {Booking.Currencies} currency - The currency in which the service is priced.
9
9
  * @property {Object} service - Information about the selected service.
10
10
  * @property {number} service.serviceId - The unique identifier for the service.
11
- * @property {TariffMatrix} service.tariffsMatrix - The tariff matrix for pricing the service.
11
+ * @property {TariffsMatrix} service.tariffsMatrix - The tariff matrix for pricing the service.
12
12
  * @property {Date|undefined} [service.date] - The date for the service (optional).
13
13
  * @property {number|undefined} [service.tripId] - The unique identifier for the trip (optional).
14
14
  */
@@ -16,7 +16,7 @@ export type CreateServiceCartRequest = {
16
16
  currency: Booking.Currencies;
17
17
  service: {
18
18
  serviceId: number;
19
- tariffsMatrix: TariffMatrix;
19
+ tariffsMatrix: TariffsMatrix;
20
20
  date?: Date;
21
21
  tripId?: number;
22
22
  };
@@ -28,7 +28,7 @@ export type CreateSubscriptionCartRequest = {
28
28
  outboundRouteId: number;
29
29
  returnRouteId: number;
30
30
  numberOfPassengers: number;
31
- period: SubscriptionPeriod[];
31
+ periods: SubscriptionPeriod[];
32
32
  };
33
33
  /**
34
34
  * @description This is the object that describes which perios should be booked.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Library for use MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",