@kushki/js 1.29.1 → 1.30.0-alpha.19723
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/gateway/KushkiGateway.d.ts +1 -1
- package/lib/gateway/KushkiGateway.js +4 -2
- package/lib/repository/IKushkiGateway.d.ts +1 -1
- package/lib/service/CardService.d.ts +5 -0
- package/lib/service/CardService.js +39 -14
- package/lib/types/cash_token_request.d.ts +100 -16
- package/lib/types/jwt_response.d.ts +1 -0
- package/lib/types/subscriptionId_request.d.ts +0 -1
- package/lib/types/subscription_token_kpay_request.d.ts +1 -1
- package/lib/types/token_kpay_request.d.ts +1 -1
- package/package.json +1 -1
|
@@ -73,7 +73,7 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
73
73
|
chargeMobileProcessor(body: MobileProcessorChargeRequest, publicCredential: string, testEnv: boolean, regional: boolean): Observable<MobileProcessorChargeResponse>;
|
|
74
74
|
deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
|
|
75
75
|
requestSavedPaymentMethods(body: SavedPaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<PaymentDataResponse[]>;
|
|
76
|
-
cybersourceJwt(mid: string, testEnv: boolean, regional: boolean): Observable<string>;
|
|
76
|
+
cybersourceJwt(mid: string, testEnv: boolean, regional: boolean, subscriptionId?: string): Observable<string>;
|
|
77
77
|
getUserId(subscriptionId: string, mid: string, testEnv: boolean, regional: boolean): Observable<GetUserId>;
|
|
78
78
|
private _assignChannel;
|
|
79
79
|
private _buildHeader;
|
|
@@ -248,10 +248,12 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
248
248
|
return _this.requestGet(path, testEnv, regional, mid);
|
|
249
249
|
}), operators_1.map(function (response) { return response; }));
|
|
250
250
|
};
|
|
251
|
-
KushkiGateway.prototype.cybersourceJwt = function (mid, testEnv, regional) {
|
|
251
|
+
KushkiGateway.prototype.cybersourceJwt = function (mid, testEnv, regional, subscriptionId) {
|
|
252
252
|
var _this = this;
|
|
253
253
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
254
|
-
return _this.requestGet(
|
|
254
|
+
return _this.requestGet(subscriptionId
|
|
255
|
+
? PathEnum_1.PathEnum.cybersource_jwt + "?subscriptionId=" + subscriptionId
|
|
256
|
+
: PathEnum_1.PathEnum.cybersource_jwt, testEnv, regional, mid);
|
|
255
257
|
}), operators_1.map(function (response) { return response.jwt; }));
|
|
256
258
|
};
|
|
257
259
|
KushkiGateway.prototype.getUserId = function (subscriptionId, mid, testEnv, regional) {
|
|
@@ -161,7 +161,7 @@ export interface IKushkiGateway {
|
|
|
161
161
|
* @param testEnv - is test environment
|
|
162
162
|
* @param regional - Define if endpoint used regional URL
|
|
163
163
|
*/
|
|
164
|
-
cybersourceJwt(mid: string, testEnv: boolean, regional: boolean): Observable<string>;
|
|
164
|
+
cybersourceJwt(mid: string, testEnv: boolean, regional: boolean, subscriptionId?: string): Observable<string>;
|
|
165
165
|
/**
|
|
166
166
|
* Get userId
|
|
167
167
|
* @param subscriptionId subscription id for the request
|
|
@@ -58,7 +58,12 @@ export declare class CardService implements ICardService {
|
|
|
58
58
|
private _checkAmount;
|
|
59
59
|
private _checkRequestBody;
|
|
60
60
|
private _getCybersourceJwt;
|
|
61
|
+
private _isSandboxEnabled;
|
|
62
|
+
private _getCybersourceJwtSubscription;
|
|
63
|
+
private _is3DSSecureEnabled;
|
|
61
64
|
private _initCybersource;
|
|
65
|
+
private _initializeCardinal;
|
|
66
|
+
private _initCybersourceSubscription;
|
|
62
67
|
private _completeCardinal;
|
|
63
68
|
private static _initCardinal;
|
|
64
69
|
private static _ccaCardinal;
|
|
@@ -143,9 +143,7 @@ var CardService = /** @class */ (function () {
|
|
|
143
143
|
_this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
144
144
|
return rxjs_1.forkJoin([
|
|
145
145
|
_this._getDeviceTokenSiftScienceObject(request, mid, isTest, merchant, regional),
|
|
146
|
-
_this.
|
|
147
|
-
? request.cardNumber
|
|
148
|
-
: undefined),
|
|
146
|
+
_this._getCybersourceJwtSubscription(merchant, mid, isTest, regional, request.subscriptionId),
|
|
149
147
|
]);
|
|
150
148
|
}), operators_1.switchMap(function (_a) {
|
|
151
149
|
var sift_science_obj = _a[0], jwt = _a[1];
|
|
@@ -229,7 +227,7 @@ var CardService = /** @class */ (function () {
|
|
|
229
227
|
CardService.prototype.requestSecureInit = function (request, mid, isTest, regional) {
|
|
230
228
|
var _this = this;
|
|
231
229
|
return rxjs_1.of(1).pipe(operators_1.map(function () { return _this._checkCardLength(request, ErrorEnum_1.ErrorCode.E014); }), operators_1.switchMap(function () { return _this._getMerchantSettings(mid, isTest, regional); }), operators_1.switchMap(function (merchantSettings) {
|
|
232
|
-
return rxjs_1.iif(function () { return
|
|
230
|
+
return rxjs_1.iif(function () { return _this._is3DSSecureEnabled(merchantSettings); }, rxjs_1.of(merchantSettings), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E013)));
|
|
233
231
|
}), operators_1.switchMap(function (merchant) {
|
|
234
232
|
return _this._getCybersourceJwt(merchant, mid, isTest, regional, request.card.number);
|
|
235
233
|
}), operators_1.map(function (jwt) { return ({
|
|
@@ -305,26 +303,53 @@ var CardService = /** @class */ (function () {
|
|
|
305
303
|
CardService.prototype._getCybersourceJwt = function (merchantSettings, mid, isTest, regional, cardNumber) {
|
|
306
304
|
var _this = this;
|
|
307
305
|
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
308
|
-
if (
|
|
306
|
+
if (_this._is3DSSecureEnabled(merchantSettings) &&
|
|
309
307
|
cardNumber !== undefined)
|
|
310
|
-
return rxjs_1.iif(function () { return
|
|
308
|
+
return rxjs_1.iif(function () { return _this._isSandboxEnabled(merchantSettings); }, _this._initCybersourceSandbox(mid, isTest, regional), _this._initCybersource(cardNumber, mid, isTest, regional));
|
|
311
309
|
return rxjs_1.of(undefined);
|
|
312
310
|
}));
|
|
313
311
|
};
|
|
312
|
+
CardService.prototype._isSandboxEnabled = function (merchantSettings) {
|
|
313
|
+
return !!merchantSettings.sandboxEnable;
|
|
314
|
+
};
|
|
315
|
+
CardService.prototype._getCybersourceJwtSubscription = function (merchantSettings, mid, isTest, regional, subscriptionId) {
|
|
316
|
+
var _this = this;
|
|
317
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
318
|
+
if (_this._is3DSSecureEnabled(merchantSettings))
|
|
319
|
+
return rxjs_1.iif(function () { return _this._isSandboxEnabled(merchantSettings); }, _this._initCybersourceSandbox(mid, isTest, regional), _this._initCybersourceSubscription(subscriptionId, mid, isTest, regional));
|
|
320
|
+
return rxjs_1.of(undefined);
|
|
321
|
+
}));
|
|
322
|
+
};
|
|
323
|
+
CardService.prototype._is3DSSecureEnabled = function (merchantSettings) {
|
|
324
|
+
return merchantSettings[this._3Dsecure] === true;
|
|
325
|
+
};
|
|
314
326
|
CardService.prototype._initCybersource = function (cardNumber, mid, isTest, regional) {
|
|
315
327
|
var _this = this;
|
|
316
328
|
return rxjs_1.of(1).pipe(operators_1.switchMap(function () { return _this._gateway.cybersourceJwt(mid, isTest, regional); }), operators_1.map(function (jwt) {
|
|
317
|
-
|
|
318
|
-
Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/staging"); }).then(function () {
|
|
319
|
-
CardService_1._initCardinal(jwt, cardNumber);
|
|
320
|
-
});
|
|
321
|
-
else
|
|
322
|
-
Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/prod"); }).then(function () {
|
|
323
|
-
CardService_1._initCardinal(jwt, cardNumber);
|
|
324
|
-
});
|
|
329
|
+
_this._initializeCardinal(isTest, jwt, cardNumber);
|
|
325
330
|
return jwt;
|
|
326
331
|
}));
|
|
327
332
|
};
|
|
333
|
+
CardService.prototype._initializeCardinal = function (isTest, jwt, identifier) {
|
|
334
|
+
if (isTest)
|
|
335
|
+
Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/staging"); }).then(function () {
|
|
336
|
+
CardService_1._initCardinal(jwt, identifier);
|
|
337
|
+
});
|
|
338
|
+
else
|
|
339
|
+
Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/prod"); }).then(function () {
|
|
340
|
+
CardService_1._initCardinal(jwt, identifier);
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
CardService.prototype._initCybersourceSubscription = function (subscriptionId, mid, isTest, regional) {
|
|
344
|
+
var _this = this;
|
|
345
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
346
|
+
return _this._gateway.cybersourceJwt(mid, isTest, regional, subscriptionId);
|
|
347
|
+
}), operators_1.map(function (jwtResponse) {
|
|
348
|
+
var bin = Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
349
|
+
_this._initializeCardinal(isTest, jwtResponse.jwt, bin);
|
|
350
|
+
return jwtResponse.jwt;
|
|
351
|
+
}));
|
|
352
|
+
};
|
|
328
353
|
// istanbul ignore next
|
|
329
354
|
CardService.prototype._completeCardinal = function (secureServiceId, mid, isTest, regional, callback) {
|
|
330
355
|
var _this = this;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
/* tslint:disable:all */
|
|
2
2
|
/* tslint:disable:all */
|
|
3
3
|
|
|
4
|
-
export type CashTokenRequest =
|
|
4
|
+
export type CashTokenRequest =
|
|
5
|
+
| PeruvianTokenRequest
|
|
6
|
+
| BrazilianTokenRequest
|
|
7
|
+
| MexicanTokenRequest
|
|
8
|
+
| ColombianTokenRequest
|
|
9
|
+
| CostaRicanTokenRequest
|
|
10
|
+
| GuatemalanTokenRequest
|
|
11
|
+
| PanamanianRequest
|
|
12
|
+
| NicaraguanRequest
|
|
13
|
+
| HonduranRequest
|
|
14
|
+
| SalvadoranRequest
|
|
15
|
+
| GenericTokenRequest;
|
|
5
16
|
export type Name = string;
|
|
6
17
|
export type LastName = string;
|
|
7
18
|
export type Identification = string;
|
|
@@ -9,18 +20,6 @@ export type TotalAmount = number;
|
|
|
9
20
|
export type Email = string;
|
|
10
21
|
export type Description = string;
|
|
11
22
|
|
|
12
|
-
export interface GenericTokenRequest {
|
|
13
|
-
name: Name;
|
|
14
|
-
lastName: LastName;
|
|
15
|
-
identification: Identification;
|
|
16
|
-
totalAmount: TotalAmount;
|
|
17
|
-
email?: Email;
|
|
18
|
-
description?: Description;
|
|
19
|
-
currency: "COP" | "USD" | "CLP" | "CRC" | "UF";
|
|
20
|
-
documentType?: "CC" | "NIT" | "CE" | "TI" | "PP" | "RUC" | "RUT" | "CI";
|
|
21
|
-
savePaymentData?: boolean;
|
|
22
|
-
[k: string]: any;
|
|
23
|
-
}
|
|
24
23
|
export interface PeruvianTokenRequest {
|
|
25
24
|
name: Name;
|
|
26
25
|
lastName: LastName;
|
|
@@ -32,7 +31,6 @@ export interface PeruvianTokenRequest {
|
|
|
32
31
|
documentType?: "DNI" | "CE" | "PAS" | "RUC";
|
|
33
32
|
phonePrefix?: string;
|
|
34
33
|
phoneNumber?: string;
|
|
35
|
-
savePaymentData?: boolean;
|
|
36
34
|
[k: string]: any;
|
|
37
35
|
}
|
|
38
36
|
export interface BrazilianTokenRequest {
|
|
@@ -45,7 +43,6 @@ export interface BrazilianTokenRequest {
|
|
|
45
43
|
currency: "BRL";
|
|
46
44
|
documentType?: "CPF" | "CNPJ" | "RG" | "DNI" | "CI" | "CP" | "RNE";
|
|
47
45
|
userType?: string;
|
|
48
|
-
savePaymentData?: boolean;
|
|
49
46
|
[k: string]: any;
|
|
50
47
|
}
|
|
51
48
|
export interface MexicanTokenRequest {
|
|
@@ -57,6 +54,93 @@ export interface MexicanTokenRequest {
|
|
|
57
54
|
description?: Description;
|
|
58
55
|
currency: "MXN";
|
|
59
56
|
documentType?: "PP" | "RFC" | "CURP";
|
|
60
|
-
|
|
57
|
+
[k: string]: any;
|
|
58
|
+
}
|
|
59
|
+
export interface ColombianTokenRequest {
|
|
60
|
+
name: Name;
|
|
61
|
+
lastName: LastName;
|
|
62
|
+
identification: Identification;
|
|
63
|
+
totalAmount: TotalAmount;
|
|
64
|
+
email?: Email;
|
|
65
|
+
description?: Description;
|
|
66
|
+
currency: "COP";
|
|
67
|
+
documentType?: "CC" | "NIT" | "CE" | "TI" | "PP" | "RUT";
|
|
68
|
+
[k: string]: any;
|
|
69
|
+
}
|
|
70
|
+
export interface CostaRicanTokenRequest {
|
|
71
|
+
name: Name;
|
|
72
|
+
lastName: LastName;
|
|
73
|
+
identification: Identification;
|
|
74
|
+
totalAmount: TotalAmount;
|
|
75
|
+
email?: Email;
|
|
76
|
+
description?: Description;
|
|
77
|
+
currency: "CRC";
|
|
78
|
+
documentType: "CI" | "NITE";
|
|
79
|
+
[k: string]: any;
|
|
80
|
+
}
|
|
81
|
+
export interface GuatemalanTokenRequest {
|
|
82
|
+
name: Name;
|
|
83
|
+
lastName: LastName;
|
|
84
|
+
totalAmount: TotalAmount;
|
|
85
|
+
email?: Email;
|
|
86
|
+
description?: Description;
|
|
87
|
+
currency: "GTQ";
|
|
88
|
+
documentType: "DPI" | "NIT";
|
|
89
|
+
identification: string;
|
|
90
|
+
[k: string]: any;
|
|
91
|
+
}
|
|
92
|
+
export interface PanamanianRequest {
|
|
93
|
+
name: Name;
|
|
94
|
+
lastName: LastName;
|
|
95
|
+
totalAmount: TotalAmount;
|
|
96
|
+
email?: Email;
|
|
97
|
+
description?: Description;
|
|
98
|
+
currency: "PAB" | "USD";
|
|
99
|
+
documentType: "CIP" | "NIT";
|
|
100
|
+
identification: string;
|
|
101
|
+
[k: string]: any;
|
|
102
|
+
}
|
|
103
|
+
export interface NicaraguanRequest {
|
|
104
|
+
name: Name;
|
|
105
|
+
lastName: LastName;
|
|
106
|
+
totalAmount: TotalAmount;
|
|
107
|
+
email?: Email;
|
|
108
|
+
description?: Description;
|
|
109
|
+
currency: "NIO";
|
|
110
|
+
documentType: "CI" | "RUC";
|
|
111
|
+
identification: string;
|
|
112
|
+
[k: string]: any;
|
|
113
|
+
}
|
|
114
|
+
export interface HonduranRequest {
|
|
115
|
+
name: Name;
|
|
116
|
+
lastName: LastName;
|
|
117
|
+
totalAmount: TotalAmount;
|
|
118
|
+
email?: Email;
|
|
119
|
+
description?: Description;
|
|
120
|
+
currency: "HNL";
|
|
121
|
+
documentType: "RNP" | "RTN";
|
|
122
|
+
identification: string;
|
|
123
|
+
[k: string]: any;
|
|
124
|
+
}
|
|
125
|
+
export interface SalvadoranRequest {
|
|
126
|
+
name: Name;
|
|
127
|
+
lastName: LastName;
|
|
128
|
+
totalAmount: TotalAmount;
|
|
129
|
+
email?: Email;
|
|
130
|
+
description?: Description;
|
|
131
|
+
currency: "USD";
|
|
132
|
+
documentType: "DUI" | "NIT";
|
|
133
|
+
identification: string;
|
|
134
|
+
[k: string]: any;
|
|
135
|
+
}
|
|
136
|
+
export interface GenericTokenRequest {
|
|
137
|
+
name: Name;
|
|
138
|
+
lastName: LastName;
|
|
139
|
+
identification: Identification;
|
|
140
|
+
totalAmount: TotalAmount;
|
|
141
|
+
email?: Email;
|
|
142
|
+
description?: Description;
|
|
143
|
+
currency: "USD" | "CLP" | "UF";
|
|
144
|
+
documentType?: "CC" | "CE" | "TI" | "PP" | "RUC" | "RUT" | "CI";
|
|
61
145
|
[k: string]: any;
|
|
62
146
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
export interface SubscriptionTokenKPayRequest {
|
|
5
5
|
walletId: string;
|
|
6
|
-
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
6
|
+
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO" | "PAB";
|
|
7
7
|
userId?: string;
|
|
8
8
|
sessionId?: string;
|
|
9
9
|
card?: {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
export interface TokenKPayRequest {
|
|
5
5
|
walletId: string;
|
|
6
|
-
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
6
|
+
currency?: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL" | "CRC" | "GTQ" | "HNL" | "NIO" | "PAB";
|
|
7
7
|
isDeferred?: boolean;
|
|
8
8
|
amount: number | string;
|
|
9
9
|
months?: number;
|