@kushki/js 1.40.1-alpha.14317.2 → 1.40.1

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.
Files changed (44) hide show
  1. package/README.md +1 -0
  2. package/lib/.DS_Store +0 -0
  3. package/lib/Kushki.d.ts +117 -4
  4. package/lib/Kushki.js +119 -3
  5. package/lib/KushkiInfo.js +3 -2
  6. package/lib/constant/Identifiers.d.ts +1 -1
  7. package/lib/constant/Identifiers.js +1 -1
  8. package/lib/gateway/KushkiGateway.d.ts +7 -6
  9. package/lib/gateway/KushkiGateway.js +13 -6
  10. package/lib/gateway/SiftScience.d.ts +1 -0
  11. package/lib/gateway/SiftScience.js +5 -0
  12. package/lib/infrastructure/CardBrandsEnum.d.ts +2 -1
  13. package/lib/infrastructure/CardBrandsEnum.js +1 -0
  14. package/lib/infrastructure/CardinalValidated.d.ts +10 -0
  15. package/lib/infrastructure/CardinalValidated.js +8 -0
  16. package/lib/infrastructure/Container.js +2 -2
  17. package/lib/infrastructure/EnvironmentEnum.d.ts +1 -1
  18. package/lib/infrastructure/EnvironmentEnum.js +1 -1
  19. package/lib/infrastructure/ErrorEnum.d.ts +4 -1
  20. package/lib/infrastructure/ErrorEnum.js +19 -1
  21. package/lib/infrastructure/PathEnum.d.ts +4 -3
  22. package/lib/infrastructure/PathEnum.js +3 -2
  23. package/lib/repository/IApplePayService.d.ts +40 -0
  24. package/lib/repository/IKushkiGateway.d.ts +27 -18
  25. package/lib/service/ApplePayService.d.ts +36 -0
  26. package/lib/service/ApplePayService.js +189 -0
  27. package/lib/service/CardService.d.ts +5 -2
  28. package/lib/service/CardService.js +85 -70
  29. package/lib/types/apple_pay_get_token_events.d.ts +46 -0
  30. package/lib/types/apple_pay_get_token_options.d.ts +12 -0
  31. package/lib/types/apple_pay_options.d.ts +25 -0
  32. package/lib/types/apple_pay_start_session_request.d.ts +8 -0
  33. package/lib/types/kushki_subscription_tokens_request.d.ts +0 -10
  34. package/lib/types/subscription_token_request.d.ts +0 -10
  35. package/package.json +3 -2
  36. package/lib/repository/IMobileProcessorService.d.ts +0 -16
  37. package/lib/service/MobileProcessorService.d.ts +0 -35
  38. package/lib/service/MobileProcessorService.js +0 -126
  39. package/lib/types/mobile_processor_charge_request.d.ts +0 -13
  40. package/lib/types/mobile_processor_charge_response.d.ts +0 -7
  41. package/lib/types/mobile_processor_token.d.ts +0 -66
  42. package/lib/types/mobile_processor_token_request.d.ts +0 -11
  43. package/lib/types/mobile_processor_token_response.d.ts +0 -15
  44. /package/lib/repository/{IMobileProcessorService.js → IApplePayService.js} +0 -0
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # kushki-js
2
+
2
3
  Front-end js library
3
4
 
4
5
 
package/lib/.DS_Store ADDED
Binary file
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";
@@ -19,8 +22,6 @@ import { GetBrandsLogosByMerchantResponse } from "./../lib/types/get_brands_logo
19
22
  import { InitAuthRequest } from "./../lib/types/init_auth_request";
20
23
  import { InitAuthResponse } from "./../lib/types/init_auth_response";
21
24
  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
25
  import { MultiMerchantInfoRequest } from "./../lib/types/multimerchant_info_request";
25
26
  import { MultiMerchantInfoResponse } from "./../lib/types/multimerchant_info_response";
26
27
  import { PaymentDataResponse } from "./../lib/types/payment_data_response";
