@kushki/js 1.41.0-alpha-34148.0 → 1.41.0-alpha
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 +23 -15
- package/lib/Kushki.js +23 -16
- package/lib/KushkiInfo.js +1 -1
- package/lib/gateway/KushkiGateway.d.ts +5 -11
- package/lib/gateway/KushkiGateway.js +15 -19
- package/lib/infrastructure/EnvironmentEnum.d.ts +1 -1
- package/lib/infrastructure/EnvironmentEnum.js +1 -1
- package/lib/infrastructure/TransferPaymentTypeEnum.d.ts +8 -0
- package/lib/infrastructure/TransferPaymentTypeEnum.js +11 -0
- package/lib/lib.d.ts +1 -0
- package/lib/lib.js +1 -0
- package/lib/repository/IKushkiGateway.d.ts +3 -1
- package/lib/repository/ITransferService.d.ts +3 -1
- package/lib/service/TransferService.d.ts +2 -1
- package/lib/service/TransferService.js +2 -2
- package/lib/types/get_transfer_config_response.d.ts +14 -6
- package/lib/types/transfer_token_request.d.ts +2 -2
- package/package.json +1 -1
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
|
|
93
|
-
*
|
|
94
|
-
* `
|
|
95
|
-
*
|
|
96
|
-
*
|
|
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
|
|
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,
|
|
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
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
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
|
|
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
|
|
70
|
-
*
|
|
71
|
-
* `
|
|
72
|
-
*
|
|
73
|
-
*
|
|
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
|
|
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,
|
|
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
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
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
|
|
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
|
|
15
|
+
const kushki_js_version = "1.41.0-alpha";
|
|
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";
|
|
@@ -33,14 +34,6 @@ import { TokenChargeRequest } from "./../../lib/types/token_charge_request";
|
|
|
33
34
|
import { TransferSubscriptionTokenRequest } from "./../../lib/types/transfer_subscription_token_request";
|
|
34
35
|
import { TransferTokenRequest } from "./../../lib/types/transfer_token_request";
|
|
35
36
|
import { Validate3DsResponse } from "./../../lib/types/validate_3ds_response";
|
|
36
|
-
/**
|
|
37
|
-
* TEMPORARY (CAR-17885): routes transfer token and transfer config requests to
|
|
38
|
-
* the transfer dev environment while multi-processor is under test.
|
|
39
|
-
* Applies only when testEnv is true and regional is false.
|
|
40
|
-
* Remove this constant, the `uatDomainOverride` parameter and the related
|
|
41
|
-
* TEMPORARY tests before releasing.
|
|
42
|
-
*/
|
|
43
|
-
export declare const TEMP_TRANSFER_UAT_DOMAIN: string;
|
|
44
37
|
/**
|
|
45
38
|
* Kushki Gateway Implementation
|
|
46
39
|
*/
|
|
@@ -54,11 +47,11 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
54
47
|
private _uatUrl;
|
|
55
48
|
private _prodUrl;
|
|
56
49
|
private _kshAuthorization;
|
|
57
|
-
request<T = object>(body: object, headers: object, path: string, testEnv: boolean, regional: boolean
|
|
58
|
-
requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string
|
|
50
|
+
request<T = object>(body: object, headers: object, path: string, testEnv: boolean, regional: boolean): Observable<T>;
|
|
51
|
+
requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string): Observable<T>;
|
|
59
52
|
requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
|
|
60
53
|
requestBrandsLogosByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
|
|
61
|
-
requestTransferConfig(mid: string, testEnv: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
|
|
54
|
+
requestTransferConfig(mid: string, testEnv: boolean, regional: boolean, paymentType?: TransferPaymentTypeEnum): Observable<GetTransferConfigResponse>;
|
|
62
55
|
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
63
56
|
requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
64
57
|
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
@@ -84,6 +77,7 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
84
77
|
validateAppleDomain(domain: string, mid: string, testEnv: boolean, regional: boolean): Observable<Validate3DsResponse>;
|
|
85
78
|
startApplePaySession(body: ApplePayStartSessionRequest, mid: string, testEnv: boolean, regional: boolean): Observable<object>;
|
|
86
79
|
getApplePayToken(body: ApplePayPaymentData, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
80
|
+
private _buildTransferConfigPath;
|
|
87
81
|
private _buildCybersourceJwtPath;
|
|
88
82
|
private _assignChannel;
|
|
89
83
|
private _buildHeader;
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
var KushkiGateway_1;
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.KushkiGateway =
|
|
10
|
+
exports.KushkiGateway = void 0;
|
|
11
11
|
/**
|
|
12
12
|
* Kushki Gateway File
|
|
13
13
|
*/
|
|
@@ -21,14 +21,6 @@ const rxjs_1 = require("rxjs");
|
|
|
21
21
|
const operators_1 = require("rxjs/operators");
|
|
22
22
|
const UtilsService_1 = require("./../../lib/service/UtilsService");
|
|
23
23
|
const KushkiInfo_1 = require("./../../lib/KushkiInfo");
|
|
24
|
-
/**
|
|
25
|
-
* TEMPORARY (CAR-17885): routes transfer token and transfer config requests to
|
|
26
|
-
* the transfer dev environment while multi-processor is under test.
|
|
27
|
-
* Applies only when testEnv is true and regional is false.
|
|
28
|
-
* Remove this constant, the `uatDomainOverride` parameter and the related
|
|
29
|
-
* TEMPORARY tests before releasing.
|
|
30
|
-
*/
|
|
31
|
-
exports.TEMP_TRANSFER_UAT_DOMAIN = "https://transfer-dev-01-us-east-1.kushki.dev/";
|
|
32
24
|
/**
|
|
33
25
|
* Kushki Gateway Implementation
|
|
34
26
|
*/
|
|
@@ -46,8 +38,8 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
46
38
|
static _aurusError(data) {
|
|
47
39
|
return data.hasOwnProperty("response_code");
|
|
48
40
|
}
|
|
49
|
-
request(body, headers, path, testEnv, regional
|
|
50
|
-
return rxjs_1.of(this._assignChannel(regional, path
|
|
41
|
+
request(body, headers, path, testEnv, regional) {
|
|
42
|
+
return rxjs_1.of(this._assignChannel(regional, path)).pipe(operators_1.switchMap(() => axios_1.default.post(`${testEnv ? this._uatUrl : this._prodUrl}`, body, {
|
|
51
43
|
headers: Object.assign(Object.assign({}, headers), { [this._contentHeader]: this._contentJSON }),
|
|
52
44
|
})), operators_1.map((response) => response.data), operators_1.catchError((err) => {
|
|
53
45
|
if (KushkiGateway_1._aurusError(UtilsService_1.UtilsService.sGet(err, "response.data", {})))
|
|
@@ -55,8 +47,8 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
55
47
|
return rxjs_1.throwError(err);
|
|
56
48
|
}));
|
|
57
49
|
}
|
|
58
|
-
requestGet(path, testEnv, regional, mid
|
|
59
|
-
return rxjs_1.of(this._assignChannel(regional, path
|
|
50
|
+
requestGet(path, testEnv, regional, mid) {
|
|
51
|
+
return rxjs_1.of(this._assignChannel(regional, path)).pipe(operators_1.switchMap(() => axios_1.default.get(`${testEnv ? this._uatUrl : this._prodUrl}`, {
|
|
60
52
|
headers: {
|
|
61
53
|
[this._publicHeader]: mid || "",
|
|
62
54
|
[this._contentHeader]: this._contentJSON,
|
|
@@ -69,8 +61,8 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
69
61
|
requestBrandsLogosByMerchant(mid, testEnv, regional) {
|
|
70
62
|
return this.requestGet(`${PathEnum_1.PathEnum.brands_logos_by_merchant}`, testEnv, regional, mid);
|
|
71
63
|
}
|
|
72
|
-
requestTransferConfig(mid, testEnv, regional) {
|
|
73
|
-
return this.requestGet(
|
|
64
|
+
requestTransferConfig(mid, testEnv, regional, paymentType) {
|
|
65
|
+
return this.requestGet(this._buildTransferConfigPath(paymentType), testEnv, regional, mid);
|
|
74
66
|
}
|
|
75
67
|
requestToken(body, mid, testEnv, regional) {
|
|
76
68
|
return this.request(body, {
|
|
@@ -88,7 +80,7 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
88
80
|
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional);
|
|
89
81
|
}
|
|
90
82
|
requestTransferToken(body, mid, testEnv, regional) {
|
|
91
|
-
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
|
|
83
|
+
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)));
|
|
92
84
|
}
|
|
93
85
|
requestMerchantSettings(mid, testEnv, regional) {
|
|
94
86
|
return rxjs_1.of(1).pipe(operators_1.concatMap(() => this.requestGet(`${PathEnum_1.PathEnum.merchant_settings}settings`, testEnv, regional, mid)), operators_1.map((response) => response));
|
|
@@ -164,6 +156,11 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
164
156
|
[this._kushkiInfoHeader]: KushkiInfo_1.KInfo.sKushkiInfo,
|
|
165
157
|
}, `${PathEnum_1.PathEnum.get_apple_pay_token}?switch=${this._multiRegionEcommSwitch}`, testEnv, regional)));
|
|
166
158
|
}
|
|
159
|
+
_buildTransferConfigPath(paymentType) {
|
|
160
|
+
if (!paymentType)
|
|
161
|
+
return PathEnum_1.PathEnum.transfer_config;
|
|
162
|
+
return `${PathEnum_1.PathEnum.transfer_config}?paymentType=${encodeURIComponent(paymentType)}`;
|
|
163
|
+
}
|
|
167
164
|
_buildCybersourceJwtPath(subscriptionId) {
|
|
168
165
|
let path = PathEnum_1.PathEnum.cybersource_jwt;
|
|
169
166
|
const params = [];
|
|
@@ -173,10 +170,9 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
173
170
|
path += `?${params.join("&")}`;
|
|
174
171
|
return path;
|
|
175
172
|
}
|
|
176
|
-
_assignChannel(regional, path
|
|
177
|
-
) {
|
|
173
|
+
_assignChannel(regional, path) {
|
|
178
174
|
if (!regional) {
|
|
179
|
-
this._uatUrl = `${
|
|
175
|
+
this._uatUrl = `${EnvironmentEnum_1.EnvironmentEnum.uat}${path}`;
|
|
180
176
|
this._prodUrl = `${EnvironmentEnum_1.EnvironmentEnum.prod}${path}`;
|
|
181
177
|
}
|
|
182
178
|
else {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Environment enum file
|
|
4
4
|
*/
|
|
5
5
|
export declare enum EnvironmentEnum {
|
|
6
|
-
uat = "https://api-
|
|
6
|
+
uat = "https://api-uat.kushkipagos.com/",
|
|
7
7
|
prod = "https://api.kushkipagos.com/",
|
|
8
8
|
regionalUat = "https://regional-uat.kushkipagos.com/",
|
|
9
9
|
regionalProd = "https://regional.kushkipagos.com/"
|
|
@@ -6,7 +6,7 @@ exports.EnvironmentEnum = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
var EnvironmentEnum;
|
|
8
8
|
(function (EnvironmentEnum) {
|
|
9
|
-
EnvironmentEnum["uat"] = "https://api-
|
|
9
|
+
EnvironmentEnum["uat"] = "https://api-uat.kushkipagos.com/";
|
|
10
10
|
EnvironmentEnum["prod"] = "https://api.kushkipagos.com/";
|
|
11
11
|
EnvironmentEnum["regionalUat"] = "https://regional-uat.kushkipagos.com/";
|
|
12
12
|
EnvironmentEnum["regionalProd"] = "https://regional.kushkipagos.com/";
|
|
@@ -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
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
|
|
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
|
|
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
|
-
*
|
|
25
|
+
* Product type. "PAYMENT" is a one-time payment, "SUBSCRIPTION" a recurring one; the same values TransferPaymentTypeEnum accepts as getTransferConfig filter.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
paymentType: "PAYMENT" | "SUBSCRIPTION";
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
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
|
|
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.
|
|
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
|
-
|
|
144
|
+
channel?: string;
|
|
145
145
|
[k: string]: any;
|
|
146
146
|
};
|
|
147
147
|
[k: string]: any;
|