@kushki/js 1.40.5 → 1.41.0-alpha-34148.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 +74 -1
- package/lib/Kushki.js +74 -0
- package/lib/KushkiInfo.js +1 -1
- package/lib/gateway/KushkiGateway.d.ts +13 -3
- package/lib/gateway/KushkiGateway.js +20 -8
- package/lib/infrastructure/EnvironmentEnum.d.ts +1 -1
- package/lib/infrastructure/EnvironmentEnum.js +1 -1
- package/lib/infrastructure/PathEnum.d.ts +2 -1
- package/lib/infrastructure/PathEnum.js +1 -0
- package/lib/repository/IKushkiGateway.d.ts +9 -1
- package/lib/repository/ITransferService.d.ts +9 -1
- package/lib/service/TransferService.d.ts +3 -1
- package/lib/service/TransferService.js +8 -2
- package/lib/types/get_transfer_config_response.d.ts +38 -0
- package/lib/types/{remote/transfer_token_request.d.ts → transfer_token_request.d.ts} +17 -1
- package/package.json +1 -1
- package/lib/environments/environment.d.ts +0 -5
- package/lib/environments/environment.js +0 -11
package/lib/Kushki.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { CashTokenRequest } from "./../lib/types/cash_token_request";
|
|
|
18
18
|
import { DeviceTokenRequest } from "./../lib/types/device_token_request";
|
|
19
19
|
import { ErrorResponse } from "./../lib/types/error_response";
|
|
20
20
|
import { GetBrandsLogosByMerchantResponse } from "./../lib/types/get_brands_logos_by_merchant_response";
|
|
21
|
+
import { GetTransferConfigResponse } from "./../lib/types/get_transfer_config_response";
|
|
21
22
|
import { KushkiInfo } from "./../lib/types/kushki_info";
|
|
22
23
|
import { MultiMerchantInfoRequest } from "./../lib/types/multimerchant_info_request";
|
|
23
24
|
import { MultiMerchantInfoResponse } from "./../lib/types/multimerchant_info_response";
|
|
@@ -27,7 +28,6 @@ import { CommissionConfigurationAmount } from "./../lib/types/remote/commission_
|
|
|
27
28
|
import { CommissionConfigurationRequest } from "./../lib/types/remote/commission_configuration_request";
|
|
28
29
|
import { IDeferredResponse } from "./../lib/types/remote/deferred_response";
|
|
29
30
|
import { TokenResponse } from "./../lib/types/remote/token_response";
|
|
30
|
-
import { TransferTokenRequest } from "./../lib/types/remote/transfer_token_request";
|
|
31
31
|
import { ResponseStatusValidator } from "./../lib/types/response_status_validator";
|
|
32
32
|
import { SecureInitRequest } from "./../lib/types/secure_init_request";
|
|
33
33
|
import { SecureInitResponse } from "./../lib/types/secure_init_response";
|
|
@@ -40,6 +40,7 @@ import { SubscriptionTokenRequest } from "./../lib/types/subscription_token_requ
|
|
|
40
40
|
import { TokenChargeRequest } from "./../lib/types/token_charge_request";
|
|
41
41
|
import { TokenRequest } from "./../lib/types/token_request";
|
|
42
42
|
import { TransferSubscriptionTokenRequest } from "./../lib/types/transfer_subscription_token_request";
|
|
43
|
+
import { TransferTokenRequest } from "./../lib/types/transfer_token_request";
|
|
43
44
|
import { Validate3DSRequest } from "./../lib/types/validate_3ds_request";
|
|
44
45
|
import { Validate3DsResponse } from "./../lib/types/validate_3ds_response";
|
|
45
46
|
/**
|
|
@@ -81,7 +82,79 @@ export declare class Kushki {
|
|
|
81
82
|
requestTokenCharge(body: TokenChargeRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
82
83
|
requestDeviceToken(body: DeviceTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
83
84
|
requestSubscriptionToken(body: SubscriptionTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
85
|
+
/**
|
|
86
|
+
* Requests a transfer token.
|
|
87
|
+
*
|
|
88
|
+
* Legacy single-processor merchants send the country specific body (PSE,
|
|
89
|
+
* Webpay, SPEI, etc.).
|
|
90
|
+
*
|
|
91
|
+
* 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.
|
|
97
|
+
*
|
|
98
|
+
* @param {TransferTokenRequest} body transfer token request
|
|
99
|
+
* @param {Function} callback with value
|
|
100
|
+
* @returns {void}
|
|
101
|
+
* @example
|
|
102
|
+
* kushki.getTransferConfig((config) => {
|
|
103
|
+
* const processor = config.processors[0];
|
|
104
|
+
* const flow = processor.supportedFlows[0];
|
|
105
|
+
*
|
|
106
|
+
* kushki.requestTransferToken(
|
|
107
|
+
* {
|
|
108
|
+
* amount: { subtotalIva: 0, subtotalIva0: 9000, iva: 0 },
|
|
109
|
+
* currency: processor.currency,
|
|
110
|
+
* processor: { name: processor.name, flowType: flow.type },
|
|
111
|
+
* },
|
|
112
|
+
* (response) => console.log(response)
|
|
113
|
+
* );
|
|
114
|
+
* });
|
|
115
|
+
*/
|
|
84
116
|
requestTransferToken(body: TransferTokenRequest, callback: (value: TokenResponse | ErrorResponse) => void): void;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves the configuration of the transfer processors enabled for the
|
|
119
|
+
* merchant.
|
|
120
|
+
*
|
|
121
|
+
* Transfer supports multiple processors per merchant, so the response may
|
|
122
|
+
* contain zero, one or more enabled processors. The end user is expected to
|
|
123
|
+
* pick which processor will handle the payment.
|
|
124
|
+
*
|
|
125
|
+
* - 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.
|
|
131
|
+
*
|
|
132
|
+
* An empty `processors` array is a valid success response, not an error.
|
|
133
|
+
*
|
|
134
|
+
* The merchant id, environment (test/production) and region are taken from
|
|
135
|
+
* the Kushki instance options.
|
|
136
|
+
*
|
|
137
|
+
* @param {Function} callback invoked with a `GetTransferConfigResponse` on
|
|
138
|
+
* success or an `ErrorResponse` on failure
|
|
139
|
+
* @returns {void}
|
|
140
|
+
* @example
|
|
141
|
+
* kushki.getTransferConfig((response) => {
|
|
142
|
+
* if ("code" in response) {
|
|
143
|
+
* console.error(response.message);
|
|
144
|
+
* return;
|
|
145
|
+
* }
|
|
146
|
+
* response.processors.forEach((processor) => {
|
|
147
|
+
* if (processor.supportedFlows) {
|
|
148
|
+
* // Multi-processor: let the user choose a flow before tokenizing
|
|
149
|
+
* console.log(processor.name, processor.supportedFlows);
|
|
150
|
+
* } else {
|
|
151
|
+
* // Legacy processor: only name and currency are available
|
|
152
|
+
* console.log(processor.name, processor.currency);
|
|
153
|
+
* }
|
|
154
|
+
* });
|
|
155
|
+
* });
|
|
156
|
+
*/
|
|
157
|
+
getTransferConfig(callback: (value: GetTransferConfigResponse | ErrorResponse) => void): void;
|
|
85
158
|
checkStatus(callback: (value: ResponseStatusValidator | ErrorResponse) => void): void;
|
|
86
159
|
/**
|
|
87
160
|
* @deprecated since version 1.19.8 use requestBankList instead
|
package/lib/Kushki.js
CHANGED
|
@@ -59,9 +59,83 @@ class Kushki {
|
|
|
59
59
|
requestSubscriptionToken(body, callback) {
|
|
60
60
|
this._cardService.requestSubscriptionToken(body, this._merchantId, this._inTestEnvironment, this._regional, callback);
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Requests a transfer token.
|
|
64
|
+
*
|
|
65
|
+
* Legacy single-processor merchants send the country specific body (PSE,
|
|
66
|
+
* Webpay, SPEI, etc.).
|
|
67
|
+
*
|
|
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.
|
|
74
|
+
*
|
|
75
|
+
* @param {TransferTokenRequest} body transfer token request
|
|
76
|
+
* @param {Function} callback with value
|
|
77
|
+
* @returns {void}
|
|
78
|
+
* @example
|
|
79
|
+
* kushki.getTransferConfig((config) => {
|
|
80
|
+
* const processor = config.processors[0];
|
|
81
|
+
* const flow = processor.supportedFlows[0];
|
|
82
|
+
*
|
|
83
|
+
* kushki.requestTransferToken(
|
|
84
|
+
* {
|
|
85
|
+
* amount: { subtotalIva: 0, subtotalIva0: 9000, iva: 0 },
|
|
86
|
+
* currency: processor.currency,
|
|
87
|
+
* processor: { name: processor.name, flowType: flow.type },
|
|
88
|
+
* },
|
|
89
|
+
* (response) => console.log(response)
|
|
90
|
+
* );
|
|
91
|
+
* });
|
|
92
|
+
*/
|
|
62
93
|
requestTransferToken(body, callback) {
|
|
63
94
|
this._resolve(this._transferService.requestTransferToken(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
64
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Retrieves the configuration of the transfer processors enabled for the
|
|
98
|
+
* merchant.
|
|
99
|
+
*
|
|
100
|
+
* Transfer supports multiple processors per merchant, so the response may
|
|
101
|
+
* contain zero, one or more enabled processors. The end user is expected to
|
|
102
|
+
* pick which processor will handle the payment.
|
|
103
|
+
*
|
|
104
|
+
* - 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.
|
|
110
|
+
*
|
|
111
|
+
* An empty `processors` array is a valid success response, not an error.
|
|
112
|
+
*
|
|
113
|
+
* The merchant id, environment (test/production) and region are taken from
|
|
114
|
+
* the Kushki instance options.
|
|
115
|
+
*
|
|
116
|
+
* @param {Function} callback invoked with a `GetTransferConfigResponse` on
|
|
117
|
+
* success or an `ErrorResponse` on failure
|
|
118
|
+
* @returns {void}
|
|
119
|
+
* @example
|
|
120
|
+
* kushki.getTransferConfig((response) => {
|
|
121
|
+
* if ("code" in response) {
|
|
122
|
+
* console.error(response.message);
|
|
123
|
+
* return;
|
|
124
|
+
* }
|
|
125
|
+
* response.processors.forEach((processor) => {
|
|
126
|
+
* if (processor.supportedFlows) {
|
|
127
|
+
* // Multi-processor: let the user choose a flow before tokenizing
|
|
128
|
+
* console.log(processor.name, processor.supportedFlows);
|
|
129
|
+
* } else {
|
|
130
|
+
* // Legacy processor: only name and currency are available
|
|
131
|
+
* console.log(processor.name, processor.currency);
|
|
132
|
+
* }
|
|
133
|
+
* });
|
|
134
|
+
* });
|
|
135
|
+
*/
|
|
136
|
+
getTransferConfig(callback) {
|
|
137
|
+
this._resolve(this._transferService.getTransferConfig(this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
138
|
+
}
|
|
65
139
|
checkStatus(callback) {
|
|
66
140
|
this._resolve(this._kushkiService.checkStatus(this._merchantId, this._inTestEnvironment, this._regional), callback);
|
|
67
141
|
}
|
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.
|
|
15
|
+
const kushki_js_version = "1.41.0-alpha-34148.0";
|
|
16
16
|
if (kushkiInfo) {
|
|
17
17
|
if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
|
|
18
18
|
kushkiInfo.platformVersion = kushki_js_version;
|
|
@@ -11,6 +11,7 @@ import { CardAsyncTokenResponse } from "./../../lib/types/card_async_token_respo
|
|
|
11
11
|
import { CashTokenRequest } from "./../../lib/types/cash_token_request";
|
|
12
12
|
import { DeferredOptionsResponse } from "./../../lib/types/deferred_options_response";
|
|
13
13
|
import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
|
|
14
|
+
import { GetTransferConfigResponse } from "./../../lib/types/get_transfer_config_response";
|
|
14
15
|
import { GetUserId } from "./../../lib/types/get_user_id";
|
|
15
16
|
import { JwtResponse } from "./../../lib/types/jwt_response";
|
|
16
17
|
import { KushkiSubscriptionTokensRequest } from "./../../lib/types/kushki_subscription_tokens_request";
|
|
@@ -23,7 +24,6 @@ import { PayoutsTransferTokenRequest } from "./../../lib/types/payouts_transfer_
|
|
|
23
24
|
import { CommissionConfigurationAmount } from "./../../lib/types/remote/commission_configuration_amount";
|
|
24
25
|
import { CommissionConfigurationRequest } from "./../../lib/types/remote/commission_configuration_request";
|
|
25
26
|
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
26
|
-
import { TransferTokenRequest } from "./../../lib/types/remote/transfer_token_request";
|
|
27
27
|
import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
|
|
28
28
|
import { SecureOtpRequest } from "./../../lib/types/secure_otp_request";
|
|
29
29
|
import { SecureOtpResponse } from "./../../lib/types/secure_otp_response";
|
|
@@ -31,7 +31,16 @@ import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscriptio
|
|
|
31
31
|
import { SubscriptionCardAsyncTokenResponse } from "./../../lib/types/subscription_card_async_token_response";
|
|
32
32
|
import { TokenChargeRequest } from "./../../lib/types/token_charge_request";
|
|
33
33
|
import { TransferSubscriptionTokenRequest } from "./../../lib/types/transfer_subscription_token_request";
|
|
34
|
+
import { TransferTokenRequest } from "./../../lib/types/transfer_token_request";
|
|
34
35
|
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;
|
|
35
44
|
/**
|
|
36
45
|
* Kushki Gateway Implementation
|
|
37
46
|
*/
|
|
@@ -45,10 +54,11 @@ export declare class KushkiGateway implements IKushkiGateway {
|
|
|
45
54
|
private _uatUrl;
|
|
46
55
|
private _prodUrl;
|
|
47
56
|
private _kshAuthorization;
|
|
48
|
-
request<T = object>(body: object, headers: object, path: string, testEnv: boolean, regional: boolean): Observable<T>;
|
|
49
|
-
requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string): Observable<T>;
|
|
57
|
+
request<T = object>(body: object, headers: object, path: string, testEnv: boolean, regional: boolean, uatDomainOverride?: string): Observable<T>;
|
|
58
|
+
requestGet<T extends object = object>(path: string, testEnv: boolean, regional: boolean, mid?: string, uatDomainOverride?: string): Observable<T>;
|
|
50
59
|
requestBrandsByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<string[]>;
|
|
51
60
|
requestBrandsLogosByMerchant(mid: string, testEnv: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
|
|
61
|
+
requestTransferConfig(mid: string, testEnv: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
|
|
52
62
|
requestToken(body: KushkiTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
53
63
|
requestDeviceToken(body: TokenChargeRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
54
64
|
requestSubscriptionToken(body: KushkiSubscriptionTokensRequest, mid: string, testEnv: boolean, regional: boolean): Observable<TokenResponse>;
|
|
@@ -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 = void 0;
|
|
10
|
+
exports.KushkiGateway = exports.TEMP_TRANSFER_UAT_DOMAIN = void 0;
|
|
11
11
|
/**
|
|
12
12
|
* Kushki Gateway File
|
|
13
13
|
*/
|
|
@@ -21,6 +21,14 @@ 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/";
|
|
24
32
|
/**
|
|
25
33
|
* Kushki Gateway Implementation
|
|
26
34
|
*/
|
|
@@ -38,8 +46,8 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
38
46
|
static _aurusError(data) {
|
|
39
47
|
return data.hasOwnProperty("response_code");
|
|
40
48
|
}
|
|
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, {
|
|
49
|
+
request(body, headers, path, testEnv, regional, uatDomainOverride) {
|
|
50
|
+
return rxjs_1.of(this._assignChannel(regional, path, uatDomainOverride)).pipe(operators_1.switchMap(() => axios_1.default.post(`${testEnv ? this._uatUrl : this._prodUrl}`, body, {
|
|
43
51
|
headers: Object.assign(Object.assign({}, headers), { [this._contentHeader]: this._contentJSON }),
|
|
44
52
|
})), operators_1.map((response) => response.data), operators_1.catchError((err) => {
|
|
45
53
|
if (KushkiGateway_1._aurusError(UtilsService_1.UtilsService.sGet(err, "response.data", {})))
|
|
@@ -47,8 +55,8 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
47
55
|
return rxjs_1.throwError(err);
|
|
48
56
|
}));
|
|
49
57
|
}
|
|
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}`, {
|
|
58
|
+
requestGet(path, testEnv, regional, mid, uatDomainOverride) {
|
|
59
|
+
return rxjs_1.of(this._assignChannel(regional, path, uatDomainOverride)).pipe(operators_1.switchMap(() => axios_1.default.get(`${testEnv ? this._uatUrl : this._prodUrl}`, {
|
|
52
60
|
headers: {
|
|
53
61
|
[this._publicHeader]: mid || "",
|
|
54
62
|
[this._contentHeader]: this._contentJSON,
|
|
@@ -61,6 +69,9 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
61
69
|
requestBrandsLogosByMerchant(mid, testEnv, regional) {
|
|
62
70
|
return this.requestGet(`${PathEnum_1.PathEnum.brands_logos_by_merchant}`, testEnv, regional, mid);
|
|
63
71
|
}
|
|
72
|
+
requestTransferConfig(mid, testEnv, regional) {
|
|
73
|
+
return this.requestGet(PathEnum_1.PathEnum.transfer_config, testEnv, regional, mid, exports.TEMP_TRANSFER_UAT_DOMAIN);
|
|
74
|
+
}
|
|
64
75
|
requestToken(body, mid, testEnv, regional) {
|
|
65
76
|
return this.request(body, {
|
|
66
77
|
[this._publicHeader]: mid,
|
|
@@ -77,7 +88,7 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
77
88
|
}, PathEnum_1.PathEnum.card_subscription_tokens, testEnv, regional);
|
|
78
89
|
}
|
|
79
90
|
requestTransferToken(body, mid, testEnv, regional) {
|
|
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)));
|
|
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, exports.TEMP_TRANSFER_UAT_DOMAIN)));
|
|
81
92
|
}
|
|
82
93
|
requestMerchantSettings(mid, testEnv, regional) {
|
|
83
94
|
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));
|
|
@@ -162,9 +173,10 @@ let KushkiGateway = KushkiGateway_1 = class KushkiGateway {
|
|
|
162
173
|
path += `?${params.join("&")}`;
|
|
163
174
|
return path;
|
|
164
175
|
}
|
|
165
|
-
_assignChannel(regional, path)
|
|
176
|
+
_assignChannel(regional, path, uatDomainOverride // TEMPORARY (CAR-17885), see TEMP_TRANSFER_UAT_DOMAIN
|
|
177
|
+
) {
|
|
166
178
|
if (!regional) {
|
|
167
|
-
this._uatUrl = `${EnvironmentEnum_1.EnvironmentEnum.uat}${path}`;
|
|
179
|
+
this._uatUrl = `${uatDomainOverride ? uatDomainOverride : EnvironmentEnum_1.EnvironmentEnum.uat}${path}`;
|
|
168
180
|
this._prodUrl = `${EnvironmentEnum_1.EnvironmentEnum.prod}${path}`;
|
|
169
181
|
}
|
|
170
182
|
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-qa.orizaba.kushki.dev/",
|
|
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-qa.orizaba.kushki.dev/";
|
|
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/";
|
|
@@ -29,5 +29,6 @@ export declare enum PathEnum {
|
|
|
29
29
|
get_user_id = "v1/subscriptions/",
|
|
30
30
|
validate_apple_domain = "apple-pay/v1/validate",
|
|
31
31
|
start_apple_pay_session = "apple-pay/v1/session/start",
|
|
32
|
-
get_apple_pay_token = "apple-pay/v1/token"
|
|
32
|
+
get_apple_pay_token = "apple-pay/v1/token",
|
|
33
|
+
transfer_config = "transfer/v1/config"
|
|
33
34
|
}
|
|
@@ -33,4 +33,5 @@ var PathEnum;
|
|
|
33
33
|
PathEnum["validate_apple_domain"] = "apple-pay/v1/validate";
|
|
34
34
|
PathEnum["start_apple_pay_session"] = "apple-pay/v1/session/start";
|
|
35
35
|
PathEnum["get_apple_pay_token"] = "apple-pay/v1/token";
|
|
36
|
+
PathEnum["transfer_config"] = "transfer/v1/config";
|
|
36
37
|
})(PathEnum = exports.PathEnum || (exports.PathEnum = {}));
|
|
@@ -12,6 +12,7 @@ import { CardAsyncTokenResponse } from "./../../lib/types/card_async_token_respo
|
|
|
12
12
|
import { CashTokenRequest } from "./../../lib/types/cash_token_request";
|
|
13
13
|
import { DeferredOptionsResponse } from "./../../lib/types/deferred_options_response";
|
|
14
14
|
import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
|
|
15
|
+
import { GetTransferConfigResponse } from "./../../lib/types/get_transfer_config_response";
|
|
15
16
|
import { GetUserId } from "./../../lib/types/get_user_id";
|
|
16
17
|
import { JwtResponse } from "./../../lib/types/jwt_response";
|
|
17
18
|
import { KushkiSubscriptionTokensRequest } from "./../../lib/types/kushki_subscription_tokens_request";
|
|
@@ -24,7 +25,6 @@ import { PayoutsTransferTokenRequest } from "./../../lib/types/payouts_transfer_
|
|
|
24
25
|
import { CommissionConfigurationAmount } from "./../../lib/types/remote/commission_configuration_amount";
|
|
25
26
|
import { CommissionConfigurationRequest } from "./../../lib/types/remote/commission_configuration_request";
|
|
26
27
|
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
27
|
-
import { TransferTokenRequest } from "./../../lib/types/remote/transfer_token_request";
|
|
28
28
|
import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
|
|
29
29
|
import { SecureOtpRequest } from "./../../lib/types/secure_otp_request";
|
|
30
30
|
import { SecureOtpResponse } from "./../../lib/types/secure_otp_response";
|
|
@@ -32,6 +32,7 @@ import { SubscriptionCardAsyncTokenRequest } from "./../../lib/types/subscriptio
|
|
|
32
32
|
import { SubscriptionCardAsyncTokenResponse } from "./../../lib/types/subscription_card_async_token_response";
|
|
33
33
|
import { TokenChargeRequest } from "./../../lib/types/token_charge_request";
|
|
34
34
|
import { TransferSubscriptionTokenRequest } from "./../../lib/types/transfer_subscription_token_request";
|
|
35
|
+
import { TransferTokenRequest } from "./../../lib/types/transfer_token_request";
|
|
35
36
|
import { Validate3DsResponse } from "./../../lib/types/validate_3ds_response";
|
|
36
37
|
export interface IKushkiGateway {
|
|
37
38
|
/**
|
|
@@ -105,6 +106,13 @@ export interface IKushkiGateway {
|
|
|
105
106
|
* @return GetBrandsLogosByMerchantResponse[]
|
|
106
107
|
*/
|
|
107
108
|
requestBrandsLogosByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Get transfer processors config by merchant
|
|
111
|
+
* @param mid - public merchant id
|
|
112
|
+
* @param testEnv - is test environment
|
|
113
|
+
* @param regional - Define if endpoint used regional URL
|
|
114
|
+
*/
|
|
115
|
+
requestTransferConfig(mid: string, testEnv: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
|
|
108
116
|
/**
|
|
109
117
|
* Send Webpay tokens request to Transbank API
|
|
110
118
|
*/
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Observable } from "rxjs";
|
|
6
6
|
import { BankListResponse } from "./../../lib/types/bank_list_response";
|
|
7
|
+
import { GetTransferConfigResponse } from "./../../lib/types/get_transfer_config_response";
|
|
7
8
|
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
8
|
-
import { TransferTokenRequest } from "./../../lib/types/
|
|
9
|
+
import { TransferTokenRequest } from "./../../lib/types/transfer_token_request";
|
|
9
10
|
export interface ITransferService {
|
|
10
11
|
/**
|
|
11
12
|
* Transfer Token
|
|
@@ -22,4 +23,11 @@ export interface ITransferService {
|
|
|
22
23
|
* @param regional - Define if endpoint used regional URL
|
|
23
24
|
*/
|
|
24
25
|
requestBankList(mid: string, isTest: boolean, regional: boolean): Observable<BankListResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Transfer processors Config
|
|
28
|
+
* @param mid - public merchant id
|
|
29
|
+
* @param isTest - is test environment
|
|
30
|
+
* @param regional - Define if endpoint used regional URL
|
|
31
|
+
*/
|
|
32
|
+
getTransferConfig(mid: string, isTest: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
|
|
25
33
|
}
|
|
@@ -5,8 +5,9 @@ import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
|
|
|
5
5
|
import { ITransferService } from "./../../lib/repository/ITransferService";
|
|
6
6
|
import { Observable } from "rxjs";
|
|
7
7
|
import { BankListResponse } from "./../../lib/types/bank_list_response";
|
|
8
|
+
import { GetTransferConfigResponse } from "./../../lib/types/get_transfer_config_response";
|
|
8
9
|
import { TokenResponse } from "./../../lib/types/remote/token_response";
|
|
9
|
-
import { TransferTokenRequest } from "./../../lib/types/
|
|
10
|
+
import { TransferTokenRequest } from "./../../lib/types/transfer_token_request";
|
|
10
11
|
/**
|
|
11
12
|
* Implementation
|
|
12
13
|
*/
|
|
@@ -16,4 +17,5 @@ export declare class TransferService implements ITransferService {
|
|
|
16
17
|
constructor(gateway: IKushkiGateway, antiFraud: IAntiFraud);
|
|
17
18
|
requestTransferToken(request: TransferTokenRequest, mid: string, isTest: boolean, regional: boolean): Observable<TokenResponse>;
|
|
18
19
|
requestBankList(mid: string, isTest: boolean, regional: boolean): Observable<BankListResponse>;
|
|
20
|
+
getTransferConfig(mid: string, isTest: boolean, regional: boolean): Observable<GetTransferConfigResponse>;
|
|
19
21
|
}
|
|
@@ -30,15 +30,21 @@ let TransferService = class TransferService {
|
|
|
30
30
|
}
|
|
31
31
|
requestTransferToken(request, mid, isTest, regional) {
|
|
32
32
|
return this._gateway.requestMerchantSettings(mid, isTest, regional).pipe(operators_1.switchMap((merchant) => {
|
|
33
|
-
const client = request.documentNumber !== undefined
|
|
33
|
+
const client = "documentNumber" in request && request.documentNumber !== undefined
|
|
34
34
|
? request.documentNumber
|
|
35
35
|
: new Date().getTime().toString();
|
|
36
|
-
|
|
36
|
+
const bank_id = "bankId" in request && request.bankId !== undefined
|
|
37
|
+
? request.bankId
|
|
38
|
+
: "";
|
|
39
|
+
return this._antiFraud.createSiftScienceSession(bank_id, client, mid, isTest, merchant);
|
|
37
40
|
}), operators_1.switchMap((siftObject) => this._gateway.requestTransferToken(Object.assign(Object.assign({}, request), siftObject), mid, isTest, regional)));
|
|
38
41
|
}
|
|
39
42
|
requestBankList(mid, isTest, regional) {
|
|
40
43
|
return this._gateway.requestPseBankList(mid, isTest, regional);
|
|
41
44
|
}
|
|
45
|
+
getTransferConfig(mid, isTest, regional) {
|
|
46
|
+
return this._gateway.requestTransferConfig(mid, isTest, regional);
|
|
47
|
+
}
|
|
42
48
|
};
|
|
43
49
|
TransferService = __decorate([
|
|
44
50
|
inversify_1.injectable(),
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* tslint:disable:all */
|
|
2
|
+
/* tslint:disable:all */
|
|
3
|
+
|
|
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.
|
|
6
|
+
*/
|
|
7
|
+
export interface GetTransferConfigResponse {
|
|
8
|
+
/**
|
|
9
|
+
* Enabled transfer processors. An empty array is a valid response: the merchant has no transfer processor configured.
|
|
10
|
+
*/
|
|
11
|
+
processors: {
|
|
12
|
+
/**
|
|
13
|
+
* Processor name as configured in Kushki (e.g. "Bre-B Credibanco Processor"). For multi-processor merchants send it as-is in requestTransferToken as processor.name.
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* ISO 4217 currency code the processor operates with (e.g. "COP"). Use it as currency in requestTransferToken.
|
|
18
|
+
*/
|
|
19
|
+
currency: string;
|
|
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.
|
|
22
|
+
*/
|
|
23
|
+
supportedFlows?: {
|
|
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.
|
|
26
|
+
*/
|
|
27
|
+
type: string;
|
|
28
|
+
/**
|
|
29
|
+
* Human readable flow name (e.g. "QR", "Bre-B") meant to be displayed to the end user.
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional longer text describing the flow, meant to be displayed to the end user.
|
|
34
|
+
*/
|
|
35
|
+
description?: string;
|
|
36
|
+
}[];
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
@@ -8,7 +8,8 @@ export type TransferTokenRequest =
|
|
|
8
8
|
| BrazilianTokenRequest
|
|
9
9
|
| CostaRicaTokenRequest
|
|
10
10
|
| PeruvianTokenRequest
|
|
11
|
-
| EcuadorTokenRequest
|
|
11
|
+
| EcuadorTokenRequest
|
|
12
|
+
| MultiProcessorTokenRequest;
|
|
12
13
|
export type CallbackUrl = string;
|
|
13
14
|
export type UserType = "0" | "1";
|
|
14
15
|
export type UserId = string | null;
|
|
@@ -130,3 +131,18 @@ export interface EcuadorTokenRequest {
|
|
|
130
131
|
savePaymentData?: boolean;
|
|
131
132
|
[k: string]: any;
|
|
132
133
|
}
|
|
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.
|
|
136
|
+
*/
|
|
137
|
+
export interface MultiProcessorTokenRequest {
|
|
138
|
+
amount: Amount;
|
|
139
|
+
currency: string;
|
|
140
|
+
userId?: UserId;
|
|
141
|
+
sessionId?: SessionId;
|
|
142
|
+
processor: {
|
|
143
|
+
name: string;
|
|
144
|
+
flowType?: string;
|
|
145
|
+
[k: string]: any;
|
|
146
|
+
};
|
|
147
|
+
[k: string]: any;
|
|
148
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.environment = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Environment file
|
|
6
|
-
*/
|
|
7
|
-
/* tslint:disable:all */
|
|
8
|
-
// The file contents for the current environment will overwrite these during build.
|
|
9
|
-
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
|
10
|
-
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
|
11
|
-
exports.environment = {};
|