@kushki/js 1.41.0-alpha-34148.0 → 1.41.0-alpha-34148.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
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { AxiosError } from "axios";
6
6
  import { KushkiError } from "./../lib/generic/KushkiError";
7
+ import { TransferPaymentTypeEnum } from "./../lib/infrastructure/TransferPaymentTypeEnum";
7
8
  import "reflect-metadata";
8
9
  import { AppleTokenResponse } from "./../lib/types/apple_pay_get_token_events";
9
10
  import { ApplePayGetTokenOptions } from "./../lib/types/apple_pay_get_token_options";
@@ -89,11 +90,12 @@ export declare class Kushki {
89
90
  * Webpay, SPEI, etc.).
90
91
  *
91
92
  * Multi-processor merchants send `MultiProcessorTokenRequest`: `amount`,
92
- * `currency` and a `processor` object whose `name` and `flowType` must be
93
- * taken from `getTransferConfig` (`processors[].name` and
94
- * `supportedFlows[].type`) and forwarded as-is. Any extra field a given
95
- * processor needs can be added to the body or inside `processor`; the SDK
96
- * does not validate them, the backend does.
93
+ * `currency` and a `processor` object taken from `getTransferConfig`:
94
+ * `processor.name` is `processors[].name` and `processor.channel` is one of
95
+ * the `channels` of a `supportedFlows` product with `paymentType`
96
+ * `"PAYMENT"` (omit it when the processor has no such products). Extra
97
+ * fields a processor needs go in the body or inside `processor`; the
98
+ * backend validates them.
97
99
  *
98
100
  * @param {TransferTokenRequest} body transfer token request
99
101
  * @param {Function} callback with value
