@kushki/js 1.39.1 → 1.39.2
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/README.md +1 -0
- package/lib/KushkiInfo.js +3 -2
- package/lib/service/CardService.js +10 -6
- package/package.json +4 -2
package/lib/KushkiInfo.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.KInfo = void 0;
|
|
7
|
+
const buffer_1 = require("buffer");
|
|
7
8
|
const PlatformCodeEnum_1 = require("./../lib/infrastructure/PlatformCodeEnum");
|
|
8
9
|
const UtilsService_1 = require("./../lib/service/UtilsService");
|
|
9
10
|
/**
|
|
@@ -11,7 +12,7 @@ const UtilsService_1 = require("./../lib/service/UtilsService");
|
|
|
11
12
|
*/
|
|
12
13
|
class KInfo {
|
|
13
14
|
static buildKushkiInfo(kushkiInfo) {
|
|
14
|
-
const kushki_js_version = "1.39.
|
|
15
|
+
const kushki_js_version = "1.39.2";
|
|
15
16
|
if (kushkiInfo) {
|
|
16
17
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
17
18
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -23,7 +24,7 @@ class KInfo {
|
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
static _encodeKushkiInfo(kushkiInfo) {
|
|
26
|
-
return Buffer.from(JSON.stringify(kushkiInfo)).toString("base64");
|
|
27
|
+
return buffer_1.Buffer.from(JSON.stringify(kushkiInfo)).toString("base64");
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
exports.KInfo = KInfo;
|
|
@@ -28,6 +28,7 @@ var CardService_1;
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.CardService = void 0;
|
|
30
30
|
const cardinal_sandbox_js_1 = require("@kushki/cardinal-sandbox-js");
|
|
31
|
+
const buffer_1 = require("buffer");
|
|
31
32
|
const Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
32
33
|
const dot = require("dot-object");
|
|
33
34
|
const KushkiError_1 = require("./../../lib/generic/KushkiError");
|
|
@@ -215,14 +216,17 @@ let CardService = CardService_1 = class CardService {
|
|
|
215
216
|
}
|
|
216
217
|
requestSecureInit(request, mid, isTest, regional, callback) {
|
|
217
218
|
rxjs_1.of(1)
|
|
218
|
-
.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) => this._getCybersourceJwt(merchant, mid, isTest, regional, request.card.number)
|
|
219
|
-
jwt: jwt,
|
|
220
|
-
})))
|
|
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))))
|
|
221
220
|
.subscribe({
|
|
222
221
|
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
223
|
-
next: (
|
|
222
|
+
next: ([jwt_response, merchant_settings]) => {
|
|
223
|
+
const jwt = { jwt: jwt_response };
|
|
224
|
+
if (this._isSandboxEnabled(merchant_settings)) {
|
|
225
|
+
callback(jwt);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
224
228
|
this._request3DSToken(isTest, () => {
|
|
225
|
-
callback(
|
|
229
|
+
callback(jwt);
|
|
226
230
|
});
|
|
227
231
|
},
|
|
228
232
|
});
|
|
@@ -352,7 +356,7 @@ let CardService = CardService_1 = class CardService {
|
|
|
352
356
|
}
|
|
353
357
|
_initCybersourceSubscription(subscriptionId, mid, isTest, regional) {
|
|
354
358
|
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this._gateway.cybersourceJwt(mid, isTest, regional, subscriptionId)), operators_1.map((jwtResponse) => {
|
|
355
|
-
const bin = Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
359
|
+
const bin = buffer_1.Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
356
360
|
this._initializeCardinal(isTest, jwtResponse.jwt, bin);
|
|
357
361
|
return jwtResponse.jwt;
|
|
358
362
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushki/js",
|
|
3
|
-
"version": "1.39.
|
|
3
|
+
"version": "1.39.2",
|
|
4
4
|
"description": "kushki-js",
|
|
5
5
|
"main": "lib/lib.js",
|
|
6
6
|
"types": "lib/lib.d.ts",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
],
|
|
12
12
|
"husky": {
|
|
13
13
|
"hooks": {
|
|
14
|
-
"pre-commit": "lint-staged"
|
|
14
|
+
"pre-commit": "lint-staged",
|
|
15
|
+
"pre-push": "npm run lint:duplicate && npm run lint:check && npm run test:unit"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
@@ -101,6 +102,7 @@
|
|
|
101
102
|
"acorn": "6.4.1",
|
|
102
103
|
"aws-amplify": "4.3.30",
|
|
103
104
|
"axios": "0.21.3",
|
|
105
|
+
"buffer": "^6.0.3",
|
|
104
106
|
"ci": "^2.1.1",
|
|
105
107
|
"dot-object": "2.1.4",
|
|
106
108
|
"inversify": "5.0.1",
|