mts-booking-library 1.2.18 → 1.2.19
Sign up to get free protection for your applications and to get access to all the features.
@@ -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;
|