@kushki/js 1.22.0 → 1.24.0-alpha.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.
- package/README.md +1 -2
- package/lib/Kushki.d.ts +6 -0
- package/lib/Kushki.js +14 -2
- package/lib/constant/Identifiers.d.ts +2 -0
- package/lib/constant/Identifiers.js +2 -0
- package/lib/gateway/KushkiGateway.d.ts +3 -2
- package/lib/gateway/KushkiGateway.js +13 -6
- package/lib/infrastructure/BinCardTypeEnum.d.ts +8 -0
- package/lib/infrastructure/BinCardTypeEnum.js +11 -0
- package/lib/infrastructure/Container.js +14 -6
- package/lib/infrastructure/ErrorEnum.d.ts +2 -1
- package/lib/infrastructure/ErrorEnum.js +6 -0
- package/lib/infrastructure/KPayUserPoolEnum.d.ts +5 -0
- package/lib/infrastructure/KPayUserPoolEnum.js +8 -0
- package/lib/repository/IAuthService.d.ts +6 -2
- package/lib/repository/ICardDynamicService.d.ts +13 -0
- package/lib/repository/ICardDynamicService.js +2 -0
- package/lib/repository/ICardSubscriptionDynamicService.d.ts +13 -0
- package/lib/repository/ICardSubscriptionDynamicService.js +5 -0
- package/lib/repository/IKushkiGateway.d.ts +2 -1
- package/lib/service/AuthService.d.ts +9 -4
- package/lib/service/AuthService.js +119 -39
- package/lib/service/CardDynamicService.d.ts +21 -0
- package/lib/service/CardDynamicService.js +60 -0
- package/lib/service/CardService.d.ts +3 -1
- package/lib/service/CardService.js +30 -13
- package/lib/service/CardSubscriptionDynamicService.d.ts +21 -0
- package/lib/service/CardSubscriptionDynamicService.js +60 -0
- package/lib/service/KPayService.d.ts +3 -1
- package/lib/service/KPayService.js +10 -3
- package/lib/types/cash_token_request.d.ts +4 -0
- package/lib/types/delete_payment_method_request.d.ts +0 -1
- package/lib/types/init_auth_response.d.ts +1 -1
- package/lib/types/kushki_subscription_tokens_request.d.ts +1 -0
- package/lib/types/kushki_transfer_tokens_request.d.ts +2 -0
- package/lib/types/subscription_token_kpay_request.d.ts +1 -2
- package/lib/types/subscription_token_request.d.ts +2 -1
- package/lib/types/token_kpay_request.d.ts +1 -2
- package/lib/types/token_request.d.ts +2 -1
- package/lib/types/validate_session_response.d.ts +6 -0
- package/package.json +10 -5
- package/lib/.DS_Store +0 -0
package/README.md
CHANGED
package/lib/Kushki.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ import { TokenChargeRequest } from "./../lib/types/token_charge_request";
|
|
|
34
34
|
import { TokenKPayRequest } from "./../lib/types/token_kpay_request";
|
|
35
35
|
import { TokenRequest } from "./../lib/types/token_request";
|
|
36
36
|
import { TransferSubscriptionTokenRequest } from "./../lib/types/transfer_subscription_token_request";
|
|
37
|
+
import { ValidateSessionResponse } from "./../lib/types/validate_session_response";
|
|
37
38
|
import { VerifyAuthRequest } from "./../lib/types/verify_auth_request";
|
|
38
39
|
import { VerifyAuthResponse } from "./../lib/types/verify_auth_response";
|
|
39
40
|
/**
|
|
@@ -57,6 +58,8 @@ export declare class Kushki {
|
|
|
57
58
|
private readonly _mobileProcessorService;
|
|
58
59
|
private readonly _kPayService;
|
|
59
60
|
private readonly _authService;
|
|
61
|
+
private readonly _cardDynamicService;
|
|
62
|
+
private readonly _cardSubscriptionDynamicService;
|
|
60
63
|
constructor(body: {
|
|
61
64
|
merchantId: string;
|
|
62
65
|
inTestEnvironment?: boolean;
|
|
@@ -89,10 +92,13 @@ export declare class Kushki {
|
|
|
89
92
|
requestTransferSubscriptionBankList(callback: (value: BankListResponse | ErrorResponse) => void): void;
|
|
90
93
|
requestPayoutsTransferBankList(callback: (value: BankListResponse | ErrorResponse) => void): void;
|
|
91
94
|
requestMobileProcessorToken(body: MobileProcessorTokenRequest, callback: (value: MobileProcessorToken | ErrorResponse) => void): void;
|
|
95
|
+
requestCardDynamicToken(bin: BinBody, body: CardAsyncTokenRequest | TokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
96
|
+
requestCardSubscriptionDynamicToken(bin: BinBody, body: SubscriptionCardAsyncTokenRequest | SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
92
97
|
requestInitAuth(body: InitAuthRequest, callback: (value: InitAuthResponse | ErrorResponse) => void): void;
|
|
93
98
|
deletePaymentMethod(body: DeletePaymentMethodRequest, callback: (value: boolean | ErrorResponse) => void): void;
|
|
94
99
|
requestSavedPaymentMethods(body: SavedPaymentMethodRequest, callback: (value: PaymentDataResponse[] | ErrorResponse) => void): void;
|
|
95
100
|
requestVerifyAuth(body: VerifyAuthRequest, callback: (value: VerifyAuthResponse | ErrorResponse) => void): void;
|
|
101
|
+
validateSession(callback: (value: ValidateSessionResponse | ErrorResponse) => void): void;
|
|
96
102
|
private static _callbackError;
|
|
97
103
|
private _requestBankList;
|
|
98
104
|
private _resolve;
|
package/lib/Kushki.js
CHANGED
|
@@ -10,6 +10,7 @@ var UtilsService_1 = require("./../lib/service/UtilsService");
|
|
|
10
10
|
* Implementation
|
|
11
11
|
*/
|
|
12
12
|
var Kushki = /** @class */ (function () {
|
|
13
|
+
// tslint:disable-next-line:max-func-body-length
|
|
13
14
|
function Kushki(body) {
|
|
14
15
|
body.inTestEnvironment =
|
|
15
16
|
body.inTestEnvironment === undefined ? false : body.inTestEnvironment;
|
|
@@ -31,6 +32,8 @@ var Kushki = /** @class */ (function () {
|
|
|
31
32
|
this._mobileProcessorService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.MobileProcessorService)();
|
|
32
33
|
this._authService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.AuthService)();
|
|
33
34
|
this._kPayService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.KPayService)();
|
|
35
|
+
this._cardDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardDynamicService)();
|
|
36
|
+
this._cardSubscriptionDynamicService = Container_1.CONTAINER.get(Identifiers_1.IDENTIFIERS.CardSubscriptionDynamicService)();
|
|
34
37
|
}
|
|
35
38
|
Kushki.prototype.requestToken = function (body, callback) {
|
|
36
39
|
this._resolve(this._cardService.requestToken(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
@@ -121,8 +124,14 @@ var Kushki = /** @class */ (function () {
|
|
|
121
124
|
Kushki.prototype.requestMobileProcessorToken = function (body, callback) {
|
|
122
125
|
this._resolve(this._mobileProcessorService.requestToken(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
123
126
|
};
|
|
127
|
+
Kushki.prototype.requestCardDynamicToken = function (bin, body, callback) {
|
|
128
|
+
this._resolve(this._cardDynamicService.requestCardDynamicToken(bin, body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
129
|
+
};
|
|
130
|
+
Kushki.prototype.requestCardSubscriptionDynamicToken = function (bin, body, callback) {
|
|
131
|
+
this._resolve(this._cardSubscriptionDynamicService.requestCardSubscriptionDynamicToken(bin, body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
132
|
+
};
|
|
124
133
|
Kushki.prototype.requestInitAuth = function (body, callback) {
|
|
125
|
-
this._resolve(this._authService.requestInitAuth(body), callback);
|
|
134
|
+
this._resolve(this._authService.requestInitAuth(body, this._inTestEnvironment), callback);
|
|
126
135
|
};
|
|
127
136
|
Kushki.prototype.deletePaymentMethod = function (body, callback) {
|
|
128
137
|
this._resolve(this._kPayService.deletePaymentMethod(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
@@ -131,7 +140,10 @@ var Kushki = /** @class */ (function () {
|
|
|
131
140
|
this._resolve(this._kPayService.requestSavedPaymentMethods(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
132
141
|
};
|
|
133
142
|
Kushki.prototype.requestVerifyAuth = function (body, callback) {
|
|
134
|
-
this._resolve(this._authService.requestVerifyAuth(body.code), callback);
|
|
143
|
+
this._resolve(this._authService.requestVerifyAuth(body.code, this._inTestEnvironment), callback);
|
|
144
|
+
};
|
|
145
|
+
Kushki.prototype.validateSession = function (callback) {
|
|
146
|
+
this._resolve(this._authService.validateSession(this._inTestEnvironment), callback);
|
|
135
147
|
};
|
|
136
148
|
Kushki._callbackError = function (err, callback) {
|
|
137
149
|
if (err instanceof KushkiError_1.KushkiError)
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
export declare type containerSymbol = {
|
|
6
6
|
AntiFraud: symbol;
|
|
7
7
|
CardService: symbol;
|
|
8
|
+
CardDynamicService: symbol;
|
|
8
9
|
CashService: symbol;
|
|
10
|
+
CardSubscriptionDynamicService: symbol;
|
|
9
11
|
KushkiGateway: symbol;
|
|
10
12
|
MultiMerchantService: symbol;
|
|
11
13
|
KushkiService: symbol;
|
|
@@ -8,7 +8,9 @@ var IDENTIFIERS = {
|
|
|
8
8
|
AntiFraud: Symbol["for"]("AntiFraud"),
|
|
9
9
|
AuthService: Symbol["for"]("AuthService"),
|
|
10
10
|
CardAsyncService: Symbol["for"]("CardAsyncService"),
|
|
11
|
+
CardDynamicService: Symbol["for"]("CardDynamicService"),
|
|
11
12
|
CardService: Symbol["for"]("CardService"),
|
|
13
|
+
CardSubscriptionDynamicService: Symbol["for"]("CardSubscriptionDynamicService"),
|
|
12
14
|
CashService: Symbol["for"]("CashService"),
|
|
13
15
|
CommissionService: Symbol["for"]("CommissionService"),
|
|
14
16
|
KPayService: Symbol["for"]("KPayService"),
|
|
@@ -43,13 +43,14 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
43
43
|
private readonly _contentJSON;
|
|
44
44
|
private _uatUrl;
|
|
45
45
|
private _prodUrl;
|
|
46
|
+
private _kshAuthorization;
|
|
46
47
|
request<T = object>(body: object, headers: object, path: string, testEnv: boolean, regional: boolean): Observable<T>;
|
|
47
48
|
requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string): Observable<T>;
|
|
48
49
|
requestDelete<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<T>;
|
|
49
50
|
requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
|
|
50
51
|
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
|
|
51
52
|
requestTokenCharge(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
52
|
-
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
53
|
+
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
|
|
53
54
|
requestTransferToken(body: TransferTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
54
55
|
requestMerchantSettings(mid: string, testEnv: boolean, regional: boolean): Observable<MerchantSettingsResponse>;
|
|
55
56
|
requestPseBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
|
|
@@ -69,7 +70,7 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
69
70
|
requestPayoutsTransferBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
|
|
70
71
|
requestMobileProcessorToken(body: MobileProcessorTokenRequest, publicCredential: string, testEnv: boolean, regional: boolean): Observable<MobileProcessorTokenResponse>;
|
|
71
72
|
chargeMobileProcessor(body: MobileProcessorChargeRequest, publicCredential: string, testEnv: boolean, regional: boolean): Observable<MobileProcessorChargeResponse>;
|
|
72
|
-
deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<boolean>;
|
|
73
|
+
deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
|
|
73
74
|
requestSavedPaymentMethods(body: SavedPaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<PaymentDataResponse[]>;
|
|
74
75
|
cybersourceJwt(mid: string, testEnv: boolean, regional: boolean): Observable<string>;
|
|
75
76
|
private _assignChannel;
|
|
@@ -41,6 +41,7 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
41
41
|
this._contentJSON = "application/json";
|
|
42
42
|
this._uatUrl = "";
|
|
43
43
|
this._prodUrl = "";
|
|
44
|
+
this._kshAuthorization = "KSH-Authorization";
|
|
44
45
|
}
|
|
45
46
|
KushkiGateway_1 = KushkiGateway;
|
|
46
47
|
KushkiGateway._aurusError = function (data) {
|
|
@@ -78,7 +79,7 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
78
79
|
return axios_1["default"]["delete"]("" + (testEnv ? _this._uatUrl : _this._prodUrl), {
|
|
79
80
|
headers: (_a = {},
|
|
80
81
|
_a[_this._contentHeader] = _this._contentJSON,
|
|
81
|
-
_a[
|
|
82
|
+
_a[_this._kshAuthorization] = authorization,
|
|
82
83
|
_a[_this._publicHeader] = mid,
|
|
83
84
|
_a)
|
|
84
85
|
});
|
|
@@ -94,7 +95,7 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
94
95
|
return rxjs_1.iif(function () { return authorization === undefined; }, _this.request(body, (_a = {},
|
|
95
96
|
_a[_this._publicHeader] = mid,
|
|
96
97
|
_a), PathEnum_1.PathEnum.card_tokens, testEnv, regional), _this.request(body, (_b = {},
|
|
97
|
-
_b[
|
|
98
|
+
_b[_this._kshAuthorization] = authorization,
|
|
98
99
|
_b[_this._publicHeader] = mid,
|
|
99
100
|
_b), PathEnum_1.PathEnum.card_tokens, testEnv, regional));
|
|
100
101
|
}));
|
|
@@ -105,10 +106,16 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
105
106
|
return _this.request(body, _this._buildHeader(mid), "" + PathEnum_1.PathEnum.card_token_charge + body.subscriptionId + "/tokens", testEnv, regional);
|
|
106
107
|
}));
|
|
107
108
|
};
|
|
108
|
-
KushkiGateway.prototype.requestSubscriptionToken = function (body, mid, testEnv, regional) {
|
|
109
|
+
KushkiGateway.prototype.requestSubscriptionToken = function (body, mid, testEnv, regional, authorization) {
|
|
109
110
|
var _this = this;
|
|
110
111
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
111
|
-
|
|
112
|
+
var _a, _b;
|
|
113
|
+
return rxjs_1.iif(function () { return authorization === undefined; }, _this.request(body, (_a = {},
|
|
114
|
+
_a[_this._publicHeader] = mid,
|
|
115
|
+
_a), PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional), _this.request(body, (_b = {},
|
|
116
|
+
_b[_this._kshAuthorization] = authorization,
|
|
117
|
+
_b[_this._publicHeader] = mid,
|
|
118
|
+
_b), PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional));
|
|
112
119
|
}), operators_1.map(function (response) { return response; }));
|
|
113
120
|
};
|
|
114
121
|
KushkiGateway.prototype.requestTransferToken = function (body, mid, testEnv, regional) {
|
|
@@ -225,10 +232,10 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
225
232
|
return _this.request(body, _this._buildHeader(publicCredential), PathEnum_1.PathEnum.mobile_processor_charge, testEnv, regional);
|
|
226
233
|
}), operators_1.map(function (response) { return response; }));
|
|
227
234
|
};
|
|
228
|
-
KushkiGateway.prototype.deletePaymentMethod = function (body, testEnv, regional, mid) {
|
|
235
|
+
KushkiGateway.prototype.deletePaymentMethod = function (body, testEnv, regional, mid, authorization) {
|
|
229
236
|
var _this = this;
|
|
230
237
|
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
231
|
-
return _this.requestDelete(PathEnum_1.PathEnum.kpay_delete_payment_method + "/" + body.walletId, testEnv, regional, mid,
|
|
238
|
+
return _this.requestDelete(PathEnum_1.PathEnum.kpay_delete_payment_method + "/" + body.walletId, testEnv, regional, mid, authorization);
|
|
232
239
|
}), operators_1.map(function (response) { return !!response; }));
|
|
233
240
|
};
|
|
234
241
|
KushkiGateway.prototype.requestSavedPaymentMethods = function (body, testEnv, regional, mid) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BinInfo cardType Enum
|
|
4
|
+
*/
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.BinCardTypeEnum = void 0;
|
|
7
|
+
var BinCardTypeEnum;
|
|
8
|
+
(function (BinCardTypeEnum) {
|
|
9
|
+
BinCardTypeEnum["debit"] = "debit";
|
|
10
|
+
BinCardTypeEnum["credit"] = "credit";
|
|
11
|
+
})(BinCardTypeEnum = exports.BinCardTypeEnum || (exports.BinCardTypeEnum = {}));
|
|
@@ -10,7 +10,9 @@ var SiftScience_1 = require("./../../lib/gateway/SiftScience");
|
|
|
10
10
|
var inversify_1 = require("inversify");
|
|
11
11
|
var AuthService_1 = require("./../../lib/service/AuthService");
|
|
12
12
|
var CardAsyncService_1 = require("./../../lib/service/CardAsyncService");
|
|
13
|
+
var CardDynamicService_1 = require("./../../lib/service/CardDynamicService");
|
|
13
14
|
var CardService_1 = require("./../../lib/service/CardService");
|
|
15
|
+
var CardSubscriptionDynamicService_1 = require("./../../lib/service/CardSubscriptionDynamicService");
|
|
14
16
|
var CashService_1 = require("./../../lib/service/CashService");
|
|
15
17
|
var CommissionService_1 = require("./../../lib/service/CommissionService");
|
|
16
18
|
var KPayService_1 = require("./../../lib/service/KPayService");
|
|
@@ -25,12 +27,21 @@ var TransferSubscriptionsService_1 = require("./../../lib/service/TransferSubscr
|
|
|
25
27
|
var CONTAINER = new inversify_1.Container();
|
|
26
28
|
exports.CONTAINER = CONTAINER;
|
|
27
29
|
// Service
|
|
30
|
+
CONTAINER.bind(Identifiers_1.IDENTIFIERS.AuthService).toFactory(function (context) { return function () {
|
|
31
|
+
return new AuthService_1.AuthService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway));
|
|
32
|
+
}; });
|
|
28
33
|
CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardService).toFactory(function (context) { return function (regional) {
|
|
29
|
-
return new CardService_1.CardService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional));
|
|
34
|
+
return 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
35
|
}; });
|
|
31
36
|
CONTAINER.bind(Identifiers_1.IDENTIFIERS.CashService).toFactory(function (context) { return function (regional) {
|
|
32
37
|
return new CashService_1.CashService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional));
|
|
33
38
|
}; });
|
|
39
|
+
CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardDynamicService).toFactory(function (context) { return function () {
|
|
40
|
+
return new CardDynamicService_1.CardDynamicService(context.container.get(Identifiers_1.IDENTIFIERS.CardService)(), context.container.get(Identifiers_1.IDENTIFIERS.CardAsyncService)());
|
|
41
|
+
}; });
|
|
42
|
+
CONTAINER.bind(Identifiers_1.IDENTIFIERS.CardSubscriptionDynamicService).toFactory(function (context) { return function () {
|
|
43
|
+
return new CardSubscriptionDynamicService_1.CardSubscriptionDynamicService(context.container.get(Identifiers_1.IDENTIFIERS.CardService)(), context.container.get(Identifiers_1.IDENTIFIERS.CardAsyncService)());
|
|
44
|
+
}; });
|
|
34
45
|
CONTAINER.bind(Identifiers_1.IDENTIFIERS.MobileProcessorService).toFactory(function (context) { return function () {
|
|
35
46
|
return new MobileProcessorService_1.MobileProcessorService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway));
|
|
36
47
|
}; });
|
|
@@ -61,11 +72,8 @@ CONTAINER.bind(Identifiers_1.IDENTIFIERS.TransferSubscriptionService).toFactory(
|
|
|
61
72
|
CONTAINER.bind(Identifiers_1.IDENTIFIERS.PayoutsTransferService).toFactory(function (context) { return function (regional) {
|
|
62
73
|
return new PayoutsTransferService_1.PayoutsTransferService(context.container.get(Identifiers_1.IDENTIFIERS.AntiFraud)(regional), context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway));
|
|
63
74
|
}; });
|
|
64
|
-
CONTAINER.bind(Identifiers_1.IDENTIFIERS.
|
|
65
|
-
return new
|
|
66
|
-
}; });
|
|
67
|
-
CONTAINER.bind(Identifiers_1.IDENTIFIERS.KPayService).toFactory(function (context) { return function () {
|
|
68
|
-
return new KPayService_1.KPayService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway));
|
|
75
|
+
CONTAINER.bind(Identifiers_1.IDENTIFIERS.KPayService).toFactory(function (context) { return function (regional) {
|
|
76
|
+
return new KPayService_1.KPayService(context.container.get(Identifiers_1.IDENTIFIERS.KushkiGateway), context.container.get(Identifiers_1.IDENTIFIERS.AuthService)(regional));
|
|
69
77
|
}; });
|
|
70
78
|
// Gateway
|
|
71
79
|
CONTAINER.bind(Identifiers_1.IDENTIFIERS.KushkiGateway).to(KushkiGateway_1.KushkiGateway);
|
|
@@ -15,6 +15,7 @@ var ErrorCode;
|
|
|
15
15
|
ErrorCode["E008"] = "E008";
|
|
16
16
|
ErrorCode["E009"] = "E009";
|
|
17
17
|
ErrorCode["E010"] = "E010";
|
|
18
|
+
ErrorCode["E011"] = "E011";
|
|
18
19
|
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
|
19
20
|
exports.ERRORS = (_a = {},
|
|
20
21
|
_a[ErrorCode.E001] = {
|
|
@@ -67,4 +68,9 @@ exports.ERRORS = (_a = {},
|
|
|
67
68
|
message: "Es necesaria la verificación de autenticación del usuario.",
|
|
68
69
|
statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest
|
|
69
70
|
},
|
|
71
|
+
_a[ErrorCode.E011] = {
|
|
72
|
+
code: ErrorCode.E011,
|
|
73
|
+
message: "Sesión no disponible.",
|
|
74
|
+
statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest
|
|
75
|
+
},
|
|
70
76
|
_a);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = 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 = {}));
|
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
import { Observable } from "rxjs";
|
|
6
6
|
import { InitAuthRequest } from "./../../lib/types/init_auth_request";
|
|
7
7
|
import { InitAuthResponse } from "./../../lib/types/init_auth_response";
|
|
8
|
+
import { ValidateSessionResponse } from "./../../lib/types/validate_session_response";
|
|
8
9
|
import { VerifyAuthResponse } from "./../../lib/types/verify_auth_response";
|
|
9
10
|
export interface IAuthService {
|
|
10
11
|
/**
|
|
11
12
|
* Get Log in credentials
|
|
12
13
|
* @param body - required mail from user and name as a optional value
|
|
14
|
+
* @param isTesEnvironment
|
|
13
15
|
*/
|
|
14
|
-
requestInitAuth(body: InitAuthRequest): Observable<InitAuthResponse>;
|
|
15
|
-
requestVerifyAuth(code: string): Observable<VerifyAuthResponse>;
|
|
16
|
+
requestInitAuth(body: InitAuthRequest, isTesEnvironment: boolean): Observable<InitAuthResponse>;
|
|
17
|
+
requestVerifyAuth(code: string, isTesEnvironment: boolean): Observable<VerifyAuthResponse>;
|
|
18
|
+
validateSession(isTesEnvironment: boolean): Observable<ValidateSessionResponse>;
|
|
19
|
+
getAuthorizationToken(): Observable<string>;
|
|
16
20
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
/**
|
|
3
|
+
* ICardDynamicService
|
|
4
|
+
*/
|
|
5
|
+
import { Observable } from "rxjs";
|
|
6
|
+
import { BinBody } from "./../../lib/types/bin_body";
|
|
7
|
+
import { CardAsyncTokenRequest } from "./../../lib/types/card_async_token_request";
|
|
8
|
+
import { CardAsyncTokenResponse } from "./../../lib/types/card_async_token_response";
|
|
9
|
+
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
10
|
+
import { TokenRequest } from "./../../lib/types/token_request";
|
|
11
|
+
export interface ICardDynamicService {
|
|
12
|
+
requestCardDynamicToken(bin: BinBody, body: CardAsyncTokenRequest | TokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<CardAsyncTokenResponse | TokenResponse>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
/**
|
|
3
|
+
* ICardDynamicService
|
|
4
|
+
*/
|
|
5
|
+
import { Observable } from "rxjs";
|
|
6
|
+
import { BinBody } from "./../../lib/types/bin_body";
|
|
7
|
+
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
8
|
+
import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscription_card_async_token_request";
|
|
9
|
+
import { SubscriptionCardAsyncTokenResponse } from "./../../lib/types/subscription_card_async_token_response";
|
|
10
|
+
import { SubscriptionTokenRequest } from "./../../lib/types/subscription_token_request";
|
|
11
|
+
export interface ICardSubscriptionDynamicService {
|
|
12
|
+
requestCardSubscriptionDynamicToken(bin: BinBody, body: SubscriptionCardAsyncTokenRequest | SubscriptionTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<SubscriptionCardAsyncTokenResponse | TokenResponse>;
|
|
13
|
+
}
|
|
@@ -144,8 +144,9 @@ export interface IKushkiGateway {
|
|
|
144
144
|
* @param testEnv
|
|
145
145
|
* @param mid - public credential for request
|
|
146
146
|
* @param regional - Define if endpoint used regional URL
|
|
147
|
+
* @param authorization
|
|
147
148
|
*/
|
|
148
|
-
deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<boolean>;
|
|
149
|
+
deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
|
|
149
150
|
/**
|
|
150
151
|
* @param body
|
|
151
152
|
* @param testEnv
|
|
@@ -5,6 +5,7 @@ import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
|
|
|
5
5
|
import { Observable } from "rxjs";
|
|
6
6
|
import { InitAuthRequest } from "./../../lib/types/init_auth_request";
|
|
7
7
|
import { InitAuthResponse } from "./../../lib/types/init_auth_response";
|
|
8
|
+
import { ValidateSessionResponse } from "./../../lib/types/validate_session_response";
|
|
8
9
|
import { VerifyAuthResponse } from "./../../lib/types/verify_auth_response";
|
|
9
10
|
/**
|
|
10
11
|
* Implementation
|
|
@@ -13,14 +14,18 @@ export declare class AuthService implements IAuthService {
|
|
|
13
14
|
private readonly _gateway;
|
|
14
15
|
private _cognitoUser?;
|
|
15
16
|
constructor(gateway: IKushkiGateway);
|
|
16
|
-
requestInitAuth(body: InitAuthRequest): Observable<InitAuthResponse>;
|
|
17
|
-
requestVerifyAuth(code: string): Observable<VerifyAuthResponse>;
|
|
17
|
+
requestInitAuth(body: InitAuthRequest, isTesEnvironment: boolean): Observable<InitAuthResponse>;
|
|
18
|
+
requestVerifyAuth(code: string, isTesEnvironment: boolean): Observable<VerifyAuthResponse>;
|
|
19
|
+
validateSession(isTesEnvironment: boolean): Observable<ValidateSessionResponse>;
|
|
20
|
+
getAuthorizationToken(): Observable<string>;
|
|
21
|
+
private _currentAuthenticatedUser;
|
|
18
22
|
private _verifyCurrentSession;
|
|
19
23
|
private _handleInitAuth;
|
|
20
24
|
private _validateCurrentSession;
|
|
25
|
+
private _getCurrentUserEmail;
|
|
21
26
|
private _signOut;
|
|
22
|
-
private static _configureAmplifyCredentials;
|
|
23
|
-
private static _getRandomString;
|
|
24
27
|
private _userSignIn;
|
|
25
28
|
private _userSignInPasswordles;
|
|
29
|
+
private static _configureAmplifyCredentials;
|
|
30
|
+
private static _getRandomString;
|
|
26
31
|
}
|
|
@@ -11,41 +11,100 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
+
function step(op) {
|
|
28
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
+
while (_) try {
|
|
30
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
31
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
+
switch (op[0]) {
|
|
33
|
+
case 0: case 1: t = op; break;
|
|
34
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
+
default:
|
|
38
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
+
if (t[2]) _.ops.pop();
|
|
43
|
+
_.trys.pop(); continue;
|
|
44
|
+
}
|
|
45
|
+
op = body.call(thisArg, _);
|
|
46
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
14
50
|
exports.__esModule = true;
|
|
15
51
|
exports.AuthService = void 0;
|
|
16
52
|
var aws_amplify_1 = require("aws-amplify");
|
|
53
|
+
var axios_1 = require("axios");
|
|
17
54
|
var Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
18
55
|
var KushkiError_1 = require("./../../lib/generic/KushkiError");
|
|
19
56
|
var CognitoErrorEnum_1 = require("./../../lib/infrastructure/CognitoErrorEnum");
|
|
20
57
|
var ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
|
|
58
|
+
var KPayUserPoolEnum_1 = require("./../../lib/infrastructure/KPayUserPoolEnum");
|
|
21
59
|
var inversify_1 = require("inversify");
|
|
22
|
-
var lodash_1 = require("lodash");
|
|
23
60
|
require("reflect-metadata");
|
|
24
61
|
var rxjs_1 = require("rxjs");
|
|
25
62
|
var operators_1 = require("rxjs/operators");
|
|
63
|
+
var UtilsService_1 = require("./../../lib/service/UtilsService");
|
|
26
64
|
/**
|
|
27
65
|
* Implementation
|
|
28
66
|
*/
|
|
29
67
|
var AuthService = /** @class */ (function () {
|
|
30
68
|
function AuthService(gateway) {
|
|
31
69
|
this._gateway = gateway;
|
|
32
|
-
AuthService_1._configureAmplifyCredentials();
|
|
33
70
|
}
|
|
34
71
|
AuthService_1 = AuthService;
|
|
35
|
-
AuthService.prototype.requestInitAuth = function (body) {
|
|
72
|
+
AuthService.prototype.requestInitAuth = function (body, isTesEnvironment) {
|
|
36
73
|
var _this = this;
|
|
37
|
-
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () {
|
|
38
|
-
return
|
|
74
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () {
|
|
75
|
+
return AuthService_1._configureAmplifyCredentials(isTesEnvironment);
|
|
76
|
+
}), operators_1.mergeMap(function () { return _this._validateCurrentSession(body.email); }), operators_1.mergeMap(function (sessionJwt) {
|
|
77
|
+
return rxjs_1.iif(function () { return !!sessionJwt; }, rxjs_1.of({ result: true }), _this._handleInitAuth(body.email));
|
|
39
78
|
}));
|
|
40
79
|
};
|
|
41
|
-
AuthService.prototype.requestVerifyAuth = function (code) {
|
|
80
|
+
AuthService.prototype.requestVerifyAuth = function (code, isTesEnvironment) {
|
|
42
81
|
var _this = this;
|
|
43
82
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
83
|
+
return AuthService_1._configureAmplifyCredentials(isTesEnvironment);
|
|
84
|
+
}), operators_1.concatMap(function () {
|
|
44
85
|
return rxjs_1.from(aws_amplify_1.Auth.sendCustomChallengeAnswer(_this._cognitoUser, code));
|
|
45
86
|
}), operators_1.catchError(function () { return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E009)); }), operators_1.concatMap(function () { return _this._verifyCurrentSession(); }), operators_1.map(function (session) { return ({
|
|
46
87
|
authorization: session.getRefreshToken().getToken()
|
|
47
88
|
}); }));
|
|
48
89
|
};
|
|
90
|
+
AuthService.prototype.validateSession = function (isTesEnvironment) {
|
|
91
|
+
var _this = this;
|
|
92
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
93
|
+
return AuthService_1._configureAmplifyCredentials(isTesEnvironment);
|
|
94
|
+
}), operators_1.concatMap(function () { return _this._getCurrentUserEmail(); }));
|
|
95
|
+
};
|
|
96
|
+
AuthService.prototype.getAuthorizationToken = function () {
|
|
97
|
+
var _this = this;
|
|
98
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () { return _this._currentAuthenticatedUser(); }), operators_1.mergeMap(function (cognitoUser) {
|
|
99
|
+
var session = cognitoUser ? cognitoUser.getSignInUserSession() : null;
|
|
100
|
+
if (!session)
|
|
101
|
+
return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E011));
|
|
102
|
+
return rxjs_1.of(session.getAccessToken().getJwtToken());
|
|
103
|
+
}), operators_1.catchError(function () { return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E011)); }));
|
|
104
|
+
};
|
|
105
|
+
AuthService.prototype._currentAuthenticatedUser = function () {
|
|
106
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () { return rxjs_1.from(aws_amplify_1.Auth.currentAuthenticatedUser()); }));
|
|
107
|
+
};
|
|
49
108
|
AuthService.prototype._verifyCurrentSession = function () {
|
|
50
109
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () { return rxjs_1.from(aws_amplify_1.Auth.currentSession()); }), operators_1.catchError(function () { return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E008)); }));
|
|
51
110
|
};
|
|
@@ -64,16 +123,16 @@ var AuthService = /** @class */ (function () {
|
|
|
64
123
|
username: email
|
|
65
124
|
};
|
|
66
125
|
return rxjs_1.from(aws_amplify_1.Auth.signUp(params));
|
|
67
|
-
}), operators_1.concatMap(function () { return _this._userSignIn(email, password); }), operators_1.
|
|
126
|
+
}), operators_1.concatMap(function () { return _this._userSignIn(email, password); }), operators_1.concatMap(function (cognitoUser) {
|
|
68
127
|
_this._cognitoUser = cognitoUser;
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
128
|
+
return cognitoUser
|
|
129
|
+
.getSignInUserSession()
|
|
130
|
+
.getAccessToken()
|
|
131
|
+
.getJwtToken();
|
|
132
|
+
}), operators_1.concatMap(function (authorization) {
|
|
133
|
+
return rxjs_1.iif(function () { return !!authorization; }, rxjs_1.of({ result: true }), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E001)));
|
|
75
134
|
}), operators_1.catchError(function (error) {
|
|
76
|
-
var error_code =
|
|
135
|
+
var error_code = UtilsService_1.UtilsService.sGet(error, "code", "");
|
|
77
136
|
return rxjs_1.iif(function () { return error_code === CognitoErrorEnum_1.CognitoErrorEnum.UsernameExistsException; }, _this._userSignInPasswordles(email), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E007)));
|
|
78
137
|
}));
|
|
79
138
|
};
|
|
@@ -90,24 +149,55 @@ var AuthService = /** @class */ (function () {
|
|
|
90
149
|
return rxjs_1.of(session.getAccessToken().getJwtToken());
|
|
91
150
|
}), operators_1.catchError(function () { return _this._signOut(); }));
|
|
92
151
|
};
|
|
152
|
+
AuthService.prototype._getCurrentUserEmail = function () {
|
|
153
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(function () { return aws_amplify_1.Auth.currentUserInfo(); }), operators_1.concatMap(function (currentInfo) {
|
|
154
|
+
return rxjs_1.iif(function () { return !!currentInfo.attributes.email; }, rxjs_1.of({
|
|
155
|
+
email: currentInfo.attributes.email.toLowerCase()
|
|
156
|
+
}), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E011)));
|
|
157
|
+
}), operators_1.catchError(function () { return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E011)); }));
|
|
158
|
+
};
|
|
93
159
|
AuthService.prototype._signOut = function () {
|
|
94
160
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () { return aws_amplify_1.Auth.signOut(); }), operators_1.mapTo(false));
|
|
95
161
|
};
|
|
96
|
-
AuthService.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
162
|
+
AuthService.prototype._userSignIn = function (email, password) {
|
|
163
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(function () { return rxjs_1.from(aws_amplify_1.Auth.signIn(email, password)); }));
|
|
164
|
+
};
|
|
165
|
+
AuthService.prototype._userSignInPasswordles = function (email) {
|
|
166
|
+
var _this = this;
|
|
167
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () { return rxjs_1.from(aws_amplify_1.Auth.signIn(email)); }), operators_1.mergeMap(function (cognitoUser) {
|
|
168
|
+
_this._cognitoUser = cognitoUser;
|
|
169
|
+
return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E010));
|
|
170
|
+
}));
|
|
171
|
+
};
|
|
172
|
+
AuthService._configureAmplifyCredentials = function (test) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
var remote_kpay_user_pool_url, cognito_config, auth;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
remote_kpay_user_pool_url = "" + (test ? KPayUserPoolEnum_1.KPayUserPoolEnum.uat : KPayUserPoolEnum_1.KPayUserPoolEnum.prod);
|
|
179
|
+
return [4 /*yield*/, axios_1["default"].get(remote_kpay_user_pool_url)];
|
|
180
|
+
case 1:
|
|
181
|
+
cognito_config = (_a.sent()).data;
|
|
182
|
+
auth = {
|
|
183
|
+
cognito: {
|
|
184
|
+
APP_CLIENT_ID: cognito_config.appClientId,
|
|
185
|
+
REGION: cognito_config.region,
|
|
186
|
+
USER_POOL_ID: cognito_config.userPoolId
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
aws_amplify_1.Auth.configure({
|
|
190
|
+
Auth: {
|
|
191
|
+
mandatorySignId: true,
|
|
192
|
+
region: auth.cognito.REGION,
|
|
193
|
+
storage: window.sessionStorage,
|
|
194
|
+
userPoolId: auth.cognito.USER_POOL_ID,
|
|
195
|
+
userPoolWebClientId: auth.cognito.APP_CLIENT_ID
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
return [2 /*return*/];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
111
201
|
});
|
|
112
202
|
};
|
|
113
203
|
AuthService._getRandomString = function () {
|
|
@@ -122,16 +212,6 @@ var AuthService = /** @class */ (function () {
|
|
|
122
212
|
.toUpperCase()
|
|
123
213
|
.slice(2));
|
|
124
214
|
};
|
|
125
|
-
AuthService.prototype._userSignIn = function (email, password) {
|
|
126
|
-
return rxjs_1.of(1).pipe(operators_1.concatMap(function () { return rxjs_1.from(aws_amplify_1.Auth.signIn(email, password)); }));
|
|
127
|
-
};
|
|
128
|
-
AuthService.prototype._userSignInPasswordles = function (email) {
|
|
129
|
-
var _this = this;
|
|
130
|
-
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () { return rxjs_1.from(aws_amplify_1.Auth.signIn(email)); }), operators_1.mergeMap(function (cognitoUser) {
|
|
131
|
-
_this._cognitoUser = cognitoUser;
|
|
132
|
-
return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E010));
|
|
133
|
-
}));
|
|
134
|
-
};
|
|
135
215
|
var AuthService_1;
|
|
136
216
|
AuthService = AuthService_1 = __decorate([
|
|
137
217
|
inversify_1.injectable(),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
import { ICardAsyncService } from "./../../lib/repository/ICardAsyncService";
|
|
3
|
+
import { ICardDynamicService } from "./../../lib/repository/ICardDynamicService";
|
|
4
|
+
import { ICardService } from "./../../lib/repository/ICardService";
|
|
5
|
+
import { Observable } from "rxjs";
|
|
6
|
+
import { BinBody } from "./../../lib/types/bin_body";
|
|
7
|
+
import { CardAsyncTokenRequest } from "./../../lib/types/card_async_token_request";
|
|
8
|
+
import { CardAsyncTokenResponse } from "./../../lib/types/card_async_token_response";
|
|
9
|
+
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
10
|
+
import { TokenRequest } from "./../../lib/types/token_request";
|
|
11
|
+
/**
|
|
12
|
+
* Implementation
|
|
13
|
+
*/
|
|
14
|
+
export declare class CardDynamicService implements ICardDynamicService {
|
|
15
|
+
private readonly _cardService;
|
|
16
|
+
private readonly _cardAsyncService;
|
|
17
|
+
constructor(cardService: ICardService, cardAsyncService: ICardAsyncService);
|
|
18
|
+
requestCardDynamicToken(bin: BinBody, body: CardAsyncTokenRequest | TokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<CardAsyncTokenResponse | TokenResponse>;
|
|
19
|
+
private _requestCardAsyncToken;
|
|
20
|
+
private _requestToken;
|
|
21
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
exports.__esModule = true;
|
|
15
|
+
exports.CardDynamicService = void 0;
|
|
16
|
+
/**
|
|
17
|
+
* CardDynamic Service
|
|
18
|
+
*/
|
|
19
|
+
var Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
20
|
+
var BinCardTypeEnum_1 = require("./../../lib/infrastructure/BinCardTypeEnum");
|
|
21
|
+
var inversify_1 = require("inversify");
|
|
22
|
+
var rxjs_1 = require("rxjs");
|
|
23
|
+
var operators_1 = require("rxjs/operators");
|
|
24
|
+
/**
|
|
25
|
+
* Implementation
|
|
26
|
+
*/
|
|
27
|
+
var CardDynamicService = /** @class */ (function () {
|
|
28
|
+
function CardDynamicService(cardService, cardAsyncService) {
|
|
29
|
+
this._cardService = cardService;
|
|
30
|
+
this._cardAsyncService = cardAsyncService;
|
|
31
|
+
}
|
|
32
|
+
CardDynamicService.prototype.requestCardDynamicToken = function (bin, body, mid, testEnv, regional) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
35
|
+
return _this._cardService.requestBinInfo(bin, mid, testEnv, regional);
|
|
36
|
+
}), operators_1.concatMap(function (binInfo) {
|
|
37
|
+
return rxjs_1.iif(function () { return binInfo.cardType === BinCardTypeEnum_1.BinCardTypeEnum.debit; }, _this._requestCardAsyncToken(body, mid, testEnv, regional), _this._requestToken(body, mid, testEnv, regional));
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
CardDynamicService.prototype._requestCardAsyncToken = function (body, mid, testEnv, regional) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () {
|
|
43
|
+
return _this._cardAsyncService.requestCardAsyncToken(body, mid, testEnv, regional);
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
CardDynamicService.prototype._requestToken = function (body, mid, testEnv, regional) {
|
|
47
|
+
var _this = this;
|
|
48
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () {
|
|
49
|
+
return _this._cardService.requestToken(body, mid, testEnv, regional);
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
CardDynamicService = __decorate([
|
|
53
|
+
inversify_1.injectable(),
|
|
54
|
+
__param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardService)),
|
|
55
|
+
__param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardAsyncService)),
|
|
56
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
57
|
+
], CardDynamicService);
|
|
58
|
+
return CardDynamicService;
|
|
59
|
+
}());
|
|
60
|
+
exports.CardDynamicService = CardDynamicService;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* tslint:disable:all */
|
|
2
2
|
import "reflect-metadata";
|
|
3
3
|
import { IAntiFraud } from "./../../lib/repository/IAntiFraud";
|
|
4
|
+
import { IAuthService } from "./../../lib/repository/IAuthService";
|
|
4
5
|
import { ICardService } from "./../../lib/repository/ICardService";
|
|
5
6
|
import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
|
|
6
7
|
import { Observable } from "rxjs";
|
|
@@ -20,8 +21,9 @@ export declare class CardService implements ICardService {
|
|
|
20
21
|
private readonly _gateway;
|
|
21
22
|
private readonly _receipt;
|
|
22
23
|
private readonly _antiFraud;
|
|
24
|
+
private readonly _authService;
|
|
23
25
|
private readonly _3Dsecure;
|
|
24
|
-
constructor(gateway: IKushkiGateway, antiFraud: IAntiFraud);
|
|
26
|
+
constructor(gateway: IKushkiGateway, authService: IAuthService, antiFraud: IAntiFraud);
|
|
25
27
|
requestToken(request: TokenRequest | TokenKPayRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
26
28
|
requestTokenCharge(request: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
27
29
|
requestSubscriptionToken(subscriptionTokenRequest: SubscriptionTokenRequest | SubscriptionTokenKPayRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
@@ -39,10 +39,11 @@ var operators_1 = require("rxjs/operators");
|
|
|
39
39
|
* Implementation
|
|
40
40
|
*/
|
|
41
41
|
var CardService = /** @class */ (function () {
|
|
42
|
-
function CardService(gateway, antiFraud) {
|
|
42
|
+
function CardService(gateway, authService, antiFraud) {
|
|
43
43
|
this._3Dsecure = "active_3dsecure";
|
|
44
44
|
this._gateway = gateway;
|
|
45
45
|
this._antiFraud = antiFraud;
|
|
46
|
+
this._authService = authService;
|
|
46
47
|
this._receipt = {
|
|
47
48
|
amount: "totalAmount",
|
|
48
49
|
"card.cvc": "card.cvv",
|
|
@@ -54,6 +55,7 @@ var CardService = /** @class */ (function () {
|
|
|
54
55
|
isDeferred: "isDeferred",
|
|
55
56
|
jwt: "jwt",
|
|
56
57
|
months: "months",
|
|
58
|
+
savePaymentData: "savePaymentData",
|
|
57
59
|
sessionId: "sessionId",
|
|
58
60
|
userId: "userId",
|
|
59
61
|
walletId: "walletId"
|
|
@@ -69,18 +71,25 @@ var CardService = /** @class */ (function () {
|
|
|
69
71
|
? request.card.number
|
|
70
72
|
: undefined),
|
|
71
73
|
]);
|
|
72
|
-
}), operators_1.
|
|
74
|
+
}), operators_1.mergeMap(function (_a) {
|
|
73
75
|
var sift_object = _a[0], jwt = _a[1];
|
|
74
76
|
request.isDeferred =
|
|
75
77
|
request.isDeferred === undefined ? false : request.isDeferred;
|
|
76
78
|
if (Boolean(request.cvv))
|
|
77
79
|
request.card = { cvc: request.cvv };
|
|
78
80
|
_this._checkRequestBody(request);
|
|
81
|
+
var data_to_transform = __assign(__assign({}, request), sift_object);
|
|
79
82
|
if (jwt !== undefined)
|
|
80
|
-
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
data_to_transform.jwt = jwt;
|
|
84
|
+
return rxjs_1.forkJoin([
|
|
85
|
+
rxjs_1.of(dot.transform(_this._receipt, data_to_transform)),
|
|
86
|
+
request.walletId
|
|
87
|
+
? _this._authService.getAuthorizationToken()
|
|
88
|
+
: rxjs_1.of(undefined),
|
|
89
|
+
]);
|
|
90
|
+
}), operators_1.concatMap(function (_a) {
|
|
91
|
+
var final_request = _a[0], jwt = _a[1];
|
|
92
|
+
return _this._gateway.requestToken(final_request, mid, isTest, regional, jwt);
|
|
84
93
|
}));
|
|
85
94
|
};
|
|
86
95
|
CardService.prototype.requestTokenCharge = function (request, mid, isTest, regional) {
|
|
@@ -103,13 +112,20 @@ var CardService = /** @class */ (function () {
|
|
|
103
112
|
var _this = this;
|
|
104
113
|
return this._gateway.requestMerchantSettings(mid, isTest, regional).pipe(operators_1.switchMap(function (merchant) {
|
|
105
114
|
return _this._getScienceSession(subscriptionTokenRequest, mid, isTest, merchant);
|
|
106
|
-
}), operators_1.
|
|
115
|
+
}), operators_1.concatMap(function (siftObject) {
|
|
107
116
|
_this._checkRequestBody(subscriptionTokenRequest);
|
|
117
|
+
var data_to_transform = __assign({}, subscriptionTokenRequest);
|
|
108
118
|
if (siftObject.userId === null || siftObject.sessionId === null)
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
data_to_transform.siftObject = __assign({}, siftObject);
|
|
120
|
+
return rxjs_1.forkJoin([
|
|
121
|
+
rxjs_1.of(dot.transform(_this._receipt, data_to_transform)),
|
|
122
|
+
subscriptionTokenRequest.walletId
|
|
123
|
+
? _this._authService.getAuthorizationToken()
|
|
124
|
+
: rxjs_1.of(undefined),
|
|
125
|
+
]);
|
|
126
|
+
}), operators_1.switchMap(function (_a) {
|
|
127
|
+
var body = _a[0], jwt = _a[1];
|
|
128
|
+
return _this._gateway.requestSubscriptionToken(body, mid, isTest, regional, jwt);
|
|
113
129
|
}));
|
|
114
130
|
};
|
|
115
131
|
CardService.prototype.requestDeferred = function (binBody, mid, isTest, regional) {
|
|
@@ -193,8 +209,9 @@ var CardService = /** @class */ (function () {
|
|
|
193
209
|
CardService = CardService_1 = __decorate([
|
|
194
210
|
inversify_1.injectable(),
|
|
195
211
|
__param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
|
|
196
|
-
__param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.
|
|
197
|
-
|
|
212
|
+
__param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AuthService)),
|
|
213
|
+
__param(2, inversify_1.inject(Identifiers_1.IDENTIFIERS.AntiFraud)),
|
|
214
|
+
__metadata("design:paramtypes", [Object, Object, Object])
|
|
198
215
|
], CardService);
|
|
199
216
|
return CardService;
|
|
200
217
|
}());
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
import { ICardAsyncService } from "./../../lib/repository/ICardAsyncService";
|
|
3
|
+
import { ICardService } from "./../../lib/repository/ICardService";
|
|
4
|
+
import { ICardSubscriptionDynamicService } from "./../../lib/repository/ICardSubscriptionDynamicService";
|
|
5
|
+
import { Observable } from "rxjs";
|
|
6
|
+
import { BinBody } from "./../../lib/types/bin_body";
|
|
7
|
+
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
8
|
+
import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscription_card_async_token_request";
|
|
9
|
+
import { SubscriptionCardAsyncTokenResponse } from "./../../lib/types/subscription_card_async_token_response";
|
|
10
|
+
import { SubscriptionTokenRequest } from "./../../lib/types/subscription_token_request";
|
|
11
|
+
/**
|
|
12
|
+
* Implementation
|
|
13
|
+
*/
|
|
14
|
+
export declare class CardSubscriptionDynamicService implements ICardSubscriptionDynamicService {
|
|
15
|
+
private readonly _cardServiceSubscription;
|
|
16
|
+
private readonly _cardAsyncServiceSubscription;
|
|
17
|
+
constructor(cardService: ICardService, cardAsyncService: ICardAsyncService);
|
|
18
|
+
requestCardSubscriptionDynamicToken(bin: BinBody, body: SubscriptionCardAsyncTokenRequest | SubscriptionTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<SubscriptionCardAsyncTokenResponse | TokenResponse>;
|
|
19
|
+
private _requestCardSubscriptionAsyncToken;
|
|
20
|
+
private _requestCardSubscriptionToken;
|
|
21
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
exports.__esModule = true;
|
|
15
|
+
exports.CardSubscriptionDynamicService = void 0;
|
|
16
|
+
/**
|
|
17
|
+
* CardDynamic Service
|
|
18
|
+
*/
|
|
19
|
+
var Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
20
|
+
var BinCardTypeEnum_1 = require("./../../lib/infrastructure/BinCardTypeEnum");
|
|
21
|
+
var inversify_1 = require("inversify");
|
|
22
|
+
var rxjs_1 = require("rxjs");
|
|
23
|
+
var operators_1 = require("rxjs/operators");
|
|
24
|
+
/**
|
|
25
|
+
* Implementation
|
|
26
|
+
*/
|
|
27
|
+
var CardSubscriptionDynamicService = /** @class */ (function () {
|
|
28
|
+
function CardSubscriptionDynamicService(cardService, cardAsyncService) {
|
|
29
|
+
this._cardServiceSubscription = cardService;
|
|
30
|
+
this._cardAsyncServiceSubscription = cardAsyncService;
|
|
31
|
+
}
|
|
32
|
+
CardSubscriptionDynamicService.prototype.requestCardSubscriptionDynamicToken = function (bin, body, mid, testEnv, regional) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
35
|
+
return _this._cardServiceSubscription.requestBinInfo(bin, mid, testEnv, regional);
|
|
36
|
+
}), operators_1.concatMap(function (binInfo) {
|
|
37
|
+
return rxjs_1.iif(function () { return binInfo.cardType === BinCardTypeEnum_1.BinCardTypeEnum.debit; }, _this._requestCardSubscriptionAsyncToken(body, mid, testEnv, regional), _this._requestCardSubscriptionToken(body, mid, testEnv, regional));
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
CardSubscriptionDynamicService.prototype._requestCardSubscriptionAsyncToken = function (body, mid, testEnv, regional) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () {
|
|
43
|
+
return _this._cardAsyncServiceSubscription.requestCardSubscriptionAsyncToken(body, mid, testEnv, regional);
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
CardSubscriptionDynamicService.prototype._requestCardSubscriptionToken = function (body, mid, testEnv, regional) {
|
|
47
|
+
var _this = this;
|
|
48
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(function () {
|
|
49
|
+
return _this._cardServiceSubscription.requestSubscriptionToken(body, mid, testEnv, regional);
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
CardSubscriptionDynamicService = __decorate([
|
|
53
|
+
inversify_1.injectable(),
|
|
54
|
+
__param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardService)),
|
|
55
|
+
__param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardAsyncService)),
|
|
56
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
57
|
+
], CardSubscriptionDynamicService);
|
|
58
|
+
return CardSubscriptionDynamicService;
|
|
59
|
+
}());
|
|
60
|
+
exports.CardSubscriptionDynamicService = CardSubscriptionDynamicService;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* tslint:disable:all */
|
|
2
2
|
import "reflect-metadata";
|
|
3
|
+
import { IAuthService } from "./../../lib/repository/IAuthService";
|
|
3
4
|
import { IKPayService } from "./../../lib/repository/IKPayService";
|
|
4
5
|
import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
|
|
5
6
|
import { Observable } from "rxjs";
|
|
@@ -11,7 +12,8 @@ import { SavedPaymentMethodRequest } from "./../../lib/types/saved_payment_data_
|
|
|
11
12
|
*/
|
|
12
13
|
export declare class KPayService implements IKPayService {
|
|
13
14
|
private readonly _gateway;
|
|
14
|
-
|
|
15
|
+
private readonly _authService;
|
|
16
|
+
constructor(gateway: IKushkiGateway, authService: IAuthService);
|
|
15
17
|
deletePaymentMethod(body: DeletePaymentMethodRequest, mid: string, isTest: boolean, regional: boolean): Observable<boolean>;
|
|
16
18
|
requestSavedPaymentMethods(body: SavedPaymentMethodRequest, mid: string, isTest: boolean, regional: boolean): Observable<PaymentDataResponse[]>;
|
|
17
19
|
}
|
|
@@ -19,15 +19,21 @@ exports.KPayService = void 0;
|
|
|
19
19
|
var Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
20
20
|
var inversify_1 = require("inversify");
|
|
21
21
|
require("reflect-metadata");
|
|
22
|
+
var rxjs_1 = require("rxjs");
|
|
23
|
+
var operators_1 = require("rxjs/operators");
|
|
22
24
|
/**
|
|
23
25
|
* Implementation
|
|
24
26
|
*/
|
|
25
27
|
var KPayService = /** @class */ (function () {
|
|
26
|
-
function KPayService(gateway) {
|
|
28
|
+
function KPayService(gateway, authService) {
|
|
27
29
|
this._gateway = gateway;
|
|
30
|
+
this._authService = authService;
|
|
28
31
|
}
|
|
29
32
|
KPayService.prototype.deletePaymentMethod = function (body, mid, isTest, regional) {
|
|
30
|
-
|
|
33
|
+
var _this = this;
|
|
34
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(function () { return _this._authService.getAuthorizationToken(); }), operators_1.concatMap(function (jwt) {
|
|
35
|
+
return _this._gateway.deletePaymentMethod(body, isTest, regional, mid, jwt);
|
|
36
|
+
}));
|
|
31
37
|
};
|
|
32
38
|
KPayService.prototype.requestSavedPaymentMethods = function (body, mid, isTest, regional) {
|
|
33
39
|
return this._gateway.requestSavedPaymentMethods(body, isTest, regional, mid);
|
|
@@ -35,7 +41,8 @@ var KPayService = /** @class */ (function () {
|
|
|
35
41
|
KPayService = __decorate([
|
|
36
42
|
inversify_1.injectable(),
|
|
37
43
|
__param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
|
|
38
|
-
|
|
44
|
+
__param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AuthService)),
|
|
45
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
39
46
|
], KPayService);
|
|
40
47
|
return KPayService;
|
|
41
48
|
}());
|
|
@@ -18,6 +18,7 @@ export interface GenericTokenRequest {
|
|
|
18
18
|
description?: Description;
|
|
19
19
|
currency: "COP" | "USD" | "CLP" | "CRC" | "UF";
|
|
20
20
|
documentType?: "CC" | "NIT" | "CE" | "TI" | "PP" | "RUC" | "RUT" | "CI";
|
|
21
|
+
savePaymentData?: boolean;
|
|
21
22
|
[k: string]: any;
|
|
22
23
|
}
|
|
23
24
|
export interface PeruvianTokenRequest {
|
|
@@ -31,6 +32,7 @@ export interface PeruvianTokenRequest {
|
|
|
31
32
|
documentType?: "DNI" | "CE" | "PAS" | "RUC";
|
|
32
33
|
phonePrefix?: string;
|
|
33
34
|
phoneNumber?: string;
|
|
35
|
+
savePaymentData?: boolean;
|
|
34
36
|
[k: string]: any;
|
|
35
37
|
}
|
|
36
38
|
export interface BrazilianTokenRequest {
|
|
@@ -43,6 +45,7 @@ export interface BrazilianTokenRequest {
|
|
|
43
45
|
currency: "BRL";
|
|
44
46
|
documentType?: "CPF" | "CNPJ" | "RG" | "DNI" | "CI" | "CP" | "RNE";
|
|
45
47
|
userType?: string;
|
|
48
|
+
savePaymentData?: boolean;
|
|
46
49
|
[k: string]: any;
|
|
47
50
|
}
|
|
48
51
|
export interface MexicanTokenRequest {
|
|
@@ -54,5 +57,6 @@ export interface MexicanTokenRequest {
|
|
|
54
57
|
description?: Description;
|
|
55
58
|
currency: "MXN";
|
|
56
59
|
documentType?: "PP" | "RFC" | "CURP";
|
|
60
|
+
savePaymentData?: boolean;
|
|
57
61
|
[k: string]: any;
|
|
58
62
|
}
|
|
@@ -26,6 +26,7 @@ export type KushkiTransferTokensRequest =
|
|
|
26
26
|
sessionId?: string | null;
|
|
27
27
|
email?: string;
|
|
28
28
|
currency?: "COP";
|
|
29
|
+
savePaymentData?: boolean;
|
|
29
30
|
[k: string]: any;
|
|
30
31
|
}
|
|
31
32
|
| {
|
|
@@ -51,5 +52,6 @@ export type KushkiTransferTokensRequest =
|
|
|
51
52
|
sessionId?: string | null;
|
|
52
53
|
email: string;
|
|
53
54
|
currency: "CLP" | "UF";
|
|
55
|
+
savePaymentData?: boolean;
|
|
54
56
|
[k: string]: any;
|
|
55
57
|
};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
export interface SubscriptionTokenKPayRequest {
|
|
5
5
|
walletId: string;
|
|
6
|
-
|
|
7
|
-
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN";
|
|
6
|
+
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
8
7
|
[k: string]: any;
|
|
9
8
|
}
|
|
@@ -10,6 +10,7 @@ export interface SubscriptionTokenRequest {
|
|
|
10
10
|
number: string;
|
|
11
11
|
[k: string]: any;
|
|
12
12
|
};
|
|
13
|
-
currency?: "USD" | "COP" | "PEN" | "CLP" | "UF" | "MXN";
|
|
13
|
+
currency?: "USD" | "COP" | "PEN" | "CLP" | "UF" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
14
|
+
savePaymentData?: boolean;
|
|
14
15
|
[k: string]: any;
|
|
15
16
|
}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
export interface TokenKPayRequest {
|
|
5
5
|
walletId: string;
|
|
6
|
-
|
|
7
|
-
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL";
|
|
6
|
+
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
8
7
|
isDeferred?: boolean;
|
|
9
8
|
amount: number | string;
|
|
10
9
|
months?: number;
|
|
@@ -10,9 +10,10 @@ export interface TokenRequest {
|
|
|
10
10
|
number: string;
|
|
11
11
|
[k: string]: any;
|
|
12
12
|
};
|
|
13
|
-
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL";
|
|
13
|
+
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
14
14
|
isDeferred?: boolean;
|
|
15
15
|
amount: number | string;
|
|
16
16
|
months?: number;
|
|
17
|
+
savePaymentData?: boolean;
|
|
17
18
|
[k: string]: any;
|
|
18
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushki/js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0-alpha.1",
|
|
4
4
|
"description": "kushki-js",
|
|
5
5
|
"main": "lib/lib.js",
|
|
6
6
|
"types": "lib/lib.d.ts",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@types/rx": "4.1.1",
|
|
51
51
|
"@types/sinon": "7.0.11",
|
|
52
52
|
"@types/sinon-chai": "3.2.2",
|
|
53
|
+
"@types/uuid": "3.4.4",
|
|
53
54
|
"cache-loader": "3.0.0",
|
|
54
55
|
"chai": "4.2.0",
|
|
55
56
|
"copy-webpack-plugin": "5.0.3",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"fork-ts-checker-webpack-plugin": "1.2.0",
|
|
60
61
|
"gulp": "4.0.1",
|
|
61
62
|
"gulp-clean": "0.4.0",
|
|
63
|
+
"gulp-typescript": "5.0.1 ",
|
|
62
64
|
"husky": "2.1.0",
|
|
63
65
|
"jscpd": "2.0.15",
|
|
64
66
|
"jsdom": "15.0.0",
|
|
@@ -72,7 +74,9 @@
|
|
|
72
74
|
"release-it": "10.4.4",
|
|
73
75
|
"sinon": "7.3.2",
|
|
74
76
|
"sinon-chai": "3.3.0",
|
|
77
|
+
"snyk": "1.303.1",
|
|
75
78
|
"source-map-loader": "0.2.4",
|
|
79
|
+
"source-map-support": "0.5.12",
|
|
76
80
|
"terser-webpack-plugin": "^4.2.3",
|
|
77
81
|
"thread-loader": "2.1.3",
|
|
78
82
|
"ts-loader": "5.4.3",
|
|
@@ -81,16 +85,17 @@
|
|
|
81
85
|
"tsconfig-paths-webpack-plugin": "3.2.0",
|
|
82
86
|
"tslint": "5.16.0",
|
|
83
87
|
"tslint-config-prettier": "1.18.0",
|
|
88
|
+
"ts-mockery": "1.2.0",
|
|
89
|
+
"tsutils": "3.0.0",
|
|
84
90
|
"typescript": "3.9.7",
|
|
85
91
|
"webpack": "4.30.0",
|
|
86
92
|
"webpack-command": "0.4.2",
|
|
87
93
|
"webpack-dev-server": "3.3.1"
|
|
88
94
|
},
|
|
89
95
|
"dependencies": {
|
|
90
|
-
"@aws-amplify/auth": "
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"aws-amplify": "^3.3.4",
|
|
96
|
+
"@aws-amplify/auth": "3.4.22",
|
|
97
|
+
"acorn": "6.4.1",
|
|
98
|
+
"aws-amplify": "3.3.19",
|
|
94
99
|
"axios": "0.21.1",
|
|
95
100
|
"cardinal-commerce-songbird": "1.0.2",
|
|
96
101
|
"cardinal-commerce-songbird-staging": "1.0.5",
|
package/lib/.DS_Store
DELETED
|
Binary file
|