mts-booking-library 1.2.30 → 1.2.32
Sign up to get free protection for your applications and to get access to all the features.
@@ -58,13 +58,13 @@ export declare class JourneyBooking extends Booking {
|
|
58
58
|
getBuyerPassengersDetails(): Promise<ErrorResponse | GetBuyerPassengersDetailsResponse>;
|
59
59
|
/**
|
60
60
|
* @description This method shall be called when the user wants to retrieve information about an esisting buyer.
|
61
|
-
* @param {string} [
|
62
|
-
* A
|
63
|
-
* @param {string} [
|
61
|
+
* @param {string} [linkavelCard=undefined] The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
|
62
|
+
* A linkavelCard number is a string of 9 digits.
|
63
|
+
* @param {string} [phoneNumber=undefined] The phone number of the buyer. This parameter is required if linkavelCard is not set.
|
64
64
|
* @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
|
65
65
|
* as well as a list of the available tariffs for each trip.
|
66
66
|
*/
|
67
|
-
getBuyerFromLinkavelCard(
|
67
|
+
getBuyerFromLinkavelCard(linkavelCard?: string, phoneNumber?: string): Promise<ErrorResponse | Person>;
|
68
68
|
/**
|
69
69
|
* @description This methosd shall be called when the user wants to update the buyer and the passengers information.
|
70
70
|
* @param {EditPassengersDetailsRequest} passengersDetails The object containing the buyer and the passengers information.
|
@@ -238,7 +238,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
238
238
|
if (request.departureStopName === undefined || request.destinationStopName === undefined) {
|
239
239
|
throw Error("Fields departureStopName and destinationStopName are required");
|
240
240
|
}
|
241
|
-
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
|
241
|
+
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 }, (this.cartId && { cartId: this.cartId.toString() })));
|
242
242
|
url = "".concat(this.config.API_ENDPOINT, "/booking/journeys?").concat(searchParams);
|
243
243
|
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
244
244
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.journeys;
|
@@ -328,13 +328,13 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
328
328
|
};
|
329
329
|
/**
|
330
330
|
* @description This method shall be called when the user wants to retrieve information about an esisting buyer.
|
331
|
-
* @param {string} [
|
332
|
-
* A
|
333
|
-
* @param {string} [
|
331
|
+
* @param {string} [linkavelCard=undefined] The linkavel card number of the buyer. This parameter is required if phoneNumber is not set.
|
332
|
+
* A linkavelCard number is a string of 9 digits.
|
333
|
+
* @param {string} [phoneNumber=undefined] The phone number of the buyer. This parameter is required if linkavelCard is not set.
|
334
334
|
* @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
|
335
335
|
* as well as a list of the available tariffs for each trip.
|
336
336
|
*/
|
337
|
-
JourneyBooking.prototype.getBuyerFromLinkavelCard = function (
|
337
|
+
JourneyBooking.prototype.getBuyerFromLinkavelCard = function (linkavelCard, phoneNumber) {
|
338
338
|
return __awaiter(this, void 0, void 0, function () {
|
339
339
|
var buyerPassengersDetails, searchParams, url;
|
340
340
|
return __generator(this, function (_a) {
|
@@ -346,10 +346,10 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
346
346
|
if (!buyerPassengersDetails || !buyerPassengersDetails[0]) {
|
347
347
|
throw Error("The status of the cart does not allow to call this API");
|
348
348
|
}
|
349
|
-
if (!
|
350
|
-
throw Error("At least one of the parameters
|
349
|
+
if (!linkavelCard && !phoneNumber) {
|
350
|
+
throw Error("At least one of the parameters linkavelCard or phoneNumber must be set");
|
351
351
|
}
|
352
|
-
searchParams = new URLSearchParams(__assign(__assign({}, (
|
352
|
+
searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCard && { linkavelCard: linkavelCard })), (phoneNumber && { phoneNumber: phoneNumber })));
|
353
353
|
url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams);
|
354
354
|
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
355
355
|
// Check for errors
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mts-booking-library",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.32",
|
4
4
|
"description": "Library for use MyTicketSolution Booking API",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "lib/index.d.ts",
|
@@ -14,9 +14,9 @@
|
|
14
14
|
},
|
15
15
|
"license": "ISC",
|
16
16
|
"devDependencies": {
|
17
|
-
"@types/jest": "^29.5.
|
17
|
+
"@types/jest": "^29.5.12",
|
18
18
|
"jest": "^29.7.0",
|
19
|
-
"ts-jest": "^29.1.
|
19
|
+
"ts-jest": "^29.1.2",
|
20
20
|
"typescript": "^5.3.3"
|
21
21
|
},
|
22
22
|
"files": [
|
@@ -28,7 +28,7 @@
|
|
28
28
|
],
|
29
29
|
"author": "M",
|
30
30
|
"dependencies": {
|
31
|
-
"axios": "^1.6.
|
31
|
+
"axios": "^1.6.7",
|
32
32
|
"node-localstorage": "^3.0.5"
|
33
33
|
}
|
34
34
|
}
|