@kushki/js 1.40.3-alpha.19108.0 → 1.40.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/README.md +1 -1
- package/lib/KushkiInfo.js +1 -1
- package/lib/gateway/KushkiGateway.d.ts +1 -0
- package/lib/gateway/KushkiGateway.js +13 -3
- package/lib/infrastructure/EnvironmentEnum.d.ts +1 -1
- package/lib/infrastructure/EnvironmentEnum.js +1 -1
- package/lib/service/ApplePayService.js +3 -3
- package/lib/service/CardService.js +20 -16
- package/lib/types/apple_pay_get_token_events.d.ts +0 -1
- package/lib/types/apple_pay_get_token_options.d.ts +0 -1
- package/lib/types/jwt_response.d.ts +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
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.40.3
|
|
15
|
+
const kushki_js_version = "1.40.3";
|
|
16
16
|
if (kushkiInfo) {
|
|
17
17
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
18
18
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -80,6 +80,7 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
80
80
|
validateAppleDomain(domain: string, mid: string, testEnv: boolean, regional: boolean): Observable<Validate3DsResponse>;
|
|
81
81
|
startApplePaySession(body: ApplePayStartSessionRequest, mid: string, testEnv: boolean, regional: boolean): Observable<object>;
|
|
82
82
|
getApplePayToken(body: ApplePayPaymentData, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
83
|
+
private _buildCybersourceJwtPath;
|
|
83
84
|
private _assignChannel;
|
|
84
85
|
private _buildHeader;
|
|
85
86
|
}
|
|
@@ -156,9 +156,10 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
156
156
|
}), operators_1.concatMap((path) => this.requestGet(path, testEnv, regional, mid)), operators_1.map((response) => response));
|
|
157
157
|
}
|
|
158
158
|
cybersourceJwt(mid, testEnv, regional, subscriptionId) {
|
|
159
|
-
return rxjs_1.of(1).pipe(operators_1.concatMap(() =>
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(() => {
|
|
160
|
+
const path = this._buildCybersourceJwtPath(subscriptionId);
|
|
161
|
+
return this.requestGet(path, testEnv, regional, mid);
|
|
162
|
+
}), operators_1.map((response) => response));
|
|
162
163
|
}
|
|
163
164
|
getUserId(subscriptionId, mid, testEnv, regional) {
|
|
164
165
|
return rxjs_1.of(1).pipe(operators_1.map(() => `${PathEnum_1.PathEnum.get_user_id}${subscriptionId}/user`), operators_1.concatMap((path) => this.request({}, {
|
|
@@ -180,6 +181,15 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
180
181
|
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
181
182
|
}, `${PathEnum_1.PathEnum.get_apple_pay_token}?switch=${this._multiRegionEcommSwitch}`, testEnv, regional)));
|
|
182
183
|
}
|
|
184
|
+
_buildCybersourceJwtPath(subscriptionId) {
|
|
185
|
+
let path = PathEnum_1.PathEnum.cybersource_jwt;
|
|
186
|
+
const params = [];
|
|
187
|
+
params.push(`securityAuthConfiguration=true`);
|
|
188
|
+
if (subscriptionId)
|
|
189
|
+
params.push(`subscriptionId=${subscriptionId}`);
|
|
190
|
+
path += `?${params.join("&")}`;
|
|
191
|
+
return path;
|
|
192
|
+
}
|
|
183
193
|
_assignChannel(regional, path) {
|
|
184
194
|
if (!regional) {
|
|
185
195
|
this._uatUrl = `${EnvironmentEnum_1.EnvironmentEnum.uat}${path}`;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Environment enum file
|
|
4
4
|
*/
|
|
5
5
|
export declare enum EnvironmentEnum {
|
|
6
|
-
uat = "https://
|
|
6
|
+
uat = "https://api-uat.kushkipagos.com/",
|
|
7
7
|
prod = "https://api.kushkipagos.com/",
|
|
8
8
|
regionalUat = "https://regional-uat.kushkipagos.com/",
|
|
9
9
|
regionalProd = "https://regional.kushkipagos.com/"
|
|
@@ -6,7 +6,7 @@ exports.EnvironmentEnum = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
var EnvironmentEnum;
|
|
8
8
|
(function (EnvironmentEnum) {
|
|
9
|
-
EnvironmentEnum["uat"] = "https://
|
|
9
|
+
EnvironmentEnum["uat"] = "https://api-uat.kushkipagos.com/";
|
|
10
10
|
EnvironmentEnum["prod"] = "https://api.kushkipagos.com/";
|
|
11
11
|
EnvironmentEnum["regionalUat"] = "https://regional-uat.kushkipagos.com/";
|
|
12
12
|
EnvironmentEnum["regionalProd"] = "https://regional.kushkipagos.com/";
|
|
@@ -66,7 +66,7 @@ let ApplePayService = ApplePayService_1 = class ApplePayService {
|
|
|
66
66
|
} }, options.optionalApplePayFields);
|
|
67
67
|
const session = new window.ApplePaySession(this._getSupportedApplePayVersion(), session_params);
|
|
68
68
|
session.onvalidatemerchant = (event) => this._onValidateMerchant(event, mid, session, options, isTest, regional, callback);
|
|
69
|
-
session.onpaymentauthorized = (event) => this._onPaymentAuthorized(event, mid, session, isTest, regional,
|
|
69
|
+
session.onpaymentauthorized = (event) => this._onPaymentAuthorized(event, mid, session, isTest, regional, callback);
|
|
70
70
|
session.oncancel = () => {
|
|
71
71
|
onCancel();
|
|
72
72
|
};
|
|
@@ -150,10 +150,10 @@ let ApplePayService = ApplePayService_1 = class ApplePayService {
|
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
_onPaymentAuthorized(event, mid, session, isTest, regional,
|
|
153
|
+
_onPaymentAuthorized(event, mid, session, isTest, regional, callback) {
|
|
154
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
155
155
|
try {
|
|
156
|
-
const apple_token = Object.assign(Object.assign({}, event.payment.token.paymentData), {
|
|
156
|
+
const apple_token = Object.assign(Object.assign({}, event.payment.token.paymentData), { paymentMethod: event.payment.token.paymentMethod });
|
|
157
157
|
const kushki_token = yield this._gateway
|
|
158
158
|
.getApplePayToken(apple_token, mid, isTest, regional)
|
|
159
159
|
.toPromise();
|
|
@@ -328,7 +328,7 @@ let CardService = CardService_1 = class CardService {
|
|
|
328
328
|
_is3DSSecureEnabled(merchantSettings) {
|
|
329
329
|
return merchantSettings[this._3Dsecure] === true;
|
|
330
330
|
}
|
|
331
|
-
_loadCardinalScript(isTest, onLoad, onLoadError) {
|
|
331
|
+
_loadCardinalScript(isTest, onLoad, onLoadError, cybersourceResponse) {
|
|
332
332
|
const last_script = document.getElementById("cardinal_sc_id");
|
|
333
333
|
if (last_script)
|
|
334
334
|
last_script.remove();
|
|
@@ -338,20 +338,24 @@ let CardService = CardService_1 = class CardService {
|
|
|
338
338
|
script.src = isTest
|
|
339
339
|
? "https://songbirdstag.cardinalcommerce.com/cardinalcruise/v1/songbird.js"
|
|
340
340
|
: "https://songbird.cardinalcommerce.com/cardinalcruise/v1/songbird.js";
|
|
341
|
+
if (cybersourceResponse.songbirdUrl !== undefined &&
|
|
342
|
+
cybersourceResponse.songbirdIntegrityHashValue !== undefined) {
|
|
343
|
+
script.src = cybersourceResponse.songbirdUrl;
|
|
344
|
+
script.integrity = cybersourceResponse.songbirdIntegrityHashValue;
|
|
345
|
+
script.crossOrigin = "anonymous";
|
|
346
|
+
}
|
|
341
347
|
head.appendChild(script);
|
|
342
348
|
script.onload = onLoad;
|
|
343
349
|
script.onerror = onLoadError;
|
|
344
350
|
}
|
|
345
351
|
_initCybersource(cardNumber, mid, isTest, regional) {
|
|
346
|
-
return new rxjs_1.Observable(observer => {
|
|
352
|
+
return rxjs_1.of(1).pipe(operators_1.mergeMap(() => this._gateway.cybersourceJwt(mid, isTest, regional)), operators_1.mergeMap((jwtResponse) => new rxjs_1.Observable(observer => {
|
|
347
353
|
this._loadCardinalScript(isTest, () => {
|
|
348
|
-
|
|
354
|
+
this._initializeCardinal(jwtResponse.jwt, cardNumber);
|
|
355
|
+
observer.next(jwtResponse.jwt);
|
|
349
356
|
observer.complete();
|
|
350
|
-
}, () => observer.error(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E018)));
|
|
351
|
-
})
|
|
352
|
-
this._initializeCardinal(jwtResponse.jwt, cardNumber);
|
|
353
|
-
return jwtResponse.jwt;
|
|
354
|
-
}));
|
|
357
|
+
}, () => observer.error(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E018)), jwtResponse);
|
|
358
|
+
})));
|
|
355
359
|
}
|
|
356
360
|
_initializeCardinal(jwt, cardNumber) {
|
|
357
361
|
window.Cardinal.setup("init", {
|
|
@@ -366,16 +370,16 @@ let CardService = CardService_1 = class CardService {
|
|
|
366
370
|
});
|
|
367
371
|
}
|
|
368
372
|
_initCybersourceSubscription(subscriptionId, mid, isTest, regional) {
|
|
369
|
-
return
|
|
373
|
+
return this._gateway
|
|
374
|
+
.cybersourceJwt(mid, isTest, regional, subscriptionId)
|
|
375
|
+
.pipe(operators_1.mergeMap((jwtResponse) => new rxjs_1.Observable(observer => {
|
|
370
376
|
this._loadCardinalScript(isTest, () => {
|
|
371
|
-
|
|
377
|
+
const bin = buffer_1.Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
378
|
+
this._initializeCardinal(jwtResponse.jwt, bin);
|
|
379
|
+
observer.next(jwtResponse.jwt);
|
|
372
380
|
observer.complete();
|
|
373
|
-
}, () => observer.error(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E018)));
|
|
374
|
-
})
|
|
375
|
-
const bin = buffer_1.Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
376
|
-
this._initializeCardinal(jwtResponse.jwt, bin);
|
|
377
|
-
return jwtResponse.jwt;
|
|
378
|
-
}));
|
|
381
|
+
}, () => observer.error(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E018)), jwtResponse);
|
|
382
|
+
})));
|
|
379
383
|
}
|
|
380
384
|
// istanbul ignore next
|
|
381
385
|
_completeCardinal(secureServiceId, mid, isTest, regional, callback) {
|
|
@@ -6,7 +6,6 @@ export interface ApplePayGetTokenOptions {
|
|
|
6
6
|
currencyCode: "USD" | "COP" | "CLP" | "UF" | "PEN" | "MXN" | "BRL" | "CRC" | "GTQ" | "HNL" | "NIO";
|
|
7
7
|
displayName: string;
|
|
8
8
|
amount: number;
|
|
9
|
-
isSubscription?: boolean;
|
|
10
9
|
optionalApplePayFields?: {
|
|
11
10
|
[k: string]: any;
|
|
12
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushki/js",
|
|
3
|
-
"version": "1.40.3
|
|
3
|
+
"version": "1.40.3",
|
|
4
4
|
"description": "kushki-js",
|
|
5
5
|
"main": "lib/lib.js",
|
|
6
6
|
"types": "lib/lib.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"publish:latest": "npm run build && npm publish",
|
|
20
|
-
"publish:alpha": "npm run build && npm publish --tag alpha
|
|
20
|
+
"publish:alpha": "npm run build && npm publish --tag alpha",
|
|
21
21
|
"prepare": "npm run tsc:interface && npm run test:unit && npm run test:coverage && npm run build:npm",
|
|
22
22
|
"tsc:interface": "kushki json2ts",
|
|
23
23
|
"tsc:check": "tsc --project tsconfig.check.json --noEmit",
|