@kushki/js 1.40.2-alpha → 1.40.2-alpha-19735.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/lib/Kushki.d.ts +19 -2
  2. package/lib/Kushki.js +17 -0
  3. package/lib/KushkiInfo.js +1 -1
  4. package/lib/constant/Identifiers.d.ts +2 -0
  5. package/lib/constant/Identifiers.js +2 -0
  6. package/lib/gateway/KushkiGateway.d.ts +9 -3
  7. package/lib/gateway/KushkiGateway.js +33 -6
  8. package/lib/infrastructure/Container.js +5 -1
  9. package/lib/infrastructure/KPayUserPoolEnum.d.ts +5 -0
  10. package/lib/infrastructure/KPayUserPoolEnum.js +8 -0
  11. package/lib/infrastructure/KpayPaymentKind.d.ts +6 -0
  12. package/lib/infrastructure/KpayPaymentKind.js +9 -0
  13. package/lib/infrastructure/PathEnum.d.ts +3 -0
  14. package/lib/infrastructure/PathEnum.js +3 -0
  15. package/lib/repository/IAuthService.d.ts +20 -0
  16. package/lib/repository/IAuthService.js +2 -0
  17. package/lib/repository/ICardService.d.ts +5 -3
  18. package/lib/repository/IKPayService.d.ts +26 -0
  19. package/lib/repository/IKPayService.js +2 -0
  20. package/lib/repository/IKushkiGateway.d.ts +24 -2
  21. package/lib/service/ApplePayService.js +1 -1
  22. package/lib/service/AuthService.d.ts +31 -0
  23. package/lib/service/AuthService.js +161 -0
  24. package/lib/service/CardService.d.ts +7 -3
  25. package/lib/service/CardService.js +42 -18
  26. package/lib/service/KPayService.d.ts +19 -0
  27. package/lib/service/KPayService.js +45 -0
  28. package/lib/types/apple_pay_get_token_events.d.ts +8 -2
  29. package/lib/types/apple_pay_get_token_request.d.ts +20 -0
  30. package/lib/types/delete_payment_method_request.d.ts +6 -0
  31. package/lib/types/delete_payment_method_response.d.ts +7 -0
  32. package/lib/types/init_auth_request.d.ts +6 -0
  33. package/lib/types/init_auth_response.d.ts +6 -0
  34. package/lib/types/payment_data_response.d.ts +37 -0
  35. package/lib/types/saved_payment_data_request.d.ts +10 -0
  36. package/lib/types/subscription_token_kpay_request.d.ts +13 -0
  37. package/lib/types/token_kpay_request.d.ts +12 -0
  38. package/lib/types/validate_session_response.d.ts +6 -0
  39. package/lib/types/verify_auth_request.d.ts +7 -0
  40. package/lib/types/verify_auth_response.d.ts +7 -0
  41. package/package.json +5 -3
package/lib/Kushki.d.ts CHANGED
@@ -15,12 +15,16 @@ import { CardAsyncTokenRequest } from "./../lib/types/card_async_token_request";
15
15
  import { CardAsyncTokenResponse } from "./../lib/types/card_async_token_response";
16
16
  import { CardBrandingRequest } from "./../lib/types/card_branding_request";
17
17
  import { CashTokenRequest } from "./../lib/types/cash_token_request";
18
+ import { DeletePaymentMethodRequest } from "./../lib/types/delete_payment_method_request";
18
19
  import { DeviceTokenRequest } from "./../lib/types/device_token_request";
19
20
  import { ErrorResponse } from "./../lib/types/error_response";
20
21
  import { GetBrandsLogosByMerchantResponse } from "./../lib/types/get_brands_logos_by_merchant_response";
22
+ import { InitAuthRequest } from "./../lib/types/init_auth_request";
23
+ import { InitAuthResponse } from "./../lib/types/init_auth_response";
21
24
  import { KushkiInfo } from "./../lib/types/kushki_info";
22
25
  import { MultiMerchantInfoRequest } from "./../lib/types/multimerchant_info_request";
23
26
  import { MultiMerchantInfoResponse } from "./../lib/types/multimerchant_info_response";
27
+ import { PaymentDataResponse } from "./../lib/types/payment_data_response";
24
28
  import { PayoutsCashTokenRequest } from "./../lib/types/payouts_cash_request";
25
29
  import { PayoutsTransferTokenRequest } from "./../lib/types/payouts_transfer_token_request";
26
30
  import { CommissionConfigurationAmount } from "./../lib/types/remote/commission_configuration_amount";
@@ -29,6 +33,7 @@ import { IDeferredResponse } from "./../lib/types/remote/deferred_response";
29
33
  import { TokenResponse } from "./../lib/types/remote/token_response";
30
34
  import { TransferTokenRequest } from "./../lib/types/remote/transfer_token_request";
