@kushki/js 1.40.2-alpha → 1.40.2-alpha.1
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 +1 -1
- package/lib/gateway/KushkiGateway.d.ts +2 -2
- package/lib/gateway/KushkiGateway.js +15 -8
- package/lib/repository/IKushkiGateway.d.ts +1 -1
- package/lib/service/CardService.js +18 -12
- package/lib/types/delete_payment_method_response.d.ts +7 -0
- package/lib/types/init_auth_request.d.ts +6 -0
- package/lib/types/init_auth_response.d.ts +6 -0
- package/lib/types/validate_session_response.d.ts +6 -0
- package/lib/types/verify_auth_request.d.ts +7 -0
- package/lib/types/verify_auth_response.d.ts +7 -0
- package/package.json +3 -3
- package/lib/infrastructure/CognitoErrorEnum.d.ts +0 -4
- package/lib/infrastructure/CognitoErrorEnum.js +0 -7
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.2-alpha";
|
|
15
|
+
const kushki_js_version = "1.40.2-alpha.1";
|
|
16
16
|
if (kushkiInfo) {
|
|
17
17
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
18
18
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -49,9 +49,9 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
49
49
|
requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string): Observable<T>;
|
|
50
50
|
requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
|
|
51
51
|
requestBrandsLogosByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
|
|
52
|
-
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
52
|
+
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
|
|
53
53
|
requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
54
|
-
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
54
|
+
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
|
|
55
55
|
requestTransferToken(body: TransferTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
56
56
|
requestMerchantSettings(mid: string, testEnv: boolean, regional: boolean): Observable<MerchantSettingsResponse>;
|
|
57
57
|
requestPseBankList(mid: string, testEnv: boolean, regional: boolean): Observable<BankListResponse>;
|
|
@@ -11,7 +11,6 @@ exports.KushkiGateway = void 0;
|
|
|
11
11
|
/**
|
|
12
12
|
* Kushki Gateway File
|
|
13
13
|
*/
|
|
14
|
-
/* tslint:disable: no-unnecessary-callback-wrapper */
|
|
15
14
|
const axios_1 = require("axios");
|
|
16
15
|
const AurusError_1 = require("./../../lib/generic/AurusError");
|
|
17
16
|
const EnvironmentEnum_1 = require("./../../lib/infrastructure/EnvironmentEnum");
|
|
@@ -51,7 +50,7 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
51
50
|
requestGet(path, testEnv, regional, mid) {
|
|
52
51
|
return rxjs_1.of(this._assignChannel(regional, path)).pipe(operators_1.switchMap(() => axios_1.default.get(`${testEnv ? this._uatUrl : this._prodUrl}`, {
|
|
53
52
|
headers: {
|
|
54
|
-
[this._publicHeader]: mid,
|
|
53
|
+
[this._publicHeader]: mid || "",
|
|
55
54
|
[this._contentHeader]: this._contentJSON,
|
|
56
55
|
},
|
|
57
56
|
})), operators_1.map((response) => response.data), operators_1.catchError((err) => rxjs_1.throwError(err)));
|
|
@@ -62,20 +61,28 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
62
61
|
requestBrandsLogosByMerchant(mid, testEnv, regional) {
|
|
63
62
|
return this.requestGet(`${PathEnum_1.PathEnum.brands_logos_by_merchant}`, testEnv, regional, mid);
|
|
64
63
|
}
|
|
65
|
-
requestToken(body, mid, testEnv, regional) {
|
|
66
|
-
return this.request(body, {
|
|
64
|
+
requestToken(body, mid, testEnv, regional, authorization) {
|
|
65
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(() => rxjs_1.iif(() => authorization === undefined, this.request(body, {
|
|
67
66
|
[this._publicHeader]: mid,
|
|
68
67
|
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
69
|
-
}, PathEnum_1.PathEnum.card_tokens, testEnv, regional)
|
|
68
|
+
}, PathEnum_1.PathEnum.card_tokens, testEnv, regional), this.request(body, {
|
|
69
|
+
[this._kshAuthorization]: authorization,
|
|
70
|
+
[this._publicHeader]: mid,
|
|
71
|
+
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
72
|
+
}, PathEnum_1.PathEnum.card_tokens, testEnv, regional))));
|
|
70
73
|
}
|
|
71
74
|
requestDeviceToken(body, mid, testEnv, regional) {
|
|
72
75
|
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.request(body, Object.assign(Object.assign({}, this._buildHeader(mid)), { [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo }), `${PathEnum_1.PathEnum.card_token_charge}${body.subscriptionId}/tokens`, testEnv, regional)));
|
|
73
76
|
}
|
|
74
|
-
requestSubscriptionToken(body, mid, testEnv, regional) {
|
|
75
|
-
return this.request(body, {
|
|
77
|
+
requestSubscriptionToken(body, mid, testEnv, regional, authorization) {
|
|
78
|
+
return rxjs_1.of(1).pipe(operators_1.concatMap(() => rxjs_1.iif(() => authorization === undefined, this.request(body, {
|
|
79
|
+
[this._publicHeader]: mid,
|
|
80
|
+
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
81
|
+
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional), this.request(body, {
|
|
82
|
+
[this._kshAuthorization]: authorization,
|
|
76
83
|
[this._publicHeader]: mid,
|
|
77
84
|
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
78
|
-
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional);
|
|
85
|
+
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional))), operators_1.map((response) => response));
|
|
79
86
|
}
|
|
80
87
|
requestTransferToken(body, mid, testEnv, regional) {
|
|
81
88
|
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.request(body, Object.assign(Object.assign({}, this._buildHeader(mid)), { [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo }), PathEnum_1.PathEnum.transfer_tokens, testEnv, regional)));
|
|
@@ -53,7 +53,7 @@ export interface IKushkiGateway {
|
|
|
53
53
|
/**
|
|
54
54
|
* Send tokens subscription request to Kushki API
|
|
55
55
|
*/
|
|
56
|
-
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
56
|
+
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
|
|
57
57
|
/**
|
|
58
58
|
* Send transfer tokens request to Kushki API
|
|
59
59
|
*/
|
|
@@ -93,18 +93,21 @@ let CardService = CardService_1 = class CardService {
|
|
|
93
93
|
const data_to_transform = Object.assign(Object.assign({}, request), sift_object);
|
|
94
94
|
if (jwt !== undefined)
|
|
95
95
|
data_to_transform.jwt = jwt;
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
return rxjs_1.forkJoin([
|
|
97
|
+
rxjs_1.of(dot.transform(this._receipt, Object.assign(Object.assign({}, data_to_transform), { merchantName: merchant.merchant_name }))),
|
|
98
|
+
rxjs_1.of(undefined),
|
|
99
|
+
rxjs_1.of(merchant),
|
|
100
|
+
]);
|
|
98
101
|
}))
|
|
99
102
|
.subscribe({
|
|
100
103
|
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
101
|
-
next: (
|
|
104
|
+
next: ([final_request, authorization, merchant]) => {
|
|
102
105
|
if (final_request.jwt && !merchant.sandboxEnable)
|
|
103
106
|
this._request3DSToken(() => {
|
|
104
|
-
this._requestTokenGateway(final_request, mid, isTest, regional, callback);
|
|
107
|
+
this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
|
|
105
108
|
});
|
|
106
109
|
else
|
|
107
|
-
this._requestTokenGateway(final_request, mid, isTest, regional, callback);
|
|
110
|
+
this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
|
|
108
111
|
},
|
|
109
112
|
});
|
|
110
113
|
}
|
|
@@ -154,18 +157,21 @@ let CardService = CardService_1 = class CardService {
|
|
|
154
157
|
const data_to_transform = this._getCreateSubscriptionDataToTransform(sift_object, subscriptionTokenRequest);
|
|
155
158
|
if (jwt !== undefined)
|
|
156
159
|
data_to_transform.jwt = jwt;
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
return rxjs_1.forkJoin([
|
|
161
|
+
rxjs_1.of(dot.transform(this._receipt, Object.assign(Object.assign({}, data_to_transform), { merchantName: merchant.merchant_name }))),
|
|
162
|
+
rxjs_1.of(undefined),
|
|
163
|
+
rxjs_1.of(merchant),
|
|
164
|
+
]);
|
|
159
165
|
}))
|
|
160
166
|
.subscribe({
|
|
161
167
|
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
162
|
-
next: (
|
|
168
|
+
next: ([body, jwt, merchant]) => {
|
|
163
169
|
if (body.jwt && !merchant.sandboxEnable)
|
|
164
170
|
this._request3DSToken(() => {
|
|
165
|
-
this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback);
|
|
171
|
+
this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback, jwt);
|
|
166
172
|
});
|
|
167
173
|
else
|
|
168
|
-
this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback);
|
|
174
|
+
this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback, jwt);
|
|
169
175
|
},
|
|
170
176
|
});
|
|
171
177
|
}
|
|
@@ -437,9 +443,9 @@ let CardService = CardService_1 = class CardService {
|
|
|
437
443
|
_getUserId(subscriptionId, mid, testEnv, regional, userId) {
|
|
438
444
|
return rxjs_1.of(1).pipe(operators_1.switchMap(() => rxjs_1.iif(() => UtilsService_1.UtilsService.sIsEmpty(userId), this._gateway.getUserId(subscriptionId, mid, testEnv, regional), rxjs_1.of(undefined))), operators_1.catchError(() => rxjs_1.of(undefined)));
|
|
439
445
|
}
|
|
440
|
-
_requestSubscriptionTokenGateway(body, mid, testEnv, regional, callback) {
|
|
446
|
+
_requestSubscriptionTokenGateway(body, mid, testEnv, regional, callback, authorization) {
|
|
441
447
|
this._gateway
|
|
442
|
-
.requestSubscriptionToken(body, mid, testEnv, regional)
|
|
448
|
+
.requestSubscriptionToken(body, mid, testEnv, regional, authorization)
|
|
443
449
|
.subscribe({
|
|
444
450
|
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
445
451
|
next: (response) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushki/js",
|
|
3
|
-
"version": "1.40.2-alpha",
|
|
3
|
+
"version": "1.40.2-alpha.1",
|
|
4
4
|
"description": "kushki-js",
|
|
5
5
|
"main": "lib/lib.js",
|
|
6
6
|
"types": "lib/lib.d.ts",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"snyk": "1.303.1",
|
|
81
81
|
"source-map-loader": "0.2.4",
|
|
82
82
|
"source-map-support": "0.5.12",
|
|
83
|
-
"string-replace-loader": "3.1.0",
|
|
83
|
+
"string-replace-loader": "^3.1.0",
|
|
84
84
|
"terser-webpack-plugin": "^4.2.3",
|
|
85
85
|
"thread-loader": "2.1.3",
|
|
86
86
|
"ts-loader": "5.4.3",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@kushki/cardinal-sandbox-js": "1.0.6",
|
|
101
101
|
"acorn": "6.4.1",
|
|
102
|
-
"axios": "0.
|
|
102
|
+
"axios": "0.27.2",
|
|
103
103
|
"buffer": "^6.0.3",
|
|
104
104
|
"ci": "^2.1.1",
|
|
105
105
|
"dot-object": "2.1.4",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CognitoErrorEnum = void 0;
|
|
4
|
-
var CognitoErrorEnum;
|
|
5
|
-
(function (CognitoErrorEnum) {
|
|
6
|
-
CognitoErrorEnum["UsernameExistsException"] = "UsernameExistsException";
|
|
7
|
-
})(CognitoErrorEnum = exports.CognitoErrorEnum || (exports.CognitoErrorEnum = {}));
|