@kushki/js 1.39.0 → 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/Kushki.js +1 -1
- package/lib/KushkiInfo.js +3 -2
- package/lib/repository/ICardService.d.ts +2 -1
- package/lib/service/CardService.d.ts +1 -1
- package/lib/service/CardService.js +23 -10
- package/package.json +2 -1
package/lib/Kushki.js
CHANGED
|
@@ -172,7 +172,7 @@ class Kushki {
|
|
|
172
172
|
this._cardService.validate3DS(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
173
173
|
}
|
|
174
174
|
requestSecureInit(body, callback) {
|
|
175
|
-
this.
|
|
175
|
+
this._cardService.requestSecureInit(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* @param {Function} callback - function to execute when animation ends.
|
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;
|
|
@@ -77,6 +77,7 @@ export interface ICardService {
|
|
|
77
77
|
* @param mid - public merchant id
|
|
78
78
|
* @param isTest - is test environment
|
|
79
79
|
* @param regional - Define if endpoint used regional URL
|
|
80
|
+
* @param callback
|
|
80
81
|
*/
|
|
81
|
-
requestSecureInit(body: SecureInitRequest, mid: string, isTest: boolean, regional: boolean):
|
|
82
|
+
requestSecureInit(body: SecureInitRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: SecureInitResponse | ErrorResponse) => void): void;
|
|
82
83
|
}
|
|
@@ -46,7 +46,7 @@ export declare class CardService implements ICardService {
|
|
|
46
46
|
requestDeferred(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<IDeferredResponse[]>;
|
|
47
47
|
requestBinInfo(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<BinInfoResponse>;
|
|
48
48
|
validate3DS(body: Validate3DSRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
49
|
-
requestSecureInit(request: SecureInitRequest, mid: string, isTest: boolean, regional: boolean):
|
|
49
|
+
requestSecureInit(request: SecureInitRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: SecureInitResponse | ErrorResponse) => void): void;
|
|
50
50
|
private _getCreateSubscriptionDataToTransform;
|
|
51
51
|
private _request3DSToken;
|
|
52
52
|
private _setupCompleteCardinal;
|
|
@@ -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");
|
|
@@ -213,30 +214,42 @@ let CardService = CardService_1 = class CardService {
|
|
|
213
214
|
});
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
|
-
requestSecureInit(request, mid, isTest, regional) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
requestSecureInit(request, mid, isTest, regional, callback) {
|
|
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))))
|
|
220
|
+
.subscribe({
|
|
221
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
222
|
+
next: ([jwt_response, merchant_settings]) => {
|
|
223
|
+
const jwt = { jwt: jwt_response };
|
|
224
|
+
if (this._isSandboxEnabled(merchant_settings)) {
|
|
225
|
+
callback(jwt);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this._request3DSToken(isTest, () => {
|
|
229
|
+
callback(jwt);
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
});
|
|
220
233
|
}
|
|
221
234
|
_getCreateSubscriptionDataToTransform(siftObject, subscriptionTokenRequest) {
|
|
222
235
|
if (siftObject.userId === null || siftObject.sessionId === null)
|
|
223
236
|
return Object.assign({}, subscriptionTokenRequest);
|
|
224
237
|
return Object.assign(Object.assign({}, subscriptionTokenRequest), siftObject);
|
|
225
238
|
}
|
|
226
|
-
_request3DSToken(isTest,
|
|
239
|
+
_request3DSToken(isTest, callback) {
|
|
227
240
|
if (isTest)
|
|
228
241
|
Promise.resolve().then(() => require("./../../lib/libs/cardinal/staging")).then(() => {
|
|
229
|
-
this._setupCompleteCardinal(
|
|
242
|
+
this._setupCompleteCardinal(callback);
|
|
230
243
|
});
|
|
231
244
|
else
|
|
232
245
|
Promise.resolve().then(() => require("./../../lib/libs/cardinal/prod")).then(() => {
|
|
233
|
-
this._setupCompleteCardinal(
|
|
246
|
+
this._setupCompleteCardinal(callback);
|
|
234
247
|
});
|
|
235
248
|
}
|
|
236
249
|
// istanbul ignore next
|
|
237
|
-
_setupCompleteCardinal(
|
|
250
|
+
_setupCompleteCardinal(callback) {
|
|
238
251
|
window.Cardinal.on("payments.setupComplete", () => __awaiter(this, void 0, void 0, function* () {
|
|
239
|
-
|
|
252
|
+
callback();
|
|
240
253
|
}));
|
|
241
254
|
}
|
|
242
255
|
// istanbul ignore next
|
|
@@ -343,7 +356,7 @@ let CardService = CardService_1 = class CardService {
|
|
|
343
356
|
}
|
|
344
357
|
_initCybersourceSubscription(subscriptionId, mid, isTest, regional) {
|
|
345
358
|
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this._gateway.cybersourceJwt(mid, isTest, regional, subscriptionId)), operators_1.map((jwtResponse) => {
|
|
346
|
-
const bin = Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
359
|
+
const bin = buffer_1.Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
347
360
|
this._initializeCardinal(isTest, jwtResponse.jwt, bin);
|
|
348
361
|
return jwtResponse.jwt;
|
|
349
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",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"acorn": "6.4.1",
|
|
103
103
|
"aws-amplify": "4.3.30",
|
|
104
104
|
"axios": "0.21.3",
|
|
105
|
+
"buffer": "^6.0.3",
|
|
105
106
|
"ci": "^2.1.1",
|
|
106
107
|
"dot-object": "2.1.4",
|
|
107
108
|
"inversify": "5.0.1",
|