@@ -101,13 +103,15 @@ export declare class Kushki {
101
103
  * @example
102
104
  * kushki.getTransferConfig((config) => {
103
105
  * const processor = config.processors[0];
104
- * const flow = processor.supportedFlows[0];
106
+ * const payment = processor.supportedFlows.find(
107
+ * (flow) => flow.paymentType === TransferPaymentTypeEnum.PAYMENT
108
+ * );
105
109
  *
106
110
  * kushki.requestTransferToken(
107
111
  * {
108
112
  * amount: { subtotalIva: 0, subtotalIva0: 9000, iva: 0 },
109
113
  * currency: processor.currency,
110
- * processor: { name: processor.name, flowType: flow.type },
114
+ * processor: { name: processor.name, channel: payment.channels[0] },
111
115
  * },
112
116
  * (response) => console.log(response)
113
117
  * );
@@ -123,19 +127,23 @@ export declare class Kushki {
123
127
  * pick which processor will handle the payment.
124
128
  *
125
129
  * - Legacy processors (e.g. PSE) only expose `name` and `currency`.
126
- * - Multi-processor entries also expose `supportedFlows` (e.g. Bre-B, QR).
127
- * The processor `name` and the selected flow `type` are later sent as-is
128
- * in `requestTransferToken` (`processor.name` and `processor.flowType`).
129
- * The SDK does not restrict these values; new processors or flows do not
130
- * require an SDK update.
130
+ * - Multi-processor entries also expose `supportedFlows`: one item per
131
+ * product (`paymentType` `PAYMENT` or `SUBSCRIPTION`) with the `channels`
132
+ * that offer it. `processor.name` and the chosen channel of a `PAYMENT`
133
+ * product are later sent as-is in `requestTransferToken`.
131
134
  *
132
135
  * An empty `processors` array is a valid success response, not an error.
133
136
  *
137
+ * `paymentType` is forwarded as a query param so the backend returns only
138
+ * the products of that type; processors left without products are omitted.
139
+ * Use `PAYMENT` for a one-time payment checkout.
140
+ *
134
141
  * The merchant id, environment (test/production) and region are taken from
135
142
  * the Kushki instance options.
136
143
  *
137
144
  * @param {Function} callback invoked with a `GetTransferConfigResponse` on
138
145
  * success or an `ErrorResponse` on failure
146
+ * @param {TransferPaymentTypeEnum} [paymentType] optional product type filter
139
147
  * @returns {void}
140
148
  * @example
141
149
  * kushki.getTransferConfig((response) => {
@@ -145,16 +153,16 @@ export declare class Kushki {
145
153
  * }
146
154
  * response.processors.forEach((processor) => {
147
155
  * if (processor.supportedFlows) {
148
- * // Multi-processor: let the user choose a flow before tokenizing
156
+ * // Multi-processor: let the user choose a product and channel
149
157
  * console.log(processor.name, processor.supportedFlows);
150
158
  * } else {
151
159
  * // Legacy processor: only name and currency are available
152
160
  * console.log(processor.name, processor.currency);
153
161
  * }
154
162
  * });
155
- * });
163
+ * }, TransferPaymentTypeEnum.PAYMENT);
156
164
  */
157
- getTransferConfig(callback: (value: GetTransferConfigResponse | ErrorResponse) => void): void;
165
+ getTransferConfig(callback: (value: GetTransferConfigResponse | ErrorResponse) => void, paymentType?: TransferPaymentTypeEnum): void;
158
166
  checkStatus(callback: (value: ResponseStatusValidator | ErrorResponse) => void): void;
159
167
  /**
160
168
  * @deprecated since version 1.19.8 use requestBankList instead
package/lib/Kushki.js CHANGED
@@ -66,11 +66,12 @@ class Kushki {
66
66
  * Webpay, SPEI, etc.).
67
67
  *
68
68
  * Multi-processor merchants send `MultiProcessorTokenRequest`: `amount`,
69
- * `currency` and a `processor` object whose `name` and `flowType` must be
70
- * taken from `getTransferConfig` (`processors[].name` and
71
- * `supportedFlows[].type`) and forwarded as-is. Any extra field a given
72
- * processor needs can be added to the body or inside `processor`; the SDK
73
- * does not validate them, the backend does.
69
+ * `currency` and a `processor` object taken from `getTransferConfig`:
70
+ * `processor.name` is `processors[].name` and `processor.channel` is one of
71
+ * the `channels` of a `supportedFlows` product with `paymentType`
72
+ * `"PAYMENT"` (omit it when the processor has no such products). Extra
73
+ * fields a processor needs go in the body or inside `processor`; the
74
+ * backend validates them.
74
75
  *
75
76
  * @param {TransferTokenRequest} body transfer token request
76
77
  * @param {Function} callback with value
@@ -78,13 +79,15 @@ class Kushki {
78
79
  * @example
79
80
  * kushki.getTransferConfig((config) => {
80
81
  * const processor = config.processors[0];
81
- * const flow = processor.supportedFlows[0];
82
+ * const payment = processor.supportedFlows.find(
83
+ * (flow) => flow.paymentType === TransferPaymentTypeEnum.PAYMENT
84
+ * );
82
85
  *
83
86
  * kushki.requestTransferToken(
84
87
  * {
85
88
  * amount: { subtotalIva: 0, subtotalIva0: 9000, iva: 0 },
86
89
  * currency: processor.currency,
87
- * processor: { name: processor.name, flowType: flow.type },
90
+ * processor: { name: processor.name, channel: payment.channels[0] },
88
91
  * },
89
92
  * (response) => console.log(response)
90
93
  * );
@@ -102,19 +105,23 @@ class Kushki {
102
105
  * pick which processor will handle the payment.
103
106
  *
104
107
  * - Legacy processors (e.g. PSE) only expose `name` and `currency`.
105
- * - Multi-processor entries also expose `supportedFlows` (e.g. Bre-B, QR).
106
- * The processor `name` and the selected flow `type` are later sent as-is
107
- * in `requestTransferToken` (`processor.name` and `processor.flowType`).
108
- * The SDK does not restrict these values; new processors or flows do not
109
- * require an SDK update.
108
+ * - Multi-processor entries also expose `supportedFlows`: one item per
109
+ * product (`paymentType` `PAYMENT` or `SUBSCRIPTION`) with the `channels`
110
+ * that offer it. `processor.name` and the chosen channel of a `PAYMENT`
111
+ * product are later sent as-is in `requestTransferToken`.
110
112
  *
111
113
  * An empty `processors` array is a valid success response, not an error.
112
114
  *
115
+ * `paymentType` is forwarded as a query param so the backend returns only
116
+ * the products of that type; processors left without products are omitted.
117
+ * Use `PAYMENT` for a one-time payment checkout.
118
+ *
113
119
  * The merchant id, environment (test/production) and region are taken from
114
120
  * the Kushki instance options.
115
121
  *
116
122
  * @param {Function} callback invoked with a `GetTransferConfigResponse` on
117
123
  * success or an `ErrorResponse` on failure
124
+ * @param {TransferPaymentTypeEnum} [paymentType] optional product type filter
118
125
  * @returns {void}
119
126
  * @example
120
127
  * kushki.getTransferConfig((response) => {
@@ -124,17 +131,17 @@ class Kushki {
124
131
  * }
125
132
  * response.processors.forEach((processor) => {
126
133
  * if (processor.supportedFlows) {
127
- * // Multi-processor: let the user choose a flow before tokenizing
134
+ * // Multi-processor: let the user choose a product and channel
128
135
  * console.log(processor.name, processor.supportedFlows);
129
136
  * } else {
130
137
  * // Legacy processor: only name and currency are available
131
138
  * console.log(processor.name, processor.currency);
132
139
  * }
133
140
  * });
134
- * });
141
+ * }, TransferPaymentTypeEnum.PAYMENT);
135
142
  */
136
- getTransferConfig(callback) {
137
- this._resolve(this._transferService.getTransferConfig(this._merchantId, this._inTestEnvironment, this._regional), callback);
143
+ getTransferConfig(callback, paymentType) {
144
+ this._resolve(this._transferService.getTransferConfig(this._merchantId, this._inTestEnvironment, this._regional, paymentType), callback);
138
145
  }
139
146
  checkStatus(callback) {
140
147
  this._resolve(this._kushkiService.checkStatus(this._merchantId, this._inTestEnvironment, this._regional), callback);
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.41.0-alpha-34148.0";
15
+ const kushki_js_version = "1.41.0-alpha-34148.1";
16
16
  if (kushkiInfo) {
17
17
  if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
18
18
  kushkiInfo.platformVersion = kushki_js_version;
@@ -1,4 +1,5 @@
1
1
  /* tslint:disable:all */
2
+ import { TransferPaymentTypeEnum } from "./../../lib/infrastructure/TransferPaymentTypeEnum";
2
3
  import "reflect-metadata";
3
4
  import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
4
5
  import { Observable } from "rxjs";
@@ -58,7 +59,7 @@ export declare class KushkiGateway implements IKushkiGateway {
58
59
  requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string, uatDomainOverride?: string): Observable<T>;
59
60
  requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
60
61
  requestBrandsLogosByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
61
- requestTransferConfig(mid: string, testEnv: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
62
+ requestTransferConfig(mid: string, testEnv: boolean, regional: boolean, paymentType?: TransferPaymentTypeEnum): Observable<GetTransferConfigResponse>;
62
63
  requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
63
64
  requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
64
65
  requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
@@ -84,6 +85,7 @@ export declare class KushkiGateway implements IKushkiGateway {
84
85
  validateAppleDomain(domain: string, mid: string, testEnv: boolean, regional: boolean): Observable<Validate3DsResponse>;
85
86
  startApplePaySession(body: ApplePayStartSessionRequest, mid: string, testEnv: boolean, regional: boolean): Observable<object>;
86
87
  getApplePayToken(body: ApplePayPaymentData, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
88
+ private _buildTransferConfigPath;
87
89
  private _buildCybersourceJwtPath;
88
90
  private _assignChannel;
89
91
  private _buildHeader;
@@ -69,8 +69,8 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
69
69
  requestBrandsLogosByMerchant(mid, testEnv, regional) {
70
70
  return this.requestGet(`${PathEnum_1.PathEnum.brands_logos_by_merchant}`, testEnv, regional, mid);
71
71
  }
72
- requestTransferConfig(mid, testEnv, regional) {
73
- return this.requestGet(PathEnum_1.PathEnum.transfer_config, testEnv, regional, mid, exports.TEMP_TRANSFER_UAT_DOMAIN);
72
+ requestTransferConfig(mid, testEnv, regional, paymentType) {
73
+ return this.requestGet(this._buildTransferConfigPath(paymentType), testEnv, regional, mid, exports.TEMP_TRANSFER_UAT_DOMAIN);
74
74
  }
75
75
  requestToken(body, mid, testEnv, regional) {
76
76
  return this.request(body, {
@@ -164,6 +164,11 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
164
164
  [this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
165
165
  }, `${PathEnum_1.PathEnum.get_apple_pay_token}?switch=${this._multiRegionEcommSwitch}`, testEnv, regional)));
166
166
  }
167
+ _buildTransferConfigPath(paymentType) {
168
+ if (!paymentType)
169
+ return PathEnum_1.PathEnum.transfer_config;
170
+ return `${PathEnum_1.PathEnum.transfer_config}?paymentType=${encodeURIComponent(paymentType)}`;
171
+ }
167
172
  _buildCybersourceJwtPath(subscriptionId) {
168
173
  let path = PathEnum_1.PathEnum.cybersource_jwt;
169
174
  const params = [];
@@ -0,0 +1,8 @@
1
+ /* tslint:disable:all */
2
+ /**
3
+ * Transfer payment type enum file
4
+ */
5
+ export declare enum TransferPaymentTypeEnum {
6
+ PAYMENT = "PAYMENT",
7
+ SUBSCRIPTION = "SUBSCRIPTION"
8
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransferPaymentTypeEnum = void 0;
4
+ /**
5
+ * Transfer payment type enum file
6
+ */
7
+ var TransferPaymentTypeEnum;
8
+ (function (TransferPaymentTypeEnum) {
9
+ TransferPaymentTypeEnum["PAYMENT"] = "PAYMENT";
10
+ TransferPaymentTypeEnum["SUBSCRIPTION"] = "SUBSCRIPTION";
11
+ })(TransferPaymentTypeEnum = exports.TransferPaymentTypeEnum || (exports.TransferPaymentTypeEnum = {}));
package/lib/lib.d.ts CHANGED
@@ -3,3 +3,4 @@
3
3
  * Main exports
4
4
  */
5
5
  export * from "./Kushki";
6
+ export * from "./infrastructure/TransferPaymentTypeEnum";
package/lib/lib.js CHANGED
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  __exportStar(require("./Kushki"), exports);
19
+ __exportStar(require("././../lib/infrastructure/TransferPaymentTypeEnum"), exports);
@@ -2,6 +2,7 @@
2
2
  /**
3
3
  * Interface for Kushki Gateway.
4
4
  */
5
+ import { TransferPaymentTypeEnum } from "./../../lib/infrastructure/TransferPaymentTypeEnum";
5
6
  import { Observable } from "rxjs";
6
7
  import { ApplePayPaymentData } from "./../../lib/types/apple_pay_get_token_events";
7
8
  import { ApplePayStartSessionRequest } from "./../../lib/types/apple_pay_start_session_request";
@@ -111,8 +112,9 @@ export interface IKushkiGateway {
111
112
  * @param mid - public merchant id
112
113
  * @param testEnv - is test environment
113
114
  * @param regional - Define if endpoint used regional URL
115
+ * @param paymentType - optional paymentType query param
114
116
  */
115
- requestTransferConfig(mid: string, testEnv: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
117
+ requestTransferConfig(mid: string, testEnv: boolean, regional: boolean, paymentType?: TransferPaymentTypeEnum): Observable<GetTransferConfigResponse>;
116
118
  /**
117
119
  * Send Webpay tokens request to Transbank API
118
120
  */
@@ -2,6 +2,7 @@
2
2
  /**
3
3
  * ITransferService file.
4
4
  */
5
+ import { TransferPaymentTypeEnum } from "./../../lib/infrastructure/TransferPaymentTypeEnum";
5
6
  import { Observable } from "rxjs";
6
7
  import { BankListResponse } from "./../../lib/types/bank_list_response";
7
8
  import { GetTransferConfigResponse } from "./../../lib/types/get_transfer_config_response";
@@ -28,6 +29,7 @@ export interface ITransferService {
28
29
  * @param mid - public merchant id
29
30
  * @param isTest - is test environment
30
31
  * @param regional - Define if endpoint used regional URL
32
+ * @param paymentType - optional paymentType filter
31
33
  */
32
- getTransferConfig(mid: string, isTest: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
34
+ getTransferConfig(mid: string, isTest: boolean, regional: boolean, paymentType?: TransferPaymentTypeEnum): Observable<GetTransferConfigResponse>;
33
35
  }
@@ -1,4 +1,5 @@
1
1
  /* tslint:disable:all */
2
+ import { TransferPaymentTypeEnum } from "./../../lib/infrastructure/TransferPaymentTypeEnum";
2
3
  import "reflect-metadata";
3
4
  import { IAntiFraud } from "./../../lib/repository/IAntiFraud";
4
5
  import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
@@ -17,5 +18,5 @@ export declare class TransferService implements ITransferService {
17
18
  constructor(gateway: IKushkiGateway, antiFraud: IAntiFraud);
18
19
  requestTransferToken(request: TransferTokenRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
19
20
  requestBankList(mid: string, isTest: boolean, regional: boolean): Observable<BankListResponse>;
20
- getTransferConfig(mid: string, isTest: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
21
+ getTransferConfig(mid: string, isTest: boolean, regional: boolean, paymentType?: TransferPaymentTypeEnum): Observable<GetTransferConfigResponse>;
21
22
  }
@@ -42,8 +42,8 @@ let TransferService = class TransferService {
42
42
  requestBankList(mid, isTest, regional) {
43
43
  return this._gateway.requestPseBankList(mid, isTest, regional);
44
44
  }
45
- getTransferConfig(mid, isTest, regional) {
46
- return this._gateway.requestTransferConfig(mid, isTest, regional);
45
+ getTransferConfig(mid, isTest, regional, paymentType) {
46
+ return this._gateway.requestTransferConfig(mid, isTest, regional, paymentType);
47
47
  }
48
48
  };
49
49
  TransferService = __decorate([
@@ -2,7 +2,7 @@
2
2
  /* tslint:disable:all */
3
3
 
4
4
  /**
5
- * Transfer processors enabled for the merchant. Use it to let the end user pick a processor and, when available, a flow before calling requestTransferToken.
5
+ * Transfer processors enabled for the merchant. Use it to let the end user pick a processor and, when available, a product and channel before calling requestTransferToken.
6
6
  */
7
7
  export interface GetTransferConfigResponse {
8
8
  /**
@@ -18,21 +18,29 @@ export interface GetTransferConfigResponse {
18
18
  */
19
19
  currency: string;
20
20
  /**
21
- * Payment flows the processor supports. Absent for legacy single-flow processors such as PSE. When present, the end user must pick one flow before requesting the token.
21
+ * Payment products the processor offers, each through one or more channels. Absent for legacy processors such as PSE.
22
22
  */
23
23
  supportedFlows?: {
24
24
  /**
25
- * Flow identifier defined by the backend (e.g. "QR", "BRE_B"). Send the selected value as-is in requestTransferToken as processor.flowType. The SDK does not restrict the possible values; new flows do not require an SDK update.
25
+ * Product type. "PAYMENT" is a one-time payment, "SUBSCRIPTION" a recurring one; the same values TransferPaymentTypeEnum accepts as getTransferConfig filter.
26
26
  */
27
- type: string;
27
+ paymentType: "PAYMENT" | "SUBSCRIPTION";
28
28
  /**
29
- * Human readable flow name (e.g. "QR", "Bre-B") meant to be displayed to the end user.
29
+ * Channels offering the product (e.g. "QR", "PUSH", "DEEPLINK"). For a "PAYMENT" product, send the chosen value as processor.channel in requestTransferToken.
30
+ */
31
+ channels: string[];
32
+ /**
33
+ * Human readable product name meant to be displayed to the end user.
30
34
  */
31
35
  name: string;
32
36
  /**
33
- * Optional longer text describing the flow, meant to be displayed to the end user.
37
+ * Optional longer text describing the product, meant to be displayed to the end user.
34
38
  */
35
39
  description?: string;
40
+ /**
41
+ * Available periodicities (e.g. "monthly"). Only for "SUBSCRIPTION" products.
42
+ */
43
+ periodicities?: string[];
36
44
  }[];
37
45
  }[];
38
46
  }
@@ -132,7 +132,7 @@ export interface EcuadorTokenRequest {
132
132
  [k: string]: any;
133
133
  }
134
134
  /**
135
- * Transfer token request for merchants with multiple processors. processor.name and processor.flowType come from getTransferConfig (processors[].name and supportedFlows[].type) and are forwarded as-is. Each processor may require extra fields in the body or inside processor; the backend validates them.
135
+ * Transfer token request for merchants with multiple processors. processor.name and processor.channel come from getTransferConfig (processors[].name and a channel of a PAYMENT product) and are forwarded as-is. Extra fields a processor needs go in the body or inside processor; the backend validates them.
136
136
  */
137
137
  export interface MultiProcessorTokenRequest {
138
138
  amount: Amount;
@@ -141,7 +141,7 @@ export interface MultiProcessorTokenRequest {
141
141
  sessionId?: SessionId;
142
142
  processor: {
143
143
  name: string;
144
- flowType?: string;
144
+ channel?: string;
145
145
  [k: string]: any;
146
146
  };
147
147
  [k: string]: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.41.0-alpha-34148.0",
3
+ "version": "1.41.0-alpha-34148.1",
4
4
  "description": "kushki-js",
5
5
  "main": "lib/lib.js",
6
6
  "types": "lib/lib.d.ts",