@kushki/js 1.39.2 → 1.39.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.
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.2";
15
+ const kushki_js_version = "1.39.3";
16
16
  if (kushkiInfo) {
17
17
  if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
18
18
  kushkiInfo.platformVersion = kushki_js_version;
@@ -56,6 +56,7 @@ export declare class CardService implements ICardService {
56
56
  private _getDeviceTokenSiftScienceObject;
57
57
  private _createSubscriptionSiftScienceSession;
58
58
  private _checkCardLength;
59
+ private _checkSecureInitCardLength;
59
60
  private _getScienceSession;
60
61
  private _checkCurrency;
61
62
  private _getRequestSiftObject;
@@ -216,7 +216,7 @@ let CardService = CardService_1 = class CardService {
216
216
  }
217
217
  requestSecureInit(request, mid, isTest, regional, callback) {
218
218
  rxjs_1.of(1)
219
- .pipe(operators_1.map(() => this._checkCardLength(request, ErrorEnum_1.ErrorCode.E014)), operators_1.switchMap(() => this._getMerchantSettings(mid, isTest, regional)), operators_1.switchMap((merchantSettings) => rxjs_1.iif(() => this._is3DSSecureEnabled(merchantSettings), rxjs_1.of(merchantSettings), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E013)))), operators_1.switchMap((merchant) => rxjs_1.forkJoin(this._getCybersourceJwt(merchant, mid, isTest, regional, request.card.number), rxjs_1.of(merchant))))
219
+ .pipe(operators_1.map(() => this._checkSecureInitCardLength(request)), operators_1.switchMap(() => this._getMerchantSettings(mid, isTest, regional)), operators_1.switchMap((merchantSettings) => rxjs_1.iif(() => this._is3DSSecureEnabled(merchantSettings), rxjs_1.of(merchantSettings), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E013)))), operators_1.switchMap((merchant) => rxjs_1.forkJoin(this._getCybersourceJwt(merchant, mid, isTest, regional, request.card.number), rxjs_1.of(merchant))))
220
220
  .subscribe({
221
221
  error: (err) => Kushki_1.Kushki.callbackError(err, callback),
222
222
  next: ([jwt_response, merchant_settings]) => {
@@ -281,9 +281,13 @@ let CardService = CardService_1 = class CardService {
281
281
  _createSubscriptionSiftScienceSession(subscriptionId, mid, isTest, merchantSettingsResponse, regional, request) {
282
282
  return rxjs_1.of(1).pipe(operators_1.switchMap(() => this._getUserId(subscriptionId, mid, isTest, regional, request.userId)), operators_1.switchMap((getUserIdResponse) => this._antiFraud.createSiftScienceSession(subscriptionId, "", mid, isTest, merchantSettingsResponse, UtilsService_1.UtilsService.sGet(getUserIdResponse, "userId"))));
283
283
  }
284
- _checkCardLength(request, errorCode = ErrorEnum_1.ErrorCode.E005) {
284
+ _checkCardLength(request) {
285
285
  if (request.card.number.length < 14 || request.card.number.length > 19)
286
- throw new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS[errorCode]);
286
+ throw new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS[ErrorEnum_1.ErrorCode.E005]);
287
+ }
288
+ _checkSecureInitCardLength(request) {
289
+ if (request.card.number.length < 6 || request.card.number.length > 19)
290
+ throw new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS[ErrorEnum_1.ErrorCode.E014]);
287
291
  }
288
292
  _getScienceSession(request, mid, isTest, merchant) {
289
293
  return rxjs_1.of(1).pipe(operators_1.switchMap(() => {
@@ -385,7 +389,7 @@ let CardService = CardService_1 = class CardService {
385
389
  order: {
386
390
  Consumer: {
387
391
  Account: {
388
- AccountNumber: cardNumber,
392
+ AccountNumber: UtilsService_1.getBinFromCreditCardNumber(cardNumber),
389
393
  },
390
394
  },
391
395
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.39.2",
3
+ "version": "1.39.3",
4
4
  "description": "kushki-js",
5
5
  "main": "lib/lib.js",
6
6
  "types": "lib/lib.d.ts",