mts-booking-library 3.2.0 → 3.3.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.
@@ -78,13 +78,11 @@ 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 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+).
81
+ * @param returnUrl The url to which the user will be redirected after the payment. This value shall be set only if the
82
+ * chosen gateway is {@link GatewayTypes.PAYPAL} or {@link GatewayTypes.WORLDLINE}
85
83
  * @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
86
84
  */
87
- getPaymentInformationFromGateway(gatewayId: number, returnOrigin: string, options?: ApiCallOptions): Promise<ErrorResponse | GetPaymentInformationFromGatewayResponse>;
85
+ getPaymentInformationFromGateway(gatewayId: number, returnUrl?: string, options?: ApiCallOptions): Promise<ErrorResponse | GetPaymentInformationFromGatewayResponse>;
88
86
  /**
89
87
  * @description This method shall be used to issue the tickets. It must be called after the payment was successful.
90
88
  * @param paymentMethod The payment method used to pay the cart. If the chosen method is {@link PaymentMethods.ZERO_COST},
@@ -285,13 +285,11 @@ 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 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+).
288
+ * @param returnUrl The url to which the user will be redirected after the payment. This value shall be set only if the
289
+ * chosen gateway is {@link GatewayTypes.PAYPAL} or {@link GatewayTypes.WORLDLINE}
292
290
  * @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
293
291
  */
294
- Booking.prototype.getPaymentInformationFromGateway = function (gatewayId, returnOrigin, options) {
292
+ Booking.prototype.getPaymentInformationFromGateway = function (gatewayId, returnUrl, options) {
295
293
  return __awaiter(this, void 0, void 0, function () {
296
294
  var issueStep, searchParams, url;
297
295
  return __generator(this, function (_a) {
@@ -303,7 +301,7 @@ var Booking = /** @class */ (function () {
303
301
  if (!issueStep || !issueStep[0]) {
304
302
  throw Error("The status of the cart does not allow to call this API");
305
303
  }
306
- searchParams = new URLSearchParams(__assign({ gatewayId: gatewayId.toString(), cartGuid: this.cartGuid }, (returnOrigin && { returnOrigin: returnOrigin })));
304
+ searchParams = new URLSearchParams(__assign({ gatewayId: gatewayId.toString(), cartGuid: this.cartGuid }, (returnUrl && { returnUrl: returnUrl })));
307
305
  url = "".concat(this.config.API_ENDPOINT, "/v3_payment/paymentInformation?").concat(searchParams);
308
306
  return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
309
307
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
@@ -19,6 +19,8 @@ export type Person = {
19
19
  notes?: string;
20
20
  /** The social security number of the person. */
21
21
  socialSecurityNumber?: string | null;
22
+ /** The sex of the person. M = male, F = female, O = other. */
23
+ sex?: "M" | "F" | "O" | null;
22
24
  };
23
25
  export declare const DEFAULT_PERSON: Person;
24
26
  export declare const initializePerson: (person?: Person | undefined | null) => Person;
@@ -55,6 +57,8 @@ export type GetPassenger = Person & {
55
57
  passengerPhoneNumberOption: PersonDataFieldStatus;
56
58
  /** Whether the passenger social security number is reuqired, optional or cannot be specified. */
57
59
  passengerSSNOption: PersonDataFieldStatus;
60
+ /** Whether the passenger sex is required, optional or cannot be specified. */
61
+ passengerSexOption?: PersonDataFieldStatus;
58
62
  };
59
63
  export declare enum PersonDataFieldStatus {
60
64
  /** The field (e.g. the buyer's email) is optional. The input shall be displayed, but the user can skip it. */
@@ -8,7 +8,8 @@ exports.DEFAULT_PERSON = {
8
8
  lastName: "",
9
9
  email: "",
10
10
  phoneNumber: "",
11
- socialSecurityNumber: null
11
+ socialSecurityNumber: null,
12
+ sex: undefined
12
13
  };
13
14
  var initializePerson = function (person) {
14
15
  if (!person) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",