31
35
  import { ResponseStatusValidator } from "./../lib/types/response_status_validator";
36
+ import { SavedPaymentMethodRequest } from "./../lib/types/saved_payment_data_request";
32
37
  import { SecureInitRequest } from "./../lib/types/secure_init_request";
33
38
  import { SecureInitResponse } from "./../lib/types/secure_init_response";
34
39
  import { SecureOtpRequest } from "./../lib/types/secure_otp_request";
@@ -36,12 +41,17 @@ import { SecureOtpResponse } from "./../lib/types/secure_otp_response";
36
41
  import { SiftScienceAntiFraudSessionResponse } from "./../lib/types/sift_science_session";
37
42
  import { SubscriptionCardAsyncTokenRequest } from "./../lib/types/subscription_card_async_token_request";
38
43
  import { SubscriptionCardAsyncTokenResponse } from "./../lib/types/subscription_card_async_token_response";
44
+ import { SubscriptionTokenKPayRequest } from "./../lib/types/subscription_token_kpay_request";
39
45
  import { SubscriptionTokenRequest } from "./../lib/types/subscription_token_request";
40
46
  import { TokenChargeRequest } from "./../lib/types/token_charge_request";
47
+ import { TokenKPayRequest } from "./../lib/types/token_kpay_request";
41
48
  import { TokenRequest } from "./../lib/types/token_request";
42
49
  import { TransferSubscriptionTokenRequest } from "./../lib/types/transfer_subscription_token_request";
43
50
  import { Validate3DSRequest } from "./../lib/types/validate_3ds_request";
44
51
  import { Validate3DsResponse } from "./../lib/types/validate_3ds_response";
52
+ import { ValidateSessionResponse } from "./../lib/types/validate_session_response";
53
+ import { VerifyAuthRequest } from "./../lib/types/verify_auth_request";
54
+ import { VerifyAuthResponse } from "./../lib/types/verify_auth_response";
45
55
  /**
46
56
  * Implementation
47
57
  */
@@ -60,6 +70,8 @@ export declare class Kushki {
60
70
  private readonly _payoutsCashService;
61
71
  private readonly _transferSubscriptionService;
62
72
  private readonly _payoutsTransferService;
73
+ private readonly _kPayService;
74
+ private readonly _authService;
63
75
  private readonly _cardDynamicService;
64
76
  private readonly _cardSubscriptionDynamicService;
65
77
  private readonly _siftScience;
@@ -70,7 +82,7 @@ export declare class Kushki {
70
82
  regional?: boolean;
71
83
  kushkiInfo?: KushkiInfo;
72
84
  });
