@kushki/js 1.36.0 → 1.37.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.
Files changed (76) hide show
  1. package/lib/Kushki.d.ts +17 -2
  2. package/lib/Kushki.js +132 -113
  3. package/lib/KushkiInfo.js +11 -14
  4. package/lib/constant/CreditCardEspecifications.js +2 -2
  5. package/lib/constant/Identifiers.js +21 -21
  6. package/lib/gateway/KushkiGateway.js +161 -276
  7. package/lib/gateway/SiftScience.js +42 -45
  8. package/lib/generic/AurusError.js +12 -28
  9. package/lib/generic/KushkiError.js +15 -33
  10. package/lib/infrastructure/BinCardTypeEnum.js +1 -1
  11. package/lib/infrastructure/CardBrandsEnum.d.ts +5 -0
  12. package/lib/infrastructure/CardBrandsEnum.js +8 -0
  13. package/lib/infrastructure/CognitoErrorEnum.js +1 -1
  14. package/lib/infrastructure/Container.js +41 -75
  15. package/lib/infrastructure/EnvironmentEnum.js +1 -1
  16. package/lib/infrastructure/ErrorEnum.d.ts +2 -1
  17. package/lib/infrastructure/ErrorEnum.js +42 -37
  18. package/lib/infrastructure/HeadersEnum.js +1 -1
  19. package/lib/infrastructure/KPayUserPoolEnum.js +1 -1
  20. package/lib/infrastructure/KpayPaymentKind.js +1 -1
  21. package/lib/infrastructure/PathEnum.js +1 -1
  22. package/lib/infrastructure/PlatformCodeEnum.js +15 -15
  23. package/lib/infrastructure/SiftScienceEnum.js +1 -1
  24. package/lib/infrastructure/StatusCodeEnum.js +1 -1
  25. package/lib/infrastructure/ThreeDSEnum.js +1 -1
  26. package/lib/infrastructure/VisaBrandingResourceUrlEnum.d.ts +2 -2
  27. package/lib/infrastructure/VisaBrandingResourceUrlEnum.js +3 -3
  28. package/lib/lib.js +1 -1
  29. package/lib/libs/MCSensoryBranding/mastercard-sensory-branding.d.ts +21 -0
  30. package/lib/libs/MCSensoryBranding/mastercard-sensory-branding.js +781 -0
  31. package/lib/libs/VisaSensoryBranding/visa-sensory-branding.d.ts +1 -1
  32. package/lib/libs/VisaSensoryBranding/visa-sensory-branding.js +630 -158
  33. package/lib/libs/cardinal/prod.js +10 -10
  34. package/lib/libs/cardinal/staging.js +9 -9
  35. package/lib/repository/IAntiFraud.js +1 -1
  36. package/lib/repository/IAuthService.js +1 -1
  37. package/lib/repository/ICardAsyncService.js +1 -1
  38. package/lib/repository/ICardDynamicService.js +1 -1
  39. package/lib/repository/ICardService.js +1 -1
  40. package/lib/repository/ICardSubscriptionDynamicService.js +1 -1
  41. package/lib/repository/ICashService.js +1 -1
  42. package/lib/repository/ICommissionService.js +1 -1
  43. package/lib/repository/IKPayService.js +1 -1
  44. package/lib/repository/IKushkiGateway.js +1 -1
  45. package/lib/repository/IKushkiService.d.ts +9 -2
  46. package/lib/repository/IKushkiService.js +1 -1
  47. package/lib/repository/IMobileProcessorService.js +1 -1
  48. package/lib/repository/IMultiMerchantService.js +1 -1
  49. package/lib/repository/IPayoutsCashService.js +1 -1
  50. package/lib/repository/IPayoutsTransferService.js +1 -1
  51. package/lib/repository/ISecureService.js +1 -1
  52. package/lib/repository/ISiftScienceService.js +1 -1
  53. package/lib/repository/ITransferService.js +1 -1
  54. package/lib/repository/ITransferSubscriptionService.js +1 -1
  55. package/lib/service/AuthService.js +99 -161
  56. package/lib/service/CardAsyncService.js +19 -26
  57. package/lib/service/CardDynamicService.js +32 -43
  58. package/lib/service/CardService.js +271 -382
  59. package/lib/service/CardSubscriptionDynamicService.js +31 -40
  60. package/lib/service/CashService.js +15 -16
  61. package/lib/service/CommissionService.js +13 -14
  62. package/lib/service/KPayService.js +19 -23
  63. package/lib/service/KushkiService.d.ts +2 -1
  64. package/lib/service/KushkiService.js +48 -33
  65. package/lib/service/MobileProcessorService.js +59 -70
  66. package/lib/service/MultiMerchantService.js +13 -14
  67. package/lib/service/PayoutsCashService.js +15 -16
  68. package/lib/service/PayoutsTransferService.js +17 -18
  69. package/lib/service/SecureService.js +13 -14
  70. package/lib/service/SiftScienceService.js +16 -20
  71. package/lib/service/TransferService.js +21 -36
  72. package/lib/service/TransferSubscriptionsService.js +16 -17
  73. package/lib/service/UtilsService.js +51 -57
  74. package/lib/types/card_branding_request.d.ts +40 -0
  75. package/package.json +2 -2
  76. package/lib/types/visa_branding_request.d.ts +0 -10
