@kushki/js 1.39.3 → 1.39.4
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
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.4";
|
|
16
16
|
if (kushkiInfo) {
|
|
17
17
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
18
18
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionCodeEnum = void 0;
|
|
4
|
+
var ActionCodeEnum;
|
|
5
|
+
(function (ActionCodeEnum) {
|
|
6
|
+
ActionCodeEnum["SUCCESS"] = "SUCCESS";
|
|
7
|
+
ActionCodeEnum["FAIL"] = "FAILURE";
|
|
8
|
+
})(ActionCodeEnum = exports.ActionCodeEnum || (exports.ActionCodeEnum = {}));
|
|
@@ -32,6 +32,7 @@ const buffer_1 = require("buffer");
|
|
|
32
32
|
const Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
33
33
|
const dot = require("dot-object");
|
|
34
34
|
const KushkiError_1 = require("./../../lib/generic/KushkiError");
|
|
35
|
+
const CardinalValidated_1 = require("./../../lib/infrastructure/CardinalValidated");
|
|
35
36
|
const ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
|
|
36
37
|
const ThreeDSEnum_1 = require("./../../lib/infrastructure/ThreeDSEnum");
|
|
37
38
|
const inversify_1 = require("inversify");
|
|
@@ -195,6 +196,8 @@ let CardService = CardService_1 = class CardService {
|
|
|
195
196
|
UtilsService_1.UtilsService.sGet(body, "security.paReq", ThreeDSEnum_1.ThreeDSEnum.SANDBOX) ===
|
|
196
197
|
ThreeDSEnum_1.ThreeDSEnum.SANDBOX)
|
|
197
198
|
return this._ccaSandbox(body, mid, isTest, regional, callback);
|
|
199
|
+
if (this._isInvalidSpecificationVersion(body, this._sandboxEnable))
|
|
200
|
+
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E012), callback);
|
|
198
201
|
if (isTest) {
|
|
199
202
|
// tslint:disable-next-line:no-duplicate-string
|
|
200
203
|
Promise.resolve().then(() => require("./../../lib/libs/cardinal/staging")).then(() => {
|
|
@@ -367,7 +370,9 @@ let CardService = CardService_1 = class CardService {
|
|
|
367
370
|
}
|
|
368
371
|
// istanbul ignore next
|
|
369
372
|
_completeCardinal(secureServiceId, mid, isTest, regional, callback) {
|
|
370
|
-
return window.Cardinal.on("payments.validated", () => __awaiter(this, void 0, void 0, function* () {
|
|
373
|
+
return window.Cardinal.on("payments.validated", (data) => __awaiter(this, void 0, void 0, function* () {
|
|
374
|
+
if (data.ActionCode === CardinalValidated_1.ActionCodeEnum.FAIL && !data.Validated)
|
|
375
|
+
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E012), callback);
|
|
371
376
|
const otp_request = {
|
|
372
377
|
secureServiceId,
|
|
373
378
|
otpValue: "",
|
|
@@ -469,6 +474,11 @@ let CardService = CardService_1 = class CardService {
|
|
|
469
474
|
},
|
|
470
475
|
});
|
|
471
476
|
}
|
|
477
|
+
_isInvalidSpecificationVersion(body, sandboxEnabled) {
|
|
478
|
+
const is_invalid_version = body.security.specificationVersion !== undefined &&
|
|
479
|
+
body.security.specificationVersion.startsWith("1.");
|
|
480
|
+
return is_invalid_version && !sandboxEnabled;
|
|
481
|
+
}
|
|
472
482
|
};
|
|
473
483
|
CardService = CardService_1 = __decorate([
|
|
474
484
|
inversify_1.injectable(),
|