73
- requestToken(body: TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
85
+ requestToken(body: TokenRequest | TokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
74
86
  requestInitAntiFraud(userId: string, callback: (value: SiftScienceAntiFraudSessionResponse | ErrorResponse) => void): void;
75
87
  /**
76
88
  * @deprecated use requestDeviceToken instead
@@ -80,7 +92,7 @@ export declare class Kushki {
80
92
  */
81
93
  requestTokenCharge(body: TokenChargeRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
82
94
  requestDeviceToken(body: DeviceTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
83
- requestSubscriptionToken(body: SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
95
+ requestSubscriptionToken(body: SubscriptionTokenRequest | SubscriptionTokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
84
96
  requestTransferToken(body: TransferTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
85
97
  checkStatus(callback: (value: ResponseStatusValidator | ErrorResponse) => void): void;
86
98
  /**
@@ -114,6 +126,11 @@ export declare class Kushki {
114
126
  requestMobileProcessorToken(_body: object, callback: (value: ErrorResponse) => void): void;
115
127
  requestCardDynamicToken(bin: BinBody, body: CardAsyncTokenRequest | TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
116
128
  requestCardSubscriptionDynamicToken(bin: BinBody, body: SubscriptionCardAsyncTokenRequest | SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
129
+ requestInitAuth(body: InitAuthRequest, callback: (value: InitAuthResponse | ErrorResponse) => void): void;
130
+ deletePaymentMethod(body: DeletePaymentMethodRequest, callback: (value: boolean | ErrorResponse) => void): void;
131
+ requestSavedPaymentMethods(body: SavedPaymentMethodRequest, callback: (value: PaymentDataResponse[] | ErrorResponse) => void): void;
132
+ requestVerifyAuth(body: VerifyAuthRequest, callback: (value: VerifyAuthResponse | ErrorResponse) => void): void;
133
+ validateSession(callback: (value: ValidateSessionResponse | ErrorResponse) => void): void;
117
134
  requestValidate3DS(body: Validate3DSRequest, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
118
135
  requestSecureInit(body: SecureInitRequest, callback: (value: SecureInitResponse | ErrorResponse) => void): void;
119
136
  /**
package/lib/Kushki.js CHANGED
@@ -34,6 +34,8 @@ 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._authService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.AuthService)();
38
+ this._kPayService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.KPayService)();
37
39
  this._cardDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardDynamicService)();
38
40
  this._cardSubscriptionDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardSubscriptionDynamicService)();
39
41
  this._applePayService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.ApplePayService)();
@@ -157,6 +159,21 @@ class Kushki {
157
159
  requestCardSubscriptionDynamicToken(bin, body, callback) {
158
160
  this._cardSubscriptionDynamicService.requestCardSubscriptionDynamicToken(bin, body, this._merchantId, this._inTestEnvironment, this._regional, callback);
159
161
  }
162
+ requestInitAuth(body, callback) {
163
+ this._resolve(this._authService.requestInitAuth(body, this._inTestEnvironment), callback);
164
+ }
165
+ deletePaymentMethod(body, callback) {
166
+ this._resolve(this._kPayService.deletePaymentMethod(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
167
+ }
168
+ requestSavedPaymentMethods(body, callback) {
169
+ this._resolve(this._kPayService.requestSavedPaymentMethods(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
170
+ }
171
+ requestVerifyAuth(body, callback) {
172
+ this._resolve(this._authService.requestVerifyAuth(body.code, this._inTestEnvironment), callback);
173
+ }
174
+ validateSession(callback) {
175
+ this._resolve(this._authService.validateSession(this._inTestEnvironment), callback);
176
+ }
160
177
  requestValidate3DS(body, callback) {
161
178
  this._cardService.validate3DS(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
162
179
  }
package/lib/KushkiInfo.js CHANGED
@@ -12,7 +12,7 @@ const UtilsService_1 = require("./../lib/service/UtilsService");
12
12
  */
13
13
  class KInfo {
14
14
  static buildKushkiInfo(kushkiInfo) {
15
- const kushki_js_version = "1.40.2-alpha";
15
+ const kushki_js_version = "1.40.2-alpha-19735.0";
16
16
  if (kushkiInfo) {
17
17
  if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
18
18
  kushkiInfo.platformVersion = kushki_js_version;
@@ -19,6 +19,8 @@ export declare type containerSymbol = {
19
19
  TransferSubscriptionService: symbol;
20
20
  PayoutsTransferService: symbol;
21
21
  SiftScienceService: symbol;
22
+ KPayService: symbol;
23
+ AuthService: symbol;
22
24
  ApplePayService: symbol;
23
25
  };
24
26
  declare const IDENTIFIERS: containerSymbol;
@@ -7,12 +7,14 @@ exports.IDENTIFIERS = void 0;
7
7
  const IDENTIFIERS = {
8
8
  AntiFraud: Symbol.for("AntiFraud"),
9
9
  ApplePayService: Symbol.for("ApplePayService"),
10
+ AuthService: Symbol.for("AuthService"),
10
11
  CardAsyncService: Symbol.for("CardAsyncService"),
11
12
  CardDynamicService: Symbol.for("CardDynamicService"),
12
13
  CardService: Symbol.for("CardService"),
13
14
  CardSubscriptionDynamicService: Symbol.for("CardSubscriptionDynamicService"),
14
15
  CashService: Symbol.for("CashService"),
15
16
  CommissionService: Symbol.for("CommissionService"),
17
+ KPayService: Symbol.for("KPayService"),
16
18
  KushkiGateway: Symbol.for("KushkiGateway"),
17
19
  KushkiService: Symbol.for("KushkiService"),
18
20
  MultiMerchantService: Symbol.for("MultiMerchantService"),
@@ -2,7 +2,7 @@
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";
5
+ import { ApplePayGetTokenRequest } from "./../../lib/types/apple_pay_get_token_request";
6
6
  import { ApplePayStartSessionRequest } from "./../../lib/types/apple_pay_start_session_request";
7
7
  import { BankListResponse } from "./../../lib/types/bank_list_response";
8
8
  import { BinInfoResponse } from "./../../lib/types/bin_info_response";
@@ -10,6 +10,7 @@ import { CardAsyncTokenRequest } from "./../../lib/types/card_async_token_reques
10
10
  import { CardAsyncTokenResponse } from "./../../lib/types/card_async_token_response";
11
11
  import { CashTokenRequest } from "./../../lib/types/cash_token_request";
12
12
  import { DeferredOptionsResponse } from "./../../lib/types/deferred_options_response";
13
+ import { DeletePaymentMethodRequest } from "./../../lib/types/delete_payment_method_request";
13
14
  import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
14
15
  import { GetUserId } from "./../../lib/types/get_user_id";
15
16
  import { JwtResponse } from "./../../lib/types/jwt_response";
@@ -18,6 +19,7 @@ import { KushkiTokensRequest } from "./../../lib/types/kushki_tokens_request";
18
19
  import { MerchantSettingsResponse } from "./../../lib/types/merchant_settings_response";
19
20
  import { MultiMerchantInfoRequest } from "./../../lib/types/multimerchant_info_request";
20
21
  import { MultiMerchantInfoResponse } from "./../../lib/types/multimerchant_info_response";
22
+ import { PaymentDataResponse } from "./../../lib/types/payment_data_response";
21
23
  import { PayoutsCashTokenRequest } from "./../../lib/types/payouts_cash_request";
22
24
  import { PayoutsTransferTokenRequest } from "./../../lib/types/payouts_transfer_token_request";
23
25
  import { CommissionConfigurationAmount } from "./../../lib/types/remote/commission_configuration_amount";
@@ -25,6 +27,7 @@ import { CommissionConfigurationRequest } from "./../../lib/types/remote/commiss
25
27
  import { TokenResponse } from "./../../lib/types/remote/token_response";
26
28
  import { TransferTokenRequest } from "./../../lib/types/remote/transfer_token_request";
27
29
  import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
30
+ import { SavedPaymentMethodRequest } from "./../../lib/types/saved_payment_data_request";
28
31
  import { SecureOtpRequest } from "./../../lib/types/secure_otp_request";
29
32
  import { SecureOtpResponse } from "./../../lib/types/secure_otp_response";
30
33
  import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscription_card_async_token_request";
@@ -47,11 +50,12 @@ export declare class KushkiGateway implements IKushkiGateway {
47
50
  private _kshAuthorization;
48
51
  request<T = object>(body: object, headers: object, path: string, testEnv: boolean, regional: boolean): Observable<T>;
49
52
  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>;
50
54
  requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
51
55
  requestBrandsLogosByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
52
- requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
56
+ requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
53
57
  requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
54
- requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
58
+ requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
55
59
  requestTransferToken(body: TransferTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
56
60
  requestMerchantSettings(mid: string, testEnv: boolean, regional: boolean): Observable<MerchantSettingsResponse>;
57
61
  requestPseBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
@@ -69,6 +73,8 @@ export declare class KushkiGateway implements IKushkiGateway {
69
73
  requestTokenTransferSubscription(body: TransferSubscriptionTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
70
74
  requestBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
71
75
  requestPayoutsTransferBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
76
+ deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
77
+ requestSavedPaymentMethods(body: SavedPaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<PaymentDataResponse[]>;
72
78
  cybersourceJwt(mid: string, testEnv: boolean, regional: boolean, subscriptionId?: string): Observable<JwtResponse>;
73
79
  getUserId(subscriptionId: string, mid: string, testEnv: boolean, regional: boolean): Observable<GetUserId>;
74
80
  validateAppleDomain(domain: string, mid: string, testEnv: boolean, regional: boolean): Observable<Validate3DsResponse>;
@@ -56,26 +56,43 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
56
56
  },
57
57
  })), operators_1.map((response) => response.data), operators_1.catchError((err) => rxjs_1.throwError(err)));
58
58
  }
59
+ requestDelete(path, testEnv, regional, mid, authorization) {
60
+ return rxjs_1.of(this._assignChannel(regional, path)).pipe(operators_1.switchMap(() => axios_1.default.delete(`${testEnv ? this._uatUrl : this._prodUrl}`, {
61
+ headers: {
62
+ [this._contentHeader]: this._contentJSON,
63
+ [this._kshAuthorization]: authorization,
64
+ [this._publicHeader]: mid,
65
+ },
66
+ })), operators_1.map((response) => response.data), operators_1.catchError((err) => rxjs_1.throwError(err)));
67
+ }
59
68
  requestBrandsByMerchant(mid, testEnv, regional) {
60
69
  return this.requestGet(`${PathEnum_1.PathEnum.brands_by_merchant}`, testEnv, regional, mid);
61
70
  }
62
71
  requestBrandsLogosByMerchant(mid, testEnv, regional) {
63
72
  return this.requestGet(`${PathEnum_1.PathEnum.brands_logos_by_merchant}`, testEnv, regional, mid);
64
73
  }
65
- requestToken(body, mid, testEnv, regional) {
66
- return this.request(body, {
74
+ requestToken(body, mid, testEnv, regional, authorization) {
75
+ return rxjs_1.of(1).pipe(operators_1.concatMap(() => rxjs_1.iif(() => authorization === undefined, this.request(body, {
67
76
  [this._publicHeader]: mid,
68
77
  [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
69
- }, PathEnum_1.PathEnum.card_tokens, testEnv, regional);
78
+ }, PathEnum_1.PathEnum.card_tokens, testEnv, regional), this.request(body, {
79
+ [this._kshAuthorization]: authorization,
80
+ [this._publicHeader]: mid,
81
+ [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
82
+ }, PathEnum_1.PathEnum.card_tokens, testEnv, regional))));
70
83
  }
71
84
  requestDeviceToken(body, mid, testEnv, regional) {
72
85
  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)));
73
86
  }
74
- requestSubscriptionToken(body, mid, testEnv, regional) {
75
- return this.request(body, {
87
+ requestSubscriptionToken(body, mid, testEnv, regional, authorization) {
88
+ return rxjs_1.of(1).pipe(operators_1.concatMap(() => rxjs_1.iif(() => authorization === undefined, this.request(body, {
89
+ [this._publicHeader]: mid,
90
+ [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
91
+ }, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional), this.request(body, {
92
+ [this._kshAuthorization]: authorization,
76
93
  [this._publicHeader]: mid,
77
94
  [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
78
- }, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional);
95
+ }, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional))), operators_1.map((response) => response));
79
96
  }
80
97
  requestTransferToken(body, mid, testEnv, regional) {
81
98
  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)));
@@ -128,6 +145,16 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
128
145
  requestPayoutsTransferBankList(mid, testEnv, regional) {
129
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));
130
147
  }
148
+ deletePaymentMethod(body, testEnv, regional, mid, authorization) {
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));
150
+ }
151
+ requestSavedPaymentMethods(body, testEnv, regional, mid) {
152
+ return rxjs_1.of(1).pipe(operators_1.map(() => {
153
+ const { email, kind } = body;
154
+ const kind_path = kind !== undefined ? `?kind=${kind}` : "";
155
+ return `${PathEnum_1.PathEnum.kpay_get_saved_payment_methods}/${email}${kind_path}`;
156
+ }), operators_1.concatMap((path) => this.requestGet(path, testEnv, regional, mid)), operators_1.map((response) => response));
157
+ }
131
158
  cybersourceJwt(mid, testEnv, regional, subscriptionId) {
132
159
  return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.requestGet(subscriptionId
133
160
  ? `${PathEnum_1.PathEnum.cybersource_jwt}?subscriptionId=${subscriptionId}`
@@ -9,12 +9,14 @@ const KushkiGateway_1 = require("./../../lib/gateway/KushkiGateway");
9
9
  const SiftScience_1 = require("./../../lib/gateway/SiftScience");
10
10
  const inversify_1 = require("inversify");
11
11
  const ApplePayService_1 = require("./../../lib/service/ApplePayService");
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");
14
15
  const CardService_1 = require("./../../lib/service/CardService");
15
16
  const CardSubscriptionDynamicService_1 = require("./../../lib/service/CardSubscriptionDynamicService");
16
17
  const CashService_1 = require("./../../lib/service/CashService");
17
18
  const CommissionService_1 = require("./../../lib/service/CommissionService");
19
+ const KPayService_1 = require("./../../lib/service/KPayService");
18
20
  const KushkiService_1 = require("./../../lib/service/KushkiService");
19
21
  const MultiMerchantService_1 = require("./../../lib/service/MultiMerchantService");
20
22
  const PayoutsCashService_1 = require("./../../lib/service/PayoutsCashService");
@@ -26,7 +28,8 @@ const TransferSubscriptionsService_1 = require("./../../lib/service/TransferSubs
26
28
  const CONTAINER = new inversify_1.Container();
27
29
  exports.CONTAINER = CONTAINER;
28
30
  // Service
29
- CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardService).toFactory((context) => (regional) => new CardService_1.CardService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional)));
31
+ CONTAINER.bind(Identifiers_1.IDENTIFIERS.AuthService).toFactory((context) => () => new AuthService_1.AuthService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
32
+ CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardService).toFactory((context) => (regional) => new CardService_1.CardService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AuthService)(regional), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional)));
30
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)));
31
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)()));
32
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)()));
@@ -39,6 +42,7 @@ CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardAsyncService).toFactory((context) =
39
42
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.PayoutsCashService).toFactory((context) => (regional) => new PayoutsCashService_1.PayoutsCashService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional)));
40
43
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.TransferSubscriptionService).toFactory((context) => (regional) => new TransferSubscriptionsService_1.TransferSubscriptionsService(context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional), context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
41
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)));
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)));
42
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)));
43
47
  CONTAINER.bind(Identifiers_1.IDENTIFIERS.ApplePayService).toFactory((context) => () => new ApplePayService_1.ApplePayService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway)));