@@ -11,64 +11,55 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- exports.__esModule = true;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CardSubscriptionDynamicService = void 0;
16
16
  /**
17
17
  * CardDynamic Service
18
18
  */
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var BinCardTypeEnum_1 = require("./../../lib/infrastructure/BinCardTypeEnum");
21
- var inversify_1 = require("inversify");
22
- var rxjs_1 = require("rxjs");
23
- var operators_1 = require("rxjs/operators");
24
- var Kushki_1 = require("./../../lib/Kushki");
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const BinCardTypeEnum_1 = require("./../../lib/infrastructure/BinCardTypeEnum");
21
+ const inversify_1 = require("inversify");
22
+ const rxjs_1 = require("rxjs");
23
+ const operators_1 = require("rxjs/operators");
24
+ const Kushki_1 = require("./../../lib/Kushki");
25
25
  /**
26
26
  * Implementation
27
27
  */
28
- var CardSubscriptionDynamicService = /** @class */ (function () {
29
- function CardSubscriptionDynamicService(cardService, cardAsyncService) {
28
+ let CardSubscriptionDynamicService = class CardSubscriptionDynamicService {
29
+ constructor(cardService, cardAsyncService) {
30
30
  this._cardServiceSubscription = cardService;
31
31
  this._cardAsyncServiceSubscription = cardAsyncService;
32
32
  }
33
- CardSubscriptionDynamicService.prototype.requestCardSubscriptionDynamicToken = function (bin, body, mid, testEnv, regional, callback) {
34
- var _this = this;
33
+ requestCardSubscriptionDynamicToken(bin, body, mid, testEnv, regional, callback) {
35
34
  rxjs_1.of(1)
36
- .pipe(operators_1.concatMap(function () {
37
- return _this._cardServiceSubscription.requestBinInfo(bin, mid, testEnv, regional);
38
- }))
35
+ .pipe(operators_1.concatMap(() => this._cardServiceSubscription.requestBinInfo(bin, mid, testEnv, regional)))
39
36
  .subscribe({
40
- next: function (binInfo) {
37
+ next: (binInfo) => {
41
38
  if (binInfo.cardType === BinCardTypeEnum_1.BinCardTypeEnum.debit)
42
- _this._requestCardSubscriptionAsyncToken(body, mid, testEnv, regional, callback);
39
+ this._requestCardSubscriptionAsyncToken(body, mid, testEnv, regional, callback);
43
40
  else
44
- _this._requestCardSubscriptionToken(body, mid, testEnv, regional, callback);
45
- }
41
+ this._requestCardSubscriptionToken(body, mid, testEnv, regional, callback);
42
+ },
46
43
  });
47
- };
48
- CardSubscriptionDynamicService.prototype._requestCardSubscriptionAsyncToken = function (body, mid, testEnv, regional, callback) {
49
- var _this = this;
44
+ }
45
+ _requestCardSubscriptionAsyncToken(body, mid, testEnv, regional, callback) {
50
46
  rxjs_1.of(1)
51
- .pipe(operators_1.mergeMap(function () {
52
- return _this._cardAsyncServiceSubscription.requestCardSubscriptionAsyncToken(body, mid, testEnv, regional);
53
- }))
47
+ .pipe(operators_1.mergeMap(() => this._cardAsyncServiceSubscription.requestCardSubscriptionAsyncToken(body, mid, testEnv, regional)))
54
48
  .subscribe({
55
- error: function (err) {
56
- return Kushki_1.Kushki.callbackError(err, callback);
57
- },
58
- next: function (token) {
49
+ error: (err) => Kushki_1.Kushki.callbackError(err, callback),
50
+ next: (token) => {
59
51
  callback(token);
60
- }
52
+ },
61
53
  });
62
- };
63
- CardSubscriptionDynamicService.prototype._requestCardSubscriptionToken = function (body, mid, testEnv, regional, callback) {
54
+ }
55
+ _requestCardSubscriptionToken(body, mid, testEnv, regional, callback) {
64
56
  this._cardServiceSubscription.requestSubscriptionToken(body, mid, testEnv, regional, callback);
65
- };
66
- CardSubscriptionDynamicService = __decorate([
67
- inversify_1.injectable(),
68
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardService)),
69
- __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardAsyncService)),
70
- __metadata("design:paramtypes", [Object, Object])
71
- ], CardSubscriptionDynamicService);
72
- return CardSubscriptionDynamicService;
73
- }());
57
+ }
58
+ };
59
+ CardSubscriptionDynamicService = __decorate([
60
+ inversify_1.injectable(),
61
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardService)),
62
+ __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.CardAsyncService)),
63
+ __metadata("design:paramtypes", [Object, Object])
64
+ ], CardSubscriptionDynamicService);
74
65
  exports.CardSubscriptionDynamicService = CardSubscriptionDynamicService;
