mts-booking-library 2.0.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -130,12 +130,12 @@ var SubscriptionBooking = /** @class */ (function (_super) {
130
130
  console.log(e);
131
131
  }
132
132
  };
133
- SubscriptionBooking.prototype.fetchAndSetCart = function (cartGuid) {
133
+ SubscriptionBooking.prototype.fetchAndSetCart = function (cartGuid, options) {
134
134
  return __awaiter(this, void 0, void 0, function () {
135
135
  var _this = this;
136
136
  return __generator(this, function (_a) {
137
137
  switch (_a.label) {
138
- case 0: return [4 /*yield*/, this.fetchCart(cartGuid).then(function (cart) {
138
+ case 0: return [4 /*yield*/, this.fetchCart(cartGuid, options).then(function (cart) {
139
139
  if (cart) {
140
140
  var cartDueDate = new Date();
141
141
  cartDueDate.setSeconds(cartDueDate.getSeconds() + cart.bookingDueDateRemainingSeconds);
@@ -161,13 +161,13 @@ var SubscriptionBooking = /** @class */ (function (_super) {
161
161
  });
162
162
  });
163
163
  };
164
- SubscriptionBooking.prototype.fetchCart = function (cartGuid) {
164
+ SubscriptionBooking.prototype.fetchCart = function (cartGuid, options) {
165
165
  return __awaiter(this, void 0, void 0, function () {
166
166
  var url;
167
167
  var _this = this;
168
168
  return __generator(this, function (_a) {
169
169
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts?").concat(new URLSearchParams({ cartGuid: cartGuid }));
170
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
170
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
171
171
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
172
172
  _this.resetBooking();
173
173
  throw new Error(JSON.stringify(response, null, 2));
@@ -186,7 +186,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
186
186
  * @returns An {@link ErrorResponse} object in case of error, nothing otherwise. Note that also in case of error, all
187
187
  * data will be deleted.
188
188
  */
189
- SubscriptionBooking.prototype.deleteCart = function () {
189
+ SubscriptionBooking.prototype.deleteCart = function (options) {
190
190
  return __awaiter(this, void 0, void 0, function () {
191
191
  var url;
192
192
  var _this = this;
@@ -196,7 +196,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
196
196
  throw Error("Cart is not initialized yet");
197
197
  }
198
198
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts?").concat(new URLSearchParams({ cartGuid: this.cart.guid }));
199
- return [2 /*return*/, this.callDeleteApi(url).then(function (response) {
199
+ return [2 /*return*/, this.callDeleteApi(url, options).then(function (response) {
200
200
  _this.resetBooking();
201
201
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
202
202
  })];
@@ -205,14 +205,14 @@ var SubscriptionBooking = /** @class */ (function (_super) {
205
205
  };
206
206
  /**
207
207
  * This method returns the possible departures for all subscriptions sold by this seller.
208
- * @returns {string[]} The list of possible departures
208
+ * @returns The list of possible departures
209
209
  */
210
- SubscriptionBooking.prototype.getSubscriptionsDepartures = function () {
210
+ SubscriptionBooking.prototype.getSubscriptionsDepartures = function (options) {
211
211
  return __awaiter(this, void 0, void 0, function () {
212
212
  var url;
213
213
  return __generator(this, function (_a) {
214
214
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/subscriptions/departures?");
215
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
215
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
216
216
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
217
217
  ? response
218
218
  : response.departures;
@@ -222,16 +222,16 @@ var SubscriptionBooking = /** @class */ (function (_super) {
222
222
  };
223
223
  /**
224
224
  * This method returns the possible destination for the subscriptions sold by this seller that start at the selected departure.
225
- * @param {string} departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
226
- * @returns {string[]} The list of possible destinations
225
+ * @param departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
226
+ * @returns The list of possible destinations
227
227
  */
228
- SubscriptionBooking.prototype.getSubscriptionsDestinations = function (departureStopName) {
228
+ SubscriptionBooking.prototype.getSubscriptionsDestinations = function (departureStopName, options) {
229
229
  return __awaiter(this, void 0, void 0, function () {
230
230
  var searchParams, url;
231
231
  return __generator(this, function (_a) {
232
232
  searchParams = new URLSearchParams({ departureStopName: departureStopName });
233
233
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/subscriptions/destinations?").concat(searchParams);
234
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
234
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
235
235
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
236
236
  ? response
237
237
  : response.destinations;
@@ -242,11 +242,11 @@ var SubscriptionBooking = /** @class */ (function (_super) {
242
242
  /**
243
243
  * This method returns the possible validity types for the subscriptions sold by this seller between the selected departure and destination.
244
244
  * The validity type is the duration of the subscription (1 week, 1 month, etc.). See {@link ValidityTypes} for more details.
245
- * @param {string} departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
246
- * @param {string} destinationStopName The destination stop name (as returned by {@link getSubscriptionsDstinations})
247
- * @returns {ValidityTypes[]} The list of possible validity types
245
+ * @param departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
246
+ * @param destinationStopName The destination stop name (as returned by {@link getSubscriptionsDstinations})
247
+ * @returns The list of possible validity types
248
248
  */
249
- SubscriptionBooking.prototype.getSubscriptionsValidityTypes = function (departureStopName, destinationStopName) {
249
+ SubscriptionBooking.prototype.getSubscriptionsValidityTypes = function (departureStopName, destinationStopName, options) {
250
250
  return __awaiter(this, void 0, void 0, function () {
251
251
  var searchParams, url;
252
252
  return __generator(this, function (_a) {
@@ -255,7 +255,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
255
255
  destinationStopName: destinationStopName
256
256
  });
257
257
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/subscriptions/validityTypes?").concat(searchParams);
258
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
258
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
259
259
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
260
260
  ? response
261
261
  : response.validityTypes;
@@ -267,12 +267,12 @@ var SubscriptionBooking = /** @class */ (function (_super) {
267
267
  * This method returns the subscriptions that match the given parameters.
268
268
  * Note that it will always return the subscription for the one-way trip.
269
269
  * If you want to get the subscription for the round trip, you have to call this method twice (make sure to swap departureStopName and destinationStopName)
270
- * @param {string} departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
271
- * @param {string} destinationStopName The destination stop name (as returned by {@link getSubscriptionsDstinations})
272
- * @param {string} validityType The validity type (as returned by {@link getSubscriptionsValidityTypes})
273
- * @returns {Array<Subscription>} The subscriptions that match the given parameters
270
+ * @param departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
271
+ * @param destinationStopName The destination stop name (as returned by {@link getSubscriptionsDstinations})
272
+ * @param validityType The validity type (as returned by {@link getSubscriptionsValidityTypes})
273
+ * @returns The subscriptions that match the given parameters
274
274
  */
275
- SubscriptionBooking.prototype.getSubscriptions = function (departureStopName, destinationStopName, validityType) {
275
+ SubscriptionBooking.prototype.getSubscriptions = function (departureStopName, destinationStopName, validityType, options) {
276
276
  return __awaiter(this, void 0, void 0, function () {
277
277
  var searchParams, url;
278
278
  return __generator(this, function (_a) {
@@ -282,7 +282,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
282
282
  validityType: validityType
283
283
  });
284
284
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/subscriptions/search?").concat(searchParams);
285
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
285
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
286
286
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
287
287
  ? response
288
288
  : response.subscriptions;
@@ -293,10 +293,10 @@ var SubscriptionBooking = /** @class */ (function (_super) {
293
293
  /**
294
294
  * This method returns the availability of the subscription for the given parameters.
295
295
  * Note that, contrary for the previous method, you should make one single request for both the outbound and return trip.
296
- * @param {GetSubscriptionAvailabilityRequest} request the request object containing the parameters for the availability check
297
- * @returns {GetSubscriptionAvailabilityResponse} The availability of the subscription for the given parameters
296
+ * @param request the request object containing the parameters for the availability check
297
+ * @returns The availability of the subscription for the given parameters
298
298
  */
299
- SubscriptionBooking.prototype.getSubscriptionAvailabilities = function (request) {
299
+ SubscriptionBooking.prototype.getSubscriptionAvailabilities = function (request, options) {
300
300
  return __awaiter(this, void 0, void 0, function () {
301
301
  var searchParams, url;
302
302
  return __generator(this, function (_a) {
@@ -311,7 +311,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
311
311
  validityType: request.validityType
312
312
  });
313
313
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/subscriptions/availabilities?").concat(searchParams);
314
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
314
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
315
315
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
316
316
  ? response
317
317
  : response;
@@ -321,16 +321,16 @@ var SubscriptionBooking = /** @class */ (function (_super) {
321
321
  };
322
322
  /**
323
323
  * This method creates a subscription cart for the given parameters.
324
- * @param {CreateSubscriptionCartRequest} request the request object containing the parameters for the availability check
325
- * @returns {SubscriptionCart} The created cart
324
+ * @param request the request object containing the parameters for the availability check
325
+ * @returns The created cart
326
326
  */
327
- SubscriptionBooking.prototype.createSubscriptionCart = function (request) {
327
+ SubscriptionBooking.prototype.createSubscriptionCart = function (request, options) {
328
328
  return __awaiter(this, void 0, void 0, function () {
329
329
  var url;
330
330
  var _this = this;
331
331
  return __generator(this, function (_a) {
332
332
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/subscriptions/carts");
333
- return [2 /*return*/, this.callPostApi(url, request).then(function (response) {
333
+ return [2 /*return*/, this.callPostApi(url, request, options).then(function (response) {
334
334
  // Check for errors
335
335
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
336
336
  // If there was an error, reset cartGuid and remove it from the mts-storage
@@ -358,7 +358,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
358
358
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
359
359
  * as well as a list of the available tariffs for each trip.
360
360
  */
361
- SubscriptionBooking.prototype.getBuyerPassengersDetails = function () {
361
+ SubscriptionBooking.prototype.getBuyerPassengersDetails = function (options) {
362
362
  return __awaiter(this, void 0, void 0, function () {
363
363
  var buyerPassengersDetails, searchParams, url;
364
364
  return __generator(this, function (_a) {
@@ -372,7 +372,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
372
372
  }
373
373
  searchParams = new URLSearchParams({ cartGuid: this.cart.guid });
374
374
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/details?").concat(searchParams);
375
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
375
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
376
376
  // Check for errors
377
377
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
378
378
  return response;
@@ -410,10 +410,10 @@ var SubscriptionBooking = /** @class */ (function (_super) {
410
410
  };
411
411
  /**
412
412
  * @description This methosd shall be called when the user wants to update the buyer and the passengers information.
413
- * @param {EditPassengersDetailsRequest} passengersDetails The object containing the buyer and the passengers information.
413
+ * @param passengersDetails The object containing the buyer and the passengers information.
414
414
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
415
415
  */
416
- SubscriptionBooking.prototype.updateBuyerPassengersDetails = function (passengersDetails) {
416
+ SubscriptionBooking.prototype.updateBuyerPassengersDetails = function (passengersDetails, options) {
417
417
  return __awaiter(this, void 0, void 0, function () {
418
418
  var buyerPassengersDetails, request, url;
419
419
  var _this = this;
@@ -435,7 +435,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
435
435
  request.passengers[passengerIndex].tripsToTariffs = tripsToTariffsToJson;
436
436
  });
437
437
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/details");
438
- return [2 /*return*/, this.callPostApi(url, request).then(function (response) {
438
+ return [2 /*return*/, this.callPostApi(url, request, options).then(function (response) {
439
439
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
440
440
  return response;
441
441
  }
@@ -449,10 +449,10 @@ var SubscriptionBooking = /** @class */ (function (_super) {
449
449
  //#region Reductions APIs
450
450
  /**
451
451
  * @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
452
- * @param {AddReductionRequest} request The information about the reduction to add
452
+ * @param request The information about the reduction to add
453
453
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
454
454
  */
455
- SubscriptionBooking.prototype.addReduction = function (request) {
455
+ SubscriptionBooking.prototype.addReduction = function (request, options) {
456
456
  return __awaiter(this, void 0, void 0, function () {
457
457
  var discountsStep, _i, _a, step, url;
458
458
  var _this = this;
@@ -490,7 +490,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
490
490
  _c.label = 5;
491
491
  case 5:
492
492
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/reduction");
493
- return [2 /*return*/, this.callPostApi(url, __assign(__assign({}, request), { cartGuid: this.cartGuid })).then(function (response) {
493
+ return [2 /*return*/, this.callPostApi(url, __assign(__assign({}, request), { cartGuid: this.cartGuid }), options).then(function (response) {
494
494
  var _a, _b;
495
495
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
496
496
  return response;
@@ -512,7 +512,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
512
512
  * will be removed from the whole cart.
513
513
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
514
514
  */
515
- SubscriptionBooking.prototype.removeReduction = function (tripId) {
515
+ SubscriptionBooking.prototype.removeReduction = function (tripId, options) {
516
516
  return __awaiter(this, void 0, void 0, function () {
517
517
  var discountsStep, queryParams, url;
518
518
  var _this = this;
@@ -530,7 +530,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
530
530
  cartGuid: this.cartGuid
531
531
  });
532
532
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/reduction?").concat(queryParams);
533
- return [2 /*return*/, this.callDeleteApi(url).then(function (response) {
533
+ return [2 /*return*/, this.callDeleteApi(url, options).then(function (response) {
534
534
  var _a, _b, _c;
535
535
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
536
536
  return response;
@@ -555,7 +555,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
555
555
  * remaining amount with another payment method.
556
556
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
557
557
  */
558
- SubscriptionBooking.prototype.useWallet = function () {
558
+ SubscriptionBooking.prototype.useWallet = function (options) {
559
559
  return __awaiter(this, void 0, void 0, function () {
560
560
  var issueStep, _i, _a, step, url;
561
561
  var _this = this;
@@ -597,7 +597,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
597
597
  _c.label = 5;
598
598
  case 5:
599
599
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/wallet");
600
- return [2 /*return*/, this.callPostApi(url, { cartGuid: this.cartGuid }).then(function (response) {
600
+ return [2 /*return*/, this.callPostApi(url, { cartGuid: this.cartGuid }, options).then(function (response) {
601
601
  var _a, _b;
602
602
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
603
603
  return response;
@@ -618,7 +618,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
618
618
  *
619
619
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
620
620
  */
621
- SubscriptionBooking.prototype.removeWalletReduction = function () {
621
+ SubscriptionBooking.prototype.removeWalletReduction = function (options) {
622
622
  return __awaiter(this, void 0, void 0, function () {
623
623
  var queryParams, url;
624
624
  var _this = this;
@@ -631,7 +631,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
631
631
  cartGuid: this.cartGuid
632
632
  });
633
633
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/wallet?").concat(queryParams);
634
- return [2 /*return*/, this.callDeleteApi(url).then(function (response) {
634
+ return [2 /*return*/, this.callDeleteApi(url, options).then(function (response) {
635
635
  var _a, _b, _c;
636
636
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
637
637
  return response;
@@ -650,10 +650,10 @@ var SubscriptionBooking = /** @class */ (function (_super) {
650
650
  * @description This method allows the user to use a voucher to pay the cart.
651
651
  * If the balance of the value of the voucher is enough to pay the cart, the cart will be paid fully.
652
652
  * Otherwise, the user will be asked to pay the remaining amount with another payment method.
653
- * @param {string} voucherCode The code of the voucher to use
653
+ * @param voucherCode The code of the voucher to use
654
654
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
655
655
  */
656
- SubscriptionBooking.prototype.useVoucher = function (voucherCode) {
656
+ SubscriptionBooking.prototype.useVoucher = function (voucherCode, options) {
657
657
  return __awaiter(this, void 0, void 0, function () {
658
658
  var discountsStep, _i, _a, step, url;
659
659
  var _this = this;
@@ -691,7 +691,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
691
691
  _c.label = 5;
692
692
  case 5:
693
693
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/voucher");
694
- return [2 /*return*/, this.callPostApi(url, { voucherCode: voucherCode, cartGuid: this.cartGuid }).then(function (response) {
694
+ return [2 /*return*/, this.callPostApi(url, { voucherCode: voucherCode, cartGuid: this.cartGuid }, options).then(function (response) {
695
695
  var _a, _b;
696
696
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
697
697
  return response;
@@ -6,6 +6,7 @@ import { TariffType, TermsType } from "../types/common/Tariffs";
6
6
  import { GetTariffsResponse } from "../types/tpl/GetTariffsResponse";
7
7
  import { GetSuperAreasRequest, SuperArea } from "../types/tpl/SuperArea";
8
8
  import { CreateTplCartRequest, TplCart } from "../types/tpl/TplCart";
9
+ import { ApiCallOptions } from "../utils/apiCall";
9
10
  import { Booking } from "./booking";
10
11
  export declare class TplBooking extends Booking {
11
12
  private cart?;
@@ -61,56 +62,56 @@ export declare class TplBooking extends Booking {
61
62
  }>;
62
63
  getCart(): undefined | TplCart;
63
64
  resetBooking(): void;
64
- fetchAndSetCart(cartGuid: string): Promise<void>;
65
- fetchCart(cartGuid: string): Promise<TplCart>;
65
+ fetchAndSetCart(cartGuid: string, options?: ApiCallOptions): Promise<void>;
66
+ fetchCart(cartGuid: string, options?: ApiCallOptions): Promise<TplCart>;
66
67
  /**
67
68
  * This method allows to delete a cart, thus allowing the user to exit from the booking process.
68
69
  * @returns An {@link ErrorResponse} object in case of error, nothing otherwise. Note that also in case of error, all
69
70
  * data will be deleted.
70
71
  */
71
- deleteCart(): Promise<ErrorResponse | any>;
72
+ deleteCart(options?: ApiCallOptions): Promise<ErrorResponse | any>;
72
73
  /**
73
74
  * This method allows to get the list of cities where it is possible to book a TPL service.
74
75
  * @returns An array of {@link City} objects representing the cities where it is possible to book a TPL service
75
76
  * if the call is successful, an {@link ErrorResponse} object otherwise.
76
77
  */
77
- getCities(): Promise<ErrorResponse | City[]>;
78
+ getCities(options?: ApiCallOptions): Promise<ErrorResponse | City[]>;
78
79
  /**
79
80
  * This method fetches the list of super areas for a given city. A super area is a region of the city in which
80
81
  * the TPL service is available at a certain price.
81
82
  * @returns An array of {@link SuperArea} objects representing the SuperAreas if the call is successful, an {@link ErrorResponse} object otherwise.
82
83
  */
83
- getSuperAreas(request: GetSuperAreasRequest): Promise<ErrorResponse | SuperArea[]>;
84
+ getSuperAreas(request: GetSuperAreasRequest, options?: ApiCallOptions): Promise<ErrorResponse | SuperArea[]>;
84
85
  /**
85
86
  * This method fetches the list of terms types in a given super area.
86
87
  * @returns An array of {@link TermsType} objects representing the available terms types if the call is successful, an {@link ErrorResponse} object otherwise.
87
88
  */
88
- getTermsTypes(superAreaId: number): Promise<ErrorResponse | TermsType[]>;
89
+ getTermsTypes(superAreaId: number, options?: ApiCallOptions): Promise<ErrorResponse | TermsType[]>;
89
90
  /**
90
91
  * This method fetches the list of tariff types in a given super area.
91
92
  * @returns An array of {@link TariffType} objects representing the available tariff types if the call is successful, an {@link ErrorResponse} object otherwise.
92
93
  */
93
- getTariffTypes(superAreaId: number): Promise<ErrorResponse | TariffType[]>;
94
+ getTariffTypes(superAreaId: number, options?: ApiCallOptions): Promise<ErrorResponse | TariffType[]>;
94
95
  /**
95
96
  * This method fetches the list of available tariffs for the selected terms type in a given super area.
96
- * @param {number} superAreaId The id of the super area (as returned by the {@link getSuperAreas} method).
97
- * @param {number | null} termsTypeId The id of the terms type (as returned by the {@link getTermsTypes} method).
97
+ * @param superAreaId The id of the super area (as returned by the {@link getSuperAreas} method).
98
+ * @param termsTypeId The id of the terms type (as returned by the {@link getTermsTypes} method).
98
99
  * If null, tariffs from all terms types will be considered.
99
- * @param {boolean} onlyTickets If true, only only return the tariffs that are for single tickets.
100
- * @param {boolean} onlySubscriptions If true, only return the tariffs that are for subscriptions.
100
+ * @param onlyTickets If true, only only return the tariffs that are for single tickets.
101
+ * @param onlySubscriptions If true, only return the tariffs that are for subscriptions.
101
102
  * @returns A {@link GetTariffsResponse} if the call is successful, an {@link ErrorResponse} object otherwise.
102
103
  */
103
- getTariffs(superAreaId: number, termsTypeId: number | null, onlyTickets: boolean, onlySubscriptions: boolean): Promise<ErrorResponse | GetTariffsResponse>;
104
+ getTariffs(superAreaId: number, termsTypeId: number | null, onlyTickets: boolean, onlySubscriptions: boolean, options?: ApiCallOptions): Promise<ErrorResponse | GetTariffsResponse>;
104
105
  /**
105
106
  * This method allows to create a TPL cart.
106
107
  */
107
- createTplCart(tplCart: CreateTplCartRequest): Promise<ErrorResponse | TplCart>;
108
+ createTplCart(tplCart: CreateTplCartRequest, options?: ApiCallOptions): Promise<ErrorResponse | TplCart>;
108
109
  /**
109
110
  * @description This method shall be called when the user wants to retrieve information about the buyer and the passengers.
110
111
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
111
112
  * as well as a list of the available tariffs for each trip.
112
113
  */
113
- getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
114
+ getBuyerPassengersDetails(options?: ApiCallOptions): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
114
115
  /**
115
116
  * @description This method shall be called when the user wants to update the buyer information.
116
117
  * @param buyerDetails The object containing the buyer information.
@@ -119,41 +120,41 @@ export declare class TplBooking extends Booking {
119
120
  * with the subscription. This parameter is required if the cart contains a subscription.
120
121
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
121
122
  */
122
- updateBuyerPassengersDetails(buyerDetails: PersonDetails | null, subscriptionPersonCode?: string): Promise<ErrorResponse | boolean>;
123
+ updateBuyerPassengersDetails(buyerDetails: PersonDetails | null, subscriptionPersonCode?: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
123
124
  /**
124
125
  * @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
125
- * @param {AddReductionRequest} request The information about the reduction to add
126
+ * @param request The information about the reduction to add
126
127
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
127
128
  */
128
- addReduction(request: AddReductionRequest): Promise<ErrorResponse | boolean>;
129
+ addReduction(request: AddReductionRequest, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
129
130
  /**
130
131
  * @description This method allows to remove a reduction from the whole cart or from a single trip in the cart.
131
132
  * @param tripId The id of the trip from which the reduction should be removed. If the tripId is 0, then the reduction
132
133
  * will be removed from the whole cart.
133
134
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
134
135
  */
135
- removeReduction(tripId: number): Promise<ErrorResponse | boolean>;
136
+ removeReduction(tripId: number, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
136
137
  /**
137
138
  * @description This method allows the user to use the balance in his wallet to pay the cart. If the balance of
138
139
  * the wallet is enough to pay the cart, the cart will be paid fully. Otherwise, the user will be asked to pay the
139
140
  * remaining amount with another payment method.
140
141
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
141
142
  */
142
- useWallet(): Promise<ErrorResponse | boolean>;
143
+ useWallet(options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
143
144
  /**
144
145
  * @description This method allows to remove a waller reduction from the cart.
145
146
  *
146
147
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
147
148
  */
148
- removeWalletReduction(): Promise<ErrorResponse | boolean>;
149
+ removeWalletReduction(options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
149
150
  /**
150
151
  * @description This method allows the user to use a voucher to pay the cart.
151
152
  * If the balance of the value of the voucher is enough to pay the cart, the cart will be paid fully.
152
153
  * Otherwise, the user will be asked to pay the remaining amount with another payment method.
153
- * @param {string} voucherCode The code of the voucher to use
154
+ * @param voucherCode The code of the voucher to use
154
155
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
155
156
  */
156
- useVoucher(voucherCode: string): Promise<ErrorResponse | boolean>;
157
+ useVoucher(voucherCode: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
157
158
  }
158
159
  export declare namespace TplBooking {
159
160
  const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<TplBooking>;