mts-booking-library 1.2.14 → 1.2.15
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
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { MTSConfig, MTSEnvs } from "../config";
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { ErrorResponse } from "../types/ErrorResponse";
         
     | 
| 
       3 
     | 
    
         
            -
            import { GetPaymentInformationFromGatewayResponse, GetSellerGatewaysResponse, PaymentMethods } from "../types/common/Payment";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { GetPaymentInformationFromGatewayResponse, GetSellerGatewaysResponse, PaymentMethods, Wallet } 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 {
         
     | 
| 
         @@ -77,7 +77,7 @@ export declare abstract class Booking { 
     | 
|
| 
       77 
77 
     | 
    
         
             
                 * @description This method shall be used to get all necessary informations to initialize a payment with a certain gateway.
         
     | 
| 
       78 
78 
     | 
    
         
             
                 * @param {number} gatewayId The id of the gateway to use. Its value shall be taken from the response of the {@link Booking.getSellerGateways} API
         
     | 
| 
       79 
79 
     | 
    
         
             
                 * @param {string} [returnUrl=undefined] The url to which the user will be redirected after the payment. This value shall be set only if the
         
     | 
| 
       80 
     | 
    
         
            -
                 * chosen gateway is {@link GatewayTypes.PAYPAL}
         
     | 
| 
      
 80 
     | 
    
         
            +
                 * chosen gateway is {@link GatewayTypes.PAYPAL} or {@link GatewayTypes.WORLDLINE}
         
     | 
| 
       81 
81 
     | 
    
         
             
                 * @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
         
     | 
| 
       82 
82 
     | 
    
         
             
                 */
         
     | 
| 
       83 
83 
     | 
    
         
             
                getPaymentInformationFromGateway(gatewayId: number, returnUrl?: string): Promise<ErrorResponse | GetPaymentInformationFromGatewayResponse>;
         
     | 
| 
         @@ -87,7 +87,10 @@ export declare abstract class Booking { 
     | 
|
| 
       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 
88 
     | 
    
         
             
                 * @returns An {@link ErrorResponse} object in case of error, nothing otherwise.
         
     | 
| 
       89 
89 
     | 
    
         
             
                 */
         
     | 
| 
       90 
     | 
    
         
            -
                issueTickets(paymentMethod: PaymentMethods): Promise<ErrorResponse |  
     | 
| 
      
 90 
     | 
    
         
            +
                issueTickets(paymentMethod: PaymentMethods): Promise<ErrorResponse | {
         
     | 
| 
      
 91 
     | 
    
         
            +
                    wallet: Wallet;
         
     | 
| 
      
 92 
     | 
    
         
            +
                    result: boolean;
         
     | 
| 
      
 93 
     | 
    
         
            +
                }>;
         
     | 
| 
       91 
94 
     | 
    
         
             
            }
         
     | 
| 
       92 
95 
     | 
    
         
             
            export declare namespace Booking {
         
     | 
| 
       93 
96 
     | 
    
         
             
                enum Currencies {
         
     | 
    
        package/lib/booking/booking.js
    CHANGED
    
    | 
         @@ -231,7 +231,7 @@ var Booking = /** @class */ (function () { 
     | 
|
| 
       231 
231 
     | 
    
         
             
                                    }
         
     | 
| 
       232 
232 
     | 
    
         
             
                                    _e.label = 5;
         
     | 
| 
       233 
233 
     | 
    
         
             
                                case 5:
         
     | 
| 
       234 
     | 
    
         
            -
                                    url = "".concat(this.config.API_ENDPOINT, "/sellers/").concat(this.sellerId, "/gateways");
         
     | 
| 
      
 234 
     | 
    
         
            +
                                    url = "".concat(this.config.API_ENDPOINT, "/sellers/").concat(this.sellerId, "/gateways?");
         
     | 
| 
       235 
235 
     | 
    
         
             
                                    return [2 /*return*/, this.callGetApi(url).then(function (response) {
         
     | 
| 
       236 
236 
     | 
    
         
             
                                            return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
         
     | 
| 
       237 
237 
     | 
    
         
             
                                        })];
         
     | 
| 
         @@ -243,7 +243,7 @@ var Booking = /** @class */ (function () { 
     | 
|
| 
       243 
243 
     | 
    
         
             
                 * @description This method shall be used to get all necessary informations to initialize a payment with a certain gateway.
         
     | 
| 
       244 
244 
     | 
    
         
             
                 * @param {number} gatewayId The id of the gateway to use. Its value shall be taken from the response of the {@link Booking.getSellerGateways} API
         
     | 
| 
       245 
245 
     | 
    
         
             
                 * @param {string} [returnUrl=undefined] The url to which the user will be redirected after the payment. This value shall be set only if the
         
     | 
| 
       246 
     | 
    
         
            -
                 * chosen gateway is {@link GatewayTypes.PAYPAL}
         
     | 
| 
      
 246 
     | 
    
         
            +
                 * chosen gateway is {@link GatewayTypes.PAYPAL} or {@link GatewayTypes.WORLDLINE}
         
     | 
| 
       247 
247 
     | 
    
         
             
                 * @returns An {@link ErrorResponse} object in case of error, a {@link GetPaymentInformationFromGatewayResponse} object otherwise.
         
     | 
| 
       248 
248 
     | 
    
         
             
                 */
         
     | 
| 
       249 
249 
     | 
    
         
             
                Booking.prototype.getPaymentInformationFromGateway = function (gatewayId, returnUrl) {
         
     | 
| 
         @@ -336,7 +336,7 @@ var Booking = /** @class */ (function () { 
     | 
|
| 
       336 
336 
     | 
    
         
             
                                        paymentMethod: paymentMethodToSet === Payment_1.PaymentMethods.PAY_LATER ? null : paymentMethodToSet,
         
     | 
| 
       337 
337 
     | 
    
         
             
                                    };
         
     | 
| 
       338 
338 
     | 
    
         
             
                                    return [2 /*return*/, this.callPostApi(url, body).then(function (response) {
         
     | 
| 
       339 
     | 
    
         
            -
                                            return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : true;
         
     | 
| 
      
 339 
     | 
    
         
            +
                                            return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : { wallet: response.wallet, result: true };
         
     | 
| 
       340 
340 
     | 
    
         
             
                                        })];
         
     | 
| 
       341 
341 
     | 
    
         
             
                            }
         
     | 
| 
       342 
342 
     | 
    
         
             
                        });
         
     | 
| 
         @@ -47,6 +47,7 @@ export type GetPaymentInformationFromGatewayResponse = { 
     | 
|
| 
       47 
47 
     | 
    
         
             
             */
         
     | 
| 
       48 
48 
     | 
    
         
             
            export declare enum GatewayTypes {
         
     | 
| 
       49 
49 
     | 
    
         
             
                AXEPTA_BNL = "AXEPTA_BNL",
         
     | 
| 
      
 50 
     | 
    
         
            +
                WORLDLINE = "WORLDLINE",
         
     | 
| 
       50 
51 
     | 
    
         
             
                AXERVE_BANCASELLA = "AXERVE_BANCASELLA",
         
     | 
| 
       51 
52 
     | 
    
         
             
                PAYPAL = "PAYPAL"
         
     | 
| 
       52 
53 
     | 
    
         
             
            }
         
     | 
| 
         @@ -69,3 +70,10 @@ export declare enum PaymentMethods { 
     | 
|
| 
       69 
70 
     | 
    
         
             
                WALLET = "WALLET",
         
     | 
| 
       70 
71 
     | 
    
         
             
                ZERO_COST = "ZERO_COST"
         
     | 
| 
       71 
72 
     | 
    
         
             
            }
         
     | 
| 
      
 73 
     | 
    
         
            +
            export type Wallet = {
         
     | 
| 
      
 74 
     | 
    
         
            +
                id: number;
         
     | 
| 
      
 75 
     | 
    
         
            +
                sellerId: number;
         
     | 
| 
      
 76 
     | 
    
         
            +
                resellerId: number;
         
     | 
| 
      
 77 
     | 
    
         
            +
                balance: any;
         
     | 
| 
      
 78 
     | 
    
         
            +
                walletTransactions: any[];
         
     | 
| 
      
 79 
     | 
    
         
            +
            };
         
     | 
| 
         @@ -7,6 +7,7 @@ exports.PaymentMethods = exports.GatewayTypes = void 0; 
     | 
|
| 
       7 
7 
     | 
    
         
             
            var GatewayTypes;
         
     | 
| 
       8 
8 
     | 
    
         
             
            (function (GatewayTypes) {
         
     | 
| 
       9 
9 
     | 
    
         
             
                GatewayTypes["AXEPTA_BNL"] = "AXEPTA_BNL";
         
     | 
| 
      
 10 
     | 
    
         
            +
                GatewayTypes["WORLDLINE"] = "WORLDLINE";
         
     | 
| 
       10 
11 
     | 
    
         
             
                GatewayTypes["AXERVE_BANCASELLA"] = "AXERVE_BANCASELLA";
         
     | 
| 
       11 
12 
     | 
    
         
             
                GatewayTypes["PAYPAL"] = "PAYPAL";
         
     | 
| 
       12 
13 
     | 
    
         
             
            })(GatewayTypes || (exports.GatewayTypes = GatewayTypes = {}));
         
     |