@kushki/js 1.27.0 → 1.27.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.
@@ -60,5 +60,5 @@ export declare class CardService implements ICardService {
60
60
  private static _is3dsValid;
61
61
  private _setSandboxEnable;
62
62
  private _initCybersourceSandbox;
63
- private static _ccaSandbox;
63
+ private _ccaSandbox;
64
64
  }
@@ -203,7 +203,7 @@ var CardService = /** @class */ (function () {
203
203
  if (this._sandboxEnable ||
204
204
  UtilsService_1.UtilsService.sGet(body, "security.paReq", ThreeDSEnum_1.ThreeDSEnum.SANDBOX) ===
205
205
  ThreeDSEnum_1.ThreeDSEnum.SANDBOX)
206
- return CardService_1._ccaSandbox(body, callback);
206
+ return this._ccaSandbox(body, mid, isTest, regional, callback);
207
207
  if (isTest) {
208
208
  // tslint:disable-next-line:no-duplicate-string
209
209
  Promise.resolve().then(function () { return require("cardinal-commerce-songbird-staging"); }).then(function () {
@@ -345,8 +345,10 @@ var CardService = /** @class */ (function () {
345
345
  // istanbul ignore next
346
346
  CardService._is3dsValid = function (secureOtpResponse) {
347
347
  return ("message" in secureOtpResponse &&
348
- secureOtpResponse.message === "3DS000" &&
349
- secureOtpResponse.code === "ok");
348
+ ((secureOtpResponse.message === "3DS000" &&
349
+ secureOtpResponse.code === "ok") ||
350
+ (secureOtpResponse.code === "3DS000" &&
351
+ secureOtpResponse.message === "ok")));
350
352
  };
351
353
  CardService.prototype._setSandboxEnable = function (payload) {
352
354
  this._sandboxEnable = payload;
@@ -358,7 +360,8 @@ var CardService = /** @class */ (function () {
358
360
  return jwt;
359
361
  }));
360
362
  };
361
- CardService._ccaSandbox = function (body, callback) {
363
+ CardService.prototype._ccaSandbox = function (body, mid, isTest, regional, callback) {
364
+ var _this = this;
362
365
  cardinal_sandbox_js_1.KushkiCardinalSandbox["continue"]("cca", {
363
366
  AcsUrl: body.security.acsURL,
364
367
  Payload: body.security.paReq
@@ -368,11 +371,28 @@ var CardService = /** @class */ (function () {
368
371
  }
369
372
  });
370
373
  // istanbul ignore next
371
- cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated", function (isErrorFlow) {
372
- if (isErrorFlow === true)
373
- return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E008), callback);
374
- callback({ isValid: true });
375
- });
374
+ cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated", function (isErrorFlow) { return __awaiter(_this, void 0, void 0, function () {
375
+ var otp_request, secure;
376
+ return __generator(this, function (_a) {
377
+ if (isErrorFlow === true)
378
+ return [2 /*return*/, Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E008), callback)];
379
+ otp_request = {
380
+ otpValue: "",
381
+ secureServiceId: body.secureId
382
+ };
383
+ secure = this._gateway.requestSecureServiceValidation(mid, otp_request, isTest, regional);
384
+ return [2 /*return*/, secure.subscribe({
385
+ error: function (err) {
386
+ return Kushki_1.Kushki.callbackError(err, callback);
387
+ },
388
+ next: function (response) {
389
+ return callback({
390
+ isValid: CardService_1._is3dsValid(response)
391
+ });
392
+ }
393
+ })];
394
+ });
395
+ }); });
376
396
  };
377
397
  var CardService_1;
378
398
  CardService = CardService_1 = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "description": "kushki-js",
5
5
  "main": "lib/lib.js",
6
6
  "types": "lib/lib.d.ts",
package/lib/.DS_Store DELETED
Binary file