@@ -11,32 +11,31 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- exports.__esModule = true;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CashService = void 0;
16
16
  /**
17
17
  * Cash Service file
18
18
  */
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var KushkiGateway_1 = require("./../../lib/gateway/KushkiGateway");
21
- var inversify_1 = require("inversify");
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const KushkiGateway_1 = require("./../../lib/gateway/KushkiGateway");
21
+ const inversify_1 = require("inversify");
22
22
  require("reflect-metadata");
23
23
  /**
24
24
  * Implementation
25
25
  */
26
- var CashService = /** @class */ (function () {
27
- function CashService(gateway, antiFraud) {
26
+ let CashService = class CashService {
27
+ constructor(gateway, antiFraud) {
28
28
  this._gateway = gateway;
29
29
  this._antiFraud = antiFraud;
30
30
  }
31
- CashService.prototype.requestCashToken = function (body, mid, isTest, regional) {
31
+ requestCashToken(body, mid, isTest, regional) {
32
32
  return this._gateway.requestCashToken(body, mid, isTest, regional);
33
- };
34
- CashService = __decorate([
35
- inversify_1.injectable(),
36
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
37
- __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AntiFraud)),
38
- __metadata("design:paramtypes", [KushkiGateway_1.KushkiGateway, Object])
39
- ], CashService);
40
- return CashService;
41
- }());
33
+ }
34
+ };
35
+ CashService = __decorate([
36
+ inversify_1.injectable(),
37
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
38
+ __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AntiFraud)),
39
+ __metadata("design:paramtypes", [KushkiGateway_1.KushkiGateway, Object])
40
+ ], CashService);
42
41
  exports.CashService = CashService;
