@kushki/js 1.39.5 → 1.39.6
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/service/CardService.d.ts +1 -0
- package/lib/service/CardService.js +32 -10
- package/package.json +1 -1
package/lib/KushkiInfo.js
CHANGED
|
@@ -12,7 +12,7 @@ const UtilsService_1 = require("./../lib/service/UtilsService");
|
|
|
12
12
|
*/
|
|
13
13
|
class KInfo {
|
|
14
14
|
static buildKushkiInfo(kushkiInfo) {
|
|
15
|
-
const kushki_js_version = "1.39.
|
|
15
|
+
const kushki_js_version = "1.39.6";
|
|
16
16
|
if (kushkiInfo) {
|
|
17
17
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
18
18
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -71,6 +71,7 @@ export declare class CardService implements ICardService {
|
|
|
71
71
|
private _initCybersourceSubscription;
|
|
72
72
|
private _completeCardinal;
|
|
73
73
|
private static _initCardinal;
|
|
74
|
+
private static _isCardinalInitialized;
|
|
74
75
|
private static _ccaCardinal;
|
|
75
76
|
private static _is3dsValid;
|
|
76
77
|
private _setSandboxEnable;
|
|
@@ -258,9 +258,13 @@ let CardService = CardService_1 = class CardService {
|
|
|
258
258
|
}
|
|
259
259
|
// istanbul ignore next
|
|
260
260
|
_setupCompleteCardinal(callback) {
|
|
261
|
-
|
|
261
|
+
// tslint:disable-next-line:early-exit
|
|
262
|
+
if (CardService_1._isCardinalInitialized())
|
|
262
263
|
callback();
|
|
263
|
-
|
|
264
|
+
else
|
|
265
|
+
window.Cardinal.on("payments.setupComplete", () => {
|
|
266
|
+
callback();
|
|
267
|
+
});
|
|
264
268
|
}
|
|
265
269
|
// istanbul ignore next
|
|
266
270
|
_requestTokenGateway(body, mid, testEnv, regional, callback, authorization) {
|
|
@@ -377,7 +381,9 @@ let CardService = CardService_1 = class CardService {
|
|
|
377
381
|
}
|
|
378
382
|
// istanbul ignore next
|
|
379
383
|
_completeCardinal(secureServiceId, mid, isTest, regional, callback) {
|
|
380
|
-
return window.Cardinal.on(
|
|
384
|
+
return window.Cardinal.on(
|
|
385
|
+
// tslint:disable-next-line:no-duplicate-string
|
|
386
|
+
"payments.validated", (data) => __awaiter(this, void 0, void 0, function* () {
|
|
381
387
|
if (data.ActionCode === CardinalValidated_1.ActionCodeEnum.FAIL && !data.Validated)
|
|
382
388
|
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E012), callback);
|
|
383
389
|
const otp_request = {
|
|
@@ -386,6 +392,10 @@ let CardService = CardService_1 = class CardService {
|
|
|
386
392
|
};
|
|
387
393
|
const secure = this._gateway.requestSecureServiceValidation(mid, otp_request, isTest, regional);
|
|
388
394
|
return secure.subscribe({
|
|
395
|
+
complete: () => {
|
|
396
|
+
window.Cardinal.off("payments.setupComplete");
|
|
397
|
+
window.Cardinal.off("payments.validated");
|
|
398
|
+
},
|
|
389
399
|
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
390
400
|
next: (response) => {
|
|
391
401
|
callback({
|
|
@@ -395,17 +405,29 @@ let CardService = CardService_1 = class CardService {
|
|
|
395
405
|
});
|
|
396
406
|
}));
|
|
397
407
|
}
|
|
408
|
+
// istanbul ignore next
|
|
398
409
|
static _initCardinal(jwt, cardNumber) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
410
|
+
if (CardService_1._isCardinalInitialized()) {
|
|
411
|
+
window.Cardinal.trigger("accountNumber.update", UtilsService_1.getBinFromCreditCardNumber(cardNumber));
|
|
412
|
+
window.Cardinal.trigger("jwt.update", jwt);
|
|
413
|
+
}
|
|
414
|
+
else
|
|
415
|
+
window.Cardinal.setup("init", {
|
|
416
|
+
jwt,
|
|
417
|
+
order: {
|
|
418
|
+
Consumer: {
|
|
419
|
+
Account: {
|
|
420
|
+
AccountNumber: UtilsService_1.getBinFromCreditCardNumber(cardNumber),
|
|
421
|
+
},
|
|
405
422
|
},
|
|
406
423
|
},
|
|
407
|
-
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
static _isCardinalInitialized() {
|
|
427
|
+
const cardinal_status = window.Cardinal.complete({
|
|
428
|
+
Status: "Success",
|
|
408
429
|
});
|
|
430
|
+
return !!cardinal_status;
|
|
409
431
|
}
|
|
410
432
|
static _ccaCardinal(tokenResponse) {
|
|
411
433
|
window.Cardinal.continue("cca", {
|