@kushki/js 1.30.0-alpha.19723 → 1.30.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.
@@ -73,7 +73,7 @@ export declare class KushkiGateway implements IKushkiGateway {
73
73
  chargeMobileProcessor(body: MobileProcessorChargeRequest, publicCredential: string, testEnv: boolean, regional: boolean): Observable<MobileProcessorChargeResponse>;
74
74
  deletePaymentMethod(body: DeletePaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<boolean>;
75
75
  requestSavedPaymentMethods(body: SavedPaymentMethodRequest, testEnv: boolean, regional: boolean, mid: string): Observable<PaymentDataResponse[]>;
76
- cybersourceJwt(mid: string, testEnv: boolean, regional: boolean, subscriptionId?: string): Observable<string>;
76
+ cybersourceJwt(mid: string, testEnv: boolean, regional: boolean): Observable<string>;
77
77
  getUserId(subscriptionId: string, mid: string, testEnv: boolean, regional: boolean): Observable<GetUserId>;
78
78
  private _assignChannel;
79
79
  private _buildHeader;
@@ -248,12 +248,10 @@ var KushkiGateway = /** @class */ (function () {
248
248
  return _this.requestGet(path, testEnv, regional, mid);
249
249
  }), operators_1.map(function (response) { return response; }));
250
250
  };
251
- KushkiGateway.prototype.cybersourceJwt = function (mid, testEnv, regional, subscriptionId) {
251
+ KushkiGateway.prototype.cybersourceJwt = function (mid, testEnv, regional) {
252
252
  var _this = this;
253
253
  return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
254
- return _this.requestGet(subscriptionId
255
- ? PathEnum_1.PathEnum.cybersource_jwt + "?subscriptionId=" + subscriptionId
256
- : PathEnum_1.PathEnum.cybersource_jwt, testEnv, regional, mid);
254
+ return _this.requestGet(PathEnum_1.PathEnum.cybersource_jwt, testEnv, regional, mid);
257
255
  }), operators_1.map(function (response) { return response.jwt; }));
258
256
  };
