@kushki/js 1.26.5 → 1.27.0-alpha.12985.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.
|
@@ -35,6 +35,7 @@ export declare class CardService implements ICardService {
|
|
|
35
35
|
private readonly _antiFraud;
|
|
36
36
|
private readonly _authService;
|
|
37
37
|
private readonly _3Dsecure;
|
|
38
|
+
private readonly _cardNumber;
|
|
38
39
|
private _sandboxEnable;
|
|
39
40
|
constructor(gateway: IKushkiGateway, authService: IAuthService, antiFraud: IAntiFraud);
|
|
40
41
|
requestToken(request: TokenRequest | TokenKPayRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
@@ -44,6 +45,7 @@ export declare class CardService implements ICardService {
|
|
|
44
45
|
requestBinInfo(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<BinInfoResponse>;
|
|
45
46
|
validate3DS(body: Validate3DSRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
46
47
|
private _validateParameters;
|
|
48
|
+
private _getDeviceTokenSiftScienceObject;
|
|
47
49
|
private _checkCardLength;
|
|
48
50
|
private _getScienceSession;
|
|
49
51
|
private _checkCurrency;
|
|
@@ -77,27 +77,30 @@ var UtilsService_1 = require("./../../lib/service/UtilsService");
|
|
|
77
77
|
var Kushki_1 = require("./../../lib/Kushki");
|
|
78
78
|
var CardService = /** @class */ (function () {
|
|
79
79
|
function CardService(gateway, authService, antiFraud) {
|
|
80
|
+
var _a;
|
|
80
81
|
this._3Dsecure = "active_3dsecure";
|
|
82
|
+
this._cardNumber = "card.number";
|
|
81
83
|
this._sandboxEnable = false;
|
|
82
84
|
this._gateway = gateway;
|
|
83
85
|
this._antiFraud = antiFraud;
|
|
84
86
|
this._authService = authService;
|
|
85
|
-
this._receipt = {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
this._receipt = (_a = {
|
|
88
|
+
amount: "totalAmount",
|
|
89
|
+
"card.cvc": "card.cvv",
|
|
90
|
+
"card.expiryMonth": "card.expiryMonth",
|
|
91
|
+
"card.expiryYear": "card.expiryYear",
|
|
92
|
+
"card.name": "card.name"
|
|
93
|
+
},
|
|
94
|
+
_a[this._cardNumber] = this._cardNumber,
|
|
95
|
+
_a.currency = "currency",
|
|
96
|
+
_a.isDeferred = "isDeferred",
|
|
97
|
+
_a.jwt = "jwt",
|
|
98
|
+
_a.months = "months",
|
|
99
|
+
_a.savePaymentData = "savePaymentData",
|
|
100
|
+
_a.sessionId = "sessionId",
|
|
101
|
+
_a.userId = "userId",
|
|
102
|
+
_a.walletId = "walletId",
|
|
103
|
+
_a);
|
|
101
104
|
}
|
|
102
105
|
CardService_1 = CardService;
|
|
103
106
|
CardService.prototype.requestToken = function (request, mid, isTest, regional) {
|
|
@@ -134,28 +137,40 @@ var CardService = /** @class */ (function () {
|
|
|
134
137
|
CardService.prototype.requestDeviceToken = function (request, mid, isTest, regional) {
|
|
135
138
|
var _this = this;
|
|
136
139
|
return this._gateway.requestMerchantSettings(mid, isTest, regional).pipe(operators_1.switchMap(function (merchant) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
_this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
141
|
+
return rxjs_1.forkJoin([
|
|
142
|
+
_this._getDeviceTokenSiftScienceObject(request, mid, isTest, merchant),
|
|
143
|
+
_this._getCybersourceJwt(merchant, mid, isTest, regional, Object.prototype.hasOwnProperty.call(request, "cardNumber")
|
|
144
|
+
? request.cardNumber
|
|
145
|
+
: undefined),
|
|
146
|
+
]);
|
|
147
|
+
}), operators_1.switchMap(function (_a) {
|
|
148
|
+
var sift_science_obj = _a[0], jwt = _a[1];
|
|
149
|
+
if (sift_science_obj.userId === null)
|
|
150
|
+
delete sift_science_obj.userId;
|
|
151
|
+
if (sift_science_obj.sessionId === null)
|
|
152
|
+
delete sift_science_obj.sessionId;
|
|
153
|
+
if (jwt)
|
|
154
|
+
sift_science_obj = __assign(__assign({}, sift_science_obj), { jwt: jwt, amount: request.amount, cardHolderName: request.cardHolderName, currency: request.currency });
|
|
155
|
+
return _this._gateway.requestDeviceToken(__assign({ subscriptionId: request.subscriptionId }, sift_science_obj), mid, isTest, regional);
|
|
148
156
|
}));
|
|
149
157
|
};
|
|
150
158
|
CardService.prototype.requestSubscriptionToken = function (subscriptionTokenRequest, mid, isTest, regional) {
|
|
151
159
|
var _this = this;
|
|
152
160
|
return this._gateway.requestMerchantSettings(mid, isTest, regional).pipe(operators_1.switchMap(function (merchant) {
|
|
153
|
-
|
|
154
|
-
|
|
161
|
+
_this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
162
|
+
return rxjs_1.forkJoin([
|
|
163
|
+
_this._getScienceSession(subscriptionTokenRequest, mid, isTest, merchant),
|
|
164
|
+
_this._getCybersourceJwt(merchant, mid, isTest, regional, UtilsService_1.UtilsService.sGet(subscriptionTokenRequest, _this._cardNumber)),
|
|
165
|
+
]);
|
|
166
|
+
}), operators_1.concatMap(function (_a) {
|
|
167
|
+
var sift_object = _a[0], jwt = _a[1];
|
|
155
168
|
_this._checkRequestBody(subscriptionTokenRequest);
|
|
156
169
|
var data_to_transform = __assign({}, subscriptionTokenRequest);
|
|
157
|
-
if (
|
|
158
|
-
data_to_transform.siftObject = __assign({},
|
|
170
|
+
if (sift_object.userId === null || sift_object.sessionId === null)
|
|
171
|
+
data_to_transform.siftObject = __assign({}, sift_object);
|
|
172
|
+
if (jwt !== undefined)
|
|
173
|
+
data_to_transform.jwt = jwt;
|
|
159
174
|
return rxjs_1.forkJoin([
|
|
160
175
|
rxjs_1.of(dot.transform(_this._receipt, data_to_transform)),
|
|
161
176
|
subscriptionTokenRequest.walletId
|
|
@@ -213,6 +228,16 @@ var CardService = /** @class */ (function () {
|
|
|
213
228
|
body.security.paReq === undefined ||
|
|
214
229
|
body.security.authenticationTransactionId === undefined);
|
|
215
230
|
};
|
|
231
|
+
CardService.prototype._getDeviceTokenSiftScienceObject = function (request, mid, isTest, merchant) {
|
|
232
|
+
var _this = this;
|
|
233
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
234
|
+
return rxjs_1.iif(function () {
|
|
235
|
+
return request.sessionId !== undefined &&
|
|
236
|
+
request.sessionId !== null &&
|
|
237
|
+
(request.userId !== undefined && request.userId !== null);
|
|
238
|
+
}, _this._getRequestSiftObject(request.userId, request.sessionId), _this._antiFraud.createSiftScienceSession(request.subscriptionId, "", mid, isTest, merchant));
|
|
239
|
+
}));
|
|
240
|
+
};
|
|
216
241
|
CardService.prototype._checkCardLength = function (request) {
|
|
217
242
|
if (request.card.number.length < 14 || request.card.number.length > 19)
|
|
218
243
|
throw new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E005);
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
/* tslint:disable:all */
|
|
2
2
|
/* tslint:disable:all */
|
|
3
3
|
|
|
4
|
+
export type Currency = "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
5
|
+
|
|
4
6
|
export interface DeviceTokenRequest {
|
|
5
7
|
subscriptionId: string;
|
|
6
8
|
userId?: string | null;
|
|
7
9
|
sessionId?: string | null;
|
|
10
|
+
amount?: Amount;
|
|
11
|
+
currency?: Currency;
|
|
12
|
+
cardNumber?: string;
|
|
13
|
+
cardHolderName?: string;
|
|
14
|
+
[k: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface Amount {
|
|
17
|
+
currency?: Currency;
|
|
18
|
+
subtotalIva: number;
|
|
19
|
+
subtotalIva0: number;
|
|
20
|
+
iva: number;
|
|
21
|
+
ice?: number;
|
|
22
|
+
extraTaxes?: {
|
|
23
|
+
agenciaDeViaje?: number;
|
|
24
|
+
iac?: number;
|
|
25
|
+
propina?: number;
|
|
26
|
+
tasaAeroportuaria?: number;
|
|
27
|
+
state_tax?: number;
|
|
28
|
+
municipal_tax?: number;
|
|
29
|
+
reduced_state_tax?: number;
|
|
30
|
+
};
|
|
8
31
|
[k: string]: any;
|
|
9
32
|
}
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
/* tslint:disable:all */
|
|
2
2
|
/* tslint:disable:all */
|
|
3
3
|
|
|
4
|
+
export type Currency = "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
5
|
+
|
|
4
6
|
export interface SubscriptionIdRequest {
|
|
5
7
|
subscriptionId: string;
|
|
6
8
|
userId?: string | null;
|
|
7
9
|
sessionId?: string | null;
|
|
10
|
+
amount?: Amount;
|
|
11
|
+
currency?: Currency;
|
|
12
|
+
cardNumber?: string;
|
|
13
|
+
cardHolderName?: string;
|
|
14
|
+
[k: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface Amount {
|
|
17
|
+
currency?: Currency;
|
|
18
|
+
subtotalIva: number;
|
|
19
|
+
subtotalIva0: number;
|
|
20
|
+
iva: number;
|
|
21
|
+
ice?: number;
|
|
22
|
+
extraTaxes?: {
|
|
23
|
+
agenciaDeViaje?: number;
|
|
24
|
+
iac?: number;
|
|
25
|
+
propina?: number;
|
|
26
|
+
tasaAeroportuaria?: number;
|
|
27
|
+
state_tax?: number;
|
|
28
|
+
municipal_tax?: number;
|
|
29
|
+
reduced_state_tax?: number;
|
|
30
|
+
};
|
|
8
31
|
[k: string]: any;
|
|
9
32
|
}
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
/* tslint:disable:all */
|
|
2
2
|
/* tslint:disable:all */
|
|
3
3
|
|
|
4
|
+
export type Currency = "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
5
|
+
|
|
4
6
|
export interface TokenChargeRequest {
|
|
5
7
|
subscriptionId: string;
|
|
6
8
|
userId?: string | null;
|
|
7
9
|
sessionId?: string | null;
|
|
10
|
+
jwt?: string;
|
|
11
|
+
amount?: Amount;
|
|
12
|
+
currency?: Currency;
|
|
13
|
+
cardHolderName?: string;
|
|
14
|
+
[k: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface Amount {
|
|
17
|
+
currency?: Currency;
|
|
18
|
+
subtotalIva: number;
|
|
19
|
+
subtotalIva0: number;
|
|
20
|
+
iva: number;
|
|
21
|
+
ice?: number;
|
|
22
|
+
extraTaxes?: {
|
|
23
|
+
agenciaDeViaje?: number;
|
|
24
|
+
iac?: number;
|
|
25
|
+
propina?: number;
|
|
26
|
+
tasaAeroportuaria?: number;
|
|
27
|
+
state_tax?: number;
|
|
28
|
+
municipal_tax?: number;
|
|
29
|
+
reduced_state_tax?: number;
|
|
30
|
+
};
|
|
8
31
|
[k: string]: any;
|
|
9
32
|
}
|
package/package.json
CHANGED
package/lib/.DS_Store
DELETED
|
Binary file
|