@@ -14,25 +14,24 @@ var __metadata = (this && this.__metadata) || function (k, v) {
14
14
  var __param = (this && this.__param) || function (paramIndex, decorator) {
15
15
  return function (target, key) { decorator(target, key, paramIndex); }
16
16
  };
17
- exports.__esModule = true;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.CommissionService = void 0;
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var inversify_1 = require("inversify");
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const inversify_1 = require("inversify");
21
21
  /**
22
22
  * Implementation
23
23
  */
24
- var CommissionService = /** @class */ (function () {
25
- function CommissionService(gateway) {
24
+ let CommissionService = class CommissionService {
25
+ constructor(gateway) {
26
26
  this._gateway = gateway;
27
27
  }
28
- CommissionService.prototype.getCommissionConfiguration = function (request, mid, isTest, regional) {
28
+ getCommissionConfiguration(request, mid, isTest, regional) {
29
29
  return this._gateway.getCommissionConfiguration(request, mid, isTest, regional);
30
- };
31
- CommissionService = __decorate([
32
- inversify_1.injectable(),
33
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
34
- __metadata("design:paramtypes", [Object])
35
- ], CommissionService);
36
- return CommissionService;
37
- }());
30
+ }
31
+ };
32
+ CommissionService = __decorate([
33
+ inversify_1.injectable(),
34
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
35
+ __metadata("design:paramtypes", [Object])
36
+ ], CommissionService);
38
37
  exports.CommissionService = CommissionService;
@@ -11,39 +11,35 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- exports.__esModule = true;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.KPayService = void 0;
16
16
  /**
17
17
  * Kushki Service file
18
18
  */
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var inversify_1 = require("inversify");
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const inversify_1 = require("inversify");
21
21
  require("reflect-metadata");
22
- var rxjs_1 = require("rxjs");
23
- var operators_1 = require("rxjs/operators");
22
+ const rxjs_1 = require("rxjs");
23
+ const operators_1 = require("rxjs/operators");
24
24
  /**
25
25
  * Implementation
26
26
  */
27
- var KPayService = /** @class */ (function () {
28
- function KPayService(gateway, authService) {
27
+ let KPayService = class KPayService {
28
+ constructor(gateway, authService) {
29
29
  this._gateway = gateway;
30
30
  this._authService = authService;
31
31
  }
32
- KPayService.prototype.deletePaymentMethod = function (body, mid, isTest, regional) {
33
- var _this = this;
34
- return rxjs_1.of(1).pipe(operators_1.concatMap(function () { return _this._authService.getAuthorizationToken(); }), operators_1.concatMap(function (jwt) {
35
- return _this._gateway.deletePaymentMethod(body, isTest, regional, mid, jwt);
36
- }));
37
- };
38
- KPayService.prototype.requestSavedPaymentMethods = function (body, mid, isTest, regional) {
32
+ deletePaymentMethod(body, mid, isTest, regional) {
33
+ return rxjs_1.of(1).pipe(operators_1.concatMap(() => this._authService.getAuthorizationToken()), operators_1.concatMap(jwt => this._gateway.deletePaymentMethod(body, isTest, regional, mid, jwt)));
34
+ }
35
+ requestSavedPaymentMethods(body, mid, isTest, regional) {
39
36
  return this._gateway.requestSavedPaymentMethods(body, isTest, regional, mid);
40
- };
41
- KPayService = __decorate([
42
- inversify_1.injectable(),
43
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
44
- __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AuthService)),
45
- __metadata("design:paramtypes", [Object, Object])
46
- ], KPayService);
47
- return KPayService;
48
- }());
37
+ }
38
+ };
39
+ KPayService = __decorate([
40
+ inversify_1.injectable(),
41
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
42
+ __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AuthService)),
43
+ __metadata("design:paramtypes", [Object, Object])
44
+ ], KPayService);
49
45
  exports.KPayService = KPayService;
@@ -3,10 +3,10 @@ import "reflect-metadata";
3
3
  import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
4
4
  import { IKushkiService } from "./../../lib/repository/IKushkiService";
5
5
  import { Observable } from "rxjs";
6
+ import { MasterCardBrandingRequest, VisaBrandingRequest } from "./../../lib/types/card_branding_request";
6
7
  import { ErrorResponse } from "./../../lib/types/error_response";
7
8
  import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
8
9
  import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
