@kushki/js 1.25.1-altar.1 → 1.26.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/Kushki.d.ts +11 -1
- package/lib/Kushki.js +14 -2
- package/lib/gateway/KushkiGateway.d.ts +1 -1
- package/lib/gateway/KushkiGateway.js +1 -1
- package/lib/infrastructure/EnvironmentEnum.d.ts +2 -2
- package/lib/infrastructure/EnvironmentEnum.js +2 -2
- package/lib/infrastructure/ThreeDSEnum.d.ts +4 -0
- package/lib/infrastructure/ThreeDSEnum.js +7 -0
- package/lib/repository/ICardService.d.ts +7 -6
- package/lib/repository/IKushkiGateway.d.ts +1 -1
- package/lib/service/CardService.d.ts +3 -2
- package/lib/service/CardService.js +6 -3
- package/lib/types/device_token_request.d.ts +9 -0
- package/lib/types/validate_3ds_request.d.ts +13 -0
- package/package.json +2 -3
package/lib/Kushki.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { CardAsyncTokenRequest } from "./../lib/types/card_async_token_request";
|
|
|
12
12
|
import { CardAsyncTokenResponse } from "./../lib/types/card_async_token_response";
|
|
13
13
|
import { CashTokenRequest } from "./../lib/types/cash_token_request";
|
|
14
14
|
import { DeletePaymentMethodRequest } from "./../lib/types/delete_payment_method_request";
|
|
15
|
+
import { DeviceTokenRequest } from "./../lib/types/device_token_request";
|
|
15
16
|
import { ErrorResponse } from "./../lib/types/error_response";
|
|
16
17
|
import { InitAuthRequest } from "./../lib/types/init_auth_request";
|
|
17
18
|
import { InitAuthResponse } from "./../lib/types/init_auth_response";
|
|
@@ -39,6 +40,7 @@ import { TokenChargeRequest } from "./../lib/types/token_charge_request";
|
|
|
39
40
|
import { TokenKPayRequest } from "./../lib/types/token_kpay_request";
|
|
40
41
|
import { TokenRequest } from "./../lib/types/token_request";
|
|
41
42
|
import { TransferSubscriptionTokenRequest } from "./../lib/types/transfer_subscription_token_request";
|
|
43
|
+
import { Validate3DSRequest } from "./../lib/types/validate_3ds_request";
|
|
42
44
|
import { Validate3DsResponse } from "./../lib/types/validate_3ds_response";
|
|
43
45
|
import { ValidateSessionResponse } from "./../lib/types/validate_session_response";
|
|
44
46
|
import { VerifyAuthRequest } from "./../lib/types/verify_auth_request";
|
|
@@ -72,7 +74,14 @@ export declare class Kushki {
|
|
|
72
74
|
regional?: boolean;
|
|
73
75
|
});
|
|
74
76
|
requestToken(body: TokenRequest | TokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated use requestDeviceToken instead
|
|
79
|
+
* @param {Function} body with value
|
|
80
|
+
* @param {Function} callback with value
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
75
83
|
requestTokenCharge(body: TokenChargeRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
84
|
+
requestDeviceToken(body: DeviceTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
76
85
|
requestSubscriptionToken(body: SubscriptionTokenRequest | SubscriptionTokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
77
86
|
requestTransferToken(body: TransferTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
78
87
|
checkStatus(callback: (value: ResponseStatusValidator | ErrorResponse) => void): void;
|
|
@@ -105,8 +114,9 @@ export declare class Kushki {
|
|
|
105
114
|
requestSavedPaymentMethods(body: SavedPaymentMethodRequest, callback: (value: PaymentDataResponse[] | ErrorResponse) => void): void;
|
|
106
115
|
requestVerifyAuth(body: VerifyAuthRequest, callback: (value: VerifyAuthResponse | ErrorResponse) => void): void;
|
|
107
116
|
validateSession(callback: (value: ValidateSessionResponse | ErrorResponse) => void): void;
|
|
108
|
-
|
|
117
|
+
requestValidate3DS(body: Validate3DSRequest, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
109
118
|
static callbackError(err: ErrorResponse | KushkiError | AxiosError, callback: (value: ErrorResponse) => void): void;
|
|
110
119
|
private _requestBankList;
|
|
120
|
+
private _requestDeviceToken;
|
|
111
121
|
private _resolve;
|
|
112
122
|
}
|
package/lib/Kushki.js
CHANGED
|
@@ -38,8 +38,17 @@ var Kushki = /** @class */ (function () {
|
|
|
38
38
|
Kushki.prototype.requestToken = function (body, callback) {
|
|
39
39
|
this._resolve(this._cardService.requestToken(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated use requestDeviceToken instead
|
|
43
|
+
* @param {Function} body with value
|
|
44
|
+
* @param {Function} callback with value
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
41
47
|
Kushki.prototype.requestTokenCharge = function (body, callback) {
|
|
42
|
-
this.
|
|
48
|
+
this._requestDeviceToken(body, callback);
|
|
49
|
+
};
|
|
50
|
+
Kushki.prototype.requestDeviceToken = function (body, callback) {
|
|
51
|
+
this._requestDeviceToken(body, callback);
|
|
43
52
|
};
|
|
44
53
|
Kushki.prototype.requestSubscriptionToken = function (body, callback) {
|
|
45
54
|
this._resolve(this._cardService.requestSubscriptionToken(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
@@ -145,7 +154,7 @@ var Kushki = /** @class */ (function () {
|
|
|
145
154
|
Kushki.prototype.validateSession = function (callback) {
|
|
146
155
|
this._resolve(this._authService.validateSession(this._inTestEnvironment), callback);
|
|
147
156
|
};
|
|
148
|
-
Kushki.prototype.
|
|
157
|
+
Kushki.prototype.requestValidate3DS = function (body, callback) {
|
|
149
158
|
this._cardService.validate3DS(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
150
159
|
};
|
|
151
160
|
Kushki.callbackError = function (err, callback) {
|
|
@@ -165,6 +174,9 @@ var Kushki = /** @class */ (function () {
|
|
|
165
174
|
Kushki.prototype._requestBankList = function (callback) {
|
|
166
175
|
this._resolve(this._transferService.requestBankList(this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
167
176
|
};
|
|
177
|
+
Kushki.prototype._requestDeviceToken = function (body, callback) {
|
|
178
|
+
this._resolve(this._cardService.requestDeviceToken(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
179
|
+
};
|
|
168
180
|
Kushki.prototype._resolve = function (observable, callback) {
|
|
169
181
|
observable.subscribe({
|
|
170
182
|
error: function (err) { return Kushki.callbackError(err, callback); },
|
|
@@ -49,7 +49,7 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
49
49
|
requestDelete<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid: string, authorization: string): Observable<T>;
|
|
50
50
|
requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
|
|
51
51
|
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
|
|
52
|
-
|
|
52
|
+
requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
53
53
|
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
|
|
54
54
|
requestTransferToken(body: TransferTokenRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
55
55
|
requestMerchantSettings(mid: string, testEnv: boolean, regional: boolean): Observable<MerchantSettingsResponse>;
|
|
@@ -100,7 +100,7 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
100
100
|
_b), PathEnum_1.PathEnum.card_tokens, testEnv, regional));
|
|
101
101
|
}));
|
|
102
102
|
};
|
|
103
|
-
KushkiGateway.prototype.
|
|
103
|
+
KushkiGateway.prototype.requestDeviceToken = function (body, mid, testEnv, regional) {
|
|
104
104
|
var _this = this;
|
|
105
105
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
106
106
|
return _this.request(body, _this._buildHeader(mid), "" + PathEnum_1.PathEnum.card_token_charge + body.subscriptionId + "/tokens", testEnv, regional);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Environment enum file
|
|
4
4
|
*/
|
|
5
5
|
export declare enum EnvironmentEnum {
|
|
6
|
-
uat = "https://api-
|
|
6
|
+
uat = "https://api-uat.kushkipagos.com/",
|
|
7
7
|
prod = "https://api.kushkipagos.com/",
|
|
8
|
-
regionalUat = "https://regional-
|
|
8
|
+
regionalUat = "https://regional-uat.kushkipagos.com/",
|
|
9
9
|
regionalProd = "https://regional.kushkipagos.com/"
|
|
10
10
|
}
|
|
@@ -6,8 +6,8 @@ exports.EnvironmentEnum = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
var EnvironmentEnum;
|
|
8
8
|
(function (EnvironmentEnum) {
|
|
9
|
-
EnvironmentEnum["uat"] = "https://api-
|
|
9
|
+
EnvironmentEnum["uat"] = "https://api-uat.kushkipagos.com/";
|
|
10
10
|
EnvironmentEnum["prod"] = "https://api.kushkipagos.com/";
|
|
11
|
-
EnvironmentEnum["regionalUat"] = "https://regional-
|
|
11
|
+
EnvironmentEnum["regionalUat"] = "https://regional-uat.kushkipagos.com/";
|
|
12
12
|
EnvironmentEnum["regionalProd"] = "https://regional.kushkipagos.com/";
|
|
13
13
|
})(EnvironmentEnum = exports.EnvironmentEnum || (exports.EnvironmentEnum = {}));
|
|
@@ -13,6 +13,7 @@ import { SubscriptionTokenRequest } from "./../../lib/types/subscription_token_r
|
|
|
13
13
|
import { SubscriptionIdRequest } from "./../../lib/types/subscriptionId_request";
|
|
14
14
|
import { TokenKPayRequest } from "./../../lib/types/token_kpay_request";
|
|
15
15
|
import { TokenRequest } from "./../../lib/types/token_request";
|
|
16
|
+
import { Validate3DSRequest } from "./../../lib/types/validate_3ds_request";
|
|
16
17
|
import { Validate3DsResponse } from "./../../lib/types/validate_3ds_response";
|
|
17
18
|
export declare type IGeneralTokenRequest = TokenRequest | TokenKPayRequest | SubscriptionTokenRequest | SubscriptionTokenKPayRequest;
|
|
18
19
|
export interface ICardService {
|
|
@@ -41,13 +42,13 @@ export interface ICardService {
|
|
|
41
42
|
*/
|
|
42
43
|
requestDeferred(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<IDeferredResponse[]>;
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
* @param
|
|
45
|
+
* Request Device Token for subscriptions
|
|
46
|
+
* @param deviceTokenRequest - subscription tokens request body
|
|
46
47
|
* @param mid - public merchant id
|
|
47
48
|
* @param isTest - is test environment
|
|
48
49
|
* @param regional - for single IP
|
|
49
50
|
*/
|
|
50
|
-
|
|
51
|
+
requestDeviceToken(deviceTokenRequest: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
51
52
|
/**
|
|
52
53
|
* BinInfo
|
|
53
54
|
* @param binBody - deferred bin request body
|
|
@@ -57,12 +58,12 @@ export interface ICardService {
|
|
|
57
58
|
*/
|
|
58
59
|
requestBinInfo(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<BinInfoResponse>;
|
|
59
60
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param body -
|
|
61
|
+
* validate3DS
|
|
62
|
+
* @param body - security from token
|
|
62
63
|
* @param mid - public merchant id
|
|
63
64
|
* @param isTest - is test environment
|
|
64
65
|
* @param regional - Define if endpoint used regional URL
|
|
65
66
|
* @param callback - Define callback function to response
|
|
66
67
|
*/
|
|
67
|
-
validate3DS(body:
|
|
68
|
+
validate3DS(body: Validate3DSRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
68
69
|
}
|
|
@@ -54,7 +54,7 @@ export interface IKushkiGateway {
|
|
|
54
54
|
/**
|
|
55
55
|
* Send charge tokens request to Kushki API
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
58
58
|
/**
|
|
59
59
|
* Send tokens subscription request to Kushki API
|
|
60
60
|
*/
|
|
@@ -18,6 +18,7 @@ import { SubscriptionTokenRequest } from "./../../lib/types/subscription_token_r
|
|
|
18
18
|
import { SubscriptionIdRequest } from "./../../lib/types/subscriptionId_request";
|
|
19
19
|
import { TokenKPayRequest } from "./../../lib/types/token_kpay_request";
|
|
20
20
|
import { TokenRequest } from "./../../lib/types/token_request";
|
|
21
|
+
import { Validate3DSRequest } from "./../../lib/types/validate_3ds_request";
|
|
21
22
|
import { Validate3DsResponse } from "./../../lib/types/validate_3ds_response";
|
|
22
23
|
/**
|
|
23
24
|
* Implementation
|
|
@@ -37,11 +38,11 @@ export declare class CardService implements ICardService {
|
|
|
37
38
|
private _sandboxEnable;
|
|
38
39
|
constructor(gateway: IKushkiGateway, authService: IAuthService, antiFraud: IAntiFraud);
|
|
39
40
|
requestToken(request: TokenRequest | TokenKPayRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
40
|
-
|
|
41
|
+
requestDeviceToken(request: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
41
42
|
requestSubscriptionToken(subscriptionTokenRequest: SubscriptionTokenRequest | SubscriptionTokenKPayRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
42
43
|
requestDeferred(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<IDeferredResponse[]>;
|
|
43
44
|
requestBinInfo(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<BinInfoResponse>;
|
|
44
|
-
validate3DS(body:
|
|
45
|
+
validate3DS(body: Validate3DSRequest, mid: string, isTest: boolean, regional: boolean, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
45
46
|
private _checkCardLength;
|
|
46
47
|
private _getScienceSession;
|
|
47
48
|
private _checkCurrency;
|
|
@@ -68,6 +68,7 @@ var Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
|
68
68
|
var dot = require("dot-object");
|
|
69
69
|
var KushkiError_1 = require("./../../lib/generic/KushkiError");
|
|
70
70
|
var ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
|
|
71
|
+
var ThreeDSEnum_1 = require("./../../lib/infrastructure/ThreeDSEnum");
|
|
71
72
|
var inversify_1 = require("inversify");
|
|
72
73
|
require("reflect-metadata");
|
|
73
74
|
var rxjs_1 = require("rxjs");
|
|
@@ -130,7 +131,7 @@ var CardService = /** @class */ (function () {
|
|
|
130
131
|
return _this._gateway.requestToken(final_request, mid, isTest, regional, jwt);
|
|
131
132
|
}));
|
|
132
133
|
};
|
|
133
|
-
CardService.prototype.
|
|
134
|
+
CardService.prototype.requestDeviceToken = function (request, mid, isTest, regional) {
|
|
134
135
|
var _this = this;
|
|
135
136
|
return this._gateway.requestMerchantSettings(mid, isTest, regional).pipe(operators_1.switchMap(function (merchant) {
|
|
136
137
|
return rxjs_1.iif(function () {
|
|
@@ -143,7 +144,7 @@ var CardService = /** @class */ (function () {
|
|
|
143
144
|
delete siftObject.userId;
|
|
144
145
|
if (siftObject.sessionId === null)
|
|
145
146
|
delete siftObject.sessionId;
|
|
146
|
-
return _this._gateway.
|
|
147
|
+
return _this._gateway.requestDeviceToken(__assign({ subscriptionId: request.subscriptionId }, siftObject), mid, isTest, regional);
|
|
147
148
|
}));
|
|
148
149
|
};
|
|
149
150
|
CardService.prototype.requestSubscriptionToken = function (subscriptionTokenRequest, mid, isTest, regional) {
|
|
@@ -178,7 +179,9 @@ var CardService = /** @class */ (function () {
|
|
|
178
179
|
callback({ isValid: true });
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
|
-
if (this._sandboxEnable
|
|
182
|
+
if (this._sandboxEnable ||
|
|
183
|
+
UtilsService_1.UtilsService.sGet(body, "security.paReq", ThreeDSEnum_1.ThreeDSEnum.SANDBOX) ===
|
|
184
|
+
ThreeDSEnum_1.ThreeDSEnum.SANDBOX)
|
|
182
185
|
return CardService_1._ccaSandbox(body, callback);
|
|
183
186
|
if (isTest) {
|
|
184
187
|
// tslint:disable-next-line:no-duplicate-string
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
/* tslint:disable:all */
|
|
3
|
+
|
|
4
|
+
export interface Validate3DSRequest {
|
|
5
|
+
secureId: string;
|
|
6
|
+
security: {
|
|
7
|
+
authRequired: boolean;
|
|
8
|
+
acsURL?: string;
|
|
9
|
+
authenticationTransactionId?: string;
|
|
10
|
+
paReq?: string;
|
|
11
|
+
[k: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushki/js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.1",
|
|
4
4
|
"description": "kushki-js",
|
|
5
5
|
"main": "lib/lib.js",
|
|
6
6
|
"types": "lib/lib.d.ts",
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"husky": {
|
|
13
13
|
"hooks": {
|
|
14
|
-
"pre-commit": "lint-staged"
|
|
15
|
-
"pre-push": "npm run lint:duplicate && npm run lint:check && npm run test:unit"
|
|
14
|
+
"pre-commit": "lint-staged && npm run lint:duplicate && npm run lint:check && npm run test:unit"
|
|
16
15
|
}
|
|
17
16
|
},
|
|
18
17
|
"scripts": {
|