mts-booking-library 1.2.17 → 1.2.19
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.
@@ -233,15 +233,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
233
233
|
if (request.departureStopName === undefined || request.destinationStopName === undefined) {
|
234
234
|
throw Error("Fields departureStopName and destinationStopName are required");
|
235
235
|
}
|
236
|
-
searchParams = new URLSearchParams({
|
237
|
-
departureStopName: request.departureStopName,
|
238
|
-
destinationStopName: request.destinationStopName,
|
239
|
-
passengersNumber: request.passengersNumber.toString(),
|
240
|
-
date: request.date,
|
241
|
-
roundTripDate: request.roundTripDate ? request.roundTripDate : "null",
|
242
|
-
currency: request.currency,
|
243
|
-
isRoundtrip: request.isRoundtrip.toString()
|
244
|
-
});
|
236
|
+
searchParams = new URLSearchParams(__assign({ departureStopName: request.departureStopName, destinationStopName: request.destinationStopName, passengersNumber: request.passengersNumber.toString(), date: request.date, roundTripDate: request.roundTripDate ? request.roundTripDate : "null", currency: request.currency, isRoundtrip: request.isRoundtrip.toString() }, (this.cartId && { cartId: this.cartId.toString() })));
|
245
237
|
url = "".concat(this.config.API_ENDPOINT, "/booking/journeys?").concat(searchParams);
|
246
238
|
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
247
239
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.journeys;
|
@@ -251,11 +243,12 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
251
243
|
};
|
252
244
|
JourneyBooking.prototype.createJourneyCart = function (journeyCart) {
|
253
245
|
return __awaiter(this, void 0, void 0, function () {
|
254
|
-
var url;
|
246
|
+
var url, request;
|
255
247
|
var _this = this;
|
256
248
|
return __generator(this, function (_a) {
|
257
249
|
url = "".concat(this.config.API_ENDPOINT, "/booking/journeys/cart");
|
258
|
-
|
250
|
+
request = __assign(__assign({}, journeyCart), (this.cartId && { cartId: this.cartId.toString() }));
|
251
|
+
return [2 /*return*/, this.callPostApi(url, request).then(function (response) {
|
259
252
|
// Check for errors
|
260
253
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
261
254
|
return response;
|
@@ -477,7 +470,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
477
470
|
throw Error("The status of the cart does not allow to call this API");
|
478
471
|
}
|
479
472
|
url = "".concat(this.config.API_ENDPOINT, "/booking/cart/").concat(this.cart.id, "/seats");
|
480
|
-
return [2 /*return*/, this.callPostApi(url, { tripId: tripId,
|
473
|
+
return [2 /*return*/, this.callPostApi(url, { tripId: tripId, newSeatsIds: newSeatsIds }).then(function (response) {
|
481
474
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
482
475
|
return response;
|
483
476
|
}
|