mts-booking-library 1.2.17 → 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
- return [2 /*return*/, this.callPostApi(url, journeyCart).then(function (response) {
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, seatsIds: newSeatsIds }).then(function (response) {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "Library for use MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",