@kushki/js 1.40.4-alpha.1 → 1.40.4

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 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.4-alpha.1";
15
+ const kushki_js_version = "1.40.4";
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, authorization?: string): Observable<TokenResponse>;
52
+ requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): 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, authorization?: string): Observable<TokenResponse>;
54
+ requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): 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>;
@@ -61,28 +61,20 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
61
61
  requestBrandsLogosByMerchant(mid, testEnv, regional) {
62
62
  return this.requestGet(`${PathEnum_1.PathEnum.brands_logos_by_merchant}`, testEnv, regional, mid);
63
63
  }
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, {
64
+ requestToken(body, mid, testEnv, regional) {
65
+ return this.request(body, {
66
66
  [this._publicHeader]: mid,
67
67
  [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
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))));
68
+ }, PathEnum_1.PathEnum.card_tokens, testEnv, regional);
73
69
  }
74
70
  requestDeviceToken(body, mid, testEnv, regional) {
75
71
  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)));
76
72
  }
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,
73
+ requestSubscriptionToken(body, mid, testEnv, regional) {
74
+ return this.request(body, {
83
75
  [this._publicHeader]: mid,
84
76
  [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
85
- }, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional))), operators_1.map((response) => response));
77
+ }, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional);
86
78
  }
87
79
  requestTransferToken(body, mid, testEnv, regional) {
88
80
  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)));
@@ -45,7 +45,7 @@ export interface IKushkiGateway {
45
45
  /**
46
46
  * Send tokens request to Kushki API
47
47
  */
48
- requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean, authorization?: string): Observable<TokenResponse>;
48
+ requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
49
49
  /**
50
50
  * Send charge tokens request to Kushki API
51
51
  */
@@ -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, authorization?: string): Observable<TokenResponse>;
56
+ requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
57
57
  /**
58
58
  * Send transfer tokens request to Kushki API
59
59
  */
@@ -93,21 +93,18 @@ 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
- 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
- ]);
96
+ const final_request = dot.transform(this._receipt, Object.assign(Object.assign({}, data_to_transform), { merchantName: merchant.merchant_name }));
97
+ return rxjs_1.of({ final_request, merchant });
101
98
  }))
102
99
  .subscribe({
103
100
  error: (err) => Kushki_1.Kushki.callbackError(err, callback),
104
- next: ([final_request, authorization, merchant]) => {
101
+ next: ({ final_request, merchant, }) => {
105
102
  if (final_request.jwt && !merchant.sandboxEnable)
106
103
  this._request3DSToken(() => {
107
- this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
104
+ this._requestTokenGateway(final_request, mid, isTest, regional, callback);
108
105
  });
109
106
  else
110
- this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
107
+ this._requestTokenGateway(final_request, mid, isTest, regional, callback);
111
108
  },
112
109
  });
113
110
  }
@@ -157,21 +154,18 @@ let CardService = CardService_1 = class CardService {
157
154
  const data_to_transform = this._getCreateSubscriptionDataToTransform(sift_object, subscriptionTokenRequest);
158
155
  if (jwt !== undefined)
159
156
  data_to_transform.jwt = jwt;
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
- ]);
157
+ const body = dot.transform(this._receipt, Object.assign(Object.assign({}, data_to_transform), { merchantName: merchant.merchant_name }));
158
+ return rxjs_1.of({ body, merchant });
165
159
  }))
166
160
  .subscribe({
167
161
  error: (err) => Kushki_1.Kushki.callbackError(err, callback),
168
- next: ([body, jwt, merchant]) => {
162
+ next: ({ body, merchant, }) => {
169
163
  if (body.jwt && !merchant.sandboxEnable)
170
164
  this._request3DSToken(() => {
171
- this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback, jwt);
165
+ this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback);
172
166
  });
173
167
  else
174
- this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback, jwt);
168
+ this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback);
175
169
  },
176
170
  });
177
171
  }
@@ -230,8 +224,8 @@ let CardService = CardService_1 = class CardService {
230
224
  });
231
225
  }
232
226
  // istanbul ignore next
233
- _requestTokenGateway(body, mid, testEnv, regional, callback, authorization) {
234
- const request_token = this._gateway.requestToken(body, mid, testEnv, regional, authorization);
227
+ _requestTokenGateway(body, mid, testEnv, regional, callback) {
228
+ const request_token = this._gateway.requestToken(body, mid, testEnv, regional);
235
229
  return request_token.subscribe({
236
230
  error: (err) => Kushki_1.Kushki.callbackError(err, callback),
237
231
  next: (response) => {
@@ -447,9 +441,9 @@ let CardService = CardService_1 = class CardService {
447
441
  _getUserId(subscriptionId, mid, testEnv, regional, userId) {
448
442
  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)));
449
443
  }
450
- _requestSubscriptionTokenGateway(body, mid, testEnv, regional, callback, authorization) {
444
+ _requestSubscriptionTokenGateway(body, mid, testEnv, regional, callback) {
451
445
  this._gateway
452
- .requestSubscriptionToken(body, mid, testEnv, regional, authorization)
446
+ .requestSubscriptionToken(body, mid, testEnv, regional)
453
447
  .subscribe({
454
448
  error: (err) => Kushki_1.Kushki.callbackError(err, callback),
455
449
  next: (response) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.40.4-alpha.1",
3
+ "version": "1.40.4",
4
4
  "description": "kushki-js",
5
5
  "main": "lib/lib.js",
6
6
  "types": "lib/lib.d.ts",