@kushki/js 1.27.4 → 1.28.0-alpha.16473
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/constant/CreditCardEspecifications.d.ts +6 -0
- package/lib/constant/CreditCardEspecifications.js +7 -0
- package/lib/infrastructure/PathEnum.d.ts +1 -1
- package/lib/infrastructure/PathEnum.js +1 -1
- package/lib/service/CardService.js +2 -2
- package/lib/service/UtilsService.d.ts +1 -3
- package/lib/service/UtilsService.js +7 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export declare enum PathEnum {
|
|
|
17
17
|
deferred_options = "card/v1/deferred/",
|
|
18
18
|
gateway_status = "rules/v1/gatewayStatus",
|
|
19
19
|
secure_validation = "rules/v1/secureValidation",
|
|
20
|
-
bin_info = "
|
|
20
|
+
bin_info = "deferred/v2/bin/",
|
|
21
21
|
brands_by_merchant = "card/v1/merchant/brands",
|
|
22
22
|
card_async_tokens = "card-async/v1/tokens",
|
|
23
23
|
subscription_card_async_tokens = "subscriptions/v1/card-async/tokens",
|
|
@@ -20,7 +20,7 @@ var PathEnum;
|
|
|
20
20
|
PathEnum["deferred_options"] = "card/v1/deferred/";
|
|
21
21
|
PathEnum["gateway_status"] = "rules/v1/gatewayStatus";
|
|
22
22
|
PathEnum["secure_validation"] = "rules/v1/secureValidation";
|
|
23
|
-
PathEnum["bin_info"] = "
|
|
23
|
+
PathEnum["bin_info"] = "deferred/v2/bin/";
|
|
24
24
|
PathEnum["brands_by_merchant"] = "card/v1/merchant/brands";
|
|
25
25
|
PathEnum["card_async_tokens"] = "card-async/v1/tokens";
|
|
26
26
|
PathEnum["subscription_card_async_tokens"] = "subscriptions/v1/card-async/tokens";
|
|
@@ -186,7 +186,7 @@ var CardService = /** @class */ (function () {
|
|
|
186
186
|
return this._gateway.requestDeferredConditions(mid, binBody.bin, isTest, regional);
|
|
187
187
|
};
|
|
188
188
|
CardService.prototype.requestBinInfo = function (binBody, mid, isTest, regional) {
|
|
189
|
-
return this._gateway.requestBinInfo(mid, String(binBody.bin)
|
|
189
|
+
return this._gateway.requestBinInfo(mid, UtilsService_1.getBinFromCreditCardNumber(String(binBody.bin)), isTest, regional);
|
|
190
190
|
};
|
|
191
191
|
CardService.prototype.validate3DS = function (body, mid, isTest, regional, callback) {
|
|
192
192
|
var _this = this;
|
|
@@ -246,7 +246,7 @@ var CardService = /** @class */ (function () {
|
|
|
246
246
|
var _this = this;
|
|
247
247
|
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
248
248
|
if (request.card && request.card.number !== undefined)
|
|
249
|
-
return _this._antiFraud.createSiftScienceSession(request.card.number
|
|
249
|
+
return _this._antiFraud.createSiftScienceSession(UtilsService_1.getBinFromCreditCardNumber(request.card.number), request.card.number.slice(-4), mid, isTest, merchant);
|
|
250
250
|
return rxjs_1.of({
|
|
251
251
|
sessionId: null,
|
|
252
252
|
userId: null
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/* tslint:disable:all */
|
|
2
|
-
/**
|
|
3
|
-
* UtilsService Class
|
|
4
|
-
*/
|
|
5
2
|
export declare class UtilsService {
|
|
6
3
|
/**
|
|
7
4
|
* Lodash native methods implementation: https://youmightnotneed.com/lodash/
|
|
@@ -26,3 +23,4 @@ export declare class UtilsService {
|
|
|
26
23
|
*/
|
|
27
24
|
static sIsEmpty: (obj: any) => boolean;
|
|
28
25
|
}
|
|
26
|
+
export declare function getBinFromCreditCardNumber(value: string): string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.UtilsService = void 0;
|
|
3
|
+
exports.getBinFromCreditCardNumber = exports.UtilsService = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* UtilsService Class
|
|
6
6
|
*/
|
|
7
|
+
var CreditCardEspecifications_1 = require("./../../lib/constant/CreditCardEspecifications");
|
|
7
8
|
var UtilsService = /** @class */ (function () {
|
|
8
9
|
function UtilsService() {
|
|
9
10
|
}
|
|
@@ -58,3 +59,8 @@ var UtilsService = /** @class */ (function () {
|
|
|
58
59
|
return UtilsService;
|
|
59
60
|
}());
|
|
60
61
|
exports.UtilsService = UtilsService;
|
|
62
|
+
function getBinFromCreditCardNumber(value) {
|
|
63
|
+
var card_value = value.replace(/\D/g, "");
|
|
64
|
+
return card_value.slice(CreditCardEspecifications_1.CREDIT_CARD_ESPECIFICATIONS.cardInitialBinPlace, CreditCardEspecifications_1.CREDIT_CARD_ESPECIFICATIONS.cardFinalBinPlace);
|
|
65
|
+
}
|
|
66
|
+
exports.getBinFromCreditCardNumber = getBinFromCreditCardNumber;
|