mts-booking-library 1.3.14 → 1.3.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  import { ErrorResponse } from "../types/ErrorResponse";
2
- import { EditPassengersDetailsRequest, GetBuyerPassengersDetailsResponse, Person } from "../types/common/Person";
2
+ import { Buyer, EditPassengersDetailsRequest, GetBuyerPassengersDetailsResponse } from "../types/common/Person";
3
3
  import { AddReductionRequest } from "../types/common/Reduction";
4
4
  import { BusMatrix } from "../types/journeys/BusMatrix";
5
5
  import { CreateJourneyCartRequest, JourneyCart } from "../types/journeys/JourneyCart";
@@ -96,13 +96,12 @@ export declare class JourneyBooking extends Booking {
96
96
  getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
97
97
  /**
98
98
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
99
- * @param {string} [linkavelCard=undefined] The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
100
- * A linkavelCard number is a string of 9 digits.
101
- * @param {string} [phoneNumber=undefined] The phone number of the buyer. This parameter is required if linkavelCard is not set.
99
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
100
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
102
101
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
103
102
  * as well as a list of the available tariffs for each trip.
104
103
  */
105
- getBuyerFromLinkavelCard(linkavelCard?: string, phoneNumber?: string): Promise<ErrorResponse | Person>;
104
+ getBuyerFromLinkavelCard(linkavelCard?: string, phoneNumber?: string): Promise<ErrorResponse | Buyer>;
106
105
  /**
107
106
  * @description This methosd shall be called when the user wants to update the buyer and the passengers information.
108
107
  * @param {EditPassengersDetailsRequest} passengersDetails The object containing the buyer and the passengers information.
@@ -349,9 +349,8 @@ var JourneyBooking = /** @class */ (function (_super) {
349
349
  };
350
350
  /**
351
351
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
352
- * @param {string} [linkavelCard=undefined] The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
353
- * A linkavelCard number is a string of 9 digits.
354
- * @param {string} [phoneNumber=undefined] The phone number of the buyer. This parameter is required if linkavelCard is not set.
352
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
353
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
355
354
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
356
355
  * as well as a list of the available tariffs for each trip.
357
356
  */
@@ -1,5 +1,5 @@
1
1
  import { ErrorResponse } from "../types/ErrorResponse";
2
- import { GetBuyerPassengersDetailsResponse, Person } from "../types/common/Person";
2
+ import { Buyer, GetBuyerPassengersDetailsResponse } from "../types/common/Person";
3
3
  import { AddReductionRequest } from "../types/common/Reduction";
4
4
  import { Service, ServiceTripsResponse } from "../types/services/Service";
5
5
  import { CreateServiceCartRequest, ServiceCart } from "../types/services/ServiceCart";
@@ -98,20 +98,19 @@ export declare class ServiceBooking extends Booking {
98
98
  getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
99
99
  /**
100
100
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
101
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
102
- * A linkavelCardNumber is a string of 9 digits.
103
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
101
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
102
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
104
103
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
105
104
  * as well as a list of the available tariffs for each trip.
106
105
  */
107
- getBuyerFromLinkavelCard(linkavelCardNumber?: string, linkavelCardPhoneNumber?: string): Promise<ErrorResponse | Person>;
106
+ getBuyerFromLinkavelCard(linkavelCard?: string, phoneNumber?: string): Promise<ErrorResponse | Buyer>;
108
107
  /**
109
108
  * @description This method shall be called when the user wants to update the buyer information.
110
- * @param {Person | null} buyerDetails The object containing the buyer information.
109
+ * @param buyerDetails The object containing the buyer information.
111
110
  * It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
112
111
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
113
112
  */
114
- updateBuyerPassengersDetails(buyerDetails: Person | null): Promise<ErrorResponse | boolean>;
113
+ updateBuyerPassengersDetails(buyerDetails: Buyer | null): Promise<ErrorResponse | boolean>;
115
114
  /**
116
115
  * @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
117
116
  * @param {AddReductionRequest} request The information about the reduction to add
@@ -329,13 +329,12 @@ var ServiceBooking = /** @class */ (function (_super) {
329
329
  };
330
330
  /**
331
331
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
332
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
333
- * A linkavelCardNumber is a string of 9 digits.
334
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
332
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
333
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
335
334
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
336
335
  * as well as a list of the available tariffs for each trip.
337
336
  */
338
- ServiceBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCardNumber, linkavelCardPhoneNumber) {
337
+ ServiceBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCard, phoneNumber) {
339
338
  return __awaiter(this, void 0, void 0, function () {
340
339
  var buyerPassengersDetails, searchParams, url;
341
340
  return __generator(this, function (_a) {
@@ -347,10 +346,10 @@ var ServiceBooking = /** @class */ (function (_super) {
347
346
  if (!buyerPassengersDetails || !buyerPassengersDetails[0]) {
348
347
  throw Error("The status of the cart does not allow to call this API");
349
348
  }
350
- if (!linkavelCardNumber && !linkavelCardPhoneNumber) {
349
+ if (!linkavelCard && !phoneNumber) {
351
350
  throw Error("At least one of the parameters linkavelCardNumber and linkavelCardPhoneNumber must be set");
352
351
  }
353
- searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCardNumber && { linkavelCardNumber: linkavelCardNumber })), (linkavelCardPhoneNumber && { linkavelCardPhoneNumber: linkavelCardPhoneNumber })));
352
+ searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCard && { linkavelCard: linkavelCard })), (phoneNumber && { phoneNumber: phoneNumber })));
354
353
  url = "".concat(this.config.API_ENDPOINT, "/v3_resources/buyers?").concat(searchParams);
355
354
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
356
355
  // Check for errors
@@ -364,7 +363,7 @@ var ServiceBooking = /** @class */ (function (_super) {
364
363
  };
365
364
  /**
366
365
  * @description This method shall be called when the user wants to update the buyer information.
367
- * @param {Person | null} buyerDetails The object containing the buyer information.
366
+ * @param buyerDetails The object containing the buyer information.
368
367
  * It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
369
368
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
370
369
  */
@@ -1,5 +1,5 @@
1
1
  import { ErrorResponse } from "../types/ErrorResponse";
2
- import { EditPassengersDetailsRequest, GetBuyerPassengersDetailsResponse, Person } from "../types/common/Person";
2
+ import { Buyer, EditPassengersDetailsRequest, GetBuyerPassengersDetailsResponse } from "../types/common/Person";
3
3
  import { AddReductionRequest } from "../types/common/Reduction";
4
4
  import { GetSubscriptionAvailabilityRequest, GetSubscriptionAvailabilityResponse } from "../types/subscriptions/SubscriptionAvailabilities";
5
5
  import { CreateSubscriptionCartRequest, SubscriptionCart } from "../types/subscriptions/SubscriptionCart";
@@ -117,13 +117,12 @@ export declare class SubscriptionBooking extends Booking {
117
117
  getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
118
118
  /**
119
119
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
120
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
121
- * A linkavelCardNumber is a string of 9 digits.
122
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
120
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
121
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
123
122
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
124
123
  * as well as a list of the available tariffs for each trip.
125
124
  */
126
- getBuyerFromLinkavelCard(linkavelCardNumber?: string, linkavelCardPhoneNumber?: string): Promise<ErrorResponse | Person>;
125
+ getBuyerFromLinkavelCard(linkavelCard?: string, phoneNumber?: string): Promise<ErrorResponse | Buyer>;
127
126
  /**
128
127
  * @description This methosd shall be called when the user wants to update the buyer and the passengers information.
129
128
  * @param {EditPassengersDetailsRequest} passengersDetails The object containing the buyer and the passengers information.
@@ -408,13 +408,12 @@ var SubscriptionBooking = /** @class */ (function (_super) {
408
408
  };
409
409
  /**
410
410
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
411
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
412
- * A linkavelCardNumber is a string of 9 digits.
413
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
411
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
412
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
414
413
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
415
414
  * as well as a list of the available tariffs for each trip.
416
415
  */
417
- SubscriptionBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCardNumber, linkavelCardPhoneNumber) {
416
+ SubscriptionBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCard, phoneNumber) {
418
417
  return __awaiter(this, void 0, void 0, function () {
419
418
  var buyerPassengersDetails, searchParams, url;
420
419
  return __generator(this, function (_a) {
@@ -426,10 +425,10 @@ var SubscriptionBooking = /** @class */ (function (_super) {
426
425
  if (!buyerPassengersDetails || !buyerPassengersDetails[0]) {
427
426
  throw Error("The status of the cart does not allow to call this API");
428
427
  }
429
- if (!linkavelCardNumber && !linkavelCardPhoneNumber) {
428
+ if (!linkavelCard && !phoneNumber) {
430
429
  throw Error("At least one of the parameters linkavelCardNumber and linkavelCardPhoneNumber must be set");
431
430
  }
432
- searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCardNumber && { linkavelCardNumber: linkavelCardNumber })), (linkavelCardPhoneNumber && { linkavelCardPhoneNumber: linkavelCardPhoneNumber })));
431
+ searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCard && { linkavelCard: linkavelCard })), (phoneNumber && { phoneNumber: phoneNumber })));
433
432
  url = "".concat(this.config.API_ENDPOINT, "/v3_resources/buyers?").concat(searchParams);
434
433
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
435
434
  // Check for errors
@@ -1,6 +1,6 @@
1
1
  import { ErrorResponse } from "../types/ErrorResponse";
2
2
  import { City } from "../types/common/City";
3
- import { GetBuyerPassengersDetailsResponse, Person } from "../types/common/Person";
3
+ import { Buyer, GetBuyerPassengersDetailsResponse } from "../types/common/Person";
4
4
  import { AddReductionRequest } from "../types/common/Reduction";
5
5
  import { TariffType, TermsType } from "../types/common/Tariffs";
6
6
  import { GetTariffsResponse } from "../types/tpl/GetTariffsResponse";
@@ -103,11 +103,13 @@ export declare class TplBooking extends Booking {
103
103
  getTariffs(superAreaId: number, termsTypeId: number | null, onlyTickets: boolean, onlySubscriptions: boolean): Promise<ErrorResponse | GetTariffsResponse>;
104
104
  /**
105
105
  * This method allows to create a TPL cart.
106
- * @param {Map<number, number>} tariffIdToQuantity A map that associates a tariff id (the one chosen by the user) to the number of tickets to buy for that tariff.
107
- * @param {Booking.Currencies} currency The currency in which the ticket is priced.
108
- * @param {string} [startDate] The start date of the ticket. This is optional and should be used only for subscriptions.
106
+ * @param tariffIdToQuantity A map that associates a tariff id (the one chosen by the user) to the number of tickets to buy for that tariff.
107
+ * @param currency The currency in which the ticket is priced.
108
+ * @param startDate The start date of the ticket. This is optional and should be used only for subscriptions.
109
+ * @param isCurrentPeriod Whether the subscription is for the current period. This is optional and should be used only for subscriptions.
110
+ * @param renewSubscriptionTicketPNR The PNR of the subscription ticket to renew. This is optional and should be used only for subscriptions.
109
111
  */
110
- createTplCart(tariffIdToQuantity: Map<number, number>, currency: Booking.Currencies, startDate?: string): Promise<ErrorResponse | TplCart>;
112
+ createTplCart(tariffIdToQuantity: Map<number, number>, currency: Booking.Currencies, startDate?: string, isCurrentPeriod?: boolean, renewSubscriptionTicketPNR?: string): Promise<ErrorResponse | TplCart>;
111
113
  /**
112
114
  * @description This method shall be called when the user wants to retrieve information about the buyer and the passengers.
113
115
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
@@ -116,20 +118,19 @@ export declare class TplBooking extends Booking {
116
118
  getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
117
119
  /**
118
120
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
119
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
120
- * A linkavelCardNumber is a string of 9 digits.
121
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
121
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
122
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
122
123
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
123
124
  * as well as a list of the available tariffs for each trip.
124
125
  */
125
- getBuyerFromLinkavelCard(linkavelCardNumber?: string, linkavelCardPhoneNumber?: string): Promise<ErrorResponse | Person>;
126
+ getBuyerFromLinkavelCard(linkavelCard?: string, phoneNumber?: string): Promise<ErrorResponse | Buyer>;
126
127
  /**
127
128
  * @description This method shall be called when the user wants to update the buyer information.
128
- * @param {Person | null} buyerDetails The object containing the buyer information.
129
+ * @param buyerDetails The object containing the buyer information.
129
130
  * It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
130
131
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
131
132
  */
132
- updateBuyerPassengersDetails(buyerDetails: Person | null): Promise<ErrorResponse | boolean>;
133
+ updateBuyerPassengersDetails(buyerDetails: Buyer | null): Promise<ErrorResponse | boolean>;
133
134
  /**
134
135
  * @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
135
136
  * @param {AddReductionRequest} request The information about the reduction to add
@@ -313,11 +313,13 @@ var TplBooking = /** @class */ (function (_super) {
313
313
  };
314
314
  /**
315
315
  * This method allows to create a TPL cart.
316
- * @param {Map<number, number>} tariffIdToQuantity A map that associates a tariff id (the one chosen by the user) to the number of tickets to buy for that tariff.
317
- * @param {Booking.Currencies} currency The currency in which the ticket is priced.
318
- * @param {string} [startDate] The start date of the ticket. This is optional and should be used only for subscriptions.
316
+ * @param tariffIdToQuantity A map that associates a tariff id (the one chosen by the user) to the number of tickets to buy for that tariff.
317
+ * @param currency The currency in which the ticket is priced.
318
+ * @param startDate The start date of the ticket. This is optional and should be used only for subscriptions.
319
+ * @param isCurrentPeriod Whether the subscription is for the current period. This is optional and should be used only for subscriptions.
320
+ * @param renewSubscriptionTicketPNR The PNR of the subscription ticket to renew. This is optional and should be used only for subscriptions.
319
321
  */
320
- TplBooking.prototype.createTplCart = function (tariffIdToQuantity, currency, startDate) {
322
+ TplBooking.prototype.createTplCart = function (tariffIdToQuantity, currency, startDate, isCurrentPeriod, renewSubscriptionTicketPNR) {
321
323
  return __awaiter(this, void 0, void 0, function () {
322
324
  var url, processedTariffIdToQuantity, request;
323
325
  var _this = this;
@@ -327,7 +329,7 @@ var TplBooking = /** @class */ (function (_super) {
327
329
  tariffIdToQuantity.forEach(function (value, key) {
328
330
  processedTariffIdToQuantity[key] = value;
329
331
  });
330
- request = __assign({ tariffIdToQuantity: processedTariffIdToQuantity, currency: currency }, (startDate && { startDate: startDate }));
332
+ request = __assign(__assign(__assign({ tariffIdToQuantity: processedTariffIdToQuantity, currency: currency }, (startDate !== undefined && { startDate: startDate })), (isCurrentPeriod !== undefined && { isCurrentPeriod: isCurrentPeriod })), (renewSubscriptionTicketPNR !== undefined && { renewSubscriptionTicketPNR: renewSubscriptionTicketPNR }));
331
333
  // Call the API
332
334
  return [2 /*return*/, this.callPostApi(url, request).then(function (response) {
333
335
  // Check for errors
@@ -379,7 +381,7 @@ var TplBooking = /** @class */ (function (_super) {
379
381
  return {
380
382
  buyerDataStatus: response.buyerDataStatus,
381
383
  buyer: response.buyer,
382
- passengers: []
384
+ passengers: null
383
385
  };
384
386
  })];
385
387
  });
@@ -387,13 +389,12 @@ var TplBooking = /** @class */ (function (_super) {
387
389
  };
388
390
  /**
389
391
  * @description This method shall be called when the user wants to retrieve information about an esisting buyer.
390
- * @param {string} [linkavelCardNumber=undefined] The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
391
- * A linkavelCardNumber is a string of 9 digits.
392
- * @param {string} [linkavelCardPhoneNumber=undefined] The linkavel card phone number of the buyer. This parameter is required if linkavelCardNumber is not set.
392
+ * @param linkavelCard The linkavel card number of the buyer. This parameter is required if linkavelCardPhoneNumber is not set.
393
+ * @param phoneNumber The phone number of the buyer. This parameter is required if linkavelCard is not set.
393
394
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
394
395
  * as well as a list of the available tariffs for each trip.
395
396
  */
396
- TplBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCardNumber, linkavelCardPhoneNumber) {
397
+ TplBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCard, phoneNumber) {
397
398
  return __awaiter(this, void 0, void 0, function () {
398
399
  var buyerPassengersDetails, searchParams, url;
399
400
  return __generator(this, function (_a) {
@@ -405,10 +406,10 @@ var TplBooking = /** @class */ (function (_super) {
405
406
  if (!buyerPassengersDetails || !buyerPassengersDetails[0]) {
406
407
  throw Error("The status of the cart does not allow to call this API");
407
408
  }
408
- if (!linkavelCardNumber && !linkavelCardPhoneNumber) {
409
+ if (!linkavelCard && !phoneNumber) {
409
410
  throw Error("At least one of the parameters linkavelCardNumber and linkavelCardPhoneNumber must be set");
410
411
  }
411
- searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCardNumber && { linkavelCardNumber: linkavelCardNumber })), (linkavelCardPhoneNumber && { linkavelCardPhoneNumber: linkavelCardPhoneNumber })));
412
+ searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCard && { linkavelCard: linkavelCard })), (phoneNumber && { phoneNumber: phoneNumber })));
412
413
  url = "".concat(this.config.API_ENDPOINT, "/v3_resources/buyers?").concat(searchParams);
413
414
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
414
415
  // Check for errors
@@ -422,7 +423,7 @@ var TplBooking = /** @class */ (function (_super) {
422
423
  };
423
424
  /**
424
425
  * @description This method shall be called when the user wants to update the buyer information.
425
- * @param {Person | null} buyerDetails The object containing the buyer information.
426
+ * @param buyerDetails The object containing the buyer information.
426
427
  * It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
427
428
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
428
429
  */
@@ -1,22 +1,25 @@
1
1
  import { PassengerTariff } from "./Tariffs";
2
2
  /**
3
3
  * @description Represents a person, that can be a passenger or the buyer.
4
- *
5
- * @property {number} id - The unique identifier for the person.
6
- * @property {string} name - The name of the person.
7
- * @property {string} lastName - The last name of the person.
8
- * @property {string} email - The email of the person.
9
- * @property {string} phoneNumber - The phone number of the person.
10
- * @property {string} [notes=undefined] - The notes for this person.
11
4
  */
12
5
  export type Person = {
6
+ /** The unique identifier for the person. */
13
7
  id: number;
8
+ /** The name of the person. */
14
9
  name: string;
10
+ /** The last name of the person. */
15
11
  lastName: string;
12
+ /** The email of the person. */
16
13
  email: string;
14
+ /** The phone number of the person. */
17
15
  phoneNumber: string;
16
+ /** The notes for this person. */
18
17
  notes?: string;
19
18
  };
19
+ export type Buyer = Person & {
20
+ /** The social security number of the buyer, if provided. */
21
+ socialSecurityNumber: string | null;
22
+ };
20
23
  export declare const DEFAULT_PERSON: Person;
21
24
  export declare const initializePerson: (person?: Person | undefined | null) => Person;
22
25
  /**
@@ -37,24 +40,23 @@ export type GetPassenger = Person & {
37
40
  returnTariffs: Map<number, PassengerTariff[]> | null;
38
41
  };
39
42
  export declare enum BuyerDataStatus {
43
+ /** The buyer data are optional. Buyer form shall be displayed, but the user can skip it. */
40
44
  OPTIONAL = 0,
45
+ /** The buyer data are required. Buyer form shall be displayed and the user cannot skip it. */
41
46
  REQUIRED = 1,
47
+ /** The buyer data cannot be specified. Buyer form shall not be displayed. */
42
48
  CANNOT_BE_SPECIFIED = 2
43
49
  }
44
50
  /**
45
- * @description Represents the response of the {@link getBuyerPassengersDetails} method.
46
- *
47
- * @property {BuyerDataStatus} buyerDataStatus - Whether the for for the buyer data are required, optional or cannot be specified.
48
- * - `OPTIONAL`: The buyer data are optional. Buyer form shall be displayed, but the user can skip it.
49
- * - `REQUIRED`: The buyer data are required. Buyer form shall be displayed and the user cannot skip it.
50
- * - `CANNOT_BE_SPECIFIED`: The buyer data cannot be specified. Buyer form shall not be displayed.
51
- * @property {Person} buyer - The {@link Person} object representing the buyer.
52
- * @property {GetPassenger[]} passengers - An array of {@link GetPassenger} objects representing the passengers.
51
+ * Represents the response of the {@link getBuyerPassengersDetails} method.
53
52
  */
54
53
  export type GetBuyerPassengersDetailsResponse = {
54
+ /** Whether the form for the buyer data is required, optional or cannot be specified. */
55
55
  buyerDataStatus: BuyerDataStatus;
56
- buyer: Person;
57
- passengers: GetPassenger[];
56
+ /** The {@link Person} object representing the buyer. */
57
+ buyer: Buyer | null;
58
+ /** An array of {@link GetPassenger} objects representing the passengers. */
59
+ passengers: GetPassenger[] | null;
58
60
  };
59
61
  /**
60
62
  * @description Represents the type of the passengers array in {@link EditPassengersDetailsRequest}.
@@ -68,13 +70,14 @@ export type EditPassengerRequestType = Person & {
68
70
  };
69
71
  /**
70
72
  * @description Represents the passengers details.
71
- * This type shall be used as request for the {@link updatePassengersDetails} method.
72
- *
73
- * @property {EditPassengerRequestType[]} passengers - An array of {@link Person} extended by the map `tripsToTariffs` objects representing the passengers.
74
- * @property {Person | null} buyer - The {@link Person} object representing the buyer.
75
- * It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
73
+ * This type shall be used as request for the {@link Booking.updateBuyerPassengersDetails} method.
76
74
  */
77
75
  export type EditPassengersDetailsRequest = {
76
+ /** An array of {@link Person} extended by the map `tripsToTariffs` objects representing the passengers. */
78
77
  passengers: EditPassengerRequestType[];
79
- buyer: Person | null;
78
+ /**
79
+ * The {@link Person} object representing the buyer.
80
+ * It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
81
+ */
82
+ buyer: Buyer | null;
80
83
  };
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // This module contains the types to manage the passengers information
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.BuyerDataStatus = exports.initializePerson = exports.DEFAULT_PERSON = void 0;
5
4
  exports.DEFAULT_PERSON = {
@@ -18,7 +17,10 @@ var initializePerson = function (person) {
18
17
  exports.initializePerson = initializePerson;
19
18
  var BuyerDataStatus;
20
19
  (function (BuyerDataStatus) {
20
+ /** The buyer data are optional. Buyer form shall be displayed, but the user can skip it. */
21
21
  BuyerDataStatus[BuyerDataStatus["OPTIONAL"] = 0] = "OPTIONAL";
22
+ /** The buyer data are required. Buyer form shall be displayed and the user cannot skip it. */
22
23
  BuyerDataStatus[BuyerDataStatus["REQUIRED"] = 1] = "REQUIRED";
24
+ /** The buyer data cannot be specified. Buyer form shall not be displayed. */
23
25
  BuyerDataStatus[BuyerDataStatus["CANNOT_BE_SPECIFIED"] = 2] = "CANNOT_BE_SPECIFIED";
24
26
  })(BuyerDataStatus || (exports.BuyerDataStatus = BuyerDataStatus = {}));
@@ -1,17 +1,43 @@
1
1
  /**
2
2
  * This represents a tariff, which defined the price to pay for a certain ticket.
3
- * @param {number} id - The id of the tariff.
4
- * @param {number} tariffTypeId - The id of the tariff type.
5
- * @param {number} termsTypeId - The id of the terms type.
6
- * @param {number} value - The value of the tariff (in the currency specified in the {@link Booking} object).
7
- * @param {number} quantity - The number of passengers to which this tariff applies.
8
3
  */
9
4
  export type Tariff = {
5
+ /** The id of the tariff */
10
6
  id: number;
7
+ /** The id of the tariff type */
11
8
  tariffTypeId: number;
9
+ /** The id of the terms type */
12
10
  termsTypeId: number;
11
+ /** The id of the tariff plan */
12
+ tariffPlanId: number;
13
+ /** The id of the seller */
14
+ sellerId: number;
15
+ /** The id of the associated segment, if any */
16
+ segmentId: number | null;
17
+ /** The id of the associated super area, if any */
18
+ superAreaId: number | null;
19
+ /** The id of the associated extra, if any */
20
+ extraId: number | null;
21
+ /** The value of the tariff (in the currency specified in the {@link Booking} object) */
13
22
  value: number;
23
+ /** @deprecated Use {@link Tariff.valueCurrencies} instead */
24
+ currency: null;
25
+ /** The value of the tariff in the different currencies */
26
+ valueCurrencies: {
27
+ percentage: number | null;
28
+ eur: number | null;
29
+ usd: number | null;
30
+ chf: number | null;
31
+ id: number;
32
+ };
33
+ /** The number of passengers to which this tariff applies */
14
34
  quantity: number;
35
+ /** The custom code for one-way tickets */
36
+ oneWayCode: string | null;
37
+ /** The custom code for round trip tickets */
38
+ roundTripCode: string | null;
39
+ /** Whether the tariff is active */
40
+ isActive: boolean;
15
41
  };
16
42
  /**
17
43
  * This represents a tariff matrix, returned when searching Journeys or Services.
@@ -22,41 +48,57 @@ export type Tariff = {
22
48
  export type TariffsMatrix = (Tariff | undefined)[][];
23
49
  /**
24
50
  * This represents a tariff type (e.g. "Adult", "Child", "Over65", ...).
25
- * @param {number} id - The id of the tariff type in the db.
26
- * @param {string} name - The name of the tariff type.
27
- * @param {string} description - The description of the tariff type.
28
- * @param {boolean} requiredPassengersName - Whether the passengers' names are required for this tariff type.
29
- * @param {number} numberOfOccupiedSeats - The number of seats occupied by this tariff type.
30
- * @param {string} bookingProcessDescription - A message to be shown to the user during the booking process that describes the tariff type,
31
- * including info on the rules that apply to it.
32
51
  */
33
52
  export type TariffType = {
53
+ /** The id of the tariff type in the db */
34
54
  id: number;
55
+ /** The name of the tariff type */
35
56
  name: string;
57
+ /** The description of the tariff type */
36
58
  description: string;
59
+ /** Whether the passengers' names are required for this tariff type */
37
60
  requiredPassengersName: boolean;
61
+ /** The number of seats occupied by this tariff type */
38
62
  numberOfOccupiedSeats: number;
63
+ /**
64
+ * A message to be shown to the user during the booking process that describes the tariff type,
65
+ * including info on the rules that apply to it
66
+ */
39
67
  bookingProcessDescription: string;
40
68
  };
41
69
  /**
42
70
  * This represents a terms type (e.g. "Standard", "Business", ...).
43
- * @param {number} id - The id of the terms type in the db.
44
- * @param {string} name - The name of the terms type.
45
- * @param {string} description - The description of the terms type.
46
- * @param {boolean} isRefundAllowed - Whether tickets refunds are allowed for this terms type.
47
- * @param {boolean} isChangeAllowed - Whether changing the ticket is allowed for this terms type.
48
- * @param {string} validationRulesString - A string containing the validation rules that apply to this terms type.
49
- * @param {string} bookingProcessDescription - A message to be shown to the user during the booking process that describes the terms type,
50
- * including info on the rules that apply to it.
51
71
  */
52
72
  export type TermsType = {
73
+ /** The id of the terms type in the db */
53
74
  id: number;
75
+ /** The name of the terms type */
54
76
  name: string;
77
+ /** The description of the terms type */
55
78
  description: string;
79
+ /** Whether tickets refunds are allowed for this terms type */
56
80
  isRefundAllowed: boolean;
81
+ /** Whether changing the ticket is allowed for this terms type */
57
82
  isChangeAllowed: boolean;
83
+ /** A string containing the validation rules that apply to this terms type */
58
84
  validationRulesString: string;
85
+ /**
86
+ * A message to be shown to the user during the booking process that describes the terms type,
87
+ * including info on the rules that apply to it
88
+ */
59
89
  bookingProcessDescription: string;
90
+ /** Whether these terms are the default ones */
91
+ isDefault: boolean;
92
+ /** Whether the terms are for a subscription */
93
+ isSubscription: boolean;
94
+ /** Whether a start date can be selected for this ticket */
95
+ canSelectStartDate: boolean;
96
+ /** Whether a start date is mandatory for this ticket */
97
+ isStartDateMandatory: boolean;
98
+ /** The validation rule for these terms */
99
+ validationRule: any | null;
100
+ /** The rules associated with these terms */
101
+ rules: any | null;
60
102
  };
61
103
  export type TariffSummary = {
62
104
  quantity: number;
@@ -26,16 +26,16 @@ export type TplBookingType = {
26
26
  };
27
27
  /**
28
28
  * @description Represents a `TplBookingInfo`, which contains general information about a tpl booking.
29
- * @property {boolean} isSubscription - Whether the booking is a subscription or a single ticket.
30
- * @property {number} superAreaId - The id of the super area.
31
- * @property {number} validity - The validity of the ticket (or of the subscription).
32
- * @property {string} startDate - The start date of the ticket (or of the subscription).
33
- * @property {string} endDate - The end date of the ticket (or of the subscription).
34
29
  */
35
30
  export type TplBookingInfo = {
31
+ /** Whether the booking is a subscription or a single ticket. */
36
32
  isSubscription: boolean;
33
+ /** The id of the super area. */
37
34
  superAreaId: number;
38
- validity: number;
35
+ /** The validity of the ticket (or of the subscription). */
36
+ validity: string;
37
+ /** The start date of the ticket (or of the subscription). */
39
38
  startDate: string;
39
+ /** The end date of the ticket (or of the subscription). */
40
40
  endDate: string;
41
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  "jest": "^29.7.0",
21
21
  "prettier": "^3.3.3",
22
22
  "ts-jest": "^29.2.3",
23
- "typescript": "^5.5.3"
23
+ "typescript": "^5.5.4"
24
24
  },
25
25
  "files": [
26
26
  "lib/**/*"