@kushki/js 1.35.1-cotopaxi.1 → 1.36.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.
- package/lib/KushkiInfo.js +1 -1
- package/lib/gateway/SiftScience.js +1 -0
- package/lib/generic/AurusError.js +1 -0
- package/lib/infrastructure/EnvironmentEnum.d.ts +2 -2
- package/lib/infrastructure/EnvironmentEnum.js +2 -2
- package/lib/repository/ICardService.d.ts +5 -0
- package/lib/service/CardService.d.ts +3 -0
- package/lib/service/CardService.js +26 -1
- package/package.json +1 -1
package/lib/KushkiInfo.js
CHANGED
|
@@ -13,7 +13,7 @@ var KInfo = /** @class */ (function () {
|
|
|
13
13
|
function KInfo() {
|
|
14
14
|
}
|
|
15
15
|
KInfo.buildKushkiInfo = function (kushkiInfo) {
|
|
16
|
-
var kushki_js_version = "1.
|
|
16
|
+
var kushki_js_version = "1.36.0";
|
|
17
17
|
if (kushkiInfo) {
|
|
18
18
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
19
19
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -83,6 +83,7 @@ var SiftScience = /** @class */ (function () {
|
|
|
83
83
|
};
|
|
84
84
|
SiftScience.prototype._initSiftScience = function (regional) {
|
|
85
85
|
try {
|
|
86
|
+
// istanbul ignore next
|
|
86
87
|
if (!UtilsService_1.UtilsService.sIsEmpty(window)) {
|
|
87
88
|
var e = window.document.createElement("script");
|
|
88
89
|
e.src = regional
|
|
@@ -22,6 +22,7 @@ exports.AurusError = void 0;
|
|
|
22
22
|
*/
|
|
23
23
|
var AurusError = /** @class */ (function (_super) {
|
|
24
24
|
__extends(AurusError, _super);
|
|
25
|
+
// istanbul ignore next
|
|
25
26
|
function AurusError(code, message) {
|
|
26
27
|
var _this = _super.call(this, "AURUS" + code) /* istanbul ignore next: TODO: reporter is failing */ || this;
|
|
27
28
|
_this.code = code;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Environment enum file
|
|
4
4
|
*/
|
|
5
5
|
export declare enum EnvironmentEnum {
|
|
6
|
-
uat = "https://api-
|
|
6
|
+
uat = "https://api-uat.kushkipagos.com/",
|
|
7
7
|
prod = "https://api.kushkipagos.com/",
|
|
8
|
-
regionalUat = "https://regional-
|
|
8
|
+
regionalUat = "https://regional-uat.kushkipagos.com/",
|
|
9
9
|
regionalProd = "https://regional.kushkipagos.com/"
|
|
10
10
|
}
|
|
@@ -6,8 +6,8 @@ exports.EnvironmentEnum = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
var EnvironmentEnum;
|
|
8
8
|
(function (EnvironmentEnum) {
|
|
9
|
-
EnvironmentEnum["uat"] = "https://api-
|
|
9
|
+
EnvironmentEnum["uat"] = "https://api-uat.kushkipagos.com/";
|
|
10
10
|
EnvironmentEnum["prod"] = "https://api.kushkipagos.com/";
|
|
11
|
-
EnvironmentEnum["regionalUat"] = "https://regional-
|
|
11
|
+
EnvironmentEnum["regionalUat"] = "https://regional-uat.kushkipagos.com/";
|
|
12
12
|
EnvironmentEnum["regionalProd"] = "https://regional.kushkipagos.com/";
|
|
13
13
|
})(EnvironmentEnum = exports.EnvironmentEnum || (exports.EnvironmentEnum = {}));
|
|
@@ -79,4 +79,9 @@ export interface ICardService {
|
|
|
79
79
|
* @param regional - Define if endpoint used regional URL
|
|
80
80
|
*/
|
|
81
81
|
requestSecureInit(body: SecureInitRequest, mid: string, isTest: boolean, regional: boolean): Observable<SecureInitResponse>;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param alreadyObtainedToken
|
|
85
|
+
*/
|
|
86
|
+
setAlreadyObtainedToken(alreadyObtainedToken: boolean): any;
|
|
82
87
|
}
|
|
@@ -39,6 +39,7 @@ export declare class CardService implements ICardService {
|
|
|
39
39
|
private readonly _3Dsecure;
|
|
40
40
|
private readonly _cardNumber;
|
|
41
41
|
private _sandboxEnable;
|
|
42
|
+
private _alreadyObtainedToken;
|
|
42
43
|
constructor(gateway: IKushkiGateway, authService: IAuthService, antiFraud: IAntiFraud);
|
|
43
44
|
requestToken(request: TokenRequest | TokenKPayRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
44
45
|
requestDeviceToken(request: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
@@ -47,6 +48,8 @@ export declare class CardService implements ICardService {
|
|
|
47
48
|
requestBinInfo(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<BinInfoResponse>;
|
|
48
49
|
validate3DS(body: Validate3DSRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
49
50
|
requestSecureInit(request: SecureInitRequest, mid: string, isTest: boolean, regional: boolean): Observable<SecureInitResponse>;
|
|
51
|
+
setAlreadyObtainedToken(alreadyObtainedToken: boolean): void;
|
|
52
|
+
private _handleRetryRequestToken3DS;
|
|
50
53
|
private _getCreateSubscriptionDataToTransform;
|
|
51
54
|
private _request3DSToken;
|
|
52
55
|
private _setupCompleteCardinal;
|
|
@@ -82,6 +82,7 @@ var CardService = /** @class */ (function () {
|
|
|
82
82
|
this._3Dsecure = "active_3dsecure";
|
|
83
83
|
this._cardNumber = "card.number";
|
|
84
84
|
this._sandboxEnable = false;
|
|
85
|
+
this._alreadyObtainedToken = false;
|
|
85
86
|
this._gateway = gateway;
|
|
86
87
|
this._antiFraud = antiFraud;
|
|
87
88
|
this._authService = authService;
|
|
@@ -143,10 +144,14 @@ var CardService = /** @class */ (function () {
|
|
|
143
144
|
},
|
|
144
145
|
next: function (_a) {
|
|
145
146
|
var final_request = _a[0], authorization = _a[1], merchant = _a[2];
|
|
146
|
-
if (final_request.jwt && !merchant.sandboxEnable)
|
|
147
|
+
if (final_request.jwt && !merchant.sandboxEnable) {
|
|
147
148
|
_this._request3DSToken(isTest, function () {
|
|
149
|
+
window.Cardinal.off("payments.setupComplete");
|
|
150
|
+
// istanbul ignore next
|
|
148
151
|
_this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
|
|
149
152
|
});
|
|
153
|
+
_this._handleRetryRequestToken3DS(final_request, mid, isTest, regional, callback, authorization);
|
|
154
|
+
}
|
|
150
155
|
else
|
|
151
156
|
_this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
|
|
152
157
|
}
|
|
@@ -278,6 +283,24 @@ var CardService = /** @class */ (function () {
|
|
|
278
283
|
jwt: jwt
|
|
279
284
|
}); }));
|
|
280
285
|
};
|
|
286
|
+
CardService.prototype.setAlreadyObtainedToken = function (alreadyObtainedToken) {
|
|
287
|
+
this._alreadyObtainedToken = alreadyObtainedToken;
|
|
288
|
+
};
|
|
289
|
+
CardService.prototype._handleRetryRequestToken3DS = function (finalRequest, mid, isTest, regional, callback, authorization) {
|
|
290
|
+
var _this = this;
|
|
291
|
+
// istanbul ignore next
|
|
292
|
+
if (this._alreadyObtainedToken)
|
|
293
|
+
return;
|
|
294
|
+
window.Cardinal.complete({
|
|
295
|
+
Status: "Success"
|
|
296
|
+
})
|
|
297
|
+
.then(function () {
|
|
298
|
+
_this._requestTokenGateway(finalRequest, mid, isTest, regional, callback, authorization);
|
|
299
|
+
})["catch"](function () {
|
|
300
|
+
var error = ErrorEnum_1.ERRORS[ErrorEnum_1.ErrorCode.E002];
|
|
301
|
+
Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(error, ""), callback);
|
|
302
|
+
});
|
|
303
|
+
};
|
|
281
304
|
CardService.prototype._getCreateSubscriptionDataToTransform = function (siftObject, subscriptionTokenRequest) {
|
|
282
305
|
if (siftObject.userId === null || siftObject.sessionId === null)
|
|
283
306
|
return __assign({}, subscriptionTokenRequest);
|
|
@@ -306,6 +329,7 @@ var CardService = /** @class */ (function () {
|
|
|
306
329
|
};
|
|
307
330
|
// istanbul ignore next
|
|
308
331
|
CardService.prototype._requestTokenGateway = function (body, mid, testEnv, regional, callback, authorization) {
|
|
332
|
+
var _this = this;
|
|
309
333
|
var request_token = this._gateway.requestToken(body, mid, testEnv, regional, authorization);
|
|
310
334
|
return request_token.subscribe({
|
|
311
335
|
error: function (err) {
|
|
@@ -313,6 +337,7 @@ var CardService = /** @class */ (function () {
|
|
|
313
337
|
},
|
|
314
338
|
next: function (response) {
|
|
315
339
|
callback(response);
|
|
340
|
+
_this._alreadyObtainedToken = true;
|
|
316
341
|
}
|
|
317
342
|
});
|
|
318
343
|
};
|