mts-booking-library 1.2.21 → 1.2.23
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.
- package/lib/booking/booking.d.ts +3 -6
- package/lib/booking/booking.js +2 -2
- package/lib/booking/serviceBooking.d.ts +3 -2
- package/lib/booking/serviceBooking.js +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/types/common/Payment.d.ts +15 -1
- package/lib/types/common/Person.d.ts +3 -2
- package/package.json +2 -2
package/lib/booking/booking.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { MTSConfig, MTSEnvs } from "../config";
|
2
2
|
import { ErrorResponse } from "../types/ErrorResponse";
|
3
|
-
import { GetPaymentInformationFromGatewayResponse, GetSellerGatewaysResponse, PaymentMethods,
|
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
|
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 {
|
package/lib/booking/booking.js
CHANGED
@@ -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
|
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 :
|
340
|
+
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
|
341
341
|
})];
|
342
342
|
}
|
343
343
|
});
|
@@ -71,10 +71,11 @@ export declare class ServiceBooking extends Booking {
|
|
71
71
|
getBuyerFromLinkavelCard(linkavelCardNumber?: string, linkavelCardPhoneNumber?: string): Promise<ErrorResponse | Person>;
|
72
72
|
/**
|
73
73
|
* @description This method shall be called when the user wants to update the buyer information.
|
74
|
-
* @param {Person} buyerDetails The object containing the buyer information.
|
74
|
+
* @param {Person | null} buyerDetails The object containing the buyer information.
|
75
|
+
* It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
|
75
76
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
76
77
|
*/
|
77
|
-
updateBuyerPassengersDetails(buyerDetails: Person): Promise<ErrorResponse | boolean>;
|
78
|
+
updateBuyerPassengersDetails(buyerDetails: Person | null): Promise<ErrorResponse | boolean>;
|
78
79
|
/**
|
79
80
|
* @description This method allows to add a reduction to the whole cart or to a single trip in the cart.
|
80
81
|
* @param {AddReductionRequest} request The information about the reduction to add
|
@@ -336,7 +336,8 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
336
336
|
};
|
337
337
|
/**
|
338
338
|
* @description This method shall be called when the user wants to update the buyer information.
|
339
|
-
* @param {Person} buyerDetails The object containing the buyer information.
|
339
|
+
* @param {Person | null} buyerDetails The object containing the buyer information.
|
340
|
+
* It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
|
340
341
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
341
342
|
*/
|
342
343
|
ServiceBooking.prototype.updateBuyerPassengersDetails = function (buyerDetails) {
|
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
|
+
};
|
@@ -64,9 +64,10 @@ export type EditPassengerRequestType = Person & {
|
|
64
64
|
* This type shall be used as request for the {@link updatePassengersDetails} method.
|
65
65
|
*
|
66
66
|
* @property {EditPassengerRequestType[]} passengers - An array of {@link Person} extended by the map `tripsToTariffs` objects representing the passengers.
|
67
|
-
* @property {Person} buyer - The {@link Person} object representing the buyer.
|
67
|
+
* @property {Person | null} buyer - The {@link Person} object representing the buyer.
|
68
|
+
* It should be null if the buyer data cannot be specified (see {@link GetBuyerPassengersDetailsResponse.buyerDataStatus}).
|
68
69
|
*/
|
69
70
|
export type EditPassengersDetailsRequest = {
|
70
71
|
passengers: EditPassengerRequestType[];
|
71
|
-
buyer: Person;
|
72
|
+
buyer: Person | null;
|
72
73
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mts-booking-library",
|
3
|
-
"version": "1.2.
|
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.
|
31
|
+
"axios": "^1.6.5",
|
32
32
|
"node-localstorage": "^3.0.5"
|
33
33
|
}
|
34
34
|
}
|