44
48
  // Gateway
@@ -0,0 +1,5 @@
1
+ /* tslint:disable:all */
2
+ export declare enum KPayUserPoolEnum {
3
+ uat = "https://kushki-static-dev.s3.amazonaws.com/kpay/kpay_user_pool_dev.json",
4
+ prod = "https://kushki-static.s3.amazonaws.com/kpay/kpay_user_pool_prod.json"
5
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KPayUserPoolEnum = void 0;
4
+ var KPayUserPoolEnum;
5
+ (function (KPayUserPoolEnum) {
6
+ KPayUserPoolEnum["uat"] = "https://kushki-static-dev.s3.amazonaws.com/kpay/kpay_user_pool_dev.json";
7
+ KPayUserPoolEnum["prod"] = "https://kushki-static.s3.amazonaws.com/kpay/kpay_user_pool_prod.json";
8
+ })(KPayUserPoolEnum = exports.KPayUserPoolEnum || (exports.KPayUserPoolEnum = {}));
@@ -0,0 +1,6 @@
1
+ /* tslint:disable:all */
2
+ export declare enum KpayPaymentKind {
3
+ CARD = "card",
4
+ TRANSFER = "transfer",
5
+ CASH = "cash"
6
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KpayPaymentKind = void 0;
4
+ var KpayPaymentKind;
5
+ (function (KpayPaymentKind) {
6
+ KpayPaymentKind["CARD"] = "card";
7
+ KpayPaymentKind["TRANSFER"] = "transfer";
8
+ KpayPaymentKind["CASH"] = "cash";
9
+ })(KpayPaymentKind = exports.KpayPaymentKind || (exports.KpayPaymentKind = {}));
@@ -26,6 +26,9 @@ export declare enum PathEnum {
26
26
  transfer_subscription_tokens = "transfer-subscriptions/v1/tokens",
27
27
  payouts_transfer_tokens = "payouts/transfer/v1/tokens",
28
28
  cybersource_jwt = "card/v1/authToken",
29
+ savedPaymentMethods = "/personal-wallet/v1/payment-data/",
30
+ kpay_delete_payment_method = "personal-wallet/v1/walletSubscription",
31
+ kpay_get_saved_payment_methods = "personal-wallet/v1/payment-data",
29
32
  get_user_id = "v1/subscriptions/",
30
33
  validate_apple_domain = "apple-pay/v1/validate",
31
34
  start_apple_pay_session = "apple-pay/v1/session/start",
@@ -29,6 +29,9 @@ var PathEnum;
29
29
  PathEnum["transfer_subscription_tokens"] = "transfer-subscriptions/v1/tokens";
30
30
  PathEnum["payouts_transfer_tokens"] = "payouts/transfer/v1/tokens";
31
31
  PathEnum["cybersource_jwt"] = "card/v1/authToken";
32
+ PathEnum["savedPaymentMethods"] = "/personal-wallet/v1/payment-data/";
33
+ PathEnum["kpay_delete_payment_method"] = "personal-wallet/v1/walletSubscription";
34
+ PathEnum["kpay_get_saved_payment_methods"] = "personal-wallet/v1/payment-data";
32
35
  PathEnum["get_user_id"] = "v1/subscriptions/";
33
36
  PathEnum["validate_apple_domain"] = "apple-pay/v1/validate";
34
37
  PathEnum["start_apple_pay_session"] = "apple-pay/v1/session/start";
@@ -0,0 +1,20 @@
1
+ /* tslint:disable:all */
2
+ /**
3
+ * ICardService file.
4
+ */
5
+ import { Observable } from "rxjs";
6
+ import { InitAuthRequest } from "./../../lib/types/init_auth_request";
7
+ import { InitAuthResponse } from "./../../lib/types/init_auth_response";
8
+ import { ValidateSessionResponse } from "./../../lib/types/validate_session_response";
9
+ import { VerifyAuthResponse } from "./../../lib/types/verify_auth_response";
10
+ export interface IAuthService {
11
+ /**
12
+ * Get Log in credentials
13
+ * @param body - required mail from user and name as a optional value
14
+ * @param isTestEnvironment
15
+ */
16
+ requestInitAuth(body: InitAuthRequest, isTestEnvironment: boolean): Observable<InitAuthResponse>;
17
+ requestVerifyAuth(code: string, isTestEnvironment: boolean): Observable<VerifyAuthResponse>;
18
+ validateSession(isTestEnvironment: boolean): Observable<ValidateSessionResponse>;
19
+ getAuthorizationToken(): Observable<string>;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,12 +10,14 @@ import { IDeferredResponse } from "./../../lib/types/remote/deferred_response";
10
10
  import { TokenResponse } from "./../../lib/types/remote/token_response";
11
11
  import { SecureInitRequest } from "./../../lib/types/secure_init_request";
12
12
  import { SecureInitResponse } from "./../../lib/types/secure_init_response";
13
+ import { SubscriptionTokenKPayRequest } from "./../../lib/types/subscription_token_kpay_request";
13
14
  import { SubscriptionTokenRequest } from "./../../lib/types/subscription_token_request";
14
15
  import { SubscriptionIdRequest } from "./../../lib/types/subscriptionId_request";
16
+ import { TokenKPayRequest } from "./../../lib/types/token_kpay_request";
15
17
  import { TokenRequest } from "./../../lib/types/token_request";
16
18
  import { Validate3DSRequest } from "./../../lib/types/validate_3ds_request";
17
19
  import { Validate3DsResponse } from "./../../lib/types/validate_3ds_response";
18
- export declare type IGeneralTokenRequest = TokenRequest | SubscriptionTokenRequest;
20
+ export declare type IGeneralTokenRequest = TokenRequest | TokenKPayRequest | SubscriptionTokenRequest | SubscriptionTokenKPayRequest;
19
21
  export interface ICardService {
20
22
  /**
21
23
  * Token
@@ -25,7 +27,7 @@ export interface ICardService {
25
27
  * @param regional - Define if endpoint used regional URL
26
28
  * @param callback
27
29
  */
28
- requestToken(tokenRequest: TokenRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: TokenResponse | ErrorResponse) => void): void;
30
+ requestToken(tokenRequest: TokenRequest | TokenKPayRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: TokenResponse | ErrorResponse) => void): void;
29
31
  /**
30
32
  * Subscription Token
31
33
  * @param subscriptionTokenRequest - subscription tokens request body
@@ -34,7 +36,7 @@ export interface ICardService {
34
36
  * @param regional - Define if endpoint used regional URL
35
37
  * @param callback
36
38
  */
37
- requestSubscriptionToken(subscriptionTokenRequest: SubscriptionTokenRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: TokenResponse | ErrorResponse) => void): void;
39
+ requestSubscriptionToken(subscriptionTokenRequest: SubscriptionTokenRequest | SubscriptionTokenKPayRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: TokenResponse | ErrorResponse) => void): void;
38
40
  /**
39
41
  * Subscription Token
40
42
  * @param binBody - deferred bin request body
@@ -0,0 +1,26 @@
1
+ /* tslint:disable:all */
2
+ /**
3
+ * ICardService file.
4
+ */
5
+ import { Observable } from "rxjs";
6
+ import { DeletePaymentMethodRequest } from "./../../lib/types/delete_payment_method_request";
7
+ import { PaymentDataResponse } from "./../../lib/types/payment_data_response";
8
+ import { SavedPaymentMethodRequest } from "./../../lib/types/saved_payment_data_request";
9
+ export interface IKPayService {
10
+ /**
11
+ * deletePaymentMethod from user
12
+ * @param body - delete payment method id
13
+ * @param mid - public merchant id
14
+ * @param isTest - is test environment
15
+ * @param regional - Define if endpoint used regional URL
16
+ */
17
+ deletePaymentMethod(body: DeletePaymentMethodRequest, mid: string, isTest: boolean, regional: boolean): Observable<boolean>;
18
+ /**
19
+ * requestSavedPaymentMethods from user
20
+ * @param body - user email and payment kind
21
+ * @param mid - public merchant id
22
+ * @param isTest - is test environment
23
+ * @param regional - Define if endpoint used regional URL
24
+ */
25
+ requestSavedPaymentMethods(body: SavedPaymentMethodRequest, mid: string, isTest: boolean, regional: boolean): Observable<PaymentDataResponse[]>;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,7 +3,7 @@
3
3
  * Interface for Kushki Gateway.
4
4
  */
5
5
  import { Observable } from "rxjs";
6
- import { ApplePayGetTokenRequest } from "./../../lib/types/apple_pay_get_token_events";
6
+ import { ApplePayGetTokenRequest } from "./../../lib/types/apple_pay_get_token_request";
7
7
  import { ApplePayStartSessionRequest } from "./../../lib/types/apple_pay_start_session_request";
8
8
  import { BankListResponse } from "./../../lib/types/bank_list_response";
9
9
  import { BinInfoResponse } from "./../../lib/types/bin_info_response";
@@ -11,6 +11,7 @@ import { CardAsyncTokenRequest } from "./../../lib/types/card_async_token_reques
11
11
  import { CardAsyncTokenResponse } from "./../../lib/types/card_async_token_response";
12
12
  import { CashTokenRequest } from "./../../lib/types/cash_token_request";
13
13
  import { DeferredOptionsResponse } from "./../../lib/types/deferred_options_response";
14
+ import { DeletePaymentMethodRequest } from "./../../lib/types/delete_payment_method_request";
14
15
  import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
15
16
  import { GetUserId } from "./../../lib/types/get_user_id";
16
17
  import { JwtResponse } from "./../../lib/types/jwt_response";
@@ -19,6 +20,7 @@ import { KushkiTokensRequest } from "./../../lib/types/kushki_tokens_request";
19
20
  import { MerchantSettingsResponse } from "./../../lib/types/merchant_settings_response";
20
21
  import { MultiMerchantInfoRequest } from "./../../lib/types/multimerchant_info_request";
21
22
  import { MultiMerchantInfoResponse } from "./../../lib/types/multimerchant_info_response";
23
+ import { PaymentDataResponse } from "./../../lib/types/payment_data_response";
22
24
  import { PayoutsCashTokenRequest } from "./../../lib/types/payouts_cash_request";
23
25
  import { PayoutsTransferTokenRequest } from "./../../lib/types/payouts_transfer_token_request";
24
26
  import { CommissionConfigurationAmount } from "./../../lib/types/remote/commission_configuration_amount";
@@ -26,6 +28,7 @@ import { CommissionConfigurationRequest } from "./../../lib/types/remote/commiss
26
28
  import { TokenResponse } from "./../../lib/types/remote/token_response";
27
29
  import { TransferTokenRequest } from "./../../lib/types/remote/transfer_token_request";
28
30
  import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
31
+ import { SavedPaymentMethodRequest } from "./../../lib/types/saved_payment_data_request";
29
32
  import { SecureOtpRequest } from "./../../lib/types/secure_otp_request";
30
33
  import { SecureOtpResponse } from "./../../lib/types/secure_otp_response";
31
34
  import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscription_card_async_token_request";
@@ -42,6 +45,10 @@ export interface IKushkiGateway {
42
45
  * Send GET requests to Kushki Gateway
43
46
  */
44
47
  requestGet(path: string, testEnv: boolean, regional: boolean, mid?: string): Observable<object>;
48
+ /**
49
+ * Send DELETE requests to Kushki Gateway
50
+ */
51
+ requestDelete<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<T>;
45
52
  /**
46
53
  * Send tokens request to Kushki API
47
54
  */
@@ -53,7 +60,7 @@ export interface IKushkiGateway {
53
60
  /**
54
61
  * Send tokens subscription request to Kushki API
55
62
  */
56
- requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
63
+ requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
57
64
  /**
58
65
  * Send transfer tokens request to Kushki API
59
66
  */
@@ -128,6 +135,21 @@ export interface IKushkiGateway {
128
135
  * Request banklist payouts transfer to Kushki API
129
136
  */
130
137
  requestPayoutsTransferBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
138
+ /**
139
+ * @param body
140
+ * @param testEnv
141
+ * @param mid - public credential for request
142
+ * @param regional - Define if endpoint used regional URL
143
+ * @param authorization
144
+ */
145
+ deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
146
+ /**
147
+ * @param body
148
+ * @param testEnv
149
+ * @param mid - public credential for request
150
+ * @param regional - Define if endpoint used regional URL
151
+ */
152
+ requestSavedPaymentMethods(body: SavedPaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<PaymentDataResponse[]>;
131
153
  /**
132
154
  * Get JWT for 3DS
133
155
  * @param mid - public credential for request
@@ -153,7 +153,7 @@ let ApplePayService = ApplePayService_1 = class ApplePayService {
153
153
  _onPaymentAuthorized(event, mid, session, isTest, regional, callback) {
154
154
  return __awaiter(this, void 0, void 0, function* () {
155
155
  try {
156
- const apple_token = event.payment.token.paymentData;
156
+ const apple_token = Object.assign(Object.assign({}, event.payment.token.paymentData), { paymentMethod: event.payment.token.paymentMethod });
157
157
  const kushki_token = yield this._gateway
158
158
  .getApplePayToken(apple_token, mid, isTest, regional)
159
159
  .toPromise();
@@ -0,0 +1,31 @@
1
+ /* tslint:disable:all */
2
+ import "reflect-metadata";
3
+ import { IAuthService } from "./../../lib/repository/IAuthService";
4
+ import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
5
+ import { Observable } from "rxjs";
6
+ import { InitAuthRequest } from "./../../lib/types/init_auth_request";
7
+ import { InitAuthResponse } from "./../../lib/types/init_auth_response";
8
+ import { ValidateSessionResponse } from "./../../lib/types/validate_session_response";
9
+ import { VerifyAuthResponse } from "./../../lib/types/verify_auth_response";
10
+ /**
11
+ * Implementation
12
+ */
13
+ export declare class AuthService implements IAuthService {
14
+ private readonly _gateway;
15
+ private _cognitoUser?;
16
+ constructor(gateway: IKushkiGateway);
17
+ requestInitAuth(body: InitAuthRequest, isTestEnvironment: boolean): Observable<InitAuthResponse>;
18
+ requestVerifyAuth(code: string, isTestEnvironment: boolean): Observable<VerifyAuthResponse>;
19
+ validateSession(isTestEnvironment: boolean): Observable<ValidateSessionResponse>;
20
+ getAuthorizationToken(): Observable<string>;
21
+ private _currentAuthenticatedUser;
22
+ private _verifyCurrentSession;
23
+ private _handleInitAuth;
24
+ private _validateCurrentSession;
25
+ private _getCurrentUserEmail;
26
+ private _signOut;
27
+ private _userSignIn;
28
+ private _userSignInPasswordles;
29
+ private static _configureAmplifyCredentials;
30
+ private static _getRandomString;
31
+ }