9
- import { VisaBrandingRequest } from "./../../lib/types/visa_branding_request";
10
10
  declare global {
11
11
  interface Window {
12
12
  VisaSensoryBranding: any;
@@ -22,4 +22,5 @@ export declare class KushkiService implements IKushkiService {
22
22
  requestBrandsByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<string[]>;
23
23
  requestBrandsLogosByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
24
24
  initVisaBrandingAnimation(isTest: boolean, callback: (error?: ErrorResponse) => void, body?: VisaBrandingRequest): void;
25
+ initMasterCardBrandingAnimation(callback: () => void, body: MasterCardBrandingRequest): void;
25
26
  }
@@ -11,52 +11,67 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- exports.__esModule = true;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.KushkiService = void 0;
16
16
  /**
17
17
  * Kushki Service file
18
18
  */
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var KushkiError_1 = require("./../../lib/generic/KushkiError");
21
- var ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
22
- var inversify_1 = require("inversify");
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const KushkiError_1 = require("./../../lib/generic/KushkiError");
21
+ const ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
22
+ const VisaBrandingResourceUrlEnum_1 = require("./../../lib/infrastructure/VisaBrandingResourceUrlEnum");
23
+ const inversify_1 = require("inversify");
24
+ const mastercard_sensory_branding_1 = require("./../../lib/libs/MCSensoryBranding/mastercard-sensory-branding");
23
25
  require("reflect-metadata");
24
- var Kushki_1 = require("./../../lib/Kushki");
26
+ const Kushki_1 = require("./../../lib/Kushki");
25
27
  /**
26
28
  * Implementation
27
29
  */
28
- var KushkiService = /** @class */ (function () {
29
- function KushkiService(gateway) {
30
+ let KushkiService = class KushkiService {
31
+ constructor(gateway) {
30
32
  this._gateway = gateway;
31
33
  }
32
- KushkiService.prototype.checkStatus = function (mid, isTest, regional) {
34
+ checkStatus(mid, isTest, regional) {
33
35
  return this._gateway.checkStatus(mid, isTest, regional);
34
- };
35
- KushkiService.prototype.requestBrandsByMerchant = function (mid, isTest, regional) {
36
+ }
37
+ requestBrandsByMerchant(mid, isTest, regional) {
36
38
  return this._gateway.requestBrandsByMerchant(mid, isTest, regional);
37
- };
38
- KushkiService.prototype.requestBrandsLogosByMerchant = function (mid, isTest, regional) {
39
+ }
40
+ requestBrandsLogosByMerchant(mid, isTest, regional) {
39
41
  return this._gateway.requestBrandsLogosByMerchant(mid, isTest, regional);
40
- };
41
- KushkiService.prototype.initVisaBrandingAnimation = function (isTest, callback, body) {
42
- Promise.resolve().then(function () { return require("./../../lib/libs/VisaSensoryBranding/visa-sensory-branding"); }).then(function () {
43
- window.VisaSensoryBranding.init(body, isTest);
42
+ }
43
+ initVisaBrandingAnimation(isTest, callback, body) {
44
+ Promise.resolve().then(() => require("./../../lib/libs/VisaSensoryBranding/visa-sensory-branding")).then(() => {
45
+ window.VisaSensoryBranding.init(body, isTest
46
+ ? VisaBrandingResourceUrlEnum_1.VisaBrandingResourceUrlEnum.DEV
47
+ : VisaBrandingResourceUrlEnum_1.VisaBrandingResourceUrlEnum.PROD);
44
48
  window.VisaSensoryBranding.show();
45
- // @ts-ignore
46
- document
47
- .getElementById("visa-sensory-branding")
48
- .addEventListener("visa-sensory-branding-end", function () {
49
- callback();
49
+ window.addEventListener("message", e => {
50
+ if (e.data === "visa-sensory-branding-end")
51
+ callback();
50
52
  });
51
- })["catch"](function () {
52
- return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E016), callback);
53
- });
54
- };
55
- KushkiService = __decorate([
56
- inversify_1.injectable(),
57
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
58
- __metadata("design:paramtypes", [Object])
59
- ], KushkiService);
60
- return KushkiService;
61
- }());
53
+ })
54
+ .catch(() => Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E016), callback));
55
+ }
56
+ initMasterCardBrandingAnimation(callback, body) {
57
+ Promise.resolve().then(() => require("./../../lib/libs/MCSensoryBranding/mastercard-sensory-branding")).then(() => {
58
+ const mc_component = new mastercard_sensory_branding_1.MCSonic();
59
+ const container = document.getElementById("mc-container");
60
+ if (body.clearBackground)
61
+ mc_component.clearBackground = body.clearBackground;
62
+ if (body.type)
63
+ mc_component.type = body.type;
64
+ // @ts-ignore
65
+ container.appendChild(mc_component);
66
+ document.addEventListener("sonicCompletion", callback);
67
+ mc_component.play();
68
+ })
69
+ .catch(() => Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E016), callback));
70
+ }
71
+ };
72
+ KushkiService = __decorate([
73
+ inversify_1.injectable(),
74
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
75
+ __metadata("design:paramtypes", [Object])
76
+ ], KushkiService);
62
77
  exports.KushkiService = KushkiService;