259
257
  KushkiGateway.prototype.getUserId = function (subscriptionId, mid, testEnv, regional) {
@@ -161,7 +161,7 @@ export interface IKushkiGateway {
161
161
  * @param testEnv - is test environment
162
162
  * @param regional - Define if endpoint used regional URL
163
163
  */
164
- cybersourceJwt(mid: string, testEnv: boolean, regional: boolean, subscriptionId?: string): Observable<string>;
164
+ cybersourceJwt(mid: string, testEnv: boolean, regional: boolean): Observable<string>;
165
165
  /**
166
166
  * Get userId
167
167
  * @param subscriptionId subscription id for the request
@@ -58,12 +58,7 @@ export declare class CardService implements ICardService {
58
58
  private _checkAmount;
59
59
  private _checkRequestBody;
60
60
  private _getCybersourceJwt;
61
- private _isSandboxEnabled;
62
- private _getCybersourceJwtSubscription;
63
- private _is3DSSecureEnabled;
64
61
  private _initCybersource;
65
- private _initializeCardinal;
66
- private _initCybersourceSubscription;
67
62
  private _completeCardinal;
68
63
  private static _initCardinal;
69
64
  private static _ccaCardinal;
@@ -143,7 +143,9 @@ var CardService = /** @class */ (function () {
143
143
  _this._setSandboxEnable(!!merchant.sandboxEnable);
144
144
  return rxjs_1.forkJoin([
145
145
  _this._getDeviceTokenSiftScienceObject(request, mid, isTest, merchant, regional),
146
- _this._getCybersourceJwtSubscription(merchant, mid, isTest, regional, request.subscriptionId),
146
+ _this._getCybersourceJwt(merchant, mid, isTest, regional, Object.prototype.hasOwnProperty.call(request, "cardNumber")
147
+ ? request.cardNumber
148
+ : undefined),
147
149
  ]);
148
150
  }), operators_1.switchMap(function (_a) {
149
151
  var sift_science_obj = _a[0], jwt = _a[1];
@@ -227,7 +229,7 @@ var CardService = /** @class */ (function () {
227
229
  CardService.prototype.requestSecureInit = function (request, mid, isTest, regional) {
228
230
  var _this = this;
229
231
  return rxjs_1.of(1).pipe(operators_1.map(function () { return _this._checkCardLength(request, ErrorEnum_1.ErrorCode.E014); }), operators_1.switchMap(function () { return _this._getMerchantSettings(mid, isTest, regional); }), operators_1.switchMap(function (merchantSettings) {
230
- return rxjs_1.iif(function () { return _this._is3DSSecureEnabled(merchantSettings); }, rxjs_1.of(merchantSettings), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E013)));
232
+ return rxjs_1.iif(function () { return merchantSettings[_this._3Dsecure] === true; }, rxjs_1.of(merchantSettings), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E013)));
231
233
  }), operators_1.switchMap(function (merchant) {
232
234
  return _this._getCybersourceJwt(merchant, mid, isTest, regional, request.card.number);
233
235
  }), operators_1.map(function (jwt) { return ({
@@ -303,53 +305,26 @@ var CardService = /** @class */ (function () {
303
305
  CardService.prototype._getCybersourceJwt = function (merchantSettings, mid, isTest, regional, cardNumber) {
304
306
  var _this = this;
305
307
  return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
306
- if (_this._is3DSSecureEnabled(merchantSettings) &&
308
+ if (merchantSettings[_this._3Dsecure] === true &&
307
309
  cardNumber !== undefined)
308
- return rxjs_1.iif(function () { return _this._isSandboxEnabled(merchantSettings); }, _this._initCybersourceSandbox(mid, isTest, regional), _this._initCybersource(cardNumber, mid, isTest, regional));
310
+ return rxjs_1.iif(function () { return !!merchantSettings.sandboxEnable; }, _this._initCybersourceSandbox(mid, isTest, regional), _this._initCybersource(cardNumber, mid, isTest, regional));
309
311
  return rxjs_1.of(undefined);
310
312
  }));
311
313
  };
312
- CardService.prototype._isSandboxEnabled = function (merchantSettings) {
313
- return !!merchantSettings.sandboxEnable;
314
- };
315
- CardService.prototype._getCybersourceJwtSubscription = function (merchantSettings, mid, isTest, regional, subscriptionId) {
316
- var _this = this;
317
- return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
318
- if (_this._is3DSSecureEnabled(merchantSettings))
319
- return rxjs_1.iif(function () { return _this._isSandboxEnabled(merchantSettings); }, _this._initCybersourceSandbox(mid, isTest, regional), _this._initCybersourceSubscription(subscriptionId, mid, isTest, regional));
320
- return rxjs_1.of(undefined);
321
- }));
322
- };
323
- CardService.prototype._is3DSSecureEnabled = function (merchantSettings) {
324
- return merchantSettings[this._3Dsecure] === true;
325
- };
326
314
  CardService.prototype._initCybersource = function (cardNumber, mid, isTest, regional) {
327
315
  var _this = this;
328
316
  return rxjs_1.of(1).pipe(operators_1.switchMap(function () { return _this._gateway.cybersourceJwt(mid, isTest, regional); }), operators_1.map(function (jwt) {
329
- _this._initializeCardinal(isTest, jwt, cardNumber);
317
+ if (isTest)
318
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/staging"); }).then(function () {
319
+ CardService_1._initCardinal(jwt, cardNumber);
320
+ });
321
+ else
322
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/prod"); }).then(function () {
323
+ CardService_1._initCardinal(jwt, cardNumber);
324
+ });
330
325
  return jwt;
331
326
  }));
332
327
  };
333
- CardService.prototype._initializeCardinal = function (isTest, jwt, identifier) {
334
- if (isTest)
335
- Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/staging"); }).then(function () {
336
- CardService_1._initCardinal(jwt, identifier);
337
- });
338
- else
339
- Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/prod"); }).then(function () {
340
- CardService_1._initCardinal(jwt, identifier);
341
- });
342
- };
343
- CardService.prototype._initCybersourceSubscription = function (subscriptionId, mid, isTest, regional) {
344
- var _this = this;
345
- return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
346
- return _this._gateway.cybersourceJwt(mid, isTest, regional, subscriptionId);
347
- }), operators_1.map(function (jwtResponse) {
348
- var bin = Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
349
- _this._initializeCardinal(isTest, jwtResponse.jwt, bin);
350
- return jwtResponse.jwt;
351
- }));
352
- };
353
328
  // istanbul ignore next
354
329
  CardService.prototype._completeCardinal = function (secureServiceId, mid, isTest, regional, callback) {
355
330
  var _this = this;
@@ -3,5 +3,4 @@
3
3
 
4
4
  export interface JwtResponse {
5
5
  jwt: string;
6
- identifier?: string;
7
6
  }
@@ -9,6 +9,7 @@ export interface SubscriptionIdRequest {
9
9
  sessionId?: string | null;
10
10
  amount?: Amount;
11
11
  currency?: Currency;
12
+ cardNumber?: string;
12
13
  cardHolderName?: string;
13
14
  [k: string]: any;
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.30.0-alpha.19723",
3
+ "version": "1.30.1",
4
4
  "description": "kushki-js",
5
5
  "main": "lib/lib.js",
6
6
  "types": "lib/lib.d.ts",
@@ -95,10 +95,10 @@
95
95
  "webpack-dev-server": "3.3.1"
96
96
  },
97
97
  "dependencies": {
98
- "@aws-amplify/auth": "3.4.22",
98
+ "@aws-amplify/auth": "4.6.1",
99
99
  "@kushki/cardinal-sandbox-js": "1.0.3",
100
100
  "acorn": "6.4.1",
101
- "aws-amplify": "3.3.19",
101
+ "aws-amplify": "4.3.30",
102
102
  "axios": "0.21.1",
103
103
  "ci": "^2.1.1",
104
104
  "dot-object": "2.1.4",