@kushki/js 1.26.2 → 1.26.3
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.
|
@@ -16,6 +16,7 @@ var ErrorCode;
|
|
|
16
16
|
ErrorCode["E009"] = "E009";
|
|
17
17
|
ErrorCode["E010"] = "E010";
|
|
18
18
|
ErrorCode["E011"] = "E011";
|
|
19
|
+
ErrorCode["E012"] = "E012";
|
|
19
20
|
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
|
20
21
|
exports.ERRORS = (_a = {},
|
|
21
22
|
_a[ErrorCode.E001] = {
|
|
@@ -73,4 +74,9 @@ exports.ERRORS = (_a = {},
|
|
|
73
74
|
message: "Sesión no disponible.",
|
|
74
75
|
statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest
|
|
75
76
|
},
|
|
77
|
+
_a[ErrorCode.E012] = {
|
|
78
|
+
code: ErrorCode.E012,
|
|
79
|
+
message: "Campos 3DS inválidos",
|
|
80
|
+
statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest
|
|
81
|
+
},
|
|
76
82
|
_a);
|
|
@@ -43,6 +43,7 @@ export declare class CardService implements ICardService {
|
|
|
43
43
|
requestDeferred(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<IDeferredResponse[]>;
|
|
44
44
|
requestBinInfo(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<BinInfoResponse>;
|
|
45
45
|
validate3DS(body: Validate3DSRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
46
|
+
private _validateParameters;
|
|
46
47
|
private _checkCardLength;
|
|
47
48
|
private _getScienceSession;
|
|
48
49
|
private _checkCurrency;
|
|
@@ -175,10 +175,16 @@ var CardService = /** @class */ (function () {
|
|
|
175
175
|
};
|
|
176
176
|
CardService.prototype.validate3DS = function (body, mid, isTest, regional, callback) {
|
|
177
177
|
var _this = this;
|
|
178
|
+
// tslint:disable-next-line
|
|
179
|
+
if (body.security === undefined)
|
|
180
|
+
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E012), callback);
|
|
178
181
|
if (!UtilsService_1.UtilsService.sGet(body, "security.authRequired", false)) {
|
|
179
182
|
callback({ isValid: true });
|
|
180
183
|
return;
|
|
181
184
|
}
|
|
185
|
+
if (UtilsService_1.UtilsService.sGet(body, "security.authRequired") &&
|
|
186
|
+
this._validateParameters(body))
|
|
187
|
+
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E012), callback);
|
|
182
188
|
if (this._sandboxEnable ||
|
|
183
189
|
UtilsService_1.UtilsService.sGet(body, "security.paReq", ThreeDSEnum_1.ThreeDSEnum.SANDBOX) ===
|
|
184
190
|
ThreeDSEnum_1.ThreeDSEnum.SANDBOX)
|
|
@@ -202,6 +208,11 @@ var CardService = /** @class */ (function () {
|
|
|
202
208
|
});
|
|
203
209
|
}
|
|
204
210
|
};
|
|
211
|
+
CardService.prototype._validateParameters = function (body) {
|
|
212
|
+
return (body.security.acsURL === undefined ||
|
|
213
|
+
body.security.paReq === undefined ||
|
|
214
|
+
body.security.authenticationTransactionId === undefined);
|
|
215
|
+
};
|
|
205
216
|
CardService.prototype._checkCardLength = function (request) {
|
|
206
217
|
if (request.card.number.length < 14 || request.card.number.length > 19)
|
|
207
218
|
throw new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E005);
|
|
@@ -332,8 +343,10 @@ var CardService = /** @class */ (function () {
|
|
|
332
343
|
}
|
|
333
344
|
});
|
|
334
345
|
// istanbul ignore next
|
|
335
|
-
cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated", function () {
|
|
336
|
-
|
|
346
|
+
cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated", function (isErrorFlow) {
|
|
347
|
+
if (isErrorFlow === true)
|
|
348
|
+
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E008), callback);
|
|
349
|
+
callback({ isValid: true });
|
|
337
350
|
});
|
|
338
351
|
};
|
|
339
352
|
var CardService_1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushki/js",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.3",
|
|
4
4
|
"description": "kushki-js",
|
|
5
5
|
"main": "lib/lib.js",
|
|
6
6
|
"types": "lib/lib.d.ts",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@aws-amplify/auth": "3.4.22",
|
|
98
|
-
"@kushki/cardinal-sandbox-js": "1.0.
|
|
98
|
+
"@kushki/cardinal-sandbox-js": "1.0.1",
|
|
99
99
|
"acorn": "6.4.1",
|
|
100
100
|
"aws-amplify": "3.3.19",
|
|
101
101
|
"axios": "0.21.1",
|