mts-booking-library 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/booking/booking.d.ts +13 -12
- package/lib/booking/booking.js +24 -24
- package/lib/booking/journeyBooking.d.ts +32 -31
- package/lib/booking/journeyBooking.js +49 -49
- package/lib/booking/serviceBooking.d.ts +22 -21
- package/lib/booking/serviceBooking.js +34 -34
- package/lib/booking/subscriptionBooking.d.ts +34 -33
- package/lib/booking/subscriptionBooking.js +49 -49
- package/lib/booking/tplBooking.d.ts +23 -22
- package/lib/booking/tplBooking.js +38 -38
- package/lib/utils/apiCall.d.ts +9 -4
- package/lib/utils/apiCall.js +12 -8
- package/package.json +1 -1
- package/lib/SubscriptionBooking.d.ts +0 -0
- package/lib/SubscriptionBooking.js +0 -148
- package/lib/utils/testUtils.d.ts +0 -8
- package/lib/utils/testUtils.js +0 -19
@@ -130,12 +130,12 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
130
130
|
console.log(e);
|
131
131
|
}
|
132
132
|
};
|
133
|
-
ServiceBooking.prototype.fetchAndSetCart = function (cartGuid) {
|
133
|
+
ServiceBooking.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 ServiceBooking = /** @class */ (function (_super) {
|
|
161
161
|
});
|
162
162
|
});
|
163
163
|
};
|
164
|
-
ServiceBooking.prototype.fetchCart = function (cartGuid) {
|
164
|
+
ServiceBooking.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 ServiceBooking = /** @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
|
-
ServiceBooking.prototype.deleteCart = function () {
|
189
|
+
ServiceBooking.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 ServiceBooking = /** @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
|
// Clear all data
|
201
201
|
_this.resetBooking();
|
202
202
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
|
@@ -207,14 +207,14 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
207
207
|
/**
|
208
208
|
* This method returns the list of cities in which the seller offers tours.
|
209
209
|
* If the sellerId is not set or it is 0, it will return the list of cities for all sellers.
|
210
|
-
* @returns
|
210
|
+
* @returns The list of possible cities
|
211
211
|
*/
|
212
|
-
ServiceBooking.prototype.getServiceCities = function () {
|
212
|
+
ServiceBooking.prototype.getServiceCities = function (options) {
|
213
213
|
return __awaiter(this, void 0, void 0, function () {
|
214
214
|
var url;
|
215
215
|
return __generator(this, function (_a) {
|
216
216
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/services/cities?");
|
217
|
-
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
217
|
+
return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
|
218
218
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
|
219
219
|
? response
|
220
220
|
: response.cities;
|
@@ -225,17 +225,17 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
225
225
|
/**
|
226
226
|
* This method returns the tours sold by this seller in the given city.
|
227
227
|
* If the sellerId is not set or it is 0, it will return the tours in the given city for all sellers.
|
228
|
-
* @param
|
229
|
-
* @param
|
230
|
-
* @returns
|
228
|
+
* @param cityName The name of the selected city (as returned by {@link getTourCities})
|
229
|
+
* @param The currency in which the prices should be returned
|
230
|
+
* @returns The returned tours
|
231
231
|
*/
|
232
|
-
ServiceBooking.prototype.getServices = function (currency, cityName) {
|
232
|
+
ServiceBooking.prototype.getServices = function (currency, cityName, options) {
|
233
233
|
return __awaiter(this, void 0, void 0, function () {
|
234
234
|
var searchParams, url;
|
235
235
|
return __generator(this, function (_a) {
|
236
236
|
searchParams = new URLSearchParams(__assign(__assign({}, (cityName && { cityName: cityName })), { currency: currency }));
|
237
237
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/services?").concat(searchParams);
|
238
|
-
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
238
|
+
return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
|
239
239
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
|
240
240
|
? response
|
241
241
|
: response.services;
|
@@ -247,17 +247,17 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
247
247
|
* This method returns the tours available for the given date. This method can be used if the seller wants the user to book a specific date
|
248
248
|
* and/or a specific hour for the tour.
|
249
249
|
* You should call this method only if {@link Service.isDateOptional} or {@link Service.isDateRequired} is true for the selected tour.
|
250
|
-
* @param
|
251
|
-
* @param
|
250
|
+
* @param serviceId The id of the selected tour (can be retrieved in the object {@link Service} returned by {@link getTours})
|
251
|
+
* @param date The date on which to get the tours, in ISO string format
|
252
252
|
* @returns {ServiceTripsResponse} The returned information about the tour (tripId and hour)
|
253
253
|
*/
|
254
|
-
ServiceBooking.prototype.getServiceTrips = function (serviceId, date) {
|
254
|
+
ServiceBooking.prototype.getServiceTrips = function (serviceId, date, options) {
|
255
255
|
return __awaiter(this, void 0, void 0, function () {
|
256
256
|
var searchParams, url;
|
257
257
|
return __generator(this, function (_a) {
|
258
258
|
searchParams = new URLSearchParams({ serviceId: serviceId.toString(), date: date });
|
259
259
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/services/trips?").concat(searchParams);
|
260
|
-
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
260
|
+
return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
|
261
261
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
|
262
262
|
? response
|
263
263
|
: response;
|
@@ -265,13 +265,13 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
265
265
|
});
|
266
266
|
});
|
267
267
|
};
|
268
|
-
ServiceBooking.prototype.createServiceCart = function (serviceCart) {
|
268
|
+
ServiceBooking.prototype.createServiceCart = function (serviceCart, options) {
|
269
269
|
return __awaiter(this, void 0, void 0, function () {
|
270
270
|
var url;
|
271
271
|
var _this = this;
|
272
272
|
return __generator(this, function (_a) {
|
273
273
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/services/carts");
|
274
|
-
return [2 /*return*/, this.callPostApi(url, serviceCart).then(function (response) {
|
274
|
+
return [2 /*return*/, this.callPostApi(url, serviceCart, options).then(function (response) {
|
275
275
|
// Check for errors
|
276
276
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
277
277
|
// If there was an error, reset cartGuid and remove it from the mts-storage
|
@@ -335,7 +335,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
335
335
|
* It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
|
336
336
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
337
337
|
*/
|
338
|
-
ServiceBooking.prototype.updateBuyerPassengersDetails = function (buyerDetails) {
|
338
|
+
ServiceBooking.prototype.updateBuyerPassengersDetails = function (buyerDetails, options) {
|
339
339
|
return __awaiter(this, void 0, void 0, function () {
|
340
340
|
var buyerPassengersDetails, request, url;
|
341
341
|
var _this = this;
|
@@ -354,7 +354,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
354
354
|
passengers: []
|
355
355
|
};
|
356
356
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/details");
|
357
|
-
return [2 /*return*/, this.callPostApi(url, request).then(function (response) {
|
357
|
+
return [2 /*return*/, this.callPostApi(url, request, options).then(function (response) {
|
358
358
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
359
359
|
return response;
|
360
360
|
}
|
@@ -369,10 +369,10 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
369
369
|
//#region Reductions APIs
|
370
370
|
/**
|
371
371
|
* @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
|
372
|
-
* @param
|
372
|
+
* @param request The information about the reduction to add
|
373
373
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
|
374
374
|
*/
|
375
|
-
ServiceBooking.prototype.addReduction = function (request) {
|
375
|
+
ServiceBooking.prototype.addReduction = function (request, options) {
|
376
376
|
return __awaiter(this, void 0, void 0, function () {
|
377
377
|
var discountsStep, _i, _a, step, url;
|
378
378
|
var _this = this;
|
@@ -410,7 +410,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
410
410
|
_c.label = 5;
|
411
411
|
case 5:
|
412
412
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/reduction");
|
413
|
-
return [2 /*return*/, this.callPostApi(url, __assign(__assign({}, request), { cartGuid: this.cartGuid })).then(function (response) {
|
413
|
+
return [2 /*return*/, this.callPostApi(url, __assign(__assign({}, request), { cartGuid: this.cartGuid }), options).then(function (response) {
|
414
414
|
var _a, _b;
|
415
415
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
416
416
|
return response;
|
@@ -432,7 +432,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
432
432
|
* will be removed from the whole cart.
|
433
433
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
|
434
434
|
*/
|
435
|
-
ServiceBooking.prototype.removeReduction = function (tripId) {
|
435
|
+
ServiceBooking.prototype.removeReduction = function (tripId, options) {
|
436
436
|
return __awaiter(this, void 0, void 0, function () {
|
437
437
|
var discountsStep, queryParams, url;
|
438
438
|
var _this = this;
|
@@ -450,7 +450,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
450
450
|
cartGuid: this.cartGuid
|
451
451
|
});
|
452
452
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/reduction?").concat(queryParams);
|
453
|
-
return [2 /*return*/, this.callDeleteApi(url).then(function (response) {
|
453
|
+
return [2 /*return*/, this.callDeleteApi(url, options).then(function (response) {
|
454
454
|
var _a, _b, _c;
|
455
455
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
456
456
|
return response;
|
@@ -475,7 +475,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
475
475
|
* remaining amount with another payment method.
|
476
476
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
477
477
|
*/
|
478
|
-
ServiceBooking.prototype.useWallet = function () {
|
478
|
+
ServiceBooking.prototype.useWallet = function (options) {
|
479
479
|
return __awaiter(this, void 0, void 0, function () {
|
480
480
|
var issueStep, _i, _a, step, url;
|
481
481
|
var _this = this;
|
@@ -517,7 +517,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
517
517
|
_c.label = 5;
|
518
518
|
case 5:
|
519
519
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/wallet");
|
520
|
-
return [2 /*return*/, this.callPostApi(url, { cartGuid: this.cartGuid }).then(function (response) {
|
520
|
+
return [2 /*return*/, this.callPostApi(url, { cartGuid: this.cartGuid }, options).then(function (response) {
|
521
521
|
var _a, _b;
|
522
522
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
523
523
|
return response;
|
@@ -538,7 +538,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
538
538
|
*
|
539
539
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
|
540
540
|
*/
|
541
|
-
ServiceBooking.prototype.removeWalletReduction = function () {
|
541
|
+
ServiceBooking.prototype.removeWalletReduction = function (options) {
|
542
542
|
return __awaiter(this, void 0, void 0, function () {
|
543
543
|
var queryParams, url;
|
544
544
|
var _this = this;
|
@@ -551,7 +551,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
551
551
|
cartGuid: this.cartGuid
|
552
552
|
});
|
553
553
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/wallet?").concat(queryParams);
|
554
|
-
return [2 /*return*/, this.callDeleteApi(url).then(function (response) {
|
554
|
+
return [2 /*return*/, this.callDeleteApi(url, options).then(function (response) {
|
555
555
|
var _a, _b, _c;
|
556
556
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
557
557
|
return response;
|
@@ -570,10 +570,10 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
570
570
|
* @description This method allows the user to use a voucher to pay the cart.
|
571
571
|
* If the balance of the value of the voucher is enough to pay the cart, the cart will be paid fully.
|
572
572
|
* Otherwise, the user will be asked to pay the remaining amount with another payment method.
|
573
|
-
* @param
|
573
|
+
* @param voucherCode The code of the voucher to use
|
574
574
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
575
575
|
*/
|
576
|
-
ServiceBooking.prototype.useVoucher = function (voucherCode) {
|
576
|
+
ServiceBooking.prototype.useVoucher = function (voucherCode, options) {
|
577
577
|
return __awaiter(this, void 0, void 0, function () {
|
578
578
|
var discountsStep, _i, _a, step, url;
|
579
579
|
var _this = this;
|
@@ -611,7 +611,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
611
611
|
_c.label = 5;
|
612
612
|
case 5:
|
613
613
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/payment/voucher");
|
614
|
-
return [2 /*return*/, this.callPostApi(url, { voucherCode: voucherCode, cartGuid: this.cartGuid }).then(function (response) {
|
614
|
+
return [2 /*return*/, this.callPostApi(url, { voucherCode: voucherCode, cartGuid: this.cartGuid }, options).then(function (response) {
|
615
615
|
var _a, _b;
|
616
616
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
617
617
|
return response;
|
@@ -4,6 +4,7 @@ import { AddReductionRequest } from "../types/common/Reduction";
|
|
4
4
|
import { GetSubscriptionAvailabilityRequest, GetSubscriptionAvailabilityResponse } from "../types/subscriptions/SubscriptionAvailabilities";
|
5
5
|
import { CreateSubscriptionCartRequest, SubscriptionCart } from "../types/subscriptions/SubscriptionCart";
|
6
6
|
import { Subscription } from "../types/subscriptions/Subscriptions";
|
7
|
+
import { ApiCallOptions } from "../utils/apiCall";
|
7
8
|
import { Booking } from "./booking";
|
8
9
|
export declare class SubscriptionBooking extends Booking {
|
9
10
|
private cart?;
|
@@ -59,102 +60,102 @@ export declare class SubscriptionBooking extends Booking {
|
|
59
60
|
}>;
|
60
61
|
getCart(): SubscriptionCart | undefined;
|
61
62
|
resetBooking(): void;
|
62
|
-
fetchAndSetCart(cartGuid: string): Promise<void>;
|
63
|
-
fetchCart(cartGuid: string): Promise<SubscriptionCart>;
|
63
|
+
fetchAndSetCart(cartGuid: string, options?: ApiCallOptions): Promise<void>;
|
64
|
+
fetchCart(cartGuid: string, options?: ApiCallOptions): Promise<SubscriptionCart>;
|
64
65
|
/**
|
65
66
|
* This method allows to delete a cart, thus allowing the user to exit from the booking process.
|
66
67
|
* @returns An {@link ErrorResponse} object in case of error, nothing otherwise. Note that also in case of error, all
|
67
68
|
* data will be deleted.
|
68
69
|
*/
|
69
|
-
deleteCart(): Promise<ErrorResponse | any>;
|
70
|
+
deleteCart(options?: ApiCallOptions): Promise<ErrorResponse | any>;
|
70
71
|
/**
|
71
72
|
* This method returns the possible departures for all subscriptions sold by this seller.
|
72
|
-
* @returns
|
73
|
+
* @returns The list of possible departures
|
73
74
|
*/
|
74
|
-
getSubscriptionsDepartures(): Promise<ErrorResponse | string[]>;
|
75
|
+
getSubscriptionsDepartures(options?: ApiCallOptions): Promise<ErrorResponse | string[]>;
|
75
76
|
/**
|
76
77
|
* This method returns the possible destination for the subscriptions sold by this seller that start at the selected departure.
|
77
|
-
* @param
|
78
|
-
* @returns
|
78
|
+
* @param departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
|
79
|
+
* @returns The list of possible destinations
|
79
80
|
*/
|
80
|
-
getSubscriptionsDestinations(departureStopName: string): Promise<ErrorResponse | string[]>;
|
81
|
+
getSubscriptionsDestinations(departureStopName: string, options?: ApiCallOptions): Promise<ErrorResponse | string[]>;
|
81
82
|
/**
|
82
83
|
* This method returns the possible validity types for the subscriptions sold by this seller between the selected departure and destination.
|
83
84
|
* The validity type is the duration of the subscription (1 week, 1 month, etc.). See {@link ValidityTypes} for more details.
|
84
|
-
* @param
|
85
|
-
* @param
|
86
|
-
* @returns
|
85
|
+
* @param departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
|
86
|
+
* @param destinationStopName The destination stop name (as returned by {@link getSubscriptionsDstinations})
|
87
|
+
* @returns The list of possible validity types
|
87
88
|
*/
|
88
|
-
getSubscriptionsValidityTypes(departureStopName: string, destinationStopName: string): Promise<ErrorResponse | SubscriptionBooking.ValidityTypes[]>;
|
89
|
+
getSubscriptionsValidityTypes(departureStopName: string, destinationStopName: string, options?: ApiCallOptions): Promise<ErrorResponse | SubscriptionBooking.ValidityTypes[]>;
|
89
90
|
/**
|
90
91
|
* This method returns the subscriptions that match the given parameters.
|
91
92
|
* Note that it will always return the subscription for the one-way trip.
|
92
93
|
* 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)
|
93
|
-
* @param
|
94
|
-
* @param
|
95
|
-
* @param
|
96
|
-
* @returns
|
94
|
+
* @param departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
|
95
|
+
* @param destinationStopName The destination stop name (as returned by {@link getSubscriptionsDstinations})
|
96
|
+
* @param validityType The validity type (as returned by {@link getSubscriptionsValidityTypes})
|
97
|
+
* @returns The subscriptions that match the given parameters
|
97
98
|
*/
|
98
|
-
getSubscriptions(departureStopName: string, destinationStopName: string, validityType: string): Promise<ErrorResponse | Subscription[]>;
|
99
|
+
getSubscriptions(departureStopName: string, destinationStopName: string, validityType: string, options?: ApiCallOptions): Promise<ErrorResponse | Subscription[]>;
|
99
100
|
/**
|
100
101
|
* This method returns the availability of the subscription for the given parameters.
|
101
102
|
* Note that, contrary for the previous method, you should make one single request for both the outbound and return trip.
|
102
|
-
* @param
|
103
|
-
* @returns
|
103
|
+
* @param request the request object containing the parameters for the availability check
|
104
|
+
* @returns The availability of the subscription for the given parameters
|
104
105
|
*/
|
105
|
-
getSubscriptionAvailabilities(request: GetSubscriptionAvailabilityRequest): Promise<ErrorResponse | GetSubscriptionAvailabilityResponse>;
|
106
|
+
getSubscriptionAvailabilities(request: GetSubscriptionAvailabilityRequest, options?: ApiCallOptions): Promise<ErrorResponse | GetSubscriptionAvailabilityResponse>;
|
106
107
|
/**
|
107
108
|
* This method creates a subscription cart for the given parameters.
|
108
|
-
* @param
|
109
|
-
* @returns
|
109
|
+
* @param request the request object containing the parameters for the availability check
|
110
|
+
* @returns The created cart
|
110
111
|
*/
|
111
|
-
createSubscriptionCart(request: CreateSubscriptionCartRequest): Promise<ErrorResponse | SubscriptionCart>;
|
112
|
+
createSubscriptionCart(request: CreateSubscriptionCartRequest, options?: ApiCallOptions): Promise<ErrorResponse | SubscriptionCart>;
|
112
113
|
/**
|
113
114
|
* @description This method shall be called when the user wants to retrieve information about the buyer and the passengers.
|
114
115
|
* @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
|
115
116
|
* as well as a list of the available tariffs for each trip.
|
116
117
|
*/
|
117
|
-
getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
|
118
|
+
getBuyerPassengersDetails(options?: ApiCallOptions): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
|
118
119
|
/**
|
119
120
|
* @description This methosd shall be called when the user wants to update the buyer and the passengers information.
|
120
|
-
* @param
|
121
|
+
* @param passengersDetails The object containing the buyer and the passengers information.
|
121
122
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
122
123
|
*/
|
123
|
-
updateBuyerPassengersDetails(passengersDetails: EditPassengersDetailsRequest): Promise<ErrorResponse | boolean>;
|
124
|
+
updateBuyerPassengersDetails(passengersDetails: EditPassengersDetailsRequest, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
124
125
|
/**
|
125
126
|
* @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
|
126
|
-
* @param
|
127
|
+
* @param request The information about the reduction to add
|
127
128
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
|
128
129
|
*/
|
129
|
-
addReduction(request: AddReductionRequest): Promise<ErrorResponse | boolean>;
|
130
|
+
addReduction(request: AddReductionRequest, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
130
131
|
/**
|
131
132
|
* @description This method allows to remove a reduction from the whole cart or from a single trip in the cart.
|
132
133
|
* @param tripId The id of the trip from which the reduction should be removed. If the tripId is 0, then the reduction
|
133
134
|
* will be removed from the whole cart.
|
134
135
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
|
135
136
|
*/
|
136
|
-
removeReduction(tripId: number): Promise<ErrorResponse | boolean>;
|
137
|
+
removeReduction(tripId: number, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
137
138
|
/**
|
138
139
|
* @description This method allows the user to use the balance in his wallet to pay the cart. If the balance of
|
139
140
|
* the wallet is enough to pay the cart, the cart will be paid fully. Otherwise, the user will be asked to pay the
|
140
141
|
* remaining amount with another payment method.
|
141
142
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
142
143
|
*/
|
143
|
-
useWallet(): Promise<ErrorResponse | boolean>;
|
144
|
+
useWallet(options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
144
145
|
/**
|
145
146
|
* @description This method allows to remove a waller reduction from the cart.
|
146
147
|
*
|
147
148
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise. Also, the cart is updated.
|
148
149
|
*/
|
149
|
-
removeWalletReduction(): Promise<ErrorResponse | boolean>;
|
150
|
+
removeWalletReduction(options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
150
151
|
/**
|
151
152
|
* @description This method allows the user to use a voucher to pay the cart.
|
152
153
|
* If the balance of the value of the voucher is enough to pay the cart, the cart will be paid fully.
|
153
154
|
* Otherwise, the user will be asked to pay the remaining amount with another payment method.
|
154
|
-
* @param
|
155
|
+
* @param voucherCode The code of the voucher to use
|
155
156
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
156
157
|
*/
|
157
|
-
useVoucher(voucherCode: string): Promise<ErrorResponse | boolean>;
|
158
|
+
useVoucher(voucherCode: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
158
159
|
}
|
159
160
|
export declare namespace SubscriptionBooking {
|
160
161
|
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<SubscriptionBooking>;
|