@@ -14,90 +14,80 @@ var __metadata = (this && this.__metadata) || function (k, v) {
14
14
  var __param = (this && this.__param) || function (paramIndex, decorator) {
15
15
  return function (target, key) { decorator(target, key, paramIndex); }
16
16
  };
17
- exports.__esModule = true;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.MobileProcessorService = void 0;
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var KushkiError_1 = require("./../../lib/generic/KushkiError");
21
- var ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
22
- var inversify_1 = require("inversify");
23
- var rxjs_1 = require("rxjs");
24
- var operators_1 = require("rxjs/operators");
25
- var MobileProcessorService = /** @class */ (function () {
26
- function MobileProcessorService(gateway) {
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const KushkiError_1 = require("./../../lib/generic/KushkiError");
21
+ const ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
22
+ const inversify_1 = require("inversify");
23
+ const rxjs_1 = require("rxjs");
24
+ const operators_1 = require("rxjs/operators");
25
+ let MobileProcessorService = class MobileProcessorService {
26
+ constructor(gateway) {
27
27
  this._gateway = gateway;
28
28
  }
29
29
  // istanbul ignore next
30
- MobileProcessorService.prototype.requestToken = function (request, publicCredential, isTest, regional) {
31
- var _this = this;
32
- var token;
33
- var apple_request = this.createAppleRequest(request);
34
- return rxjs_1.of(1).pipe(operators_1.mergeMap(function () {
35
- return new rxjs_1.Observable(function (observer) {
36
- // tslint:disable-next-line:no-any
37
- var apple_session = new window.ApplePaySession(2, apple_request);
38
- apple_session.onvalidatemerchant = function (event) {
39
- return _this.onvalidatemerchant(event, observer, apple_session);
40
- };
41
- apple_session.begin();
42
- });
43
- }), operators_1.mergeMap(function (session) {
44
- return _this.requestGatewayToken(request, session, publicCredential, isTest, regional);
45
- }), operators_1.mergeMap(function (_a) {
46
- var session = _a[0], response = _a[1];
30
+ requestToken(request, publicCredential, isTest, regional) {
31
+ let token;
32
+ const apple_request = this.createAppleRequest(request);
33
+ return rxjs_1.of(1).pipe(operators_1.mergeMap(() => new rxjs_1.Observable((observer) => {
34
+ // tslint:disable-next-line:no-any
35
+ const apple_session = new window.ApplePaySession(2, apple_request);
36
+ apple_session.onvalidatemerchant = (event) => this.onvalidatemerchant(event, observer, apple_session);
37
+ apple_session.begin();
38
+ })), operators_1.mergeMap((session) => this.requestGatewayToken(request, session, publicCredential, isTest, regional)), operators_1.mergeMap(([session, response]) => {
47
39
  token = response.token;
48
40
  delete response.token;
49
41
  session.session.completeMerchantValidation(response);
50
42
  return rxjs_1.of(session);
51
- }), operators_1.mergeMap(function (session) {
52
- return new rxjs_1.Observable(function (observer) {
53
- session.session.onpaymentauthorized = function (event) {
54
- observer.next({
55
- payment_token: event.payment,
56
- session: session.session
57
- });
58
- };
59
- });
60
- }), operators_1.mergeMap(function (session) {
43
+ }), operators_1.mergeMap((session) => new rxjs_1.Observable((observer) => {
44
+ session.session.onpaymentauthorized = (event) => {
45
+ observer.next({
46
+ payment_token: event.payment,
47
+ session: session.session,
48
+ });
49
+ };
50
+ })), operators_1.mergeMap((session) => {
61
51
  session.session.completePayment(
62
52
  // tslint:disable-next-line:no-any
63
53
  window.ApplePaySession.STATUS_SUCCESS);
64
54
  return rxjs_1.of({
65
- token: token,
66
- paymentToken: session.payment_token
55
+ token,
56
+ paymentToken: session.payment_token,
67
57
  });
68
- }), operators_1.catchError(function (error) {
58
+ }), operators_1.catchError((error) => {
69
59
  if (error.message ===
70
60
  "The object does not support the operation or argument.")
71
61
  return rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E006));
72
62
  return rxjs_1.throwError(error);
73
63
  }));
74
- };
75
- MobileProcessorService.prototype.requestGatewayToken = function (request, session, publicCredential, isTest, regional) {
64
+ }
65
+ requestGatewayToken(request, session, publicCredential, isTest, regional) {
76
66
  request.validationUrl = session.validation_url;
77
67
  request.domainName = session.current_url;
78
68
  delete request.description;
79
69
  return rxjs_1.forkJoin([
80
70
  rxjs_1.of(session),
81
71
  this._gateway.requestMobileProcessorToken(request, publicCredential, isTest, regional),
82
- ]).pipe(operators_1.catchError(function (err) {
72
+ ]).pipe(operators_1.catchError((err) => {
83
73
  session.session.abort();
84
74
  return rxjs_1.throwError(err);
85
75
  }));
86
- };
87
- MobileProcessorService.prototype.requestGatewayCharge = function (token, publicCredential, isTest, regional, request, session) {
88
- var charge_request = {
89
- token: token,
76
+ }
77
+ requestGatewayCharge(token, publicCredential, isTest, regional, request, session) {
78
+ const charge_request = {
79
+ token,
90
80
  amount: request.totalAmount,
91
81
  currency: request.currency,
92
82
  encodedPaymentToken: session.payment_token,
93
- softDescriptor: "KushkiPagos"
83
+ softDescriptor: "KushkiPagos",
94
84
  };
95
85
  return rxjs_1.forkJoin([
96
86
  rxjs_1.of(session),
97
87
  this._gateway.chargeMobileProcessor(charge_request, publicCredential, isTest, regional),
98
88
  ]);
99
- };
100
- MobileProcessorService.prototype.createAppleRequest = function (request) {
89
+ }
90
+ createAppleRequest(request) {
101
91
  return {
102
92
  countryCode: "US",
103
93
  currencyCode: "USD",
@@ -108,30 +98,29 @@ var MobileProcessorService = /** @class */ (function () {
108
98
  total: {
109
99
  amount: request.totalAmount,
110
100
  label: request.description,
111
- type: "final"
112
- }
101
+ type: "final",
102
+ },
113
103
  };
114
- };
115
- MobileProcessorService.prototype.completePayment = function (session, response) {
104
+ }
105
+ completePayment(session, response) {
116
106
  session.session.completePayment(
117
107
  // tslint:disable-next-line:no-any
118
108
  window.ApplePaySession.STATUS_SUCCESS);
119
109
  return rxjs_1.of(response);
120
- };
121
- MobileProcessorService.prototype.onvalidatemerchant = function (event, observer, session) {
122
- var validation_url = event.validationURL;
123
- var current_url = window.location.host;
124
- observer.next({ current_url: current_url, validation_url: validation_url, session: session });
125
- };
126
- MobileProcessorService.prototype.paymentAuthorized = function (event, observer, session) {
127
- var payment_token = event.payment;
128
- observer.next({ payment_token: payment_token, session: session.session });
129
- };
130
- MobileProcessorService = __decorate([
131
- inversify_1.injectable(),
132
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
133
- __metadata("design:paramtypes", [Object])
134
- ], MobileProcessorService);
135
- return MobileProcessorService;
136
- }());
110
+ }
111
+ onvalidatemerchant(event, observer, session) {
112
+ const validation_url = event.validationURL;
113
+ const current_url = window.location.host;
114
+ observer.next({ current_url, validation_url, session });
115
+ }
116
+ paymentAuthorized(event, observer, session) {
117
+ const payment_token = event.payment;
118
+ observer.next({ payment_token, session: session.session });
119
+ }
120
+ };
121
+ MobileProcessorService = __decorate([
122
+ inversify_1.injectable(),
123
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
124
+ __metadata("design:paramtypes", [Object])
125
+ ], MobileProcessorService);
137
126
  exports.MobileProcessorService = MobileProcessorService;
@@ -14,25 +14,24 @@ var __metadata = (this && this.__metadata) || function (k, v) {
14
14
  var __param = (this && this.__param) || function (paramIndex, decorator) {
15
15
  return function (target, key) { decorator(target, key, paramIndex); }
16
16
  };
17
- exports.__esModule = true;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.MultiMerchantService = void 0;
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var inversify_1 = require("inversify");
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const inversify_1 = require("inversify");
21
21
  /**
22
22
  * Implementation
23
23
  */
24
- var MultiMerchantService = /** @class */ (function () {
25
- function MultiMerchantService(gateway) {
24
+ let MultiMerchantService = class MultiMerchantService {
25
+ constructor(gateway) {
26
26
  this._gateway = gateway;
27
27
  }
28
- MultiMerchantService.prototype.multiMerchantInfo = function (request, mid, isTest, regional) {
28
+ multiMerchantInfo(request, mid, isTest, regional) {
29
29
  return this._gateway.multiMerchantInfo(request, mid, isTest, regional);
30
- };
31
- MultiMerchantService = __decorate([
32
- inversify_1.injectable(),
33
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
34
- __metadata("design:paramtypes", [Object])
35
- ], MultiMerchantService);
36
- return MultiMerchantService;
37
- }());
30
+ }
31
+ };
32
+ MultiMerchantService = __decorate([
33
+ inversify_1.injectable(),
34
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
35
+ __metadata("design:paramtypes", [Object])
36
+ ], MultiMerchantService);
38
37
  exports.MultiMerchantService = MultiMerchantService;
@@ -11,32 +11,31 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- exports.__esModule = true;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.PayoutsCashService = void 0;
16
16
  /**
17
17
  * Payouts Cash Service file
18
18
  */
19
- var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
- var KushkiGateway_1 = require("./../../lib/gateway/KushkiGateway");
21
- var inversify_1 = require("inversify");
19
+ const Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ const KushkiGateway_1 = require("./../../lib/gateway/KushkiGateway");
21
+ const inversify_1 = require("inversify");
22
22
  require("reflect-metadata");
23
23
  /**
24
24
  * Implementation
25
25
  */
26
- var PayoutsCashService = /** @class */ (function () {
27
- function PayoutsCashService(gateway, antiFraud) {
26
+ let PayoutsCashService = class PayoutsCashService {
27
+ constructor(gateway, antiFraud) {
28
28
  this._kushkiGateway = gateway;
29
29
  this._antiFraud = antiFraud;
30
30
  }
31
- PayoutsCashService.prototype.requestPayoutsCashToken = function (body, mid, isTest, regional) {
31
+ requestPayoutsCashToken(body, mid, isTest, regional) {
32
32
  return this._kushkiGateway.requestPayoutsCashToken(body, mid, isTest, regional);
33
- };
34
- PayoutsCashService = __decorate([
35
- inversify_1.injectable(),
36
- __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
37
- __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AntiFraud)),
38
- __metadata("design:paramtypes", [KushkiGateway_1.KushkiGateway, Object])
39
- ], PayoutsCashService);
40
- return PayoutsCashService;
41
- }());
33
+ }
34
+ };
35
+ PayoutsCashService = __decorate([
36
+ inversify_1.injectable(),
37
+ __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
38
+ __param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AntiFraud)),
39
+ __metadata("design:paramtypes", [KushkiGateway_1.KushkiGateway, Object])
40
+ ], PayoutsCashService);
42
41
  exports.PayoutsCashService = PayoutsCashService;