mts-booking-library 3.1.0 → 3.2.0
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
CHANGED
|
@@ -78,11 +78,13 @@ export declare abstract class Booking {
|
|
|
78
78
|
/**
|
|
79
79
|
* @description This method shall be used to get all necessary informations to initialize a payment with a certain gateway.
|
|
80
80
|
* @param gatewayId The id of the gateway to use. Its value shall be taken from the response of the {@link Booking.getSellerGateways} API
|
|
81
|
-
* @param
|
|
82
|
-
*
|
|
81
|
+
* @param returnOrigin The FE origin (scheme+host+port, e.g. `window.location.origin`) that the gateway should redirect
|
|
82
|
+
* back to after the payment. The BE validates this against a per-app allowlist and stitches the canonical
|
|
83
|
+
* `/booking?step=BOOKING_STEP_PAYMENT_PROCESSING&cartGuid={guid}` path on top. Pass `window.location.origin` from the
|
|
84
|
+
* caller — the BE owns the rest. Replaces the legacy full-URL `returnUrl` parameter (BE 3.2.0+).
|
|
83
85
|
* @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
|
|
84
86
|
*/
|
|
85
|
-
getPaymentInformationFromGateway(gatewayId: number,
|
|
87
|
+
getPaymentInformationFromGateway(gatewayId: number, returnOrigin: string, options?: ApiCallOptions): Promise<ErrorResponse | GetPaymentInformationFromGatewayResponse>;
|
|
86
88
|
/**
|
|
87
89
|
* @description This method shall be used to issue the tickets. It must be called after the payment was successful.
|
|
88
90
|
* @param paymentMethod The payment method used to pay the cart. If the chosen method is {@link PaymentMethods.ZERO_COST},
|
package/lib/booking/booking.js
CHANGED
|
@@ -285,11 +285,13 @@ var Booking = /** @class */ (function () {
|
|
|
285
285
|
/**
|
|
286
286
|
* @description This method shall be used to get all necessary informations to initialize a payment with a certain gateway.
|
|
287
287
|
* @param gatewayId The id of the gateway to use. Its value shall be taken from the response of the {@link Booking.getSellerGateways} API
|
|
288
|
-
* @param
|
|
289
|
-
*
|
|
288
|
+
* @param returnOrigin The FE origin (scheme+host+port, e.g. `window.location.origin`) that the gateway should redirect
|
|
289
|
+
* back to after the payment. The BE validates this against a per-app allowlist and stitches the canonical
|
|
290
|
+
* `/booking?step=BOOKING_STEP_PAYMENT_PROCESSING&cartGuid={guid}` path on top. Pass `window.location.origin` from the
|
|
291
|
+
* caller — the BE owns the rest. Replaces the legacy full-URL `returnUrl` parameter (BE 3.2.0+).
|
|
290
292
|
* @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
|
|
291
293
|
*/
|
|
292
|
-
Booking.prototype.getPaymentInformationFromGateway = function (gatewayId,
|
|
294
|
+
Booking.prototype.getPaymentInformationFromGateway = function (gatewayId, returnOrigin, options) {
|
|
293
295
|
return __awaiter(this, void 0, void 0, function () {
|
|
294
296
|
var issueStep, searchParams, url;
|
|
295
297
|
return __generator(this, function (_a) {
|
|
@@ -301,7 +303,7 @@ var Booking = /** @class */ (function () {
|
|
|
301
303
|
if (!issueStep || !issueStep[0]) {
|
|
302
304
|
throw Error("The status of the cart does not allow to call this API");
|
|
303
305
|
}
|
|
304
|
-
searchParams = new URLSearchParams(__assign({ gatewayId: gatewayId.toString(), cartGuid: this.cartGuid }, (
|
|
306
|
+
searchParams = new URLSearchParams(__assign({ gatewayId: gatewayId.toString(), cartGuid: this.cartGuid }, (returnOrigin && { returnOrigin: returnOrigin })));
|
|
305
307
|
url = "".concat(this.config.API_ENDPOINT, "/v3_payment/paymentInformation?").concat(searchParams);
|
|
306
308
|
return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
|
|
307
309
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
|