@@ -69,12 +70,12 @@ export declare class Kushki {
69
70
  private readonly _payoutsCashService;
70
71
  private readonly _transferSubscriptionService;
71
72
  private readonly _payoutsTransferService;
72
- private readonly _mobileProcessorService;
73
73
  private readonly _kPayService;
74
74
  private readonly _authService;
75
75
  private readonly _cardDynamicService;
76
76
  private readonly _cardSubscriptionDynamicService;
77
77
  private readonly _siftScience;
78
+ private readonly _applePayService;
78
79
  constructor(body: {
79
80
  merchantId: string;
80
81
  inTestEnvironment?: boolean;
@@ -116,7 +117,13 @@ export declare class Kushki {
116
117
  requestTransferSubscriptionToken(body: TransferSubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
117
118
  requestTransferSubscriptionBankList(callback: (value: BankListResponse | ErrorResponse) => void): void;
118
119
  requestPayoutsTransferBankList(callback: (value: BankListResponse | ErrorResponse) => void): void;
119
- requestMobileProcessorToken(body: MobileProcessorTokenRequest, callback: (value: MobileProcessorToken | ErrorResponse) => void): void;
120
+ /**
121
+ * @deprecated Method has been fully removed
122
+ * @param {object} _body unused
123
+ * @param {function} callback always return error
124
+ * @returns {void}
125
+ */
126
+ requestMobileProcessorToken(_body: object, callback: (value: ErrorResponse) => void): void;
120
127
  requestCardDynamicToken(bin: BinBody, body: CardAsyncTokenRequest | TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
121
128
  requestCardSubscriptionDynamicToken(bin: BinBody, body: SubscriptionCardAsyncTokenRequest | SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
122
129
  requestInitAuth(body: InitAuthRequest, callback: (value: InitAuthResponse | ErrorResponse) => void): void;
@@ -142,6 +149,112 @@ export declare class Kushki {
142
149
  * @returns {void}
143
150
  */
144
151
  initCardBrandingAnimation(callback: (error?: ErrorResponse) => void, body: CardBrandingRequest): void;
152
+ /**
153
+ * Initializes and renders the Apple Pay button inside the HTML container
154
+ * with the id `kushki-apple-pay-button`.
155
+ *
156
+ * For this method to work correctly, you must have the following container
157
+ * in your project’s HTML:
158
+ *
159
+ * ```html
160
+ * <div id="kushki-apple-pay-button"></div>
161
+ * ```
162
+ *
163
+ * ### Example usage:
164
+ * ```ts
165
+ * kushki.initApplePayButton(
166
+ * { style: "white", type: "pay", locale: "es-MX" },
167
+ * () => console.log("init"),
168
+ * () => console.log("clicked, you can start request token process...."),
169
+ * error => console.log("error", error)
170
+ * );
171
+ * ```
172
+ *
173
+ * @param {ApplePayOptions} options - Visual and behavioral options for the Apple Pay button.
174
+ * - **style**: `"black"` | `"white"` → button style.
175
+ * - **locale**: `"en-US"` | `"es-ES"` | `"es-MX"` | `"pt-BR"` → language/region for the button.
176
+ * - **type**: `"add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" |
177
+ * "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" |
178
+ * "subscribe" | "support" | "tip" | "top-up"` → defines the text/action displayed on the button.
179
+ *
180
+ * @param {Function} onInit - Callback executed when:
181
+ * - All merchant validations and resources have been successfully verified.
182
+ * - The button has been successfully rendered inside the container.
183
+ *
184
+ * @param {Function} onClick - Callback executed only if:
185
+ * - The button was successfully initialized.
186
+ * - The user clicks the button.
187
+ * - Typically used to start the Apple Pay token request process.
188
+ *
189
+ * @param {Function} onError - Callback executed if an error occurs during button initialization.
190
+ * Receives an {@link ErrorResponse} object with the following properties:
191
+ * - **code**: error code (e.g., `E019`, `E020`).
192
+ * - **message**: human-readable error description.
193
+ * - **error**: additional error details.
194
+ *
195
+ * ### Possible errors (`ErrorResponse.code`):
196
+ * - `E019`: Apple Pay resources were not created.
197
+ * - `E020`: Apple Pay payments are not available.
198
+ *
199
+ * @returns {void}
200
+ */
201
+ initApplePayButton(options: ApplePayOptions, onInit: () => void, onClick: () => void, onError: (error: ErrorResponse) => void): void;
202
+ /**
203
+ * Starts the Apple Pay payment flow and requests a Kushki card token
204
+ * to charge a transaction.
205
+ *
206
+ * > ⚠️ This method requires that {@link initApplePayButton} has been successfully
207
+ * initialized and rendered beforehand.
208
+ *
209
+ * ### Example usage:
210
+ * ```ts
211
+ * kushki.requestApplePayToken(
212
+ * {
213
+ * countryCode: "EC",
214
+ * currencyCode: "USD",
215
+ * displayName: "My Store",
216
+ * amount: 5000
217
+ * },
218
+ * response => {
219
+ * if ("token" in response) {
220
+ * console.log("Card token:", response.token);
221
+ * } else {
222
+ * console.error("Error requesting token:", response);
223
+ * }
224
+ * },
225
+ * () => {
226
+ * console.log("User cancelled Apple Pay payment flow");
227
+ * }
228
+ * );
229
+ * ```
230
+ *
231
+ * @param {ApplePayGetTokenOptions} options - Configuration options for the Apple Pay payment request.
232
+ * - **countryCode**: Merchant’s country (e.g., `"MX"`, `"CO"`, `"EC"`, etc.).
233
+ * - **currencyCode**: Currency for the transaction (e.g., `"USD"`, `"MXN"`, `"COP"`, etc.).
234
+ * - **displayName**: The merchant name displayed in the Apple Pay sheet.
235
+ * - **amount**: Transaction amount.
236
+ * - **optionalApplePayFields**: Additional Apple Pay configuration fields,
237
+ * following Apple’s specification:
238
+ * {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest}
239
+ * These fields allow merchants to customize their checkout experience
240
+ * (e.g., required shipping methods, billing address, etc.).
241
+ *
242
+ * @param {Function} callback - Callback executed when the payment flow finishes.
243
+ * - On success, returns an {@link AppleTokenResponse}:
244
+ * - **token**: Kushki card token (always returned).
245
+ * - **billingContact**: Apple Pay billing contact (if requested in the payment configuration).
246
+ * - **shippingContact**: Apple Pay shipping contact (if requested in the payment configuration).
247
+ * - On failure, returns an {@link ErrorResponse}:
248
+ * - **E006**: Error requesting Apple Pay token.
249
+ * - **E007**: Error starting session.
250
+ * - **E020**: Apple Pay payments are not available.
251
+ *
252
+ * @param {Function} onCancel - Callback executed if the payment flow is cancelled,
253
+ * either by the user or due to an unexpected error during the process.
254
+ *
255
+ * @returns {void}
256
+ */
257
+ requestApplePayToken(options: ApplePayGetTokenOptions, callback: (value: AppleTokenResponse | ErrorResponse) => void, onCancel: () => void): void;
145
258
  static callbackError(err: ErrorResponse | KushkiError | AxiosError, callback: (value: ErrorResponse) => void): void;
146
259
  private _requestBankList;
147
260
  private _requestDeviceToken;
package/lib/Kushki.js CHANGED
@@ -34,11 +34,11 @@ 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
37
  this._authService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.AuthService)();
39
38
  this._kPayService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.KPayService)();
40
39
  this._cardDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardDynamicService)();
41
40
  this._cardSubscriptionDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardSubscriptionDynamicService)();
41
+ this._applePayService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.ApplePayService)();
42
42
  }
43
43
  requestToken(body, callback) {
44
44
  this._cardService.requestToken(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
@@ -144,8 +144,14 @@ class Kushki {
144
144
  requestPayoutsTransferBankList(callback) {
145
145
  this._resolve(this._payoutsTransferService.requestPayoutsTransferBankList(this._merchantId, this._inTestEnvironment, this._regional), callback);
146
146
  }
147
- requestMobileProcessorToken(body, callback) {
148
- this._resolve(this._mobileProcessorService.requestToken(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
147
+ /**
148
+ * @deprecated Method has been fully removed
149
+ * @param {object} _body unused
150
+ * @param {function} callback always return error
151
+ * @returns {void}
152
+ */
153
+ requestMobileProcessorToken(_body, callback) {
154
+ Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E002), callback);
149
155
  }
150
156
  requestCardDynamicToken(bin, body, callback) {
151
157
  this._cardDynamicService.requestCardDynamicToken(bin, body, this._merchantId, this._inTestEnvironment, this._regional, callback);
@@ -201,6 +207,116 @@ class Kushki {
201
207
  return Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E017), callback);
202
208
  }
203
209
  }
210
+ /**
211
+ * Initializes and renders the Apple Pay button inside the HTML container
212
+ * with the id `kushki-apple-pay-button`.
213
+ *
214
+ * For this method to work correctly, you must have the following container
215
+ * in your project’s HTML:
216
+ *
217
+ * ```html
218
+ * <div id="kushki-apple-pay-button"></div>
219
+ * ```
220
+ *
221
+ * ### Example usage:
222
+ * ```ts
223
+ * kushki.initApplePayButton(
224
+ * { style: "white", type: "pay", locale: "es-MX" },
225
+ * () => console.log("init"),
226
+ * () => console.log("clicked, you can start request token process...."),
227
+ * error => console.log("error", error)
228
+ * );
229
+ * ```
230
+ *
231
+ * @param {ApplePayOptions} options - Visual and behavioral options for the Apple Pay button.
232
+ * - **style**: `"black"` | `"white"` → button style.
233
+ * - **locale**: `"en-US"` | `"es-ES"` | `"es-MX"` | `"pt-BR"` → language/region for the button.
234
+ * - **type**: `"add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" |
235
+ * "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" |
236
+ * "subscribe" | "support" | "tip" | "top-up"` → defines the text/action displayed on the button.
237
+ *
238
+ * @param {Function} onInit - Callback executed when:
239
+ * - All merchant validations and resources have been successfully verified.
240
+ * - The button has been successfully rendered inside the container.
241
+ *
242
+ * @param {Function} onClick - Callback executed only if:
243
+ * - The button was successfully initialized.
244
+ * - The user clicks the button.
245
+ * - Typically used to start the Apple Pay token request process.
246
+ *
247
+ * @param {Function} onError - Callback executed if an error occurs during button initialization.
248
+ * Receives an {@link ErrorResponse} object with the following properties:
249
+ * - **code**: error code (e.g., `E019`, `E020`).
250
+ * - **message**: human-readable error description.
251
+ * - **error**: additional error details.
252
+ *
253
+ * ### Possible errors (`ErrorResponse.code`):
254
+ * - `E019`: Apple Pay resources were not created.
255
+ * - `E020`: Apple Pay payments are not available.
256
+ *
257
+ * @returns {void}
258
+ */
259
+ initApplePayButton(options, onInit, onClick, onError) {
260
+ this._applePayService.initApplePayButton(options, this._merchantId, this._inTestEnvironment, this._regional, onInit, onClick, onError);
261
+ }
262
+ /**
263
+ * Starts the Apple Pay payment flow and requests a Kushki card token
264
+ * to charge a transaction.
265
+ *
266
+ * > ⚠️ This method requires that {@link initApplePayButton} has been successfully
267
+ * initialized and rendered beforehand.
268
+ *
269
+ * ### Example usage:
270
+ * ```ts
271
+ * kushki.requestApplePayToken(
272
+ * {
273
+ * countryCode: "EC",
274
+ * currencyCode: "USD",
275
+ * displayName: "My Store",
276
+ * amount: 5000
277
+ * },
278
+ * response => {
279
+ * if ("token" in response) {
280
+ * console.log("Card token:", response.token);
281
+ * } else {
282
+ * console.error("Error requesting token:", response);
283
+ * }
284
+ * },
285
+ * () => {
286
+ * console.log("User cancelled Apple Pay payment flow");
287
+ * }
288
+ * );
289
+ * ```
290
+ *
291
+ * @param {ApplePayGetTokenOptions} options - Configuration options for the Apple Pay payment request.
292
+ * - **countryCode**: Merchant’s country (e.g., `"MX"`, `"CO"`, `"EC"`, etc.).
293
+ * - **currencyCode**: Currency for the transaction (e.g., `"USD"`, `"MXN"`, `"COP"`, etc.).
294
+ * - **displayName**: The merchant name displayed in the Apple Pay sheet.
295
+ * - **amount**: Transaction amount.
296
+ * - **optionalApplePayFields**: Additional Apple Pay configuration fields,
297
+ * following Apple’s specification:
298
+ * {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest}
299
+ * These fields allow merchants to customize their checkout experience
300
+ * (e.g., required shipping methods, billing address, etc.).
301
+ *
302
+ * @param {Function} callback - Callback executed when the payment flow finishes.
303
+ * - On success, returns an {@link AppleTokenResponse}:
304
+ * - **token**: Kushki card token (always returned).
305
+ * - **billingContact**: Apple Pay billing contact (if requested in the payment configuration).
306
+ * - **shippingContact**: Apple Pay shipping contact (if requested in the payment configuration).
307
+ * - On failure, returns an {@link ErrorResponse}:
308
+ * - **E006**: Error requesting Apple Pay token.
309
+ * - **E007**: Error starting session.
310
+ * - **E020**: Apple Pay payments are not available.
311
+ *
312
+ * @param {Function} onCancel - Callback executed if the payment flow is cancelled,
313
+ * either by the user or due to an unexpected error during the process.
314
+ *
315
+ * @returns {void}
316
+ */
317
+ requestApplePayToken(options, callback, onCancel) {
318
+ this._applePayService.requestApplePayToken(options, this._merchantId, this._inTestEnvironment, this._regional, callback, onCancel);
319
+ }
204
320
  static callbackError(err, callback) {
205
321
  if (err instanceof KushkiError_1.KushkiError)
206
322
  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.1-alpha.14317.2";
15
+ const kushki_js_version = "1.40.1";
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,7 +14,6 @@ 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;
@@ -22,6 +21,7 @@ export declare type containerSymbol = {
22
21
  SiftScienceService: symbol;
23
22
  KPayService: symbol;
24
23
  AuthService: symbol;
24
+ ApplePayService: symbol;
25
25
  };
26
26
  declare const IDENTIFIERS: containerSymbol;
27
27
  export { IDENTIFIERS };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.IDENTIFIERS = void 0;
7
7
  const IDENTIFIERS = {
8
8
  AntiFraud: Symbol.for("AntiFraud"),
9
+ ApplePayService: Symbol.for("ApplePayService"),
9
10
  AuthService: Symbol.for("AuthService"),
10
11
  CardAsyncService: Symbol.for("CardAsyncService"),
11
12
  CardDynamicService: Symbol.for("CardDynamicService"),
@@ -16,7 +17,6 @@ const IDENTIFIERS = {
16
17
  KPayService: Symbol.for("KPayService"),
17
18
  KushkiGateway: Symbol.for("KushkiGateway"),
18
19
  KushkiService: Symbol.for("KushkiService"),
19
- MobileProcessorService: Symbol.for("MobileProcessorService"),
20
20
  MultiMerchantService: Symbol.for("MultiMerchantService"),
21
21
  PayoutsCashService: Symbol.for("PayoutsCashService"),
22
22
  PayoutsTransferService: Symbol.for("PayoutsTransferService"),
@@ -2,6 +2,8 @@
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";
@@ -15,10 +17,6 @@ import { JwtResponse } from "./../../lib/types/jwt_response";
15
17
  import { KushkiSubscriptionTokensRequest } from "./../../lib/types/kushki_subscription_tokens_request";
16
18
  import { KushkiTokensRequest } from "./../../lib/types/kushki_tokens_request";
17
19
  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
20
  import { MultiMerchantInfoRequest } from "./../../lib/types/multimerchant_info_request";
23
21
  import { MultiMerchantInfoResponse } from "./../../lib/types/multimerchant_info_response";
24
22
  import { PaymentDataResponse } from "./../../lib/types/payment_data_response";
@@ -36,6 +34,7 @@ import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscriptio
36
34
  import { SubscriptionCardAsyncTokenResponse } from "./../../lib/types/subscription_card_async_token_response";
37
35
  import { TokenChargeRequest } from "./../../lib/types/token_charge_request";
38
36
  import { TransferSubscriptionTokenRequest } from "./../../lib/types/transfer_subscription_token_request";
37
+ import { Validate3DsResponse } from "./../../lib/types/validate_3ds_response";
39
38
  /**
40
39
  * Kushki Gateway Implementation
41
40
  */
@@ -45,6 +44,7 @@ export declare class KushkiGateway implements IKushkiGateway {
45
44
  private readonly _contentHeader;
46
45
  private readonly _contentJSON;
47
46
  private readonly _kushkiInfoHeader;
47
+ private readonly _multiRegionEcommSwitch;
48
48
  private _uatUrl;
49
49
  private _prodUrl;
50
50
  private _kshAuthorization;
@@ -73,12 +73,13 @@ export declare class KushkiGateway implements IKushkiGateway {
73
73
  requestTokenTransferSubscription(body: TransferSubscriptionTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
74
74
  requestBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
75
75
  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
76
  deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
79
77
  requestSavedPaymentMethods(body: SavedPaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<PaymentDataResponse[]>;
80
78
  cybersourceJwt(mid: string, testEnv: boolean, regional: boolean, subscriptionId?: string): Observable<JwtResponse>;
81
79
  getUserId(subscriptionId: string, mid: string, testEnv: boolean, regional: boolean): Observable<GetUserId>;
80
+ validateAppleDomain(domain: string, mid: string, testEnv: boolean, regional: boolean): Observable<Validate3DsResponse>;
81
+ startApplePaySession(body: ApplePayStartSessionRequest, mid: string, testEnv: boolean, regional: boolean): Observable<object>;
82
+ getApplePayToken(body: ApplePayGetTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
82
83
  private _assignChannel;
83
84
  private _buildHeader;
84
85
  }
@@ -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";
@@ -144,12 +145,6 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
144
145
  requestPayoutsTransferBankList(mid, testEnv, regional) {
145
146
  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
147
  }
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
148
  deletePaymentMethod(body, testEnv, regional, mid, authorization) {
154
149
  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
150
  }
@@ -173,6 +168,18 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
173
168
  userId: response.userId,
174
169
  })));
175
170
  }
171
+ validateAppleDomain(domain, mid, testEnv, regional) {
172
+ 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)));
173
+ }
174
+ startApplePaySession(body, mid, testEnv, regional) {
175
+ 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)));
176
+ }
177
+ getApplePayToken(body, mid, testEnv, regional) {
178
+ return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.request(body, {
179
+ [this._publicHeader]: mid,
180
+ [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
181
+ }, `${PathEnum_1.PathEnum.get_apple_pay_token}?switch=${this._multiRegionEcommSwitch}`, testEnv, regional)));
182
+ }
176
183
  _assignChannel(regional, path) {
177
184
  if (!regional) {
178
185
  this._uatUrl = `${EnvironmentEnum_1.EnvironmentEnum.uat}${path}`;
@@ -13,6 +13,7 @@ import { SiftScienceAntiFraudSessionResponse } from "./../../lib/types/sift_scie
13
13
  */
14
14
  export declare class SiftScience implements IAntiFraud {
15
15
  private readonly _siftProperty;
16
+ private readonly _siftScriptId;
16
17
  private _sift;
17
18
  constructor(regional: boolean);
18
19
  createSiftScienceSession(processor: string, clientIdentification: string, mid: string, isTest: boolean, merchantSettingsResponse: MerchantSettingsResponse, userId?: string): Observable<SiftScienceObject>;
@@ -28,6 +28,7 @@ const uuid_1 = require("uuid");
28
28
  let SiftScience = class SiftScience {
29
29
  constructor(regional) {
30
30
  this._siftProperty = "_sift";
31
+ this._siftScriptId = "sift_sc_id";
31
32
  this._sift = [];
32
33
  this._initSiftScience(regional);
33
34
  }
@@ -92,7 +93,11 @@ let SiftScience = class SiftScience {
92
93
  try {
93
94
  // istanbul ignore next
94
95
  if (!UtilsService_1.UtilsService.sIsEmpty(window)) {
96
+ const last_script = document.getElementById(this._siftScriptId);
97
+ if (last_script)
98
+ return;
95
99
  const e = window.document.createElement("script");
100
+ e.id = this._siftScriptId;
96
101
  e.src = regional
97
102
  ? "https://regional-cdn.kushkipagos.com/siftscience/s.js"
98
103
  : "https://cdn.siftscience.com/s.js";
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable:all */
2
2
  export declare enum CardBrandsEnum {
3
3
  VISA = "visa",
4
- MASTERCARD = "mastercard"
4
+ MASTERCARD = "mastercard",
5
+ MASTER_CARD = "masterCard"
5
6
  }
@@ -5,4 +5,5 @@ var CardBrandsEnum;
5
5
  (function (CardBrandsEnum) {
6
6
  CardBrandsEnum["VISA"] = "visa";
7
7
  CardBrandsEnum["MASTERCARD"] = "mastercard";
8
+ CardBrandsEnum["MASTER_CARD"] = "masterCard";
8
9
  })(CardBrandsEnum = exports.CardBrandsEnum || (exports.CardBrandsEnum = {}));
@@ -0,0 +1,10 @@
1
+ /* tslint:disable:all */
2
+ export interface ICardinalValidated {
3
+ ActionCode: string;
4
+ Validated: boolean;
5
+ ErrorDescription: string;
6
+ }
7
+ export declare enum ActionCodeEnum {
8
+ SUCCESS = "SUCCESS",
9
+ FAIL = "FAILURE"
10
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionCodeEnum = void 0;
4
+ var ActionCodeEnum;
5
+ (function (ActionCodeEnum) {
6
+ ActionCodeEnum["SUCCESS"] = "SUCCESS";
7
+ ActionCodeEnum["FAIL"] = "FAILURE";
8
+ })(ActionCodeEnum = exports.ActionCodeEnum || (exports.ActionCodeEnum = {}));
@@ -8,6 +8,7 @@ const Identifiers_1 = require("./../../lib/constant/Identifiers");
8
8
  const KushkiGateway_1 = require("./../../lib/gateway/KushkiGateway");
9
9
  const SiftScience_1 = require("./../../lib/gateway/SiftScience");
10
10
  const inversify_1 = require("inversify");
11
+ const ApplePayService_1 = require("./../../lib/service/ApplePayService");
11
12
  const AuthService_1 = require("./../../lib/service/AuthService");
12
13
  const CardAsyncService_1 = require("./../../lib/service/CardAsyncService");
13
14
  const CardDynamicService_1 = require("./../../lib/service/CardDynamicService");
@@ -17,7 +18,6 @@ const CashService_1 = require("./../../lib/service/CashService");
17
18
  const CommissionService_1 = require("./../../lib/service/CommissionService");
18
19
  const KPayService_1 = require("./../../lib/service/KPayService");
19
20
  const KushkiService_1 = require("./../../lib/service/KushkiService");
20
- const MobileProcessorService_1 = require("./../../lib/service/MobileProcessorService");
21
21
  const MultiMerchantService_1 = require("./../../lib/service/MultiMerchantService");
22
22
  const PayoutsCashService_1 = require("./../../lib/service/PayoutsCashService");
23
23
  const PayoutsTransferService_1 = require("./../../lib/service/PayoutsTransferService");
@@ -33,7 +33,6 @@ CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardService).toFactory((context) => (re
33
33
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.CashService).toFactory((context) => (regional) => new CashService_1.CashService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional)));
34
34
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardDynamicService).toFactory((context) => () => new CardDynamicService_1.CardDynamicService(context.container.get(Identifiers_1.IDENTIFIERS.CardService)(), context.container.get(Identifiers_1.IDENTIFIERS.CardAsyncService)()));
35
35
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardSubscriptionDynamicService).toFactory((context) => () => new CardSubscriptionDynamicService_1.CardSubscriptionDynamicService(context.container.get(Identifiers_1.IDENTIFIERS.CardService)(), context.container.get(Identifiers_1.IDENTIFIERS.CardAsyncService)()));
36
- CONTAINER.bind(Identifiers_1.IDENTIFIERS.MobileProcessorService).toFactory((context) => () => new MobileProcessorService_1.MobileProcessorService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
37
36
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.KushkiService).toFactory((context) => (_regional) => new KushkiService_1.KushkiService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
38
37
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.TransferService).toFactory((context) => (regional) => new TransferService_1.TransferService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional)));
39
38
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.SecureService).toFactory((context) => () => new SecureService_1.SecureService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
@@ -45,6 +44,7 @@ CONTAINER.bind(Identifiers_1.IDENTIFIERS.TransferSubscriptionService).toFactory(
45
44
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.PayoutsTransferService).toFactory((context) => (regional) => new PayoutsTransferService_1.PayoutsTransferService(context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional), context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
46
45
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.KPayService).toFactory((context) => (regional) => new KPayService_1.KPayService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AuthService)(regional)));
47
46
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.SiftScienceService).toFactory((context) => (regional) => new SiftScienceService_1.SiftScienceService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional)));
47
+ CONTAINER.bind(Identifiers_1.IDENTIFIERS.ApplePayService).toFactory((context) => () => new ApplePayService_1.ApplePayService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
48
48
  // Gateway
49
49
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.KushkiGateway).to(KushkiGateway_1.KushkiGateway);
50
50
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.AntiFraud).toFactory(() => (regional) => new SiftScience_1.SiftScience(regional));
@@ -3,7 +3,7 @@
3
3
  * Environment enum file
