mts-booking-library 1.2.20 → 1.2.22
Sign up to get free protection for your applications and to get access to all the features.
@@ -341,11 +341,8 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
341
341
|
if (!linkavelCardNumber && !linkavelCardPhoneNumber) {
|
342
342
|
throw Error("At least one of the parameters linkavelCardNumber and linkavelCardPhoneNumber must be set");
|
343
343
|
}
|
344
|
-
searchParams = new URLSearchParams({
|
345
|
-
|
346
|
-
linkavelCardPhoneNumber: linkavelCardPhoneNumber !== null && linkavelCardPhoneNumber !== void 0 ? linkavelCardPhoneNumber : "",
|
347
|
-
});
|
348
|
-
url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams, "}");
|
344
|
+
searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCardNumber && { linkavelCardNumber: linkavelCardNumber })), (linkavelCardPhoneNumber && { linkavelCardPhoneNumber: linkavelCardPhoneNumber })));
|
345
|
+
url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams);
|
349
346
|
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
350
347
|
// Check for errors
|
351
348
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
@@ -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
|
@@ -322,11 +322,8 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
322
322
|
if (!linkavelCardNumber && !linkavelCardPhoneNumber) {
|
323
323
|
throw Error("At least one of the parameters linkavelCardNumber and linkavelCardPhoneNumber must be set");
|
324
324
|
}
|
325
|
-
searchParams = new URLSearchParams({
|
326
|
-
|
327
|
-
linkavelCardPhoneNumber: linkavelCardPhoneNumber !== null && linkavelCardPhoneNumber !== void 0 ? linkavelCardPhoneNumber : "",
|
328
|
-
});
|
329
|
-
url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams, "}");
|
325
|
+
searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCardNumber && { linkavelCardNumber: linkavelCardNumber })), (linkavelCardPhoneNumber && { linkavelCardPhoneNumber: linkavelCardPhoneNumber })));
|
326
|
+
url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams);
|
330
327
|
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
331
328
|
// Check for errors
|
332
329
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
@@ -339,7 +336,8 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
339
336
|
};
|
340
337
|
/**
|
341
338
|
* @description This method shall be called when the user wants to update the buyer information.
|
342
|
-
* @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}).
|
343
341
|
* @returns An {@link ErrorResponse} object in case of error, true otherwise.
|
344
342
|
*/
|
345
343
|
ServiceBooking.prototype.updateBuyerPassengersDetails = function (buyerDetails) {
|
@@ -403,11 +403,8 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
403
403
|
if (!linkavelCardNumber && !linkavelCardPhoneNumber) {
|
404
404
|
throw Error("At least one of the parameters linkavelCardNumber and linkavelCardPhoneNumber must be set");
|
405
405
|
}
|
406
|
-
searchParams = new URLSearchParams({
|
407
|
-
|
408
|
-
linkavelCardPhoneNumber: linkavelCardPhoneNumber !== null && linkavelCardPhoneNumber !== void 0 ? linkavelCardPhoneNumber : "",
|
409
|
-
});
|
410
|
-
url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams, "}");
|
406
|
+
searchParams = new URLSearchParams(__assign(__assign({}, (linkavelCardNumber && { linkavelCardNumber: linkavelCardNumber })), (linkavelCardPhoneNumber && { linkavelCardPhoneNumber: linkavelCardPhoneNumber })));
|
407
|
+
url = "".concat(this.config.API_ENDPOINT, "/buyers?").concat(searchParams);
|
411
408
|
return [2 /*return*/, this.callGetApi(url).then(function (response) {
|
412
409
|
// Check for errors
|
413
410
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
|
@@ -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
|
};
|