@kushki/js 1.40.1-alpha.14317.3 → 1.40.2-alpha
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/README.md +1 -0
- package/lib/Kushki.d.ts +119 -23
- package/lib/Kushki.js +119 -20
- package/lib/KushkiInfo.js +3 -2
- package/lib/constant/Identifiers.d.ts +1 -3
- package/lib/constant/Identifiers.js +1 -3
- package/lib/gateway/KushkiGateway.d.ts +9 -14
- package/lib/gateway/KushkiGateway.js +19 -39
- package/lib/gateway/SiftScience.d.ts +1 -0
- package/lib/gateway/SiftScience.js +5 -0
- package/lib/infrastructure/CardBrandsEnum.d.ts +2 -1
- package/lib/infrastructure/CardBrandsEnum.js +1 -0
- package/lib/infrastructure/CardinalValidated.d.ts +10 -0
- package/lib/infrastructure/CardinalValidated.js +8 -0
- package/lib/infrastructure/Container.js +3 -7
- package/lib/infrastructure/EnvironmentEnum.d.ts +1 -1
- package/lib/infrastructure/EnvironmentEnum.js +1 -1
- package/lib/infrastructure/ErrorEnum.d.ts +4 -1
- package/lib/infrastructure/ErrorEnum.js +19 -1
- package/lib/infrastructure/PathEnum.d.ts +4 -6
- package/lib/infrastructure/PathEnum.js +3 -5
- package/lib/repository/IApplePayService.d.ts +40 -0
- package/lib/repository/ICardService.d.ts +3 -5
- package/lib/repository/IKushkiGateway.d.ts +23 -36
- package/lib/service/ApplePayService.d.ts +36 -0
- package/lib/service/ApplePayService.js +189 -0
- package/lib/service/CardService.d.ts +8 -9
- package/lib/service/CardService.js +103 -112
- package/lib/types/apple_pay_get_token_events.d.ts +46 -0
- package/lib/types/apple_pay_get_token_options.d.ts +12 -0
- package/lib/types/apple_pay_options.d.ts +25 -0
- package/lib/types/apple_pay_start_session_request.d.ts +8 -0
- package/lib/types/kushki_subscription_tokens_request.d.ts +0 -10
- package/lib/types/subscription_token_request.d.ts +0 -10
- package/package.json +5 -6
- package/lib/infrastructure/KPayUserPoolEnum.d.ts +0 -5
- package/lib/infrastructure/KPayUserPoolEnum.js +0 -8
- package/lib/infrastructure/KpayPaymentKind.d.ts +0 -6
- package/lib/infrastructure/KpayPaymentKind.js +0 -9
- package/lib/repository/IAuthService.d.ts +0 -20
- package/lib/repository/IKPayService.d.ts +0 -26
- package/lib/repository/IKPayService.js +0 -2
- package/lib/repository/IMobileProcessorService.d.ts +0 -16
- package/lib/repository/IMobileProcessorService.js +0 -2
- package/lib/service/AuthService.d.ts +0 -31
- package/lib/service/AuthService.js +0 -161
- package/lib/service/KPayService.d.ts +0 -19
- package/lib/service/KPayService.js +0 -45
- package/lib/service/MobileProcessorService.d.ts +0 -35
- package/lib/service/MobileProcessorService.js +0 -126
- package/lib/types/delete_payment_method_request.d.ts +0 -6
- package/lib/types/delete_payment_method_response.d.ts +0 -7
- package/lib/types/init_auth_request.d.ts +0 -6
- package/lib/types/init_auth_response.d.ts +0 -6
- package/lib/types/mobile_processor_charge_request.d.ts +0 -13
- package/lib/types/mobile_processor_charge_response.d.ts +0 -7
- package/lib/types/mobile_processor_token.d.ts +0 -66
- package/lib/types/mobile_processor_token_request.d.ts +0 -11
- package/lib/types/mobile_processor_token_response.d.ts +0 -15
- package/lib/types/payment_data_response.d.ts +0 -37
- package/lib/types/saved_payment_data_request.d.ts +0 -10
- package/lib/types/subscription_token_kpay_request.d.ts +0 -13
- package/lib/types/token_kpay_request.d.ts +0 -12
- package/lib/types/validate_session_response.d.ts +0 -6
- package/lib/types/verify_auth_request.d.ts +0 -7
- package/lib/types/verify_auth_response.d.ts +0 -7
- /package/lib/repository/{IAuthService.js → IApplePayService.js} +0 -0
package/lib/Kushki.d.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import { AxiosError } from "axios";
|
|
6
6
|
import { KushkiError } from "./../lib/generic/KushkiError";
|
|
7
7
|
import "reflect-metadata";
|
|
8
|
+
import { AppleTokenResponse } from "./../lib/types/apple_pay_get_token_events";
|
|
9
|
+
import { ApplePayGetTokenOptions } from "./../lib/types/apple_pay_get_token_options";
|
|
10
|
+
import { ApplePayOptions } from "./../lib/types/apple_pay_options";
|
|
8
11
|
import { BankListResponse } from "./../lib/types/bank_list_response";
|
|
9
12
|
import { BinBody } from "./../lib/types/bin_body";
|
|
10
13
|
import { BinInfoResponse } from "./../lib/types/bin_info_response";
|
|
@@ -12,18 +15,12 @@ import { CardAsyncTokenRequest } from "./../lib/types/card_async_token_request";
|
|
|
12
15
|
import { CardAsyncTokenResponse } from "./../lib/types/card_async_token_response";
|
|
13
16
|
import { CardBrandingRequest } from "./../lib/types/card_branding_request";
|
|
14
17
|
import { CashTokenRequest } from "./../lib/types/cash_token_request";
|
|
15
|
-
import { DeletePaymentMethodRequest } from "./../lib/types/delete_payment_method_request";
|
|
16
18
|
import { DeviceTokenRequest } from "./../lib/types/device_token_request";
|
|
17
19
|
import { ErrorResponse } from "./../lib/types/error_response";
|
|
18
20
|
import { GetBrandsLogosByMerchantResponse } from "./../lib/types/get_brands_logos_by_merchant_response";
|
|
19
|
-
import { InitAuthRequest } from "./../lib/types/init_auth_request";
|
|
20
|
-
import { InitAuthResponse } from "./../lib/types/init_auth_response";
|
|
21
21
|
import { KushkiInfo } from "./../lib/types/kushki_info";
|
|
22
|
-
import { MobileProcessorToken } from "./../lib/types/mobile_processor_token";
|
|
23
|
-
import { MobileProcessorTokenRequest } from "./../lib/types/mobile_processor_token_request";
|
|
24
22
|
import { MultiMerchantInfoRequest } from "./../lib/types/multimerchant_info_request";
|
|
25
23
|
import { MultiMerchantInfoResponse } from "./../lib/types/multimerchant_info_response";
|
|
26
|
-
import { PaymentDataResponse } from "./../lib/types/payment_data_response";
|
|
27
24
|
import { PayoutsCashTokenRequest } from "./../lib/types/payouts_cash_request";
|
|
28
25
|
import { PayoutsTransferTokenRequest } from "./../lib/types/payouts_transfer_token_request";
|
|
29
26
|
import { CommissionConfigurationAmount } from "./../lib/types/remote/commission_configuration_amount";
|
|
@@ -32,7 +29,6 @@ import { IDeferredResponse } from "./../lib/types/remote/deferred_response";
|
|
|
32
29
|
import { TokenResponse } from "./../lib/types/remote/token_response";
|
|
33
30
|
import { TransferTokenRequest } from "./../lib/types/remote/transfer_token_request";
|
|
34
31
|
import { ResponseStatusValidator } from "./../lib/types/response_status_validator";
|
|
35
|
-
import { SavedPaymentMethodRequest } from "./../lib/types/saved_payment_data_request";
|
|
36
32
|
import { SecureInitRequest } from "./../lib/types/secure_init_request";
|
|
37
33
|
import { SecureInitResponse } from "./../lib/types/secure_init_response";
|
|
38
34
|
import { SecureOtpRequest } from "./../lib/types/secure_otp_request";
|
|
@@ -40,17 +36,12 @@ import { SecureOtpResponse } from "./../lib/types/secure_otp_response";
|
|
|
40
36
|
import { SiftScienceAntiFraudSessionResponse } from "./../lib/types/sift_science_session";
|
|
41
37
|
import { SubscriptionCardAsyncTokenRequest } from "./../lib/types/subscription_card_async_token_request";
|
|
42
38
|
import { SubscriptionCardAsyncTokenResponse } from "./../lib/types/subscription_card_async_token_response";
|
|
43
|
-
import { SubscriptionTokenKPayRequest } from "./../lib/types/subscription_token_kpay_request";
|
|
44
39
|
import { SubscriptionTokenRequest } from "./../lib/types/subscription_token_request";
|
|
45
40
|
import { TokenChargeRequest } from "./../lib/types/token_charge_request";
|
|
46
|
-
import { TokenKPayRequest } from "./../lib/types/token_kpay_request";
|
|
47
41
|
import { TokenRequest } from "./../lib/types/token_request";
|
|
48
42
|
import { TransferSubscriptionTokenRequest } from "./../lib/types/transfer_subscription_token_request";
|
|
49
43
|
import { Validate3DSRequest } from "./../lib/types/validate_3ds_request";
|
|
50
44
|
import { Validate3DsResponse } from "./../lib/types/validate_3ds_response";
|
|
51
|
-
import { ValidateSessionResponse } from "./../lib/types/validate_session_response";
|
|
52
|
-
import { VerifyAuthRequest } from "./../lib/types/verify_auth_request";
|
|
53
|
-
import { VerifyAuthResponse } from "./../lib/types/verify_auth_response";
|
|
54
45
|
/**
|
|
55
46
|
* Implementation
|
|
56
47
|
*/
|
|
@@ -69,19 +60,17 @@ export declare class Kushki {
|
|
|
69
60
|
private readonly _payoutsCashService;
|
|
70
61
|
private readonly _transferSubscriptionService;
|
|
71
62
|
private readonly _payoutsTransferService;
|
|
72
|
-
private readonly _mobileProcessorService;
|
|
73
|
-
private readonly _kPayService;
|
|
74
|
-
private readonly _authService;
|
|
75
63
|
private readonly _cardDynamicService;
|
|
76
64
|
private readonly _cardSubscriptionDynamicService;
|
|
77
65
|
private readonly _siftScience;
|
|
66
|
+
private readonly _applePayService;
|
|
78
67
|
constructor(body: {
|
|
79
68
|
merchantId: string;
|
|
80
69
|
inTestEnvironment?: boolean;
|
|
81
70
|
regional?: boolean;
|
|
82
71
|
kushkiInfo?: KushkiInfo;
|
|
83
72
|
});
|
|
84
|
-
requestToken(body: TokenRequest
|
|
73
|
+
requestToken(body: TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
85
74
|
requestInitAntiFraud(userId: string, callback: (value: SiftScienceAntiFraudSessionResponse | ErrorResponse) => void): void;
|
|
86
75
|
/**
|
|
87
76
|
* @deprecated use requestDeviceToken instead
|
|
@@ -91,7 +80,7 @@ export declare class Kushki {
|
|
|
91
80
|
*/
|
|
92
81
|
requestTokenCharge(body: TokenChargeRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
93
82
|
requestDeviceToken(body: DeviceTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
94
|
-
requestSubscriptionToken(body: SubscriptionTokenRequest
|
|
83
|
+
requestSubscriptionToken(body: SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
95
84
|
requestTransferToken(body: TransferTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
96
85
|
checkStatus(callback: (value: ResponseStatusValidator | ErrorResponse) => void): void;
|
|
97
86
|
/**
|
|
@@ -116,14 +105,15 @@ export declare class Kushki {
|
|
|
116
105
|
requestTransferSubscriptionToken(body: TransferSubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
117
106
|
requestTransferSubscriptionBankList(callback: (value: BankListResponse | ErrorResponse) => void): void;
|
|
118
107
|
requestPayoutsTransferBankList(callback: (value: BankListResponse | ErrorResponse) => void): void;
|
|
119
|
-
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Method has been fully removed
|
|
110
|
+
* @param {object} _body unused
|
|
111
|
+
* @param {function} callback always return error
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
requestMobileProcessorToken(_body: object, callback: (value: ErrorResponse) => void): void;
|
|
120
115
|
requestCardDynamicToken(bin: BinBody, body: CardAsyncTokenRequest | TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
121
116
|
requestCardSubscriptionDynamicToken(bin: BinBody, body: SubscriptionCardAsyncTokenRequest | SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
122
|
-
requestInitAuth(body: InitAuthRequest, callback: (value: InitAuthResponse | ErrorResponse) => void): void;
|
|
123
|
-
deletePaymentMethod(body: DeletePaymentMethodRequest, callback: (value: boolean | ErrorResponse) => void): void;
|
|
124
|
-
requestSavedPaymentMethods(body: SavedPaymentMethodRequest, callback: (value: PaymentDataResponse[] | ErrorResponse) => void): void;
|
|
125
|
-
requestVerifyAuth(body: VerifyAuthRequest, callback: (value: VerifyAuthResponse | ErrorResponse) => void): void;
|
|
126
|
-
validateSession(callback: (value: ValidateSessionResponse | ErrorResponse) => void): void;
|
|
127
117
|
requestValidate3DS(body: Validate3DSRequest, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
128
118
|
requestSecureInit(body: SecureInitRequest, callback: (value: SecureInitResponse | ErrorResponse) => void): void;
|
|
129
119
|
/**
|
|
@@ -142,6 +132,112 @@ export declare class Kushki {
|
|
|
142
132
|
* @returns {void}
|
|
143
133
|
*/
|
|
144
134
|
initCardBrandingAnimation(callback: (error?: ErrorResponse) => void, body: CardBrandingRequest): void;
|
|
135
|
+
/**
|
|
136
|
+
* Initializes and renders the Apple Pay button inside the HTML container
|
|
137
|
+
* with the id `kushki-apple-pay-button`.
|
|
138
|
+
*
|
|
139
|
+
* For this method to work correctly, you must have the following container
|
|
140
|
+
* in your project’s HTML:
|
|
141
|
+
*
|
|
142
|
+
* ```html
|
|
143
|
+
* <div id="kushki-apple-pay-button"></div>
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* ### Example usage:
|
|
147
|
+
* ```ts
|
|
148
|
+
* kushki.initApplePayButton(
|
|
149
|
+
* { style: "white", type: "pay", locale: "es-MX" },
|
|
150
|
+
* () => console.log("init"),
|
|
151
|
+
* () => console.log("clicked, you can start request token process...."),
|
|
152
|
+
* error => console.log("error", error)
|
|
153
|
+
* );
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @param {ApplePayOptions} options - Visual and behavioral options for the Apple Pay button.
|
|
157
|
+
* - **style**: `"black"` | `"white"` → button style.
|
|
158
|
+
* - **locale**: `"en-US"` | `"es-ES"` | `"es-MX"` | `"pt-BR"` → language/region for the button.
|
|
159
|
+
* - **type**: `"add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" |
|
|
160
|
+
* "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" |
|
|
161
|
+
* "subscribe" | "support" | "tip" | "top-up"` → defines the text/action displayed on the button.
|
|
162
|
+
*
|
|
163
|
+
* @param {Function} onInit - Callback executed when:
|
|
164
|
+
* - All merchant validations and resources have been successfully verified.
|
|
165
|
+
* - The button has been successfully rendered inside the container.
|
|
166
|
+
*
|
|
167
|
+
* @param {Function} onClick - Callback executed only if:
|
|
168
|
+
* - The button was successfully initialized.
|
|
169
|
+
* - The user clicks the button.
|
|
170
|
+
* - Typically used to start the Apple Pay token request process.
|
|
171
|
+
*
|
|
172
|
+
* @param {Function} onError - Callback executed if an error occurs during button initialization.
|
|
173
|
+
* Receives an {@link ErrorResponse} object with the following properties:
|
|
174
|
+
* - **code**: error code (e.g., `E019`, `E020`).
|
|
175
|
+
* - **message**: human-readable error description.
|
|
176
|
+
* - **error**: additional error details.
|
|
177
|
+
*
|
|
178
|
+
* ### Possible errors (`ErrorResponse.code`):
|
|
179
|
+
* - `E019`: Apple Pay resources were not created.
|
|
180
|
+
* - `E020`: Apple Pay payments are not available.
|
|
181
|
+
*
|
|
182
|
+
* @returns {void}
|
|
183
|
+
*/
|
|
184
|
+
initApplePayButton(options: ApplePayOptions, onInit: () => void, onClick: () => void, onError: (error: ErrorResponse) => void): void;
|
|
185
|
+
/**
|
|
186
|
+
* Starts the Apple Pay payment flow and requests a Kushki card token
|
|
187
|
+
* to charge a transaction.
|
|
188
|
+
*
|
|
189
|
+
* > ⚠️ This method requires that {@link initApplePayButton} has been successfully
|
|
190
|
+
* initialized and rendered beforehand.
|
|
191
|
+
*
|
|
192
|
+
* ### Example usage:
|
|
193
|
+
* ```ts
|
|
194
|
+
* kushki.requestApplePayToken(
|
|
195
|
+
* {
|
|
196
|
+
* countryCode: "EC",
|
|
197
|
+
* currencyCode: "USD",
|
|
198
|
+
* displayName: "My Store",
|
|
199
|
+
* amount: 5000
|
|
200
|
+
* },
|
|
201
|
+
* response => {
|
|
202
|
+
* if ("token" in response) {
|
|
203
|
+
* console.log("Card token:", response.token);
|
|
204
|
+
* } else {
|
|
205
|
+
* console.error("Error requesting token:", response);
|
|
206
|
+
* }
|
|
207
|
+
* },
|
|
208
|
+
* () => {
|
|
209
|
+
* console.log("User cancelled Apple Pay payment flow");
|
|
210
|
+
* }
|
|
211
|
+
* );
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @param {ApplePayGetTokenOptions} options - Configuration options for the Apple Pay payment request.
|
|
215
|
+
* - **countryCode**: Merchant’s country (e.g., `"MX"`, `"CO"`, `"EC"`, etc.).
|
|
216
|
+
* - **currencyCode**: Currency for the transaction (e.g., `"USD"`, `"MXN"`, `"COP"`, etc.).
|
|
217
|
+
* - **displayName**: The merchant name displayed in the Apple Pay sheet.
|
|
218
|
+
* - **amount**: Transaction amount.
|
|
219
|
+
* - **optionalApplePayFields**: Additional Apple Pay configuration fields,
|
|
220
|
+
* following Apple’s specification:
|
|
221
|
+
* {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest}
|
|
222
|
+
* These fields allow merchants to customize their checkout experience
|
|
223
|
+
* (e.g., required shipping methods, billing address, etc.).
|
|
224
|
+
*
|
|
225
|
+
* @param {Function} callback - Callback executed when the payment flow finishes.
|
|
226
|
+
* - On success, returns an {@link AppleTokenResponse}:
|
|
227
|
+
* - **token**: Kushki card token (always returned).
|
|
228
|
+
* - **billingContact**: Apple Pay billing contact (if requested in the payment configuration).
|
|
229
|
+
* - **shippingContact**: Apple Pay shipping contact (if requested in the payment configuration).
|
|
230
|
+
* - On failure, returns an {@link ErrorResponse}:
|
|
231
|
+
* - **E006**: Error requesting Apple Pay token.
|
|
232
|
+
* - **E007**: Error starting session.
|
|
233
|
+
* - **E020**: Apple Pay payments are not available.
|
|
234
|
+
*
|
|
235
|
+
* @param {Function} onCancel - Callback executed if the payment flow is cancelled,
|
|
236
|
+
* either by the user or due to an unexpected error during the process.
|
|
237
|
+
*
|
|
238
|
+
* @returns {void}
|
|
239
|
+
*/
|
|
240
|
+
requestApplePayToken(options: ApplePayGetTokenOptions, callback: (value: AppleTokenResponse | ErrorResponse) => void, onCancel: () => void): void;
|
|
145
241
|
static callbackError(err: ErrorResponse | KushkiError | AxiosError, callback: (value: ErrorResponse) => void): void;
|
|
146
242
|
private _requestBankList;
|
|
147
243
|
private _requestDeviceToken;
|
package/lib/Kushki.js
CHANGED
|
@@ -34,11 +34,9 @@ class Kushki {
|
|
|
34
34
|
this._payoutsCashService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.PayoutsCashService)(this._regional);
|
|
35
35
|
this._payoutsTransferService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.PayoutsTransferService)(this._regional);
|
|
36
36
|
this._transferSubscriptionService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.TransferSubscriptionService)(this._regional);
|
|
37
|
-
this._mobileProcessorService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.MobileProcessorService)();
|
|
38
|
-
this._authService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.AuthService)();
|
|
39
|
-
this._kPayService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.KPayService)();
|
|
40
37
|
this._cardDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardDynamicService)();
|
|
41
38
|
this._cardSubscriptionDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardSubscriptionDynamicService)();
|
|
39
|
+
this._applePayService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.ApplePayService)();
|
|
42
40
|
}
|
|
43
41
|
requestToken(body, callback) {
|
|
44
42
|
this._cardService.requestToken(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
@@ -144,8 +142,14 @@ class Kushki {
|
|
|
144
142
|
requestPayoutsTransferBankList(callback) {
|
|
145
143
|
this._resolve(this._payoutsTransferService.requestPayoutsTransferBankList(this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
146
144
|
}
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
/**
|
|
146
|
+
* @deprecated Method has been fully removed
|
|
147
|
+
* @param {object} _body unused
|
|
148
|
+
* @param {function} callback always return error
|
|
149
|
+
* @returns {void}
|
|
150
|
+
*/
|
|
151
|
+
requestMobileProcessorToken(_body, callback) {
|
|
152
|
+
Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E002), callback);
|
|
149
153
|
}
|
|
150
154
|
requestCardDynamicToken(bin, body, callback) {
|
|
151
155
|
this._cardDynamicService.requestCardDynamicToken(bin, body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
@@ -153,21 +157,6 @@ class Kushki {
|
|
|
153
157
|
requestCardSubscriptionDynamicToken(bin, body, callback) {
|
|
154
158
|
this._cardSubscriptionDynamicService.requestCardSubscriptionDynamicToken(bin, body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
155
159
|
}
|
|
156
|
-
requestInitAuth(body, callback) {
|
|
157
|
-
this._resolve(this._authService.requestInitAuth(body, this._inTestEnvironment), callback);
|
|
158
|
-
}
|
|
159
|
-
deletePaymentMethod(body, callback) {
|
|
160
|
-
this._resolve(this._kPayService.deletePaymentMethod(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
161
|
-
}
|
|
162
|
-
requestSavedPaymentMethods(body, callback) {
|
|
163
|
-
this._resolve(this._kPayService.requestSavedPaymentMethods(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
164
|
-
}
|
|
165
|
-
requestVerifyAuth(body, callback) {
|
|
166
|
-
this._resolve(this._authService.requestVerifyAuth(body.code, this._inTestEnvironment), callback);
|
|
167
|
-
}
|
|
168
|
-
validateSession(callback) {
|
|
169
|
-
this._resolve(this._authService.validateSession(this._inTestEnvironment), callback);
|
|
170
|
-
}
|
|
171
160
|
requestValidate3DS(body, callback) {
|
|
172
161
|
this._cardService.validate3DS(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
173
162
|
}
|
|
@@ -201,6 +190,116 @@ class Kushki {
|
|
|
201
190
|
return Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E017), callback);
|
|
202
191
|
}
|
|
203
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Initializes and renders the Apple Pay button inside the HTML container
|
|
195
|
+
* with the id `kushki-apple-pay-button`.
|
|
196
|
+
*
|
|
197
|
+
* For this method to work correctly, you must have the following container
|
|
198
|
+
* in your project’s HTML:
|
|
199
|
+
*
|
|
200
|
+
* ```html
|
|
201
|
+
* <div id="kushki-apple-pay-button"></div>
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* ### Example usage:
|
|
205
|
+
* ```ts
|
|
206
|
+
* kushki.initApplePayButton(
|
|
207
|
+
* { style: "white", type: "pay", locale: "es-MX" },
|
|
208
|
+
* () => console.log("init"),
|
|
209
|
+
* () => console.log("clicked, you can start request token process...."),
|
|
210
|
+
* error => console.log("error", error)
|
|
211
|
+
* );
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @param {ApplePayOptions} options - Visual and behavioral options for the Apple Pay button.
|
|
215
|
+
* - **style**: `"black"` | `"white"` → button style.
|
|
216
|
+
* - **locale**: `"en-US"` | `"es-ES"` | `"es-MX"` | `"pt-BR"` → language/region for the button.
|
|
217
|
+
* - **type**: `"add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" |
|
|
218
|
+
* "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" |
|
|
219
|
+
* "subscribe" | "support" | "tip" | "top-up"` → defines the text/action displayed on the button.
|
|
220
|
+
*
|
|
221
|
+
* @param {Function} onInit - Callback executed when:
|
|
222
|
+
* - All merchant validations and resources have been successfully verified.
|
|
223
|
+
* - The button has been successfully rendered inside the container.
|
|
224
|
+
*
|
|
225
|
+
* @param {Function} onClick - Callback executed only if:
|
|
226
|
+
* - The button was successfully initialized.
|
|
227
|
+
* - The user clicks the button.
|
|
228
|
+
* - Typically used to start the Apple Pay token request process.
|
|
229
|
+
*
|
|
230
|
+
* @param {Function} onError - Callback executed if an error occurs during button initialization.
|
|
231
|
+
* Receives an {@link ErrorResponse} object with the following properties:
|
|
232
|
+
* - **code**: error code (e.g., `E019`, `E020`).
|
|
233
|
+
* - **message**: human-readable error description.
|
|
234
|
+
* - **error**: additional error details.
|
|
235
|
+
*
|
|
236
|
+
* ### Possible errors (`ErrorResponse.code`):
|
|
237
|
+
* - `E019`: Apple Pay resources were not created.
|
|
238
|
+
* - `E020`: Apple Pay payments are not available.
|
|
239
|
+
*
|
|
240
|
+
* @returns {void}
|
|
241
|
+
*/
|
|
242
|
+
initApplePayButton(options, onInit, onClick, onError) {
|
|
243
|
+
this._applePayService.initApplePayButton(options, this._merchantId, this._inTestEnvironment, this._regional, onInit, onClick, onError);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Starts the Apple Pay payment flow and requests a Kushki card token
|
|
247
|
+
* to charge a transaction.
|
|
248
|
+
*
|
|
249
|
+
* > ⚠️ This method requires that {@link initApplePayButton} has been successfully
|
|
250
|
+
* initialized and rendered beforehand.
|
|
251
|
+
*
|
|
252
|
+
* ### Example usage:
|
|
253
|
+
* ```ts
|
|
254
|
+
* kushki.requestApplePayToken(
|
|
255
|
+
* {
|
|
256
|
+
* countryCode: "EC",
|
|
257
|
+
* currencyCode: "USD",
|
|
258
|
+
* displayName: "My Store",
|
|
259
|
+
* amount: 5000
|
|
260
|
+
* },
|
|
261
|
+
* response => {
|
|
262
|
+
* if ("token" in response) {
|
|
263
|
+
* console.log("Card token:", response.token);
|
|
264
|
+
* } else {
|
|
265
|
+
* console.error("Error requesting token:", response);
|
|
266
|
+
* }
|
|
267
|
+
* },
|
|
268
|
+
* () => {
|
|
269
|
+
* console.log("User cancelled Apple Pay payment flow");
|
|
270
|
+
* }
|
|
271
|
+
* );
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @param {ApplePayGetTokenOptions} options - Configuration options for the Apple Pay payment request.
|
|
275
|
+
* - **countryCode**: Merchant’s country (e.g., `"MX"`, `"CO"`, `"EC"`, etc.).
|
|
276
|
+
* - **currencyCode**: Currency for the transaction (e.g., `"USD"`, `"MXN"`, `"COP"`, etc.).
|
|
277
|
+
* - **displayName**: The merchant name displayed in the Apple Pay sheet.
|
|
278
|
+
* - **amount**: Transaction amount.
|
|
279
|
+
* - **optionalApplePayFields**: Additional Apple Pay configuration fields,
|
|
280
|
+
* following Apple’s specification:
|
|
281
|
+
* {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest}
|
|
282
|
+
* These fields allow merchants to customize their checkout experience
|
|
283
|
+
* (e.g., required shipping methods, billing address, etc.).
|
|
284
|
+
*
|
|
285
|
+
* @param {Function} callback - Callback executed when the payment flow finishes.
|
|
286
|
+
* - On success, returns an {@link AppleTokenResponse}:
|
|
287
|
+
* - **token**: Kushki card token (always returned).
|
|
288
|
+
* - **billingContact**: Apple Pay billing contact (if requested in the payment configuration).
|
|
289
|
+
* - **shippingContact**: Apple Pay shipping contact (if requested in the payment configuration).
|
|
290
|
+
* - On failure, returns an {@link ErrorResponse}:
|
|
291
|
+
* - **E006**: Error requesting Apple Pay token.
|
|
292
|
+
* - **E007**: Error starting session.
|
|
293
|
+
* - **E020**: Apple Pay payments are not available.
|
|
294
|
+
*
|
|
295
|
+
* @param {Function} onCancel - Callback executed if the payment flow is cancelled,
|
|
296
|
+
* either by the user or due to an unexpected error during the process.
|
|
297
|
+
*
|
|
298
|
+
* @returns {void}
|
|
299
|
+
*/
|
|
300
|
+
requestApplePayToken(options, callback, onCancel) {
|
|
301
|
+
this._applePayService.requestApplePayToken(options, this._merchantId, this._inTestEnvironment, this._regional, callback, onCancel);
|
|
302
|
+
}
|
|
204
303
|
static callbackError(err, callback) {
|
|
205
304
|
if (err instanceof KushkiError_1.KushkiError)
|
|
206
305
|
callback({
|
package/lib/KushkiInfo.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.KInfo = void 0;
|
|
7
|
+
const buffer_1 = require("buffer");
|
|
7
8
|
const PlatformCodeEnum_1 = require("./../lib/infrastructure/PlatformCodeEnum");
|
|
8
9
|
const UtilsService_1 = require("./../lib/service/UtilsService");
|
|
9
10
|
/**
|
|
@@ -11,7 +12,7 @@ const UtilsService_1 = require("./../lib/service/UtilsService");
|
|
|
11
12
|
*/
|
|
12
13
|
class KInfo {
|
|
13
14
|
static buildKushkiInfo(kushkiInfo) {
|
|
14
|
-
const kushki_js_version = "1.40.
|
|
15
|
+
const kushki_js_version = "1.40.2-alpha";
|
|
15
16
|
if (kushkiInfo) {
|
|
16
17
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
17
18
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -23,7 +24,7 @@ class KInfo {
|
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
static _encodeKushkiInfo(kushkiInfo) {
|
|
26
|
-
return Buffer.from(JSON.stringify(kushkiInfo)).toString("base64");
|
|
27
|
+
return buffer_1.Buffer.from(JSON.stringify(kushkiInfo)).toString("base64");
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
exports.KInfo = KInfo;
|
|
@@ -14,14 +14,12 @@ export declare type containerSymbol = {
|
|
|
14
14
|
SecureService: symbol;
|
|
15
15
|
TransferService: symbol;
|
|
16
16
|
CardAsyncService: symbol;
|
|
17
|
-
MobileProcessorService: symbol;
|
|
18
17
|
PayoutsCashService: symbol;
|
|
19
18
|
CommissionService: symbol;
|
|
20
19
|
TransferSubscriptionService: symbol;
|
|
21
20
|
PayoutsTransferService: symbol;
|
|
22
21
|
SiftScienceService: symbol;
|
|
23
|
-
|
|
24
|
-
AuthService: symbol;
|
|
22
|
+
ApplePayService: symbol;
|
|
25
23
|
};
|
|
26
24
|
declare const IDENTIFIERS: containerSymbol;
|
|
27
25
|
export { IDENTIFIERS };
|
|
@@ -6,17 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.IDENTIFIERS = void 0;
|
|
7
7
|
const IDENTIFIERS = {
|
|
8
8
|
AntiFraud: Symbol.for("AntiFraud"),
|
|
9
|
-
|
|
9
|
+
ApplePayService: Symbol.for("ApplePayService"),
|
|
10
10
|
CardAsyncService: Symbol.for("CardAsyncService"),
|
|
11
11
|
CardDynamicService: Symbol.for("CardDynamicService"),
|
|
12
12
|
CardService: Symbol.for("CardService"),
|
|
13
13
|
CardSubscriptionDynamicService: Symbol.for("CardSubscriptionDynamicService"),
|
|
14
14
|
CashService: Symbol.for("CashService"),
|
|
15
15
|
CommissionService: Symbol.for("CommissionService"),
|
|
16
|
-
KPayService: Symbol.for("KPayService"),
|
|
17
16
|
KushkiGateway: Symbol.for("KushkiGateway"),
|
|
18
17
|
KushkiService: Symbol.for("KushkiService"),
|
|
19
|
-
MobileProcessorService: Symbol.for("MobileProcessorService"),
|
|
20
18
|
MultiMerchantService: Symbol.for("MultiMerchantService"),
|
|
21
19
|
PayoutsCashService: Symbol.for("PayoutsCashService"),
|
|
22
20
|
PayoutsTransferService: Symbol.for("PayoutsTransferService"),
|
|
@@ -2,26 +2,22 @@
|
|
|
2
2
|
import "reflect-metadata";
|
|
3
3
|
import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
|
|
4
4
|
import { Observable } from "rxjs";
|
|
5
|
+
import { ApplePayGetTokenRequest } from "./../../lib/types/apple_pay_get_token_events";
|
|
6
|
+
import { ApplePayStartSessionRequest } from "./../../lib/types/apple_pay_start_session_request";
|
|
5
7
|
import { BankListResponse } from "./../../lib/types/bank_list_response";
|
|
6
8
|
import { BinInfoResponse } from "./../../lib/types/bin_info_response";
|
|
7
9
|
import { CardAsyncTokenRequest } from "./../../lib/types/card_async_token_request";
|
|
8
10
|
import { CardAsyncTokenResponse } from "./../../lib/types/card_async_token_response";
|
|
9
11
|
import { CashTokenRequest } from "./../../lib/types/cash_token_request";
|
|
10
12
|
import { DeferredOptionsResponse } from "./../../lib/types/deferred_options_response";
|
|
11
|
-
import { DeletePaymentMethodRequest } from "./../../lib/types/delete_payment_method_request";
|
|
12
13
|
import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
|
|
13
14
|
import { GetUserId } from "./../../lib/types/get_user_id";
|
|
14
15
|
import { JwtResponse } from "./../../lib/types/jwt_response";
|
|
15
16
|
import { KushkiSubscriptionTokensRequest } from "./../../lib/types/kushki_subscription_tokens_request";
|
|
16
17
|
import { KushkiTokensRequest } from "./../../lib/types/kushki_tokens_request";
|
|
17
18
|
import { MerchantSettingsResponse } from "./../../lib/types/merchant_settings_response";
|
|
18
|
-
import { MobileProcessorChargeRequest } from "./../../lib/types/mobile_processor_charge_request";
|
|
19
|
-
import { MobileProcessorChargeResponse } from "./../../lib/types/mobile_processor_charge_response";
|
|
20
|
-
import { MobileProcessorTokenRequest } from "./../../lib/types/mobile_processor_token_request";
|
|
21
|
-
import { MobileProcessorTokenResponse } from "./../../lib/types/mobile_processor_token_response";
|
|
22
19
|
import { MultiMerchantInfoRequest } from "./../../lib/types/multimerchant_info_request";
|
|
23
20
|
import { MultiMerchantInfoResponse } from "./../../lib/types/multimerchant_info_response";
|
|
24
|
-
import { PaymentDataResponse } from "./../../lib/types/payment_data_response";
|
|
25
21
|
import { PayoutsCashTokenRequest } from "./../../lib/types/payouts_cash_request";
|
|
26
22
|
import { PayoutsTransferTokenRequest } from "./../../lib/types/payouts_transfer_token_request";
|
|
27
23
|
import { CommissionConfigurationAmount } from "./../../lib/types/remote/commission_configuration_amount";
|
|
@@ -29,13 +25,13 @@ import { CommissionConfigurationRequest } from "./../../lib/types/remote/commiss
|
|
|
29
25
|
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
30
26
|
import { TransferTokenRequest } from "./../../lib/types/remote/transfer_token_request";
|
|
31
27
|
import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
|
|
32
|
-
import { SavedPaymentMethodRequest } from "./../../lib/types/saved_payment_data_request";
|
|
33
28
|
import { SecureOtpRequest } from "./../../lib/types/secure_otp_request";
|
|
34
29
|
import { SecureOtpResponse } from "./../../lib/types/secure_otp_response";
|
|
35
30
|
import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscription_card_async_token_request";
|
|
36
31
|
import { SubscriptionCardAsyncTokenResponse } from "./../../lib/types/subscription_card_async_token_response";
|
|
37
32
|
import { TokenChargeRequest } from "./../../lib/types/token_charge_request";
|
|
38
33
|
import { TransferSubscriptionTokenRequest } from "./../../lib/types/transfer_subscription_token_request";
|
|
34
|
+
import { Validate3DsResponse } from "./../../lib/types/validate_3ds_response";
|
|
39
35
|
/**
|
|
40
36
|
* Kushki Gateway Implementation
|
|
41
37
|
*/
|
|
@@ -45,17 +41,17 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
45
41
|
private readonly _contentHeader;
|
|
46
42
|
private readonly _contentJSON;
|
|
47
43
|
private readonly _kushkiInfoHeader;
|
|
44
|
+
private readonly _multiRegionEcommSwitch;
|
|
48
45
|
private _uatUrl;
|
|
49
46
|
private _prodUrl;
|
|
50
47
|
private _kshAuthorization;
|
|
51
48
|
request<T = object>(body: object, headers: object, path: string, testEnv: boolean, regional: boolean): Observable<T>;
|
|
52
49
|
requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string): Observable<T>;
|
|
53
|
-
requestDelete<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<T>;
|
|
54
50
|
requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
|
|
55
51
|
requestBrandsLogosByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
|
|
56
|
-
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean
|
|
52
|
+
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
57
53
|
requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
58
|
-
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean
|
|
54
|
+
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
59
55
|
requestTransferToken(body: TransferTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
60
56
|
requestMerchantSettings(mid: string, testEnv: boolean, regional: boolean): Observable<MerchantSettingsResponse>;
|
|
61
57
|
requestPseBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
|
|
@@ -73,12 +69,11 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
73
69
|
requestTokenTransferSubscription(body: TransferSubscriptionTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
74
70
|
requestBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
|
|
75
71
|
requestPayoutsTransferBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
|
|
76
|
-
requestMobileProcessorToken(body: MobileProcessorTokenRequest, publicCredential: string, testEnv: boolean, regional: boolean): Observable<MobileProcessorTokenResponse>;
|
|
77
|
-
chargeMobileProcessor(body: MobileProcessorChargeRequest, publicCredential: string, testEnv: boolean, regional: boolean): Observable<MobileProcessorChargeResponse>;
|
|
78
|
-
deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
|
|
79
|
-
requestSavedPaymentMethods(body: SavedPaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<PaymentDataResponse[]>;
|
|
80
72
|
cybersourceJwt(mid: string, testEnv: boolean, regional: boolean, subscriptionId?: string): Observable<JwtResponse>;
|
|
81
73
|
getUserId(subscriptionId: string, mid: string, testEnv: boolean, regional: boolean): Observable<GetUserId>;
|
|
74
|
+
validateAppleDomain(domain: string, mid: string, testEnv: boolean, regional: boolean): Observable<Validate3DsResponse>;
|
|
75
|
+
startApplePaySession(body: ApplePayStartSessionRequest, mid: string, testEnv: boolean, regional: boolean): Observable<object>;
|
|
76
|
+
getApplePayToken(body: ApplePayGetTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
82
77
|
private _assignChannel;
|
|
83
78
|
private _buildHeader;
|
|
84
79
|
}
|
|
@@ -31,6 +31,7 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
31
31
|
this._contentHeader = "Content-Type";
|
|
32
32
|
this._contentJSON = "application/json";
|
|
33
33
|
this._kushkiInfoHeader = "X-Amz-Meta-Kushki-Info";
|
|
34
|
+
this._multiRegionEcommSwitch = "ecommerce";
|
|
34
35
|
this._uatUrl = "";
|
|
35
36
|
this._prodUrl = "";
|
|
36
37
|
this._kshAuthorization = "KSH-Authorization";
|
|
@@ -55,43 +56,26 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
55
56
|
},
|
|
56
57
|
})), operators_1.map((response) => response.data), operators_1.catchError((err) => rxjs_1.throwError(err)));
|
|
57
58
|
}
|
|
58
|
-
requestDelete(path, testEnv, regional, mid, authorization) {
|
|
59
|
-
return rxjs_1.of(this._assignChannel(regional, path)).pipe(operators_1.switchMap(() => axios_1.default.delete(`${testEnv ? this._uatUrl : this._prodUrl}`, {
|
|
60
|
-
headers: {
|
|
61
|
-
[this._contentHeader]: this._contentJSON,
|
|
62
|
-
[this._kshAuthorization]: authorization,
|
|
63
|
-
[this._publicHeader]: mid,
|
|
64
|
-
},
|
|
65
|
-
})), operators_1.map((response) => response.data), operators_1.catchError((err) => rxjs_1.throwError(err)));
|
|
66
|
-
}
|
|
67
59
|
requestBrandsByMerchant(mid, testEnv, regional) {
|
|
68
60
|
return this.requestGet(`${PathEnum_1.PathEnum.brands_by_merchant}`, testEnv, regional, mid);
|
|
69
61
|
}
|
|
70
62
|
requestBrandsLogosByMerchant(mid, testEnv, regional) {
|
|
71
63
|
return this.requestGet(`${PathEnum_1.PathEnum.brands_logos_by_merchant}`, testEnv, regional, mid);
|
|
72
64
|
}
|
|
73
|
-
requestToken(body, mid, testEnv, regional
|
|
74
|
-
return
|
|
75
|
-
[this._publicHeader]: mid,
|
|
76
|
-
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
77
|
-
}, PathEnum_1.PathEnum.card_tokens, testEnv, regional), this.request(body, {
|
|
78
|
-
[this._kshAuthorization]: authorization,
|
|
65
|
+
requestToken(body, mid, testEnv, regional) {
|
|
66
|
+
return this.request(body, {
|
|
79
67
|
[this._publicHeader]: mid,
|
|
80
68
|
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
81
|
-
}, PathEnum_1.PathEnum.card_tokens, testEnv, regional)
|
|
69
|
+
}, PathEnum_1.PathEnum.card_tokens, testEnv, regional);
|
|
82
70
|
}
|
|
83
71
|
requestDeviceToken(body, mid, testEnv, regional) {
|
|
84
72
|
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.request(body, Object.assign(Object.assign({}, this._buildHeader(mid)), { [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo }), `${PathEnum_1.PathEnum.card_token_charge}${body.subscriptionId}/tokens`, testEnv, regional)));
|
|
85
73
|
}
|
|
86
|
-
requestSubscriptionToken(body, mid, testEnv, regional
|
|
87
|
-
return
|
|
88
|
-
[this._publicHeader]: mid,
|
|
89
|
-
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
90
|
-
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional), this.request(body, {
|
|
91
|
-
[this._kshAuthorization]: authorization,
|
|
74
|
+
requestSubscriptionToken(body, mid, testEnv, regional) {
|
|
75
|
+
return this.request(body, {
|
|
92
76
|
[this._publicHeader]: mid,
|
|
93
77
|
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
94
|
-
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional)
|
|
78
|
+
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional);
|
|
95
79
|
}
|
|
96
80
|
requestTransferToken(body, mid, testEnv, regional) {
|
|
97
81
|
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.request(body, Object.assign(Object.assign({}, this._buildHeader(mid)), { [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo }), PathEnum_1.PathEnum.transfer_tokens, testEnv, regional)));
|
|
@@ -144,22 +128,6 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
144
128
|
requestPayoutsTransferBankList(mid, testEnv, regional) {
|
|
145
129
|
return rxjs_1.of(1).pipe(operators_1.mergeMap(() => this.requestGet(PathEnum_1.PathEnum.bank_list_payouts_transfer, testEnv, regional, mid)), operators_1.map((response) => response));
|
|
146
130
|
}
|
|
147
|
-
requestMobileProcessorToken(body, publicCredential, testEnv, regional) {
|
|
148
|
-
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this.request(body, this._buildHeader(publicCredential), PathEnum_1.PathEnum.mobile_processor_token, testEnv, regional)), operators_1.map((response) => response));
|
|
149
|
-
}
|
|
150
|
-
chargeMobileProcessor(body, publicCredential, testEnv, regional) {
|
|
151
|
-
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this.request(body, this._buildHeader(publicCredential), PathEnum_1.PathEnum.mobile_processor_charge, testEnv, regional)), operators_1.map((response) => response));
|
|
152
|
-
}
|
|
153
|
-
deletePaymentMethod(body, testEnv, regional, mid, authorization) {
|
|
154
|
-
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this.requestDelete(`${PathEnum_1.PathEnum.kpay_delete_payment_method}/${body.walletId}`, testEnv, regional, mid, authorization)), operators_1.map((response) => !!response));
|
|
155
|
-
}
|
|
156
|
-
requestSavedPaymentMethods(body, testEnv, regional, mid) {
|
|
157
|
-
return rxjs_1.of(1).pipe(operators_1.map(() => {
|
|
158
|
-
const { email, kind } = body;
|
|
159
|
-
const kind_path = kind !== undefined ? `?kind=${kind}` : "";
|
|
160
|
-
return `${PathEnum_1.PathEnum.kpay_get_saved_payment_methods}/${email}${kind_path}`;
|
|
161
|
-
}), operators_1.concatMap((path) => this.requestGet(path, testEnv, regional, mid)), operators_1.map((response) => response));
|
|
162
|
-
}
|
|
163
131
|
cybersourceJwt(mid, testEnv, regional, subscriptionId) {
|
|
164
132
|
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.requestGet(subscriptionId
|
|
165
133
|
? `${PathEnum_1.PathEnum.cybersource_jwt}?subscriptionId=${subscriptionId}`
|
|
@@ -173,6 +141,18 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
173
141
|
userId: response.userId,
|
|
174
142
|
})));
|
|
175
143
|
}
|
|
144
|
+
validateAppleDomain(domain, mid, testEnv, regional) {
|
|
145
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.requestGet(`${PathEnum_1.PathEnum.validate_apple_domain}?domain=${domain}&switch=${this._multiRegionEcommSwitch}`, testEnv, regional, mid)));
|
|
146
|
+
}
|
|
147
|
+
startApplePaySession(body, mid, testEnv, regional) {
|
|
148
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.request(body, { [this._publicHeader]: mid }, `${PathEnum_1.PathEnum.start_apple_pay_session}?switch=${this._multiRegionEcommSwitch}`, testEnv, regional)));
|
|
149
|
+
}
|
|
150
|
+
getApplePayToken(body, mid, testEnv, regional) {
|
|
151
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.request(body, {
|
|
152
|
+
[this._publicHeader]: mid,
|
|
153
|
+
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
154
|
+
}, `${PathEnum_1.PathEnum.get_apple_pay_token}?switch=${this._multiRegionEcommSwitch}`, testEnv, regional)));
|
|
155
|
+
}
|
|
176
156
|
_assignChannel(regional, path) {
|
|
177
157
|
if (!regional) {
|
|
178
158
|
this._uatUrl = `${EnvironmentEnum_1.EnvironmentEnum.uat}${path}`;
|