@kushki/js 1.33.2 → 1.35.0
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 +4 -0
- package/lib/Kushki.js +5 -0
- package/lib/KushkiInfo.d.ts +13 -0
- package/lib/KushkiInfo.js +32 -0
- package/lib/gateway/KushkiGateway.d.ts +1 -0
- package/lib/gateway/KushkiGateway.js +22 -8
- package/lib/infrastructure/ErrorEnum.d.ts +2 -1
- package/lib/infrastructure/ErrorEnum.js +6 -0
- package/lib/infrastructure/PlatformCodeEnum.d.ts +70 -0
- package/lib/infrastructure/PlatformCodeEnum.js +73 -0
- package/lib/infrastructure/VisaBrandingResourceUrlEnum.d.ts +8 -0
- package/lib/infrastructure/VisaBrandingResourceUrlEnum.js +11 -0
- package/lib/libs/VisaSensoryBranding/visa-sensory-branding.d.ts +3 -0
- package/lib/libs/VisaSensoryBranding/visa-sensory-branding.js +167 -0
- package/lib/repository/IKushkiService.d.ts +8 -0
- package/lib/service/KushkiService.d.ts +8 -0
- package/lib/service/KushkiService.js +17 -0
- package/lib/types/kushki_info.d.ts +36 -0
- package/lib/types/visa_branding_request.d.ts +10 -0
- package/package.json +4 -2
package/lib/Kushki.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { ErrorResponse } from "./../lib/types/error_response";
|
|
|
17
17
|
import { GetBrandsLogosByMerchantResponse } from "./../lib/types/get_brands_logos_by_merchant_response";
|
|
18
18
|
import { InitAuthRequest } from "./../lib/types/init_auth_request";
|
|
19
19
|
import { InitAuthResponse } from "./../lib/types/init_auth_response";
|
|
20
|
+
import { KushkiInfo } from "./../lib/types/kushki_info";
|
|
20
21
|
import { MobileProcessorToken } from "./../lib/types/mobile_processor_token";
|
|
21
22
|
import { MobileProcessorTokenRequest } from "./../lib/types/mobile_processor_token_request";
|
|
22
23
|
import { MultiMerchantInfoRequest } from "./../lib/types/multimerchant_info_request";
|
|
@@ -49,6 +50,7 @@ import { Validate3DsResponse } from "./../lib/types/validate_3ds_response";
|
|
|
49
50
|
import { ValidateSessionResponse } from "./../lib/types/validate_session_response";
|
|
50
51
|
import { VerifyAuthRequest } from "./../lib/types/verify_auth_request";
|
|
51
52
|
import { VerifyAuthResponse } from "./../lib/types/verify_auth_response";
|
|
53
|
+
import { VisaBrandingRequest } from "./../lib/types/visa_branding_request";
|
|
52
54
|
/**
|
|
53
55
|
* Implementation
|
|
54
56
|
*/
|
|
@@ -77,6 +79,7 @@ export declare class Kushki {
|
|
|
77
79
|
merchantId: string;
|
|
78
80
|
inTestEnvironment?: boolean;
|
|
79
81
|
regional?: boolean;
|
|
82
|
+
kushkiInfo?: KushkiInfo;
|
|
80
83
|
});
|
|
81
84
|
requestToken(body: TokenRequest | TokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
82
85
|
requestInitAntiFraud(userId: string, callback: (value: SiftScienceAntiFraudSessionResponse | ErrorResponse) => void): void;
|
|
@@ -123,6 +126,7 @@ export declare class Kushki {
|
|
|
123
126
|
validateSession(callback: (value: ValidateSessionResponse | ErrorResponse) => void): void;
|
|
124
127
|
requestValidate3DS(body: Validate3DSRequest, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
|
|
125
128
|
requestSecureInit(body: SecureInitRequest, callback: (value: SecureInitResponse | ErrorResponse) => void): void;
|
|
129
|
+
initVisaBrandingAnimation(callback: (error?: ErrorResponse) => void, body?: VisaBrandingRequest): void;
|
|
126
130
|
static callbackError(err: ErrorResponse | KushkiError | AxiosError, callback: (value: ErrorResponse) => void): void;
|
|
127
131
|
private _requestBankList;
|
|
128
132
|
private _requestDeviceToken;
|
package/lib/Kushki.js
CHANGED
|
@@ -6,12 +6,14 @@ var KushkiError_1 = require("./../lib/generic/KushkiError");
|
|
|
6
6
|
var Container_1 = require("./../lib/infrastructure/Container");
|
|
7
7
|
require("reflect-metadata");
|
|
8
8
|
var UtilsService_1 = require("./../lib/service/UtilsService");
|
|
9
|
+
var KushkiInfo_1 = require("./../lib/KushkiInfo");
|
|
9
10
|
/**
|
|
10
11
|
* Implementation
|
|
11
12
|
*/
|
|
12
13
|
var Kushki = /** @class */ (function () {
|
|
13
14
|
// tslint:disable-next-line:max-func-body-length
|
|
14
15
|
function Kushki(body) {
|
|
16
|
+
KushkiInfo_1.KInfo.sKushkiInfo = KushkiInfo_1.KInfo.buildKushkiInfo(body.kushkiInfo);
|
|
15
17
|
body.inTestEnvironment =
|
|
16
18
|
body.inTestEnvironment === undefined ? false : body.inTestEnvironment;
|
|
17
19
|
body.regional = body.regional === undefined ? false : body.regional;
|
|
@@ -176,6 +178,9 @@ var Kushki = /** @class */ (function () {
|
|
|
176
178
|
Kushki.prototype.requestSecureInit = function (body, callback) {
|
|
177
179
|
this._resolve(this._cardService.requestSecureInit(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
178
180
|
};
|
|
181
|
+
Kushki.prototype.initVisaBrandingAnimation = function (callback, body) {
|
|
182
|
+
this._kushkiService.initVisaBrandingAnimation(this._inTestEnvironment, callback, body);
|
|
183
|
+
};
|
|
179
184
|
Kushki.callbackError = function (err, callback) {
|
|
180
185
|
if (err instanceof KushkiError_1.KushkiError)
|
|
181
186
|
callback({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
/**
|
|
3
|
+
* Kushki file
|
|
4
|
+
*/
|
|
5
|
+
import { KushkiInfo } from "./../lib/types/kushki_info";
|
|
6
|
+
/**
|
|
7
|
+
* Implementation
|
|
8
|
+
*/
|
|
9
|
+
export declare class KInfo {
|
|
10
|
+
static sKushkiInfo: string;
|
|
11
|
+
static buildKushkiInfo(kushkiInfo?: KushkiInfo): string;
|
|
12
|
+
private static _encodeKushkiInfo;
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Kushki file
|
|
4
|
+
*/
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.KInfo = void 0;
|
|
7
|
+
var PlatformCodeEnum_1 = require("./../lib/infrastructure/PlatformCodeEnum");
|
|
8
|
+
var UtilsService_1 = require("./../lib/service/UtilsService");
|
|
9
|
+
/**
|
|
10
|
+
* Implementation
|
|
11
|
+
*/
|
|
12
|
+
var KInfo = /** @class */ (function () {
|
|
13
|
+
function KInfo() {
|
|
14
|
+
}
|
|
15
|
+
KInfo.buildKushkiInfo = function (kushkiInfo) {
|
|
16
|
+
var kushki_js_version = "1.35.0";
|
|
17
|
+
if (kushkiInfo) {
|
|
18
|
+
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
19
|
+
kushkiInfo.platformVersion = kushki_js_version;
|
|
20
|
+
return KInfo._encodeKushkiInfo(kushkiInfo);
|
|
21
|
+
}
|
|
22
|
+
return KInfo._encodeKushkiInfo({
|
|
23
|
+
platformId: PlatformCodeEnum_1.PlatformCodeEnum.KUSHKIJS,
|
|
24
|
+
platformVersion: kushki_js_version
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
KInfo._encodeKushkiInfo = function (kushkiInfo) {
|
|
28
|
+
return btoa(JSON.stringify(kushkiInfo));
|
|
29
|
+
};
|
|
30
|
+
return KInfo;
|
|
31
|
+
}());
|
|
32
|
+
exports.KInfo = KInfo;
|
|
@@ -44,6 +44,7 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
44
44
|
private readonly _publicHeader;
|
|
45
45
|
private readonly _contentHeader;
|
|
46
46
|
private readonly _contentJSON;
|
|
47
|
+
private readonly _kushkiInfoHeader;
|
|
47
48
|
private _uatUrl;
|
|
48
49
|
private _prodUrl;
|
|
49
50
|
private _kshAuthorization;
|
|
@@ -31,6 +31,7 @@ require("reflect-metadata");
|
|
|
31
31
|
var rxjs_1 = require("rxjs");
|
|
32
32
|
var operators_1 = require("rxjs/operators");
|
|
33
33
|
var UtilsService_1 = require("./../../lib/service/UtilsService");
|
|
34
|
+
var KushkiInfo_1 = require("./../../lib/KushkiInfo");
|
|
34
35
|
/**
|
|
35
36
|
* Kushki Gateway Implementation
|
|
36
37
|
*/
|
|
@@ -39,6 +40,7 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
39
40
|
this._publicHeader = "Public-Merchant-Id";
|
|
40
41
|
this._contentHeader = "Content-Type";
|
|
41
42
|
this._contentJSON = "application/json";
|
|
43
|
+
this._kushkiInfoHeader = "X-Amz-Meta-Kushki-Info";
|
|
42
44
|
this._uatUrl = "";
|
|
43
45
|
this._prodUrl = "";
|
|
44
46
|
this._kshAuthorization = "KSH-Authorization";
|
|
@@ -97,16 +99,19 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
97
99
|
var _a, _b;
|
|
98
100
|
return rxjs_1.iif(function () { return authorization === undefined; }, _this.request(body, (_a = {},
|
|
99
101
|
_a[_this._publicHeader] = mid,
|
|
102
|
+
_a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo,
|
|
100
103
|
_a), PathEnum_1.PathEnum.card_tokens, testEnv, regional), _this.request(body, (_b = {},
|
|
101
104
|
_b[_this._kshAuthorization] = authorization,
|
|
102
105
|
_b[_this._publicHeader] = mid,
|
|
106
|
+
_b[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo,
|
|
103
107
|
_b), PathEnum_1.PathEnum.card_tokens, testEnv, regional));
|
|
104
108
|
}));
|
|
105
109
|
};
|
|
106
110
|
KushkiGateway.prototype.requestDeviceToken = function (body, mid, testEnv, regional) {
|
|
107
111
|
var _this = this;
|
|
108
112
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
109
|
-
|
|
113
|
+
var _a;
|
|
114
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), "" + PathEnum_1.PathEnum.card_token_charge + body.subscriptionId + "/tokens", testEnv, regional);
|
|
110
115
|
}));
|
|
111
116
|
};
|
|
112
117
|
KushkiGateway.prototype.requestSubscriptionToken = function (body, mid, testEnv, regional, authorization) {
|
|
@@ -115,16 +120,19 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
115
120
|
var _a, _b;
|
|
116
121
|
return rxjs_1.iif(function () { return authorization === undefined; }, _this.request(body, (_a = {},
|
|
117
122
|
_a[_this._publicHeader] = mid,
|
|
123
|
+
_a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo,
|
|
118
124
|
_a), PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional), _this.request(body, (_b = {},
|
|
119
125
|
_b[_this._kshAuthorization] = authorization,
|
|
120
126
|
_b[_this._publicHeader] = mid,
|
|
127
|
+
_b[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo,
|
|
121
128
|
_b), PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional));
|
|
122
129
|
}), operators_1.map(function (response) { return response; }));
|
|
123
130
|
};
|
|
124
131
|
KushkiGateway.prototype.requestTransferToken = function (body, mid, testEnv, regional) {
|
|
125
132
|
var _this = this;
|
|
126
133
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
127
|
-
|
|
134
|
+
var _a;
|
|
135
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), PathEnum_1.PathEnum.transfer_tokens, testEnv, regional);
|
|
128
136
|
}));
|
|
129
137
|
};
|
|
130
138
|
KushkiGateway.prototype.requestMerchantSettings = function (mid, testEnv, regional) {
|
|
@@ -154,7 +162,8 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
154
162
|
KushkiGateway.prototype.requestCashToken = function (body, mid, testEnv, regional) {
|
|
155
163
|
var _this = this;
|
|
156
164
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
157
|
-
|
|
165
|
+
var _a;
|
|
166
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), PathEnum_1.PathEnum.cash_tokens, testEnv, regional);
|
|
158
167
|
}), operators_1.map(function (response) { return response; }));
|
|
159
168
|
};
|
|
160
169
|
KushkiGateway.prototype.checkStatus = function (mid, testEnv, regional) {
|
|
@@ -172,13 +181,15 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
172
181
|
KushkiGateway.prototype.requestCardAsyncToken = function (body, mid, testEnv, regional) {
|
|
173
182
|
var _this = this;
|
|
174
183
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
175
|
-
|
|
184
|
+
var _a;
|
|
185
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), PathEnum_1.PathEnum.card_async_tokens, testEnv, regional);
|
|
176
186
|
}));
|
|
177
187
|
};
|
|
178
188
|
KushkiGateway.prototype.requestSubscriptionCardAsyncToken = function (body, mid, testEnv, regional) {
|
|
179
189
|
var _this = this;
|
|
180
190
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
181
|
-
|
|
191
|
+
var _a;
|
|
192
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), PathEnum_1.PathEnum.subscription_card_async_tokens, testEnv, regional);
|
|
182
193
|
}));
|
|
183
194
|
};
|
|
184
195
|
KushkiGateway.prototype.multiMerchantInfo = function (request, mid, isTest, regional) {
|
|
@@ -190,13 +201,15 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
190
201
|
KushkiGateway.prototype.requestPayoutsCashToken = function (body, mid, testEnv, regional) {
|
|
191
202
|
var _this = this;
|
|
192
203
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
193
|
-
|
|
204
|
+
var _a;
|
|
205
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), PathEnum_1.PathEnum.payouts_cash_tokens, testEnv, regional);
|
|
194
206
|
}), operators_1.map(function (response) { return response; }));
|
|
195
207
|
};
|
|
196
208
|
KushkiGateway.prototype.requestPayoutsTransferToken = function (body, mid, testEnv, regional) {
|
|
197
209
|
var _this = this;
|
|
198
210
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
199
|
-
|
|
211
|
+
var _a;
|
|
212
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), PathEnum_1.PathEnum.payouts_transfer_tokens, testEnv, regional);
|
|
200
213
|
}), operators_1.map(function (response) { return response; }));
|
|
201
214
|
};
|
|
202
215
|
KushkiGateway.prototype.getCommissionConfiguration = function (request, mid, isTest, regional) {
|
|
@@ -208,7 +221,8 @@ var KushkiGateway = /** @class */ (function () {
|
|
|
208
221
|
KushkiGateway.prototype.requestTokenTransferSubscription = function (body, mid, testEnv, regional) {
|
|
209
222
|
var _this = this;
|
|
210
223
|
return rxjs_1.of(1).pipe(operators_1.concatMap(function () {
|
|
211
|
-
|
|
224
|
+
var _a;
|
|
225
|
+
return _this.request(body, __assign(__assign({}, _this._buildHeader(mid)), (_a = {}, _a[_this._kushkiInfoHeader] = KushkiInfo_1.KInfo.sKushkiInfo, _a)), PathEnum_1.PathEnum.transfer_subscription_tokens, testEnv, regional);
|
|
212
226
|
}));
|
|
213
227
|
};
|
|
214
228
|
KushkiGateway.prototype.requestBankList = function (mid, testEnv, regional) {
|
|
@@ -20,6 +20,7 @@ var ErrorCode;
|
|
|
20
20
|
ErrorCode["E013"] = "E013";
|
|
21
21
|
ErrorCode["E014"] = "E014";
|
|
22
22
|
ErrorCode["E015"] = "E015";
|
|
23
|
+
ErrorCode["E016"] = "E016";
|
|
23
24
|
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
|
24
25
|
exports.ERRORS = (_a = {},
|
|
25
26
|
_a[ErrorCode.E001] = {
|
|
@@ -97,4 +98,9 @@ exports.ERRORS = (_a = {},
|
|
|
97
98
|
message: "Configuración de credenciales Sift inválidas",
|
|
98
99
|
statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest
|
|
99
100
|
},
|
|
101
|
+
_a[ErrorCode.E016] = {
|
|
102
|
+
code: ErrorCode.E016,
|
|
103
|
+
message: "Error al generar animación.",
|
|
104
|
+
statusCode: StatusCodeEnum_1.StatusCodeEnum.InternalServerError
|
|
105
|
+
},
|
|
100
106
|
_a);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
export declare enum PlatformCodeEnum {
|
|
3
|
+
API = "KP001",
|
|
4
|
+
KUSHKIJS = "KP002",
|
|
5
|
+
ANDROID = "KP003",
|
|
6
|
+
IOS = "KP004",
|
|
7
|
+
SMARTLINKS = "KP005",
|
|
8
|
+
KAJITA = "KP006",
|
|
9
|
+
CAJITA = "KP007",
|
|
10
|
+
VTEX = "KP008",
|
|
11
|
+
MAGENTO = "KP009",
|
|
12
|
+
PRESTASHOP = "KP010",
|
|
13
|
+
WOOCOMERCE = "KP011",
|
|
14
|
+
SHOPIFY = "KP012",
|
|
15
|
+
WEBCHECKOUT = "KP013"
|
|
16
|
+
}
|
|
17
|
+
export declare const PLATFORMS: {
|
|
18
|
+
KP001: {
|
|
19
|
+
platformId: string;
|
|
20
|
+
platformName: string;
|
|
21
|
+
};
|
|
22
|
+
KP002: {
|
|
23
|
+
platformId: string;
|
|
24
|
+
platformName: string;
|
|
25
|
+
};
|
|
26
|
+
KP003: {
|
|
27
|
+
platformId: string;
|
|
28
|
+
platformName: string;
|
|
29
|
+
};
|
|
30
|
+
KP004: {
|
|
31
|
+
platformId: string;
|
|
32
|
+
platformName: string;
|
|
33
|
+
};
|
|
34
|
+
KP005: {
|
|
35
|
+
platformId: string;
|
|
36
|
+
platformName: string;
|
|
37
|
+
};
|
|
38
|
+
KP006: {
|
|
39
|
+
platformId: string;
|
|
40
|
+
platformName: string;
|
|
41
|
+
};
|
|
42
|
+
KP007: {
|
|
43
|
+
platformId: string;
|
|
44
|
+
platformName: string;
|
|
45
|
+
};
|
|
46
|
+
KP008: {
|
|
47
|
+
platformId: string;
|
|
48
|
+
platformName: string;
|
|
49
|
+
};
|
|
50
|
+
KP009: {
|
|
51
|
+
platformId: string;
|
|
52
|
+
platformName: string;
|
|
53
|
+
};
|
|
54
|
+
KP010: {
|
|
55
|
+
platformId: string;
|
|
56
|
+
platformName: string;
|
|
57
|
+
};
|
|
58
|
+
KP011: {
|
|
59
|
+
platformId: string;
|
|
60
|
+
platformName: string;
|
|
61
|
+
};
|
|
62
|
+
KP012: {
|
|
63
|
+
platformId: string;
|
|
64
|
+
platformName: string;
|
|
65
|
+
};
|
|
66
|
+
KP013: {
|
|
67
|
+
platformId: string;
|
|
68
|
+
platformName: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.PLATFORMS = exports.PlatformCodeEnum = void 0;
|
|
4
|
+
var PlatformCodeEnum;
|
|
5
|
+
(function (PlatformCodeEnum) {
|
|
6
|
+
PlatformCodeEnum["API"] = "KP001";
|
|
7
|
+
PlatformCodeEnum["KUSHKIJS"] = "KP002";
|
|
8
|
+
PlatformCodeEnum["ANDROID"] = "KP003";
|
|
9
|
+
PlatformCodeEnum["IOS"] = "KP004";
|
|
10
|
+
PlatformCodeEnum["SMARTLINKS"] = "KP005";
|
|
11
|
+
PlatformCodeEnum["KAJITA"] = "KP006";
|
|
12
|
+
PlatformCodeEnum["CAJITA"] = "KP007";
|
|
13
|
+
PlatformCodeEnum["VTEX"] = "KP008";
|
|
14
|
+
PlatformCodeEnum["MAGENTO"] = "KP009";
|
|
15
|
+
PlatformCodeEnum["PRESTASHOP"] = "KP010";
|
|
16
|
+
PlatformCodeEnum["WOOCOMERCE"] = "KP011";
|
|
17
|
+
PlatformCodeEnum["SHOPIFY"] = "KP012";
|
|
18
|
+
PlatformCodeEnum["WEBCHECKOUT"] = "KP013";
|
|
19
|
+
})(PlatformCodeEnum = exports.PlatformCodeEnum || (exports.PlatformCodeEnum = {}));
|
|
20
|
+
exports.PLATFORMS = {
|
|
21
|
+
KP001: {
|
|
22
|
+
platformId: "KP001",
|
|
23
|
+
platformName: "API"
|
|
24
|
+
},
|
|
25
|
+
KP002: {
|
|
26
|
+
platformId: "KP002",
|
|
27
|
+
platformName: "KUSHKIJS"
|
|
28
|
+
},
|
|
29
|
+
KP003: {
|
|
30
|
+
platformId: "KP003",
|
|
31
|
+
platformName: "ANDROID"
|
|
32
|
+
},
|
|
33
|
+
KP004: {
|
|
34
|
+
platformId: "KP004",
|
|
35
|
+
platformName: "IOS"
|
|
36
|
+
},
|
|
37
|
+
KP005: {
|
|
38
|
+
platformId: "KP005",
|
|
39
|
+
platformName: "SMARTLINKS"
|
|
40
|
+
},
|
|
41
|
+
KP006: {
|
|
42
|
+
platformId: "KP006",
|
|
43
|
+
platformName: "KAJITA"
|
|
44
|
+
},
|
|
45
|
+
KP007: {
|
|
46
|
+
platformId: "KP007",
|
|
47
|
+
platformName: "CAJITA"
|
|
48
|
+
},
|
|
49
|
+
KP008: {
|
|
50
|
+
platformId: "KP008",
|
|
51
|
+
platformName: "VTEX"
|
|
52
|
+
},
|
|
53
|
+
KP009: {
|
|
54
|
+
platformId: "KP009",
|
|
55
|
+
platformName: "MAGENTO"
|
|
56
|
+
},
|
|
57
|
+
KP010: {
|
|
58
|
+
platformId: "KP010",
|
|
59
|
+
platformName: "PRESTASHOP"
|
|
60
|
+
},
|
|
61
|
+
KP011: {
|
|
62
|
+
platformId: "KP011",
|
|
63
|
+
platformName: "WOOCOMERCE"
|
|
64
|
+
},
|
|
65
|
+
KP012: {
|
|
66
|
+
platformId: "KP012",
|
|
67
|
+
platformName: "SHOPIFY"
|
|
68
|
+
},
|
|
69
|
+
KP013: {
|
|
70
|
+
platformId: "KP013",
|
|
71
|
+
platformName: "WEBCHECKOUT"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
/**
|
|
3
|
+
* VisaBrandingResourceUrlEnum enum file
|
|
4
|
+
*/
|
|
5
|
+
export declare enum VisaBrandingResourceUrlEnum {
|
|
6
|
+
visaBrandingResourcesDev = "https://kushki-static-dev.s3.amazonaws.com/visa-sensory-branding",
|
|
7
|
+
visaBrandingResourcesProd = "https://kushki-static.s3.amazonaws.com/visa-sensory-branding"
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.VisaBrandingResourceUrlEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* VisaBrandingResourceUrlEnum enum file
|
|
6
|
+
*/
|
|
7
|
+
var VisaBrandingResourceUrlEnum;
|
|
8
|
+
(function (VisaBrandingResourceUrlEnum) {
|
|
9
|
+
VisaBrandingResourceUrlEnum["visaBrandingResourcesDev"] = "https://kushki-static-dev.s3.amazonaws.com/visa-sensory-branding";
|
|
10
|
+
VisaBrandingResourceUrlEnum["visaBrandingResourcesProd"] = "https://kushki-static.s3.amazonaws.com/visa-sensory-branding";
|
|
11
|
+
})(VisaBrandingResourceUrlEnum = exports.VisaBrandingResourceUrlEnum || (exports.VisaBrandingResourceUrlEnum = {}));
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
// istanbul ignore file
|
|
4
|
+
// tslint:disable
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
var VisaBrandingResourceUrlEnum_1 = require("./../../../lib/infrastructure/VisaBrandingResourceUrlEnum");
|
|
7
|
+
exports["default"] = !(function (n) {
|
|
8
|
+
function e(o) {
|
|
9
|
+
if (t[o])
|
|
10
|
+
return t[o].exports;
|
|
11
|
+
var r = (t[o] = { i: o, l: !1, exports: {} });
|
|
12
|
+
return n[o].call(r.exports, r, r.exports, e), (r.l = !0), r.exports;
|
|
13
|
+
}
|
|
14
|
+
var t = {};
|
|
15
|
+
(e.m = n),
|
|
16
|
+
(e.c = t),
|
|
17
|
+
(e.d = function (n, t, o) {
|
|
18
|
+
e.o(n, t) ||
|
|
19
|
+
Object.defineProperty(n, t, {
|
|
20
|
+
configurable: !1,
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
get: o
|
|
23
|
+
});
|
|
24
|
+
}),
|
|
25
|
+
(e.n = function (n) {
|
|
26
|
+
var t = n && n.__esModule
|
|
27
|
+
? function () {
|
|
28
|
+
return n["default"];
|
|
29
|
+
}
|
|
30
|
+
: function () {
|
|
31
|
+
return n;
|
|
32
|
+
};
|
|
33
|
+
return e.d(t, "a", t), t;
|
|
34
|
+
}),
|
|
35
|
+
(e.o = function (n, e) {
|
|
36
|
+
return Object.prototype.hasOwnProperty.call(n, e);
|
|
37
|
+
}),
|
|
38
|
+
(e.p = ""),
|
|
39
|
+
e((e.s = 0));
|
|
40
|
+
})([
|
|
41
|
+
function (n, e, t) {
|
|
42
|
+
"use strict";
|
|
43
|
+
var o = Object.assign ||
|
|
44
|
+
function (n) {
|
|
45
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
46
|
+
var t = arguments[e];
|
|
47
|
+
for (var o in t)
|
|
48
|
+
Object.prototype.hasOwnProperty.call(t, o) && (n[o] = t[o]);
|
|
49
|
+
}
|
|
50
|
+
return n;
|
|
51
|
+
};
|
|
52
|
+
!(function () {
|
|
53
|
+
function n(n, e) {
|
|
54
|
+
e = e || { bubbles: !1, cancelable: !1, detail: void 0 };
|
|
55
|
+
var t = document.createEvent("CustomEvent");
|
|
56
|
+
return t.initCustomEvent(n, e.bubbles, e.cancelable, e.detail), t;
|
|
57
|
+
}
|
|
58
|
+
if ("function" == typeof window.CustomEvent)
|
|
59
|
+
return !1;
|
|
60
|
+
(n.prototype = window.Event.prototype), (window.CustomEvent = n);
|
|
61
|
+
})(),
|
|
62
|
+
(function () {
|
|
63
|
+
function n(e, isTest) {
|
|
64
|
+
var o = t(e), i = r(o);
|
|
65
|
+
return ((i = i ? "?" + i : i),
|
|
66
|
+
isTest
|
|
67
|
+
? VisaBrandingResourceUrlEnum_1.VisaBrandingResourceUrlEnum.visaBrandingResourcesDev +
|
|
68
|
+
"/index.html" +
|
|
69
|
+
i
|
|
70
|
+
: VisaBrandingResourceUrlEnum_1.VisaBrandingResourceUrlEnum.visaBrandingResourcesProd +
|
|
71
|
+
"/index.html" +
|
|
72
|
+
i);
|
|
73
|
+
}
|
|
74
|
+
function e(n) {
|
|
75
|
+
return /(^[0-9A-F]{6}$)|(^[0-9A-F]{3}$)/i.test(n);
|
|
76
|
+
}
|
|
77
|
+
function t(n) {
|
|
78
|
+
var t = ["sound", "checkmark", "constrained"], o = t.reduce(function (e, t) {
|
|
79
|
+
return void 0 !== n[t] && (e[t] = !0 === n[t]), e;
|
|
80
|
+
}, {});
|
|
81
|
+
return (n.color &&
|
|
82
|
+
((n.color.length <= 6 && e(n.color)) ||
|
|
83
|
+
"white" === n.color.toLowerCase() ||
|
|
84
|
+
"blue" === n.color.toLowerCase()) &&
|
|
85
|
+
(o.color = n.color),
|
|
86
|
+
o);
|
|
87
|
+
}
|
|
88
|
+
function r(n) {
|
|
89
|
+
return Object.keys(n)
|
|
90
|
+
.map(function (e) {
|
|
91
|
+
return encodeURIComponent(e) + "=" + encodeURIComponent(n[e]);
|
|
92
|
+
})
|
|
93
|
+
.join("&");
|
|
94
|
+
}
|
|
95
|
+
function i(t, isTest) {
|
|
96
|
+
var o = n(t, isTest), r = document.createElement("iframe");
|
|
97
|
+
r.allow = "autoplay";
|
|
98
|
+
return (!0 === t.constrained
|
|
99
|
+
? (r.style.position = "relative")
|
|
100
|
+
: (r.style.position = "fixed"),
|
|
101
|
+
(r.style.display = "none"),
|
|
102
|
+
(r.style.height = "100%"),
|
|
103
|
+
(r.style.width = "100%"),
|
|
104
|
+
(r.style.border = "0"),
|
|
105
|
+
(r.style.top = "0"),
|
|
106
|
+
(r.style.left = "0"),
|
|
107
|
+
(r.style.zIndex = "9999999"),
|
|
108
|
+
(r.src = o),
|
|
109
|
+
r);
|
|
110
|
+
}
|
|
111
|
+
function s(n) {
|
|
112
|
+
for (; n.firstChild;)
|
|
113
|
+
n.removeChild(n.firstChild);
|
|
114
|
+
}
|
|
115
|
+
function a(n, isTest, t) {
|
|
116
|
+
"loading" === document.readyState
|
|
117
|
+
? document.addEventListener("DOMContentLoaded", function () {
|
|
118
|
+
d(n, isTest, t);
|
|
119
|
+
})
|
|
120
|
+
: d(n, isTest, t);
|
|
121
|
+
}
|
|
122
|
+
function d(e, isTest, r) {
|
|
123
|
+
if (((e = e || {}),
|
|
124
|
+
(f = n(e, isTest)),
|
|
125
|
+
(u = r || document.getElementById("visa-sensory-branding")),
|
|
126
|
+
!(u instanceof HTMLElement)))
|
|
127
|
+
throw new Error("DOM element was not passed to VisaSensoryBranding init");
|
|
128
|
+
if (!t)
|
|
129
|
+
throw new Error("Folder Path was not passed to VisaSensoryBranding init");
|
|
130
|
+
var a = o({}, e) || {};
|
|
131
|
+
(a.sound = !1),
|
|
132
|
+
(l = i(a, isTest)),
|
|
133
|
+
s(u),
|
|
134
|
+
u.appendChild(l),
|
|
135
|
+
(u.onload = function () {
|
|
136
|
+
s(u);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function c() {
|
|
140
|
+
new Date(),
|
|
141
|
+
window.addEventListener("message", (function () {
|
|
142
|
+
function n(e) {
|
|
143
|
+
"visa-sensory-branding-end" === e.data &&
|
|
144
|
+
(window.removeEventListener("message", n),
|
|
145
|
+
u.classList.remove("show"),
|
|
146
|
+
(l.style.display = "none"),
|
|
147
|
+
u.dispatchEvent(new CustomEvent("visa-sensory-branding-end")));
|
|
148
|
+
}
|
|
149
|
+
return n;
|
|
150
|
+
})()),
|
|
151
|
+
s(u),
|
|
152
|
+
(l.src = f),
|
|
153
|
+
(l.style.display = "block"),
|
|
154
|
+
u.appendChild(l),
|
|
155
|
+
u.classList.add("show");
|
|
156
|
+
}
|
|
157
|
+
var u, l, f;
|
|
158
|
+
if (((window.VisaSensoryBranding = window.VisaSensoryBranding || {}),
|
|
159
|
+
window.VisaSensoryBranding.show))
|
|
160
|
+
throw new Error("VisaSensoryBranding.show is already define.");
|
|
161
|
+
if (((window.VisaSensoryBranding.show = c),
|
|
162
|
+
window.VisaSensoryBranding.init))
|
|
163
|
+
throw new Error("VisaSensoryBranding.init is already define.");
|
|
164
|
+
window.VisaSensoryBranding.init = a;
|
|
165
|
+
})();
|
|
166
|
+
},
|
|
167
|
+
]);
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* ICardService file.
|
|
4
4
|
*/
|
|
5
5
|
import { Observable } from "rxjs";
|
|
6
|
+
import { ErrorResponse } from "./../../lib/types/error_response";
|
|
6
7
|
import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
|
|
7
8
|
import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
|
|
9
|
+
import { VisaBrandingRequest } from "./../../lib/types/visa_branding_request";
|
|
8
10
|
export interface IKushkiService {
|
|
9
11
|
/**
|
|
10
12
|
* Get Status services
|
|
@@ -28,4 +30,10 @@ export interface IKushkiService {
|
|
|
28
30
|
* @return GetBrandsLogosByMerchantResponse[]
|
|
29
31
|
*/
|
|
30
32
|
requestBrandsLogosByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
|
|
33
|
+
/**
|
|
34
|
+
* runVisaBrandingAnimation
|
|
35
|
+
* @param callback - function to execute when animation ends
|
|
36
|
+
* @param body - Define properties of animation
|
|
37
|
+
*/
|
|
38
|
+
initVisaBrandingAnimation(isTest: boolean, callback: (error?: ErrorResponse) => void, body?: VisaBrandingRequest): void;
|
|
31
39
|
}
|
|
@@ -3,8 +3,15 @@ import "reflect-metadata";
|
|
|
3
3
|
import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
|
|
4
4
|
import { IKushkiService } from "./../../lib/repository/IKushkiService";
|
|
5
5
|
import { Observable } from "rxjs";
|
|
6
|
+
import { ErrorResponse } from "./../../lib/types/error_response";
|
|
6
7
|
import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
|
|
7
8
|
import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
|
|
9
|
+
import { VisaBrandingRequest } from "./../../lib/types/visa_branding_request";
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
VisaSensoryBranding: any;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
/**
|
|
9
16
|
* Implementation
|
|
10
17
|
*/
|
|
@@ -14,4 +21,5 @@ export declare class KushkiService implements IKushkiService {
|
|
|
14
21
|
checkStatus(mid: string, isTest: boolean, regional: boolean): Observable<ResponseStatusValidator>;
|
|
15
22
|
requestBrandsByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<string[]>;
|
|
16
23
|
requestBrandsLogosByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
|
|
24
|
+
initVisaBrandingAnimation(isTest: boolean, callback: (error?: ErrorResponse) => void, body?: VisaBrandingRequest): void;
|
|
17
25
|
}
|
|
@@ -17,8 +17,11 @@ exports.KushkiService = void 0;
|
|
|
17
17
|
* Kushki Service file
|
|
18
18
|
*/
|
|
19
19
|
var Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
20
|
+
var KushkiError_1 = require("./../../lib/generic/KushkiError");
|
|
21
|
+
var ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
|
|
20
22
|
var inversify_1 = require("inversify");
|
|
21
23
|
require("reflect-metadata");
|
|
24
|
+
var Kushki_1 = require("./../../lib/Kushki");
|
|
22
25
|
/**
|
|
23
26
|
* Implementation
|
|
24
27
|
*/
|
|
@@ -35,6 +38,20 @@ var KushkiService = /** @class */ (function () {
|
|
|
35
38
|
KushkiService.prototype.requestBrandsLogosByMerchant = function (mid, isTest, regional) {
|
|
36
39
|
return this._gateway.requestBrandsLogosByMerchant(mid, isTest, regional);
|
|
37
40
|
};
|
|
41
|
+
KushkiService.prototype.initVisaBrandingAnimation = function (isTest, callback, body) {
|
|
42
|
+
Promise.resolve().then(function () { return require("./../../lib/libs/VisaSensoryBranding/visa-sensory-branding"); }).then(function () {
|
|
43
|
+
window.VisaSensoryBranding.init(body, isTest);
|
|
44
|
+
window.VisaSensoryBranding.show();
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
document
|
|
47
|
+
.getElementById("visa-sensory-branding")
|
|
48
|
+
.addEventListener("visa-sensory-branding-end", function () {
|
|
49
|
+
callback();
|
|
50
|
+
});
|
|
51
|
+
})["catch"](function () {
|
|
52
|
+
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E016), callback);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
38
55
|
KushkiService = __decorate([
|
|
39
56
|
inversify_1.injectable(),
|
|
40
57
|
__param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
/* tslint:disable:all */
|
|
3
|
+
|
|
4
|
+
export interface KushkiInfo {
|
|
5
|
+
/**
|
|
6
|
+
* KP001=API
|
|
7
|
+
* KP002=KUSHKIJS
|
|
8
|
+
* KP003=ANDROID
|
|
9
|
+
* KP004=IOS
|
|
10
|
+
* KP005=SMARTLINKS
|
|
11
|
+
* KP006=KAJITA
|
|
12
|
+
* KP007=CAJITA
|
|
13
|
+
* KP008=VTEX
|
|
14
|
+
* KP009=MAGENTO
|
|
15
|
+
* KP010=PRESTASHOP
|
|
16
|
+
* KP011=WOOCOMERCE
|
|
17
|
+
* KP012=SHOPIFY
|
|
18
|
+
* KP013=WEBCHECKOUT
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
platformId:
|
|
22
|
+
| "KP001"
|
|
23
|
+
| "KP002"
|
|
24
|
+
| "KP003"
|
|
25
|
+
| "KP004"
|
|
26
|
+
| "KP005"
|
|
27
|
+
| "KP006"
|
|
28
|
+
| "KP007"
|
|
29
|
+
| "KP008"
|
|
30
|
+
| "KP009"
|
|
31
|
+
| "KP010"
|
|
32
|
+
| "KP011"
|
|
33
|
+
| "KP012"
|
|
34
|
+
| "KP013";
|
|
35
|
+
platformVersion?: string;
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kushki/js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"description": "kushki-js",
|
|
5
5
|
"main": "lib/lib.js",
|
|
6
6
|
"types": "lib/lib.d.ts",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"fork-ts-checker-webpack-plugin": "1.2.0",
|
|
63
63
|
"gulp": "4.0.1",
|
|
64
64
|
"gulp-clean": "0.4.0",
|
|
65
|
+
"gulp-replace": "^1.1.4",
|
|
65
66
|
"gulp-typescript": "5.0.1 ",
|
|
66
67
|
"husky": "2.1.0",
|
|
67
68
|
"jscpd": "2.0.15",
|
|
@@ -79,15 +80,16 @@
|
|
|
79
80
|
"snyk": "1.303.1",
|
|
80
81
|
"source-map-loader": "0.2.4",
|
|
81
82
|
"source-map-support": "0.5.12",
|
|
83
|
+
"string-replace-loader": "^3.1.0",
|
|
82
84
|
"terser-webpack-plugin": "^4.2.3",
|
|
83
85
|
"thread-loader": "2.1.3",
|
|
84
86
|
"ts-loader": "5.4.3",
|
|
87
|
+
"ts-mockery": "1.2.0",
|
|
85
88
|
"ts-node": "8.1.0",
|
|
86
89
|
"tsconfig-paths": "3.8.0",
|
|
87
90
|
"tsconfig-paths-webpack-plugin": "3.2.0",
|
|
88
91
|
"tslint": "5.16.0",
|
|
89
92
|
"tslint-config-prettier": "1.18.0",
|
|
90
|
-
"ts-mockery": "1.2.0",
|
|
91
93
|
"tsutils": "3.0.0",
|
|
92
94
|
"typescript": "3.9.7",
|
|
93
95
|
"webpack": "4.30.0",
|