4
4
  */
5
5
  export declare enum EnvironmentEnum {
6
- uat = "https://qa-console.kushkipagos.click/",
6
+ uat = "https://api-uat.kushkipagos.com/",
7
7
  prod = "https://api.kushkipagos.com/",
8
8
  regionalUat = "https://regional-uat.kushkipagos.com/",
9
9
  regionalProd = "https://regional.kushkipagos.com/"
@@ -6,7 +6,7 @@ exports.EnvironmentEnum = void 0;
6
6
  */
7
7
  var EnvironmentEnum;
8
8
  (function (EnvironmentEnum) {
9
- EnvironmentEnum["uat"] = "https://qa-console.kushkipagos.click/";
9
+ EnvironmentEnum["uat"] = "https://api-uat.kushkipagos.com/";
10
10
  EnvironmentEnum["prod"] = "https://api.kushkipagos.com/";
11
11
  EnvironmentEnum["regionalUat"] = "https://regional-uat.kushkipagos.com/";
12
12
  EnvironmentEnum["regionalProd"] = "https://regional.kushkipagos.com/";
@@ -20,6 +20,9 @@ export declare enum ErrorCode {
20
20
  E014 = "E014",
21
21
  E015 = "E015",
22
22
  E016 = "E016",
23
- E017 = "E017"
23
+ E017 = "E017",
24
+ E018 = "E018",
25
+ E019 = "E019",
26
+ E020 = "E020"
24
27
  }
25
28
  export declare const ERRORS: KushkiErrors;
@@ -21,6 +21,9 @@ var ErrorCode;
21
21
  ErrorCode["E015"] = "E015";
22
22
  ErrorCode["E016"] = "E016";
23
23
  ErrorCode["E017"] = "E017";
24
+ ErrorCode["E018"] = "E018";
25
+ ErrorCode["E019"] = "E019";
26
+ ErrorCode["E020"] = "E020";
24
27
  })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
25
28
  exports.ERRORS = {
26
29
  [ErrorCode.E001]: {
@@ -50,7 +53,7 @@ exports.ERRORS = {
50
53
  },
51
54
  [ErrorCode.E006]: {
52
55
  code: ErrorCode.E006,
53
- message: "Error de validación apple pay.",
56
+ message: "Error en solicitud de token de apple pay.",
54
57
  statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest,
55
58
  },
56
59
  [ErrorCode.E007]: {
@@ -108,4 +111,19 @@ exports.ERRORS = {
108
111
  message: "Marca de tarjeta inválida.",
109
112
  statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest,
110
113
  },
114
+ [ErrorCode.E018]: {
115
+ code: ErrorCode.E018,
116
+ message: "No se cargaron los recursos para validación con 3DS.",
117
+ statusCode: StatusCodeEnum_1.StatusCodeEnum.InternalServerError,
118
+ },
119
+ [ErrorCode.E019]: {
120
+ code: ErrorCode.E019,
121
+ message: "No se crearon los recursos de Apple Pay.",
122
+ statusCode: StatusCodeEnum_1.StatusCodeEnum.InternalServerError,
123
+ },
124
+ [ErrorCode.E020]: {
125
+ code: ErrorCode.E020,
126
+ message: "No es posible realizar pagos con Apple Pay.",
127
+ statusCode: StatusCodeEnum_1.StatusCodeEnum.InternalServerError,
128
+ },
111
129
  };