@kushki/js 1.25.1 → 1.26.0-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/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";
@@ -72,7 +73,14 @@ export declare class Kushki {
72
73
  regional?: boolean;
73
74
  });
74
75
  requestToken(body: TokenRequest | TokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
76
+ /**
77
+ * @deprecated use requestDeviceToken instead
78
+ * @param {Function} body with value
79
+ * @param {Function} callback with value
80
+ * @returns {void}
81
+ */
75
82
  requestTokenCharge(body: TokenChargeRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
83
+ requestDeviceToken(body: DeviceTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
76
84
  requestSubscriptionToken(body: SubscriptionTokenRequest | SubscriptionTokenKPayRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
77
85
  requestTransferToken(body: TransferTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
78
86
  checkStatus(callback: (value: ResponseStatusValidator | ErrorResponse) => void): void;
@@ -108,5 +116,6 @@ export declare class Kushki {
108
116
  validate3DS(body: TokenResponse, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
109
117
  static callbackError(err: ErrorResponse | KushkiError | AxiosError, callback: (value: ErrorResponse) => void): void;
110
118
  private _requestBankList;
119
+ private _requestDeviceToken;
111
120
  private _resolve;
112
121
  }
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._resolve(this._cardService.requestTokenCharge(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
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);
@@ -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
- requestTokenCharge(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
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.requestTokenCharge = function (body, mid, testEnv, regional) {
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);
@@ -41,13 +41,13 @@ export interface ICardService {
41
41
  */
42
42
  requestDeferred(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<IDeferredResponse[]>;
43
43
  /**
44
- * Token Charge for subscriptions
45
- * @param tokenChargeRequest - subscription tokens request body
44
+ * Request Device Token for subscriptions
45
+ * @param deviceTokenRequest - subscription tokens request body
46
46
  * @param mid - public merchant id
47
47
  * @param isTest - is test environment
48
48
  * @param regional - for single IP
49
49
  */
50
- requestTokenCharge(tokenChargeRequest: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
50
+ requestDeviceToken(deviceTokenRequest: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
51
51
  /**
52
52
  * BinInfo
53
53
  * @param binBody - deferred bin request body
@@ -54,7 +54,7 @@ export interface IKushkiGateway {
54
54
  /**
55
55
  * Send charge tokens request to Kushki API
56
56
  */
57
- requestTokenCharge(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
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
  */
@@ -37,7 +37,7 @@ export declare class CardService implements ICardService {
37
37
  private _sandboxEnable;
38
38
  constructor(gateway: IKushkiGateway, authService: IAuthService, antiFraud: IAntiFraud);
39
39
  requestToken(request: TokenRequest | TokenKPayRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
40
- requestTokenCharge(request: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
40
+ requestDeviceToken(request: SubscriptionIdRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
41
41
  requestSubscriptionToken(subscriptionTokenRequest: SubscriptionTokenRequest | SubscriptionTokenKPayRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
42
42
  requestDeferred(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<IDeferredResponse[]>;
43
43
  requestBinInfo(binBody: BinBody, mid: string, isTest: boolean, regional: boolean): Observable<BinInfoResponse>;
@@ -130,7 +130,7 @@ var CardService = /** @class */ (function () {
130
130
  return _this._gateway.requestToken(final_request, mid, isTest, regional, jwt);
131
131
  }));
132
132
  };
133
- CardService.prototype.requestTokenCharge = function (request, mid, isTest, regional) {
133
+ CardService.prototype.requestDeviceToken = function (request, mid, isTest, regional) {
134
134
  var _this = this;
135
135
  return this._gateway.requestMerchantSettings(mid, isTest, regional).pipe(operators_1.switchMap(function (merchant) {
136
136
  return rxjs_1.iif(function () {
@@ -143,7 +143,7 @@ var CardService = /** @class */ (function () {
143
143
  delete siftObject.userId;
144
144
  if (siftObject.sessionId === null)
145
145
  delete siftObject.sessionId;
146
- return _this._gateway.requestTokenCharge(__assign({ subscriptionId: request.subscriptionId }, siftObject), mid, isTest, regional);
146
+ return _this._gateway.requestDeviceToken(__assign({ subscriptionId: request.subscriptionId }, siftObject), mid, isTest, regional);
147
147
  }));
148
148
  };
149
149
  CardService.prototype.requestSubscriptionToken = function (subscriptionTokenRequest, mid, isTest, regional) {
@@ -0,0 +1,9 @@
1
+ /* tslint:disable:all */
2
+ /* tslint:disable:all */
3
+
4
+ export interface DeviceTokenRequest {
5
+ subscriptionId: string;
6
+ userId?: string | null;
7
+ sessionId?: string | null;
8
+ [k: string]: any;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.25.1",
3
+ "version": "1.26.0-alpha.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": {