mts-booking-library 2.0.0 → 2.1.0

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.
@@ -5,6 +5,7 @@ import { GetExtrasForBookingResponse, GetExtrasResponse } from "../types/common/
5
5
  import { GetPaymentInformationFromGatewayResponse, GetSellerGatewaysResponse, PaymentMethods, IssueCartResponse } from "../types/common/Payment";
6
6
  import { PersonDetails, GetBuyerPassengersDetailsResponse, GetPersonRequest } from "../types/common/Person";
7
7
  import { AddReductionRequest } from "../types/common/Reduction";
8
+ import { ApiCallOptions } from "../utils/apiCall";
8
9
  export declare abstract class Booking {
9
10
  private sellerId?;
10
11
  readonly resellerId?: number | undefined;
@@ -39,10 +40,10 @@ export declare abstract class Booking {
39
40
  * @param {string} access_token The new access token
40
41
  */
41
42
  renewAccessToken(access_token: string): void;
42
- callGetApi(url: string): Promise<ErrorResponse | any>;
43
- callPostApi(url: string, body: any): Promise<any>;
44
- callPutApi(url: string, body: any): Promise<any>;
45
- callDeleteApi(url: string): Promise<ErrorResponse | any>;
43
+ callGetApi(url: string, options?: ApiCallOptions): Promise<ErrorResponse | any>;
44
+ callPostApi(url: string, body: any, options?: ApiCallOptions): Promise<any>;
45
+ callPutApi(url: string, body: any, options?: ApiCallOptions): Promise<any>;
46
+ callDeleteApi(url: string, options?: ApiCallOptions): Promise<ErrorResponse | any>;
46
47
  getBookingStepsToStatus(): processedStepsToStatus;
47
48
  changeCurrency(currency: Booking.Currencies): void;
48
49
  changeLanguage(language: string): void;
@@ -51,7 +52,7 @@ export declare abstract class Booking {
51
52
  * @param bookingStep The booking step to mark as completed
52
53
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
53
54
  */
54
- markBookingStepCompleted(bookingStep: Booking.BookingSteps): Promise<ErrorResponse | boolean>;
55
+ markBookingStepCompleted(bookingStep: Booking.BookingSteps, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
55
56
  abstract deleteCart(): Promise<ErrorResponse | any>;
56
57
  abstract resetBooking(): void;
57
58
  abstract getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
@@ -61,7 +62,7 @@ export declare abstract class Booking {
61
62
  * @param {GetPersonRequest} request The object containing the parameters to search the buyer.
62
63
  * @returns An object of type {@link PersonDetails} containing the buyer information, or an {@link ErrorResponse} object in case of error.
63
64
  */
64
- getPerson(request: GetPersonRequest): Promise<ErrorResponse | PersonDetails>;
65
+ getPerson(request: GetPersonRequest, options?: ApiCallOptions): Promise<ErrorResponse | PersonDetails>;
65
66
  abstract addReduction(request: AddReductionRequest): Promise<ErrorResponse | boolean>;
66
67
  abstract removeReduction(tripId: number): Promise<ErrorResponse | boolean>;
67
68
  abstract useWallet(): Promise<ErrorResponse | boolean>;
@@ -71,7 +72,7 @@ export declare abstract class Booking {
71
72
  * @description This method shall be used to get the available payment methods for the cart. They depend on the seller configuration.
72
73
  * @returns An {@link ErrorResponse} object in case of error, a {@link GetSellerGatewaysResponse} object otherwise.
73
74
  */
74
- getSellerGateways(): Promise<ErrorResponse | GetSellerGatewaysResponse>;
75
+ getSellerGateways(options?: ApiCallOptions): Promise<ErrorResponse | GetSellerGatewaysResponse>;
75
76
  /**
76
77
  * @description This method shall be used to get all necessary informations to initialize a payment with a certain gateway.
77
78
  * @param gatewayId The id of the gateway to use. Its value shall be taken from the response of the {@link Booking.getSellerGateways} API
@@ -79,33 +80,33 @@ export declare abstract class Booking {
79
80
  * chosen gateway is {@link GatewayTypes.PAYPAL} or {@link GatewayTypes.WORLDLINE}
80
81
  * @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
81
82
  */
82
- getPaymentInformationFromGateway(gatewayId: number, returnUrl?: string): Promise<ErrorResponse | GetPaymentInformationFromGatewayResponse>;
83
+ getPaymentInformationFromGateway(gatewayId: number, returnUrl?: string, options?: ApiCallOptions): Promise<ErrorResponse | GetPaymentInformationFromGatewayResponse>;
83
84
  /**
84
85
  * @description This method shall be used to issue the tickets. It must be called after the payment was successful.
85
86
  * @param {PaymentMethods} paymentMethod The payment method used to pay the cart. If the chosen method is {@link PaymentMethods.ZERO_COST},
86
87
  * first the {@link Booking.addReduction} API is called with a 100% discount, then tickets are issued with the {@link PaymentMethods.CASH} method.
87
88
  * @returns An {@link IssueCartResponse} object.
88
89
  */
89
- issueCart(paymentMethod: PaymentMethods): Promise<ErrorResponse | IssueCartResponse>;
90
+ issueCart(paymentMethod: PaymentMethods, options?: ApiCallOptions): Promise<ErrorResponse | IssueCartResponse>;
90
91
  getExtras({ extraId, tariffPlanId }?: {
91
92
  /** The extra object identifier. By default, all the extras of the seller are returned. */
92
93
  extraId?: number;
93
94
  /** If present, the extras that are part of that tariff plan are returned. */
94
95
  tariffPlanId?: number;
95
- }): Promise<ErrorResponse | GetExtrasResponse>;
96
+ }, options?: ApiCallOptions): Promise<ErrorResponse | GetExtrasResponse>;
96
97
  /**
97
98
  * Fetches extras tariffs for the given cart
98
99
  * @param cartGuid The guid of the cart
99
100
  * @param tripId The ID of the trip for which the extras are requested. Please note that this
100
101
  * parameter is required when adding extras to a MLP or services cart.
101
102
  */
102
- getExtrasForBooking(cartGuid: string, tripId?: number): Promise<ErrorResponse | GetExtrasForBookingResponse>;
103
+ getExtrasForBooking(cartGuid: string, tripId?: number, options?: ApiCallOptions): Promise<ErrorResponse | GetExtrasForBookingResponse>;
103
104
  /**
104
105
  * Updates the extras associated with a cart, removing all previous ones.
105
106
  * @param cartGuid The guid of the cart
106
107
  * @param tariffIdToQuantity A map of tariff ids to the quantity of tickets to add for that tariff
107
108
  */
108
- updateExtrasForCart(cartGuid: string, tariffIdToQuantity: Record<number, number>): Promise<ErrorResponse | {}>;
109
+ updateExtrasForCart(cartGuid: string, tariffIdToQuantity: Record<number, number>, options?: ApiCallOptions): Promise<ErrorResponse | {}>;
109
110
  abstract getCart(): Cart | undefined;
110
111
  abstract fetchAndSetCart(cartGuid: string): Promise<void>;
111
112
  abstract fetchCart(cartGuid: string): Promise<Cart>;
@@ -109,37 +109,37 @@ var Booking = /** @class */ (function () {
109
109
  };
110
110
  (0, config_1.setConfig)(newConfig);
111
111
  };
112
- Booking.prototype.callGetApi = function (url) {
112
+ Booking.prototype.callGetApi = function (url, options) {
113
113
  var _a, _b, _c, _d;
114
114
  // Add sellerId, resellerId and language to the query string.
115
115
  // If the last character of the url is a question mark (meaning that the query string is empty), don't add the "&" character.
116
116
  // Otherwise, add it (as we are adding some parameters to the query string)
117
117
  var completeUrl = "".concat(url).concat(url.slice(-1) === "?" ? "" : "&").concat(new URLSearchParams(__assign({ sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "0", resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : "0", language: this.language }, ((0, config_1.getConfig)().ENV === config_1.MTSEnvs.DEV &&
118
118
  (0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }))));
119
- return (0, apiCall_1.makeGet)(completeUrl);
119
+ return (0, apiCall_1.makeGet)(completeUrl, options);
120
120
  };
121
- Booking.prototype.callPostApi = function (url, body) {
121
+ Booking.prototype.callPostApi = function (url, body, options) {
122
122
  var _a, _b, _c, _d;
123
123
  // Add sellerId, resellerId and language to the query string
124
124
  var completeBody = __assign(__assign(__assign({}, body), { sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 0, resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : 0, language: this.language }), ((0, config_1.getConfig)().ENV === config_1.MTSEnvs.DEV &&
125
125
  (0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }));
126
- return (0, apiCall_1.makePost)(url, completeBody);
126
+ return (0, apiCall_1.makePost)(url, completeBody, options);
127
127
  };
128
- Booking.prototype.callPutApi = function (url, body) {
128
+ Booking.prototype.callPutApi = function (url, body, options) {
129
129
  var _a, _b, _c, _d;
130
130
  // Add sellerId, resellerId and language to the query string
131
131
  var completeBody = __assign(__assign(__assign({}, body), { sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 0, resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : 0, language: this.language }), ((0, config_1.getConfig)().ENV === config_1.MTSEnvs.DEV &&
132
132
  (0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }));
133
- return (0, apiCall_1.makePut)(url, completeBody);
133
+ return (0, apiCall_1.makePut)(url, completeBody, options);
134
134
  };
135
- Booking.prototype.callDeleteApi = function (url) {
135
+ Booking.prototype.callDeleteApi = function (url, options) {
136
136
  var _a, _b, _c, _d;
137
137
  // Add sellerId, resellerId and language to the query string.
138
138
  // If the last character of the url is a question mark (meaning that the query string is empty), don't add the "&" character.
139
139
  // Otherwise, add it (as we are adding some parameters to the query string)
140
140
  var completeUrl = "".concat(url).concat(url.slice(-1) === "?" ? "" : "&").concat(new URLSearchParams(__assign({ sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "0", resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : "0", language: this.language }, ((0, config_1.getConfig)().ENV === config_1.MTSEnvs.DEV &&
141
141
  (0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }))));
142
- return (0, apiCall_1.makeDelete)(completeUrl);
142
+ return (0, apiCall_1.makeDelete)(completeUrl, options);
143
143
  };
144
144
  Booking.prototype.getBookingStepsToStatus = function () {
145
145
  return this.bookingStepsToStatus;
@@ -163,7 +163,7 @@ var Booking = /** @class */ (function () {
163
163
  * @param bookingStep The booking step to mark as completed
164
164
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
165
165
  */
166
- Booking.prototype.markBookingStepCompleted = function (bookingStep) {
166
+ Booking.prototype.markBookingStepCompleted = function (bookingStep, options) {
167
167
  return __awaiter(this, void 0, void 0, function () {
168
168
  var currentStepStatus, url;
169
169
  var _this = this;
@@ -184,7 +184,7 @@ var Booking = /** @class */ (function () {
184
184
  if (currentStepStatus[1])
185
185
  return [2 /*return*/, true];
186
186
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/bookingSteps");
187
- return [2 /*return*/, this.callPostApi(url, { bookingStep: bookingStep, cartGuid: this.cartGuid }).then(function (response) {
187
+ return [2 /*return*/, this.callPostApi(url, { bookingStep: bookingStep, cartGuid: this.cartGuid }, options).then(function (response) {
188
188
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
189
189
  return response;
190
190
  }
@@ -200,7 +200,7 @@ var Booking = /** @class */ (function () {
200
200
  * @param {GetPersonRequest} request The object containing the parameters to search the buyer.
201
201
  * @returns An object of type {@link PersonDetails} containing the buyer information, or an {@link ErrorResponse} object in case of error.
202
202
  */
203
- Booking.prototype.getPerson = function (request) {
203
+ Booking.prototype.getPerson = function (request, options) {
204
204
  return __awaiter(this, void 0, void 0, function () {
205
205
  var buyerPassengersDetails, searchParams, url;
206
206
  var _a;
@@ -218,7 +218,7 @@ var Booking = /** @class */ (function () {
218
218
  }
219
219
  searchParams = new URLSearchParams(__assign(__assign(__assign(__assign({}, (request.personId && { personId: (_a = request.personId) === null || _a === void 0 ? void 0 : _a.toString() })), (request.personCode && { personCode: request.personCode })), (request.phoneNumber && { phoneNumber: request.phoneNumber })), { includeSSN: "true" }));
220
220
  url = "".concat(this.config.API_ENDPOINT, "/v3_customers/persons?").concat(searchParams);
221
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
221
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
222
222
  // Check for errors
223
223
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
224
224
  return response;
@@ -236,7 +236,7 @@ var Booking = /** @class */ (function () {
236
236
  * @description This method shall be used to get the available payment methods for the cart. They depend on the seller configuration.
237
237
  * @returns An {@link ErrorResponse} object in case of error, a {@link GetSellerGatewaysResponse} object otherwise.
238
238
  */
239
- Booking.prototype.getSellerGateways = function () {
239
+ Booking.prototype.getSellerGateways = function (options) {
240
240
  return __awaiter(this, void 0, void 0, function () {
241
241
  var issueStep, _i, _a, step, url;
242
242
  var _b;
@@ -278,7 +278,7 @@ var Booking = /** @class */ (function () {
278
278
  case 5:
279
279
  url = "".concat(this.config.API_ENDPOINT, "/v3_resources/sellers/gateways?");
280
280
  // We use directly makeGet because we don't want to add sellerId to the query string (it is already present in the url)
281
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
281
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
282
282
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
283
283
  ? response
284
284
  : response;
@@ -294,7 +294,7 @@ var Booking = /** @class */ (function () {
294
294
  * chosen gateway is {@link GatewayTypes.PAYPAL} or {@link GatewayTypes.WORLDLINE}
295
295
  * @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
296
296
  */
297
- Booking.prototype.getPaymentInformationFromGateway = function (gatewayId, returnUrl) {
297
+ Booking.prototype.getPaymentInformationFromGateway = function (gatewayId, returnUrl, options) {
298
298
  return __awaiter(this, void 0, void 0, function () {
299
299
  var issueStep, searchParams, url;
300
300
  return __generator(this, function (_a) {
@@ -308,7 +308,7 @@ var Booking = /** @class */ (function () {
308
308
  }
309
309
  searchParams = new URLSearchParams(__assign({ gatewayId: gatewayId.toString(), cartGuid: this.cartGuid }, (returnUrl && { returnUrl: returnUrl })));
310
310
  url = "".concat(this.config.API_ENDPOINT, "/v3_payment/paymentInformation?").concat(searchParams);
311
- return [2 /*return*/, this.callGetApi(url).then(function (response) {
311
+ return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
312
312
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
313
313
  ? response
314
314
  : response;
@@ -322,7 +322,7 @@ var Booking = /** @class */ (function () {
322
322
  * first the {@link Booking.addReduction} API is called with a 100% discount, then tickets are issued with the {@link PaymentMethods.CASH} method.
323
323
  * @returns An {@link IssueCartResponse} object.
324
324
  */
325
- Booking.prototype.issueCart = function (paymentMethod) {
325
+ Booking.prototype.issueCart = function (paymentMethod, options) {
326
326
  return __awaiter(this, void 0, void 0, function () {
327
327
  var paymentMethodToSet, issueStep, _i, _a, step, url, body;
328
328
  var _b;
@@ -383,7 +383,7 @@ var Booking = /** @class */ (function () {
383
383
  cartGuid: this.cartGuid,
384
384
  paymentMethod: paymentMethodToSet === Payment_1.PaymentMethods.PAY_LATER ? null : paymentMethodToSet
385
385
  };
386
- return [2 /*return*/, this.callPostApi(url, body).then(function (response) {
386
+ return [2 /*return*/, this.callPostApi(url, body, options).then(function (response) {
387
387
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
388
388
  ? response
389
389
  : response;
@@ -395,13 +395,13 @@ var Booking = /** @class */ (function () {
395
395
  //#endregion
396
396
  // #region Extras
397
397
  Booking.prototype.getExtras = function () {
398
- return __awaiter(this, arguments, void 0, function (_a) {
398
+ return __awaiter(this, arguments, void 0, function (_a, options) {
399
399
  var searchParams, url;
400
400
  var _b = _a === void 0 ? {} : _a, extraId = _b.extraId, tariffPlanId = _b.tariffPlanId;
401
401
  return __generator(this, function (_c) {
402
402
  searchParams = new URLSearchParams(__assign(__assign({}, (extraId && { extraId: extraId.toString() })), (tariffPlanId && { tariffPlanId: tariffPlanId.toString() })));
403
403
  url = "".concat(this.config.API_ENDPOINT, "/v3_resources/extras?").concat(searchParams);
404
- return [2 /*return*/, this.callGetApi(url)];
404
+ return [2 /*return*/, this.callGetApi(url, options)];
405
405
  });
406
406
  });
407
407
  };
@@ -411,13 +411,13 @@ var Booking = /** @class */ (function () {
411
411
  * @param tripId The ID of the trip for which the extras are requested. Please note that this
412
412
  * parameter is required when adding extras to a MLP or services cart.
413
413
  */
414
- Booking.prototype.getExtrasForBooking = function (cartGuid, tripId) {
414
+ Booking.prototype.getExtrasForBooking = function (cartGuid, tripId, options) {
415
415
  return __awaiter(this, void 0, void 0, function () {
416
416
  var searchParams, url;
417
417
  return __generator(this, function (_a) {
418
418
  searchParams = new URLSearchParams(__assign({ cartGuid: cartGuid }, (tripId && { tripId: tripId.toString() })));
419
419
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/extras?").concat(searchParams);
420
- return [2 /*return*/, this.callGetApi(url)];
420
+ return [2 /*return*/, this.callGetApi(url, options)];
421
421
  });
422
422
  });
423
423
  };
@@ -426,7 +426,7 @@ var Booking = /** @class */ (function () {
426
426
  * @param cartGuid The guid of the cart
427
427
  * @param tariffIdToQuantity A map of tariff ids to the quantity of tickets to add for that tariff
428
428
  */
429
- Booking.prototype.updateExtrasForCart = function (cartGuid, tariffIdToQuantity) {
429
+ Booking.prototype.updateExtrasForCart = function (cartGuid, tariffIdToQuantity, options) {
430
430
  return __awaiter(this, void 0, void 0, function () {
431
431
  var body, url, res;
432
432
  return __generator(this, function (_a) {
@@ -437,7 +437,7 @@ var Booking = /** @class */ (function () {
437
437
  tariffIdToQuantity: tariffIdToQuantity
438
438
  };
439
439
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/extras");
440
- return [4 /*yield*/, this.callPutApi(url, body)];
440
+ return [4 /*yield*/, this.callPutApi(url, body, options)];
441
441
  case 1:
442
442
  res = _a.sent();
443
443
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(res)) {
@@ -5,6 +5,7 @@ import { BusMatrix } from "../types/journeys/BusMatrix";
5
5
  import { CreateJourneyCartRequest, JourneyCart } from "../types/journeys/JourneyCart";
6
6
  import { JourneySearchRequest, JourneySearchResult } from "../types/journeys/JourneySearch";
7
7
  import { ReductionTrip } from "../types/journeys/Trip";
8
+ import { ApiCallOptions } from "../utils/apiCall";
8
9
  import { Booking } from "./booking";
9
10
  export declare class JourneyBooking extends Booking {
10
11
  private cart?;
@@ -60,101 +61,101 @@ export declare class JourneyBooking extends Booking {
60
61
  };
61
62
  }>;
62
63
  resetBooking(): void;
63
- fetchAndSetCart(cartGuid: string): Promise<void>;
64
- fetchCart(cartGuid: string): Promise<JourneyCart>;
64
+ fetchAndSetCart(cartGuid: string, options?: ApiCallOptions): Promise<void>;
65
+ fetchCart(cartGuid: string, options?: ApiCallOptions): Promise<JourneyCart>;
65
66
  /**
66
67
  * This method allows to delete a cart, thus allowing the user to exit from the booking process.
67
68
  * @returns An {@link ErrorResponse} object in case of error, nothing otherwise. Note that also in case of error, all
68
69
  * data will be deleted.
69
70
  */
70
- deleteCart(): Promise<ErrorResponse | any>;
71
+ deleteCart(options?: ApiCallOptions): Promise<ErrorResponse | any>;
71
72
  /**
72
73
  * This method returns the possible departures for all journeys (MLP) sold by this seller.
73
- * @returns {string[]} The list of possible departures
74
+ * @returns The list of possible departures
74
75
  */
75
- getJourneysDepartures(): Promise<ErrorResponse | string[]>;
76
+ getJourneysDepartures(options?: ApiCallOptions): Promise<ErrorResponse | string[]>;
76
77
  /**
77
78
  * This method returns the possible destination for the journeys sold by this seller that start at the selected departure.
78
- * @param {string} departureStopName The departure stop name (as returned by {@link getJourneysDepartures})
79
- * @returns {string[]} The list of possible destinations
79
+ * @param departureStopName The departure stop name (as returned by {@link getJourneysDepartures})
80
+ * @returns The list of possible destinations
80
81
  */
81
- getJourneysDestinations(departureStopName: string): Promise<ErrorResponse | string[]>;
82
+ getJourneysDestinations(departureStopName: string, options?: ApiCallOptions): Promise<ErrorResponse | string[]>;
82
83
  /**
83
84
  * This method returns the journeys that match the given parameters.
84
85
  * Note that it will always return the journeys for the one-way trip.
85
86
  * If you want to get the journeys for the round trip, you have to call this method twice (make sure to swap departureStopName and destinationStopName)
86
- * @param {JourneySearch} request an object of type {@link JourneySearch} containing the parameters of the search
87
- * @returns {JourneySearchResult[]} The returned journeys that match the given parameters
87
+ * @param request an object of type {@link JourneySearch} containing the parameters of the search
88
+ * @returns The returned journeys that match the given parameters
88
89
  */
89
- getJourneys(request: JourneySearchRequest): Promise<ErrorResponse | JourneySearchResult[]>;
90
- createJourneyCart(journeyCart: CreateJourneyCartRequest): Promise<ErrorResponse | JourneyCart>;
90
+ getJourneys(request: JourneySearchRequest, options?: ApiCallOptions): Promise<ErrorResponse | JourneySearchResult[]>;
91
+ createJourneyCart(journeyCart: CreateJourneyCartRequest, options?: ApiCallOptions): Promise<ErrorResponse | JourneyCart>;
91
92
  /**
92
93
  * @description This method shall be called when the user wants to retrieve information about the buyer and the passengers.
93
94
  * @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
94
95
  * as well as a list of the available tariffs for each trip.
95
96
  */
96
- getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
97
+ getBuyerPassengersDetails(options?: ApiCallOptions): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
97
98
  /**
98
99
  * @description This methosd shall be called when the user wants to update the buyer and the passengers information.
99
- * @param {EditPassengersDetailsRequest} passengersDetails The object containing the buyer and the passengers information.
100
+ * @param passengersDetails The object containing the buyer and the passengers information.
100
101
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
101
102
  */
102
- updateBuyerPassengersDetails(passengersDetails: EditPassengersDetailsRequest): Promise<ErrorResponse | boolean>;
103
+ updateBuyerPassengersDetails(passengersDetails: EditPassengersDetailsRequest, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
103
104
  /**
104
105
  * @description This method shall be used when the user wants to retrieve the bus matrix for a trip. The bus matrix shows
105
106
  * the seats that are available and the ones that are already taken, as well as how the bus is made.
106
- * @param {number} tripId The id of the trip for which the bus matrix should be retrieved
107
- * @param {number} departureStopId The id of the departure stop
108
- * @param {number} destinationStopId The id of the destination stop
107
+ * @param tripId The id of the trip for which the bus matrix should be retrieved
108
+ * @param departureStopId The id of the departure stop
109
+ * @param destinationStopId The id of the destination stop
109
110
  * @returns An {@link ErrorResponse} object in case of error, a {@link BusMatrix} otherwise.
110
111
  */
111
- getBusMatrix(tripId: number, departureStopId: number, destinationStopId: number): Promise<ErrorResponse | BusMatrix>;
112
+ getBusMatrix(tripId: number, departureStopId: number, destinationStopId: number, options?: ApiCallOptions): Promise<ErrorResponse | BusMatrix>;
112
113
  /**
113
114
  * @description This method shall be called when the user wants to retrieve which seats were assigned for this booking.
114
- * @param {number} tripId The id of the trip for which the seats should be retrieved.
115
+ * @param tripId The id of the trip for which the seats should be retrieved.
115
116
  * @returns An {@link ErrorResponse} object in case of error, a list of {@link BusLayoutCell} ids otherwise, representing the assigned seats.
116
117
  */
117
- getAssignedSeats(tripId: number): Promise<ErrorResponse | number[]>;
118
+ getAssignedSeats(tripId: number, options?: ApiCallOptions): Promise<ErrorResponse | number[]>;
118
119
  /**
119
120
  * @description This method shall be called when the user wants to change the assigned seats of a trip.
120
- * @param {number} tripId The id of the trip for which the seats should be changed
121
- * @param {number[]} newSeatsIds The ids of the new seats, as found the {@link BusMatrix}
121
+ * @param tripId The id of the trip for which the seats should be changed
122
+ * @param newSeatsIds The ids of the new seats, as found the {@link BusMatrix}
122
123
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
123
124
  */
124
- changeSeatsOfTrip(tripId: number, newSeatsIds: number[]): Promise<ErrorResponse | boolean>;
125
+ changeSeatsOfTrip(tripId: number, newSeatsIds: number[], options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
125
126
  /**
126
127
  * @description This method shall be called when the user wants to retrieve the trips in the cart, for adding a available reduction
127
128
  * to a specific trip (rather than to the whole cart).
128
129
  * @see {@link Booking.addReduction} for detailed info on how to add a reduction.
129
130
  * @returns An {@link ErrorResponse} object in case of error, a list of {@link ReductionTrip} otherwise, representing the trips in the cart.
130
131
  */
131
- getCartTrips(): Promise<ErrorResponse | ReductionTrip[]>;
132
+ getCartTrips(options?: ApiCallOptions): Promise<ErrorResponse | ReductionTrip[]>;
132
133
  /**
133
134
  * @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
134
- * @param {AddReductionRequest} request The information about the reduction to add
135
+ * @param request The information about the reduction to add
135
136
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
136
137
  */
137
- addReduction(request: AddReductionRequest): Promise<ErrorResponse | boolean>;
138
+ addReduction(request: AddReductionRequest, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
138
139
  /**
139
140
  * @description This method allows to remove a reduction from the whole cart or from a single trip in the cart.
140
141
  * @param tripId The id of the trip from which the reduction should be removed. If the tripId is 0, then the reduction
141
142
  * will be removed from the whole cart.
142
143
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
143
144
  */
144
- removeReduction(tripId: number): Promise<ErrorResponse | boolean>;
145
+ removeReduction(tripId: number, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
145
146
  /**
146
147
  * @description This method allows the user to use the balance in his wallet to pay the cart. If the balance of
147
148
  * the wallet is enough to pay the cart, the cart will be paid fully. Otherwise, the user will be asked to pay the
148
149
  * remaining amount with another payment method.
149
150
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
150
151
  */
151
- useWallet(): Promise<ErrorResponse | boolean>;
152
+ useWallet(options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
152
153
  /**
153
154
  * @description This method allows to remove a waller reduction from the cart.
154
155
  *
155
156
  * @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
156
157
  */
157
- removeWalletReduction(): Promise<ErrorResponse | boolean>;
158
+ removeWalletReduction(options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
158
159
  /**
159
160
  * @description This method allows the user to use a voucher to pay the cart.
160
161
  * If the balance of the value of the voucher is enough to pay the cart, the cart will be paid fully.
@@ -162,7 +163,7 @@ export declare class JourneyBooking extends Booking {
162
163
  * @param voucherCode The code of the voucher to use
163
164
  * @returns An {@link ErrorResponse} object in case of error, true otherwise.
164
165
  */
165
- useVoucher(voucherCode: string): Promise<ErrorResponse | boolean>;
166
+ useVoucher(voucherCode: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
166
167
  }
167
168
  export declare namespace JourneyBooking {
168
169
  const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<JourneyBooking>;