mts-booking-library 1.2.22 → 1.2.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  import { MTSConfig, MTSEnvs } from "../config";
2
2
  import { ErrorResponse } from "../types/ErrorResponse";
3
- import { GetPaymentInformationFromGatewayResponse, GetSellerGatewaysResponse, PaymentMethods, Wallet } from "../types/common/Payment";
3
+ import { GetPaymentInformationFromGatewayResponse, GetSellerGatewaysResponse, PaymentMethods, IssueTicketsResponse } from "../types/common/Payment";
4
4
  import { GetBuyerPassengersDetailsResponse, Person } from "../types/common/Person";
5
5
  import { AddReductionRequest } from "../types/common/Reduction";
6
6
  export declare abstract class Booking {
@@ -85,12 +85,9 @@ export declare abstract class Booking {
85
85
  * @description This method shall be used to issue the tickets. It must be called after the payment was successful.
86
86
  * @param {PaymentMethods} paymentMethod The payment method used to pay the cart. If the chosen method is {@link PaymentMethods.ZERO_COST},
87
87
  * first the {@link Booking.addReduction} API is called with a 100% discount, then tickets are issued with the {@link PaymentMethods.CASH} method.
88
- * @returns An {@link ErrorResponse} object in case of error, nothing otherwise.
88
+ * @returns An {@link IssueTicketsResponse} object.
89
89
  */
90
- issueTickets(paymentMethod: PaymentMethods): Promise<ErrorResponse | {
91
- wallet: Wallet;
92
- result: boolean;
93
- }>;
90
+ issueTickets(paymentMethod: PaymentMethods): Promise<ErrorResponse | IssueTicketsResponse>;
94
91
  }
95
92
  export declare namespace Booking {
96
93
  enum Currencies {
@@ -271,7 +271,7 @@ var Booking = /** @class */ (function () {
271
271
  * @description This method shall be used to issue the tickets. It must be called after the payment was successful.
272
272
  * @param {PaymentMethods} paymentMethod The payment method used to pay the cart. If the chosen method is {@link PaymentMethods.ZERO_COST},
273
273
  * first the {@link Booking.addReduction} API is called with a 100% discount, then tickets are issued with the {@link PaymentMethods.CASH} method.
274
- * @returns An {@link ErrorResponse} object in case of error, nothing otherwise.
274
+ * @returns An {@link IssueTicketsResponse} object.
275
275
  */
276
276
  Booking.prototype.issueTickets = function (paymentMethod) {
277
277
  var _a;
@@ -337,7 +337,7 @@ var Booking = /** @class */ (function () {
337
337
  paymentMethod: paymentMethodToSet === Payment_1.PaymentMethods.PAY_LATER ? null : paymentMethodToSet,
338
338
  };
339
339
  return [2 /*return*/, this.callPostApi(url, body).then(function (response) {
340
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : { wallet: response.wallet, result: true };
340
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
341
341
  })];
342
342
  }
343
343
  });
package/lib/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { GetBuyerPassengersDetailsResponse, GetPassenger, BuyerDataStatus } from
7
7
  export { EditPassengerRequestType, EditPassengersDetailsRequest } from "./types/common/Person";
8
8
  export { Tariff, TariffsMatrix, TariffSummary, TariffType, TermsType, PassengerTariff, ExtraTariff } from "./types/common/Tariffs";
9
9
  export { Reduction, AddReductionRequest } from "./types/common/Reduction";
10
- export { Gateway, GetSellerGatewaysResponse, GetPaymentInformationFromGatewayResponse, GatewayTypes, PaymentMethods } from "./types/common/Payment";
10
+ export { Gateway, GetSellerGatewaysResponse, GetPaymentInformationFromGatewayResponse, IssueTicketsResponse, GatewayTypes, PaymentMethods } from "./types/common/Payment";
11
11
  export { ErrorResponse, objectIsMTSErrorResponse } from "./types/ErrorResponse";
12
12
  export { BusLayoutCell, BusMatrix, BusCellTypes, SeatStatus } from "./types/journeys/BusMatrix";
13
13
  export { JourneyCart, JourneyBookingType, CreateJourneyCartRequest, TripBookingInfo, DEFAULT_CREATE_JOURNEY_CART } from "./types/journeys/JourneyCart";
@@ -10,7 +10,7 @@ export type Gateway = {
10
10
  name: string;
11
11
  };
12
12
  /**
13
- * @description This type represents the response of the {@link Booking.getSellerGateways} API. Note that at least
13
+ * @description This type represents the response of the {@link Booking.getSellerGateways()} API. Note that at least
14
14
  * one of the two fields will be null, depending on the seller configuration.
15
15
  * @param {Gateway | null} cardGatewayDTO The card gateway, if available. Currecntly this can only be {@link GatewayTypes.AXEPTA_BNL}
16
16
  * or {@link GatewayTypes.AXERVE_BANCASELLA}
@@ -77,3 +77,17 @@ export type Wallet = {
77
77
  balance: any;
78
78
  walletTransactions: any[];
79
79
  };
80
+ /**
81
+ * @description This type represents the response of the {@link Booking.issueTickets} API.
82
+ * @param {Wallet} wallet If the booking was performed by a reseller, this field contains the wallet with the updated balance.
83
+ * @param {string} ticketsSentToEmail This field contains the email address to which the tickets were sent.
84
+ * If the buyer email was specified, this field will contain the buyer email. Otherwise, if the reseller performed the booking, this
85
+ * field will contain the reseller email. Otherwise, it will be the seller's email. If this is also not available, this field will contain
86
+ * the MTS email.
87
+ * @param {string[]} PNRs An array of PNRs associated with the booking.
88
+ */
89
+ export type IssueTicketsResponse = {
90
+ wallet: Wallet | null;
91
+ ticketsSentToEmail: string;
92
+ pnrs: string[];
93
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.2.22",
3
+ "version": "1.2.23",
4
4
  "description": "Library for use MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "author": "M",
30
30
  "dependencies": {
31
- "axios": "^1.6.2",
31
+ "axios": "^1.6.5",
32
32
  "node-localstorage": "^3.0.5"
33
33
  }
34
34
  }