@kushki/js 1.33.2 → 1.34.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 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";
@@ -77,6 +78,7 @@ export declare class Kushki {
77
78
  merchantId: string;
78
79
  inTestEnvironment?: boolean;
79
80
  regional?: boolean;
81
+ kushkiInfo?: KushkiInfo;
80
82
  });
81
83
  requestToken(body: TokenRequest | TokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
82
84
  requestInitAntiFraud(userId: string, callback: (value: SiftScienceAntiFraudSessionResponse | ErrorResponse) => void): void;
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;
@@ -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.34.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
- return _this.request(body, _this._buildHeader(mid), "" + PathEnum_1.PathEnum.card_token_charge + body.subscriptionId + "/tokens", testEnv, regional);
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
- return _this.request(body, _this._buildHeader(mid), PathEnum_1.PathEnum.transfer_tokens, testEnv, regional);
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
- return _this.request(body, _this._buildHeader(mid), PathEnum_1.PathEnum.cash_tokens, testEnv, regional);
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
- return _this.request(body, _this._buildHeader(mid), PathEnum_1.PathEnum.card_async_tokens, testEnv, regional);
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
- return _this.request(body, _this._buildHeader(mid), PathEnum_1.PathEnum.subscription_card_async_tokens, testEnv, regional);
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
- return _this.request(body, _this._buildHeader(mid), PathEnum_1.PathEnum.payouts_cash_tokens, testEnv, regional);
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
- return _this.request(body, _this._buildHeader(mid), PathEnum_1.PathEnum.payouts_transfer_tokens, testEnv, regional);
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
- return _this.request(body, _this._buildHeader(mid), PathEnum_1.PathEnum.transfer_subscription_tokens, testEnv, regional);
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) {
@@ -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,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.33.2",
3
+ "version": "1.34.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",