@getivy/node-sdk 0.1.0-alpha.9 → 1.1.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/CHANGELOG.md +334 -0
- package/README.md +16 -26
- package/_shims/index.d.ts +2 -0
- package/_shims/index.js +5 -1
- package/_shims/index.mjs +5 -1
- package/core.d.ts +19 -5
- package/core.d.ts.map +1 -1
- package/core.js +25 -15
- package/core.js.map +1 -1
- package/core.mjs +26 -16
- package/core.mjs.map +1 -1
- package/index.d.mts +36 -18
- package/index.d.ts +36 -18
- package/index.d.ts.map +1 -1
- package/index.js +27 -8
- package/index.js.map +1 -1
- package/index.mjs +27 -8
- package/index.mjs.map +1 -1
- package/package.json +11 -33
- package/resource.d.ts +1 -1
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/balance.d.ts +8 -5
- package/resources/balance.d.ts.map +1 -1
- package/resources/banks.d.ts +82 -67
- package/resources/banks.d.ts.map +1 -1
- package/resources/beneficiary-payouts.d.ts +61 -0
- package/resources/beneficiary-payouts.d.ts.map +1 -0
- package/resources/beneficiary-payouts.js +16 -0
- package/resources/beneficiary-payouts.js.map +1 -0
- package/resources/beneficiary-payouts.mjs +12 -0
- package/resources/beneficiary-payouts.mjs.map +1 -0
- package/resources/capabilities.d.ts +1 -10
- package/resources/capabilities.d.ts.map +1 -1
- package/resources/charges.d.ts +28 -19
- package/resources/charges.d.ts.map +1 -1
- package/resources/checkoutsession.d.ts +275 -1360
- package/resources/checkoutsession.d.ts.map +1 -1
- package/resources/customers.d.ts +140 -10
- package/resources/customers.d.ts.map +1 -1
- package/resources/customers.js +9 -2
- package/resources/customers.js.map +1 -1
- package/resources/customers.mjs +9 -2
- package/resources/customers.mjs.map +1 -1
- package/resources/data/accounts.d.ts +83 -0
- package/resources/data/accounts.d.ts.map +1 -0
- package/resources/data/accounts.js +15 -0
- package/resources/data/accounts.js.map +1 -0
- package/resources/data/accounts.mjs +11 -0
- package/resources/data/accounts.mjs.map +1 -0
- package/resources/data/balances.d.ts +48 -0
- package/resources/data/balances.d.ts.map +1 -0
- package/resources/data/balances.js +15 -0
- package/resources/data/balances.js.map +1 -0
- package/resources/data/balances.mjs +11 -0
- package/resources/data/balances.mjs.map +1 -0
- package/resources/data/consent.d.ts +80 -0
- package/resources/data/consent.d.ts.map +1 -0
- package/resources/data/consent.js +21 -0
- package/resources/data/consent.js.map +1 -0
- package/resources/data/consent.mjs +17 -0
- package/resources/data/consent.mjs.map +1 -0
- package/resources/data/data.d.ts +26 -0
- package/resources/data/data.d.ts.map +1 -0
- package/resources/data/data.js +55 -0
- package/resources/data/data.js.map +1 -0
- package/resources/data/data.mjs +28 -0
- package/resources/data/data.mjs.map +1 -0
- package/resources/data/index.d.ts +7 -0
- package/resources/data/index.d.ts.map +1 -0
- package/resources/data/index.js +17 -0
- package/resources/data/index.js.map +1 -0
- package/resources/data/index.mjs +8 -0
- package/resources/data/index.mjs.map +1 -0
- package/resources/data/session.d.ts +258 -0
- package/resources/data/session.d.ts.map +1 -0
- package/resources/data/session.js +21 -0
- package/resources/data/session.js.map +1 -0
- package/resources/data/session.mjs +17 -0
- package/resources/data/session.mjs.map +1 -0
- package/resources/data/transactions.d.ts +175 -0
- package/resources/data/transactions.d.ts.map +1 -0
- package/resources/data/transactions.js +16 -0
- package/resources/data/transactions.js.map +1 -0
- package/resources/data/transactions.mjs +12 -0
- package/resources/data/transactions.mjs.map +1 -0
- package/resources/data.d.ts +2 -0
- package/resources/data.d.ts.map +1 -0
- package/resources/data.js +19 -0
- package/resources/data.js.map +1 -0
- package/resources/data.mjs +3 -0
- package/resources/data.mjs.map +1 -0
- package/resources/deposits.d.ts +165 -0
- package/resources/deposits.d.ts.map +1 -0
- package/resources/deposits.js +15 -0
- package/resources/deposits.js.map +1 -0
- package/resources/deposits.mjs +11 -0
- package/resources/deposits.mjs.map +1 -0
- package/resources/fx.d.ts +90 -0
- package/resources/fx.d.ts.map +1 -0
- package/resources/fx.js +22 -0
- package/resources/fx.js.map +1 -0
- package/resources/fx.mjs +18 -0
- package/resources/fx.mjs.map +1 -0
- package/resources/index.d.ts +13 -8
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +15 -5
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +7 -2
- package/resources/index.mjs.map +1 -1
- package/resources/mandates.d.ts +55 -17
- package/resources/mandates.d.ts.map +1 -1
- package/resources/orders.d.ts +720 -743
- package/resources/orders.d.ts.map +1 -1
- package/resources/orders.js +13 -3
- package/resources/orders.js.map +1 -1
- package/resources/orders.mjs +13 -3
- package/resources/orders.mjs.map +1 -1
- package/resources/payouts.d.ts +219 -103
- package/resources/payouts.d.ts.map +1 -1
- package/resources/payouts.js +3 -4
- package/resources/payouts.js.map +1 -1
- package/resources/payouts.mjs +3 -4
- package/resources/payouts.mjs.map +1 -1
- package/resources/refunds.d.ts +53 -97
- package/resources/refunds.d.ts.map +1 -1
- package/resources/refunds.js +8 -12
- package/resources/refunds.js.map +1 -1
- package/resources/refunds.mjs +8 -12
- package/resources/refunds.mjs.map +1 -1
- package/resources/returns.d.ts +104 -0
- package/resources/returns.d.ts.map +1 -0
- package/resources/returns.js +21 -0
- package/resources/returns.js.map +1 -0
- package/resources/returns.mjs +17 -0
- package/resources/returns.mjs.map +1 -0
- package/resources/subaccounts.d.ts +15 -5
- package/resources/subaccounts.d.ts.map +1 -1
- package/resources/subaccounts.js.map +1 -1
- package/resources/subaccounts.mjs.map +1 -1
- package/resources/transactions.d.ts +174 -0
- package/resources/transactions.d.ts.map +1 -0
- package/resources/transactions.js +15 -0
- package/resources/transactions.js.map +1 -0
- package/resources/transactions.mjs +11 -0
- package/resources/transactions.mjs.map +1 -0
- package/resources/webhook/index.d.ts +3 -0
- package/resources/webhook/index.d.ts.map +1 -0
- package/resources/webhook/index.js +9 -0
- package/resources/webhook/index.js.map +1 -0
- package/resources/webhook/index.mjs +4 -0
- package/resources/webhook/index.mjs.map +1 -0
- package/resources/webhook/subscription.d.ts +152 -0
- package/resources/webhook/subscription.d.ts.map +1 -0
- package/resources/{webhooksubscription.js → webhook/subscription.js} +6 -6
- package/resources/webhook/subscription.js.map +1 -0
- package/resources/{webhooksubscription.mjs → webhook/subscription.mjs} +4 -4
- package/resources/webhook/subscription.mjs.map +1 -0
- package/resources/webhook/webhook.d.ts +28 -0
- package/resources/webhook/webhook.d.ts.map +1 -0
- package/resources/webhook/webhook.js +45 -0
- package/resources/webhook/webhook.js.map +1 -0
- package/resources/webhook/webhook.mjs +18 -0
- package/resources/webhook/webhook.mjs.map +1 -0
- package/resources/webhook.d.ts +2 -0
- package/resources/webhook.d.ts.map +1 -0
- package/resources/webhook.js +19 -0
- package/resources/webhook.js.map +1 -0
- package/resources/webhook.mjs +3 -0
- package/resources/webhook.mjs.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +18 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/_shims/index.d.ts +2 -0
- package/src/_shims/index.js +5 -1
- package/src/_shims/index.mjs +5 -1
- package/src/core.ts +44 -16
- package/src/index.ts +111 -60
- package/src/resource.ts +1 -1
- package/src/resources/balance.ts +8 -5
- package/src/resources/banks.ts +130 -67
- package/src/resources/beneficiary-payouts.ts +78 -0
- package/src/resources/capabilities.ts +1 -10
- package/src/resources/charges.ts +30 -21
- package/src/resources/checkoutsession.ts +1224 -3096
- package/src/resources/customers.ts +164 -9
- package/src/resources/data/accounts.ts +113 -0
- package/src/resources/data/balances.ts +60 -0
- package/src/resources/data/consent.ts +110 -0
- package/src/resources/data/data.ts +75 -0
- package/src/resources/data/index.ts +20 -0
- package/src/resources/data/session.ts +1317 -0
- package/src/resources/data/transactions.ts +235 -0
- package/src/resources/data.ts +3 -0
- package/src/resources/deposits.ts +231 -0
- package/src/resources/fx.ts +119 -0
- package/src/resources/index.ts +33 -28
- package/src/resources/mandates.ts +79 -17
- package/src/resources/orders.ts +1449 -1075
- package/src/resources/payouts.ts +273 -103
- package/src/resources/refunds.ts +70 -111
- package/src/resources/returns.ts +140 -0
- package/src/resources/subaccounts.ts +26 -4
- package/src/resources/transactions.ts +234 -0
- package/src/resources/webhook/index.ts +16 -0
- package/src/resources/{webhooksubscription.ts → webhook/subscription.ts} +164 -112
- package/src/resources/webhook/webhook.ts +69 -0
- package/src/resources/webhook.ts +3 -0
- package/src/resources.ts +1 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/reports.d.ts +0 -120
- package/resources/reports.d.ts.map +0 -1
- package/resources/reports.js +0 -31
- package/resources/reports.js.map +0 -1
- package/resources/reports.mjs +0 -27
- package/resources/reports.mjs.map +0 -1
- package/resources/webhooksubscription.d.ts +0 -155
- package/resources/webhooksubscription.d.ts.map +0 -1
- package/resources/webhooksubscription.js.map +0 -1
- package/resources/webhooksubscription.mjs.map +0 -1
- package/src/resources/reports.ts +0 -172
package/resources.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./resources/index.js"), exports);
|
|
18
|
+
//# sourceMappingURL=resources.js.map
|
package/resources.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAkC"}
|
package/resources.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
|
package/src/_shims/index.d.ts
CHANGED
|
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
|
|
|
79
79
|
export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
|
|
80
80
|
|
|
81
81
|
export function isFsReadStream(value: any): value is FsReadStream;
|
|
82
|
+
|
|
83
|
+
export const init: () => void;
|
package/src/_shims/index.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const shims = require('./registry');
|
|
5
5
|
const auto = require('@getivy/node-sdk/_shims/auto/runtime');
|
|
6
|
-
|
|
6
|
+
exports.init = () => {
|
|
7
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
|
8
|
+
};
|
|
7
9
|
for (const property of Object.keys(shims)) {
|
|
8
10
|
Object.defineProperty(exports, property, {
|
|
9
11
|
get() {
|
|
@@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) {
|
|
|
11
13
|
},
|
|
12
14
|
});
|
|
13
15
|
}
|
|
16
|
+
|
|
17
|
+
exports.init();
|
package/src/_shims/index.mjs
CHANGED
|
@@ -3,5 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as shims from './registry.mjs';
|
|
5
5
|
import * as auto from "./auto/runtime";
|
|
6
|
-
|
|
6
|
+
export const init = () => {
|
|
7
|
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
|
8
|
+
};
|
|
7
9
|
export * from './registry.mjs';
|
|
10
|
+
|
|
11
|
+
init();
|
package/src/core.ts
CHANGED
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
type RequestInit,
|
|
17
17
|
type Response,
|
|
18
18
|
type HeadersInit,
|
|
19
|
+
init,
|
|
19
20
|
} from './_shims/index';
|
|
21
|
+
|
|
22
|
+
// try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
|
|
23
|
+
init();
|
|
24
|
+
|
|
20
25
|
export { type Response };
|
|
21
26
|
import { BlobLike, isBlobLike, isMultipartBody } from './uploads';
|
|
22
27
|
export {
|
|
@@ -28,6 +33,20 @@ export {
|
|
|
28
33
|
|
|
29
34
|
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
30
35
|
|
|
36
|
+
/**
|
|
37
|
+
* An alias to the builtin `Array` type so we can
|
|
38
|
+
* easily alias it in import statements if there are name clashes.
|
|
39
|
+
*/
|
|
40
|
+
type _Array<T> = Array<T>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* An alias to the builtin `Record` type so we can
|
|
44
|
+
* easily alias it in import statements if there are name clashes.
|
|
45
|
+
*/
|
|
46
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
47
|
+
|
|
48
|
+
export type { _Array as Array, _Record as Record };
|
|
49
|
+
|
|
31
50
|
type PromiseOrValue<T> = T | Promise<T>;
|
|
32
51
|
|
|
33
52
|
type APIResponseProps = {
|
|
@@ -48,8 +67,8 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
|
|
|
48
67
|
}
|
|
49
68
|
|
|
50
69
|
const contentType = response.headers.get('content-type');
|
|
51
|
-
const
|
|
52
|
-
|
|
70
|
+
const mediaType = contentType?.split(';')[0]?.trim();
|
|
71
|
+
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
53
72
|
if (isJSON) {
|
|
54
73
|
const json = await response.json();
|
|
55
74
|
|
|
@@ -151,6 +170,7 @@ export class APIPromise<T> extends Promise<T> {
|
|
|
151
170
|
|
|
152
171
|
export abstract class APIClient {
|
|
153
172
|
baseURL: string;
|
|
173
|
+
#baseURLOverridden: boolean;
|
|
154
174
|
maxRetries: number;
|
|
155
175
|
timeout: number;
|
|
156
176
|
httpAgent: Agent | undefined;
|
|
@@ -160,18 +180,21 @@ export abstract class APIClient {
|
|
|
160
180
|
|
|
161
181
|
constructor({
|
|
162
182
|
baseURL,
|
|
183
|
+
baseURLOverridden,
|
|
163
184
|
maxRetries = 2,
|
|
164
185
|
timeout = 60000, // 1 minute
|
|
165
186
|
httpAgent,
|
|
166
187
|
fetch: overriddenFetch,
|
|
167
188
|
}: {
|
|
168
189
|
baseURL: string;
|
|
190
|
+
baseURLOverridden: boolean;
|
|
169
191
|
maxRetries?: number | undefined;
|
|
170
192
|
timeout: number | undefined;
|
|
171
193
|
httpAgent: Agent | undefined;
|
|
172
194
|
fetch: Fetch | undefined;
|
|
173
195
|
}) {
|
|
174
196
|
this.baseURL = baseURL;
|
|
197
|
+
this.#baseURLOverridden = baseURLOverridden;
|
|
175
198
|
this.maxRetries = validatePositiveInteger('maxRetries', maxRetries);
|
|
176
199
|
this.timeout = validatePositiveInteger('timeout', timeout);
|
|
177
200
|
this.httpAgent = httpAgent;
|
|
@@ -194,7 +217,7 @@ export abstract class APIClient {
|
|
|
194
217
|
protected defaultHeaders(opts: FinalRequestOptions): Headers {
|
|
195
218
|
return {
|
|
196
219
|
Accept: 'application/json',
|
|
197
|
-
'Content-Type': 'application/json',
|
|
220
|
+
...(['head', 'get'].includes(opts.method) ? {} : { 'Content-Type': 'application/json' }),
|
|
198
221
|
'User-Agent': this.getUserAgent(),
|
|
199
222
|
...getPlatformHeaders(),
|
|
200
223
|
...this.authHeaders(opts),
|
|
@@ -276,12 +299,12 @@ export abstract class APIClient {
|
|
|
276
299
|
return null;
|
|
277
300
|
}
|
|
278
301
|
|
|
279
|
-
buildRequest<Req>(
|
|
280
|
-
|
|
302
|
+
async buildRequest<Req>(
|
|
303
|
+
inputOptions: FinalRequestOptions<Req>,
|
|
281
304
|
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
282
|
-
): { req: RequestInit; url: string; timeout: number } {
|
|
283
|
-
options = { ...
|
|
284
|
-
const { method, path, query, headers: headers = {} } = options;
|
|
305
|
+
): Promise<{ req: RequestInit; url: string; timeout: number }> {
|
|
306
|
+
const options = { ...inputOptions };
|
|
307
|
+
const { method, path, query, defaultBaseURL, headers: headers = {} } = options;
|
|
285
308
|
|
|
286
309
|
const body =
|
|
287
310
|
ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ?
|
|
@@ -291,7 +314,7 @@ export abstract class APIClient {
|
|
|
291
314
|
: null;
|
|
292
315
|
const contentLength = this.calculateContentLength(body);
|
|
293
316
|
|
|
294
|
-
const url = this.buildURL(path!, query);
|
|
317
|
+
const url = this.buildURL(path!, query, defaultBaseURL);
|
|
295
318
|
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
|
|
296
319
|
options.timeout = options.timeout ?? this.timeout;
|
|
297
320
|
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
|
|
@@ -308,8 +331,8 @@ export abstract class APIClient {
|
|
|
308
331
|
}
|
|
309
332
|
|
|
310
333
|
if (this.idempotencyHeader && method !== 'get') {
|
|
311
|
-
if (!
|
|
312
|
-
headers[this.idempotencyHeader] =
|
|
334
|
+
if (!inputOptions.idempotencyKey) inputOptions.idempotencyKey = this.defaultIdempotencyKey();
|
|
335
|
+
headers[this.idempotencyHeader] = inputOptions.idempotencyKey;
|
|
313
336
|
}
|
|
314
337
|
|
|
315
338
|
const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
|
|
@@ -366,7 +389,7 @@ export abstract class APIClient {
|
|
|
366
389
|
getHeader(headers, 'x-stainless-timeout') === undefined &&
|
|
367
390
|
options.timeout
|
|
368
391
|
) {
|
|
369
|
-
reqHeaders['x-stainless-timeout'] = String(options.timeout);
|
|
392
|
+
reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
|
|
370
393
|
}
|
|
371
394
|
|
|
372
395
|
this.validateHeaders(reqHeaders, headers);
|
|
@@ -395,7 +418,7 @@ export abstract class APIClient {
|
|
|
395
418
|
!headers ? {}
|
|
396
419
|
: Symbol.iterator in headers ?
|
|
397
420
|
Object.fromEntries(Array.from(headers as Iterable<string[]>).map((header) => [...header]))
|
|
398
|
-
: { ...headers }
|
|
421
|
+
: { ...(headers as any as Record<string, string>) }
|
|
399
422
|
);
|
|
400
423
|
}
|
|
401
424
|
|
|
@@ -427,7 +450,9 @@ export abstract class APIClient {
|
|
|
427
450
|
|
|
428
451
|
await this.prepareOptions(options);
|
|
429
452
|
|
|
430
|
-
const { req, url, timeout } = this.buildRequest(options, {
|
|
453
|
+
const { req, url, timeout } = await this.buildRequest(options, {
|
|
454
|
+
retryCount: maxRetries - retriesRemaining,
|
|
455
|
+
});
|
|
431
456
|
|
|
432
457
|
await this.prepareRequest(req, { url, options });
|
|
433
458
|
|
|
@@ -484,11 +509,12 @@ export abstract class APIClient {
|
|
|
484
509
|
return new PagePromise<PageClass, Item>(this, request, Page);
|
|
485
510
|
}
|
|
486
511
|
|
|
487
|
-
buildURL<Req>(path: string, query: Req | null | undefined): string {
|
|
512
|
+
buildURL<Req>(path: string, query: Req | null | undefined, defaultBaseURL?: string | undefined): string {
|
|
513
|
+
const baseURL = (!this.#baseURLOverridden && defaultBaseURL) || this.baseURL;
|
|
488
514
|
const url =
|
|
489
515
|
isAbsoluteURL(path) ?
|
|
490
516
|
new URL(path)
|
|
491
|
-
: new URL(
|
|
517
|
+
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
492
518
|
|
|
493
519
|
const defaultQuery = this.defaultQuery();
|
|
494
520
|
if (!isEmptyObj(defaultQuery)) {
|
|
@@ -773,6 +799,7 @@ export type RequestOptions<
|
|
|
773
799
|
query?: Req | undefined;
|
|
774
800
|
body?: Req | null | undefined;
|
|
775
801
|
headers?: Headers | undefined;
|
|
802
|
+
defaultBaseURL?: string | undefined;
|
|
776
803
|
|
|
777
804
|
maxRetries?: number;
|
|
778
805
|
stream?: boolean | undefined;
|
|
@@ -794,6 +821,7 @@ const requestOptionsKeys: KeysEnum<RequestOptions> = {
|
|
|
794
821
|
query: true,
|
|
795
822
|
body: true,
|
|
796
823
|
headers: true,
|
|
824
|
+
defaultBaseURL: true,
|
|
797
825
|
|
|
798
826
|
maxRetries: true,
|
|
799
827
|
stream: true,
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
BankSearchResponse,
|
|
16
16
|
Banks,
|
|
17
17
|
} from './resources/banks';
|
|
18
|
+
import { BeneficiaryPayoutCreateResponse, BeneficiaryPayouts } from './resources/beneficiary-payouts';
|
|
18
19
|
import { Capabilities, CapabilityRetrieveParams, CapabilityRetrieveResponse } from './resources/capabilities';
|
|
19
20
|
import { Charge, ChargeCreateParams, Charges } from './resources/charges';
|
|
20
21
|
import {
|
|
@@ -31,66 +32,70 @@ import {
|
|
|
31
32
|
CustomerCreateResponse,
|
|
32
33
|
CustomerRetrieveParams,
|
|
33
34
|
CustomerRetrieveResponse,
|
|
35
|
+
CustomerSearchParams,
|
|
36
|
+
CustomerSearchResponse,
|
|
34
37
|
Customers,
|
|
35
38
|
} from './resources/customers';
|
|
39
|
+
import { DepositRetrieveParams, DepositRetrieveResponse, Deposits } from './resources/deposits';
|
|
36
40
|
import {
|
|
41
|
+
Fx,
|
|
42
|
+
FxRetrieveParams,
|
|
43
|
+
FxRetrieveRateParams,
|
|
44
|
+
FxRetrieveRateResponse,
|
|
45
|
+
FxRetrieveResponse,
|
|
46
|
+
} from './resources/fx';
|
|
47
|
+
import {
|
|
48
|
+
Mandate,
|
|
37
49
|
MandateLookupParams,
|
|
38
|
-
|
|
50
|
+
MandateLookupResponse,
|
|
39
51
|
MandateRetrieveParams,
|
|
40
52
|
MandateRevokeParams,
|
|
41
53
|
MandateRevokeResponse,
|
|
42
54
|
Mandates,
|
|
43
55
|
} from './resources/mandates';
|
|
44
56
|
import {
|
|
57
|
+
OrderCreateParams,
|
|
58
|
+
OrderCreateResponse,
|
|
59
|
+
OrderExpireParams,
|
|
60
|
+
OrderExpireResponse,
|
|
45
61
|
OrderRetrieveParams,
|
|
46
62
|
OrderRetrieveResponse,
|
|
47
|
-
OrderUpdateParams,
|
|
48
|
-
OrderUpdateResponse,
|
|
49
63
|
Orders,
|
|
50
64
|
} from './resources/orders';
|
|
51
65
|
import {
|
|
66
|
+
Payout,
|
|
52
67
|
PayoutCreateParams,
|
|
53
68
|
PayoutListParams,
|
|
54
69
|
PayoutListResponse,
|
|
55
70
|
PayoutRetrieveParams,
|
|
71
|
+
PayoutRetrieveResponse,
|
|
56
72
|
Payouts,
|
|
57
|
-
PublicUserPayout,
|
|
58
73
|
} from './resources/payouts';
|
|
59
74
|
import {
|
|
60
|
-
|
|
61
|
-
RefundBatchResponse,
|
|
75
|
+
Refund,
|
|
62
76
|
RefundCreateParams,
|
|
63
|
-
|
|
77
|
+
RefundCreateResponse,
|
|
78
|
+
RefundRetrieveParams,
|
|
79
|
+
RefundRetrieveResponse,
|
|
64
80
|
Refunds,
|
|
65
81
|
} from './resources/refunds';
|
|
66
82
|
import {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Reports,
|
|
74
|
-
} from './resources/reports';
|
|
83
|
+
ReturnCreateParams,
|
|
84
|
+
ReturnCreateResponse,
|
|
85
|
+
ReturnRetrieveParams,
|
|
86
|
+
ReturnRetrieveResponse,
|
|
87
|
+
Returns,
|
|
88
|
+
} from './resources/returns';
|
|
75
89
|
import {
|
|
76
90
|
Subaccount,
|
|
77
91
|
SubaccountCreateParams,
|
|
92
|
+
SubaccountCreateResponse,
|
|
78
93
|
SubaccountRetrieveParams,
|
|
79
94
|
Subaccounts,
|
|
80
95
|
} from './resources/subaccounts';
|
|
81
|
-
import {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
WebhooksubscriptionCreateResponse,
|
|
85
|
-
WebhooksubscriptionDeleteParams,
|
|
86
|
-
WebhooksubscriptionDeleteResponse,
|
|
87
|
-
WebhooksubscriptionListParams,
|
|
88
|
-
WebhooksubscriptionListResponse,
|
|
89
|
-
WebhooksubscriptionPingParams,
|
|
90
|
-
WebhooksubscriptionPingResponse,
|
|
91
|
-
WebhooksubscriptionUpdateParams,
|
|
92
|
-
WebhooksubscriptionUpdateResponse,
|
|
93
|
-
} from './resources/webhooksubscription';
|
|
96
|
+
import { TransactionListParams, TransactionListResponse, Transactions } from './resources/transactions';
|
|
97
|
+
import { Data } from './resources/data/data';
|
|
98
|
+
import { Webhook, WebhookTriggerParams, WebhookTriggerResponse } from './resources/webhook/webhook';
|
|
94
99
|
|
|
95
100
|
const environments = {
|
|
96
101
|
production: 'https://api.getivy.de',
|
|
@@ -126,6 +131,8 @@ export interface ClientOptions {
|
|
|
126
131
|
*
|
|
127
132
|
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
128
133
|
* much longer than this timeout before the promise succeeds or fails.
|
|
134
|
+
*
|
|
135
|
+
* @unit milliseconds
|
|
129
136
|
*/
|
|
130
137
|
timeout?: number | undefined;
|
|
131
138
|
|
|
@@ -217,6 +224,7 @@ export class Ivy extends Core.APIClient {
|
|
|
217
224
|
|
|
218
225
|
super({
|
|
219
226
|
baseURL: options.baseURL || environments[options.environment || 'production'],
|
|
227
|
+
baseURLOverridden: baseURL ? baseURL !== environments[options.environment || 'production'] : false,
|
|
220
228
|
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
221
229
|
httpAgent: options.httpAgent,
|
|
222
230
|
maxRetries: options.maxRetries,
|
|
@@ -230,17 +238,29 @@ export class Ivy extends Core.APIClient {
|
|
|
230
238
|
|
|
231
239
|
banks: API.Banks = new API.Banks(this);
|
|
232
240
|
checkoutsession: API.Checkoutsession = new API.Checkoutsession(this);
|
|
241
|
+
data: API.Data = new API.Data(this);
|
|
233
242
|
customers: API.Customers = new API.Customers(this);
|
|
234
243
|
orders: API.Orders = new API.Orders(this);
|
|
235
244
|
charges: API.Charges = new API.Charges(this);
|
|
245
|
+
deposits: API.Deposits = new API.Deposits(this);
|
|
246
|
+
returns: API.Returns = new API.Returns(this);
|
|
247
|
+
fx: API.Fx = new API.Fx(this);
|
|
248
|
+
beneficiaryPayouts: API.BeneficiaryPayouts = new API.BeneficiaryPayouts(this);
|
|
249
|
+
transactions: API.Transactions = new API.Transactions(this);
|
|
236
250
|
mandates: API.Mandates = new API.Mandates(this);
|
|
237
251
|
capabilities: API.Capabilities = new API.Capabilities(this);
|
|
238
252
|
refunds: API.Refunds = new API.Refunds(this);
|
|
239
253
|
payouts: API.Payouts = new API.Payouts(this);
|
|
240
|
-
reports: API.Reports = new API.Reports(this);
|
|
241
254
|
subaccounts: API.Subaccounts = new API.Subaccounts(this);
|
|
242
255
|
balance: API.Balance = new API.Balance(this);
|
|
243
|
-
|
|
256
|
+
webhook: API.Webhook = new API.Webhook(this);
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Check whether the base URL is set to its default.
|
|
260
|
+
*/
|
|
261
|
+
#baseURLOverridden(): boolean {
|
|
262
|
+
return this.baseURL !== environments[this._options.environment || 'production'];
|
|
263
|
+
}
|
|
244
264
|
|
|
245
265
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
246
266
|
return this._options.defaultQuery;
|
|
@@ -280,17 +300,23 @@ export class Ivy extends Core.APIClient {
|
|
|
280
300
|
|
|
281
301
|
Ivy.Banks = Banks;
|
|
282
302
|
Ivy.Checkoutsession = Checkoutsession;
|
|
303
|
+
Ivy.Data = Data;
|
|
283
304
|
Ivy.Customers = Customers;
|
|
284
305
|
Ivy.Orders = Orders;
|
|
285
306
|
Ivy.Charges = Charges;
|
|
307
|
+
Ivy.Deposits = Deposits;
|
|
308
|
+
Ivy.Returns = Returns;
|
|
309
|
+
Ivy.Fx = Fx;
|
|
310
|
+
Ivy.BeneficiaryPayouts = BeneficiaryPayouts;
|
|
311
|
+
Ivy.Transactions = Transactions;
|
|
286
312
|
Ivy.Mandates = Mandates;
|
|
287
313
|
Ivy.Capabilities = Capabilities;
|
|
288
314
|
Ivy.Refunds = Refunds;
|
|
289
315
|
Ivy.Payouts = Payouts;
|
|
290
|
-
Ivy.Reports = Reports;
|
|
291
316
|
Ivy.Subaccounts = Subaccounts;
|
|
292
317
|
Ivy.Balance = Balance;
|
|
293
|
-
Ivy.
|
|
318
|
+
Ivy.Webhook = Webhook;
|
|
319
|
+
|
|
294
320
|
export declare namespace Ivy {
|
|
295
321
|
export type RequestOptions = Core.RequestOptions;
|
|
296
322
|
|
|
@@ -314,27 +340,67 @@ export declare namespace Ivy {
|
|
|
314
340
|
type CheckoutsessionExpireParams as CheckoutsessionExpireParams,
|
|
315
341
|
};
|
|
316
342
|
|
|
343
|
+
export { Data as Data };
|
|
344
|
+
|
|
317
345
|
export {
|
|
318
346
|
Customers as Customers,
|
|
319
347
|
type CustomerCreateResponse as CustomerCreateResponse,
|
|
320
348
|
type CustomerRetrieveResponse as CustomerRetrieveResponse,
|
|
349
|
+
type CustomerSearchResponse as CustomerSearchResponse,
|
|
321
350
|
type CustomerCreateParams as CustomerCreateParams,
|
|
322
351
|
type CustomerRetrieveParams as CustomerRetrieveParams,
|
|
352
|
+
type CustomerSearchParams as CustomerSearchParams,
|
|
323
353
|
};
|
|
324
354
|
|
|
325
355
|
export {
|
|
326
356
|
Orders as Orders,
|
|
357
|
+
type OrderCreateResponse as OrderCreateResponse,
|
|
327
358
|
type OrderRetrieveResponse as OrderRetrieveResponse,
|
|
328
|
-
type
|
|
359
|
+
type OrderExpireResponse as OrderExpireResponse,
|
|
360
|
+
type OrderCreateParams as OrderCreateParams,
|
|
329
361
|
type OrderRetrieveParams as OrderRetrieveParams,
|
|
330
|
-
type
|
|
362
|
+
type OrderExpireParams as OrderExpireParams,
|
|
331
363
|
};
|
|
332
364
|
|
|
333
365
|
export { Charges as Charges, type Charge as Charge, type ChargeCreateParams as ChargeCreateParams };
|
|
334
366
|
|
|
367
|
+
export {
|
|
368
|
+
Deposits as Deposits,
|
|
369
|
+
type DepositRetrieveResponse as DepositRetrieveResponse,
|
|
370
|
+
type DepositRetrieveParams as DepositRetrieveParams,
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export {
|
|
374
|
+
Returns as Returns,
|
|
375
|
+
type ReturnCreateResponse as ReturnCreateResponse,
|
|
376
|
+
type ReturnRetrieveResponse as ReturnRetrieveResponse,
|
|
377
|
+
type ReturnCreateParams as ReturnCreateParams,
|
|
378
|
+
type ReturnRetrieveParams as ReturnRetrieveParams,
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
export {
|
|
382
|
+
Fx as Fx,
|
|
383
|
+
type FxRetrieveResponse as FxRetrieveResponse,
|
|
384
|
+
type FxRetrieveRateResponse as FxRetrieveRateResponse,
|
|
385
|
+
type FxRetrieveParams as FxRetrieveParams,
|
|
386
|
+
type FxRetrieveRateParams as FxRetrieveRateParams,
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
export {
|
|
390
|
+
BeneficiaryPayouts as BeneficiaryPayouts,
|
|
391
|
+
type BeneficiaryPayoutCreateResponse as BeneficiaryPayoutCreateResponse,
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
export {
|
|
395
|
+
Transactions as Transactions,
|
|
396
|
+
type TransactionListResponse as TransactionListResponse,
|
|
397
|
+
type TransactionListParams as TransactionListParams,
|
|
398
|
+
};
|
|
399
|
+
|
|
335
400
|
export {
|
|
336
401
|
Mandates as Mandates,
|
|
337
|
-
type
|
|
402
|
+
type Mandate as Mandate,
|
|
403
|
+
type MandateLookupResponse as MandateLookupResponse,
|
|
338
404
|
type MandateRevokeResponse as MandateRevokeResponse,
|
|
339
405
|
type MandateRetrieveParams as MandateRetrieveParams,
|
|
340
406
|
type MandateLookupParams as MandateLookupParams,
|
|
@@ -349,34 +415,27 @@ export declare namespace Ivy {
|
|
|
349
415
|
|
|
350
416
|
export {
|
|
351
417
|
Refunds as Refunds,
|
|
352
|
-
type
|
|
353
|
-
type
|
|
418
|
+
type Refund as Refund,
|
|
419
|
+
type RefundCreateResponse as RefundCreateResponse,
|
|
420
|
+
type RefundRetrieveResponse as RefundRetrieveResponse,
|
|
354
421
|
type RefundCreateParams as RefundCreateParams,
|
|
355
|
-
type
|
|
422
|
+
type RefundRetrieveParams as RefundRetrieveParams,
|
|
356
423
|
};
|
|
357
424
|
|
|
358
425
|
export {
|
|
359
426
|
Payouts as Payouts,
|
|
360
|
-
type
|
|
427
|
+
type Payout as Payout,
|
|
428
|
+
type PayoutRetrieveResponse as PayoutRetrieveResponse,
|
|
361
429
|
type PayoutListResponse as PayoutListResponse,
|
|
362
430
|
type PayoutCreateParams as PayoutCreateParams,
|
|
363
431
|
type PayoutRetrieveParams as PayoutRetrieveParams,
|
|
364
432
|
type PayoutListParams as PayoutListParams,
|
|
365
433
|
};
|
|
366
434
|
|
|
367
|
-
export {
|
|
368
|
-
Reports as Reports,
|
|
369
|
-
type PayoutReport as PayoutReport,
|
|
370
|
-
type ReportCreateResponse as ReportCreateResponse,
|
|
371
|
-
type ReportRetrieveResponse as ReportRetrieveResponse,
|
|
372
|
-
type ReportCreateParams as ReportCreateParams,
|
|
373
|
-
type ReportRetrieveParams as ReportRetrieveParams,
|
|
374
|
-
type ReportDownloadParams as ReportDownloadParams,
|
|
375
|
-
};
|
|
376
|
-
|
|
377
435
|
export {
|
|
378
436
|
Subaccounts as Subaccounts,
|
|
379
437
|
type Subaccount as Subaccount,
|
|
438
|
+
type SubaccountCreateResponse as SubaccountCreateResponse,
|
|
380
439
|
type SubaccountCreateParams as SubaccountCreateParams,
|
|
381
440
|
type SubaccountRetrieveParams as SubaccountRetrieveParams,
|
|
382
441
|
};
|
|
@@ -388,17 +447,9 @@ export declare namespace Ivy {
|
|
|
388
447
|
};
|
|
389
448
|
|
|
390
449
|
export {
|
|
391
|
-
|
|
392
|
-
type
|
|
393
|
-
type
|
|
394
|
-
type WebhooksubscriptionListResponse as WebhooksubscriptionListResponse,
|
|
395
|
-
type WebhooksubscriptionDeleteResponse as WebhooksubscriptionDeleteResponse,
|
|
396
|
-
type WebhooksubscriptionPingResponse as WebhooksubscriptionPingResponse,
|
|
397
|
-
type WebhooksubscriptionCreateParams as WebhooksubscriptionCreateParams,
|
|
398
|
-
type WebhooksubscriptionUpdateParams as WebhooksubscriptionUpdateParams,
|
|
399
|
-
type WebhooksubscriptionListParams as WebhooksubscriptionListParams,
|
|
400
|
-
type WebhooksubscriptionDeleteParams as WebhooksubscriptionDeleteParams,
|
|
401
|
-
type WebhooksubscriptionPingParams as WebhooksubscriptionPingParams,
|
|
450
|
+
Webhook as Webhook,
|
|
451
|
+
type WebhookTriggerResponse as WebhookTriggerResponse,
|
|
452
|
+
type WebhookTriggerParams as WebhookTriggerParams,
|
|
402
453
|
};
|
|
403
454
|
}
|
|
404
455
|
|
package/src/resource.ts
CHANGED
package/src/resources/balance.ts
CHANGED
|
@@ -16,10 +16,10 @@ export class Balance extends APIResource {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Returns the Balance of your Ivy account
|
|
21
|
-
*/
|
|
22
19
|
export interface BalanceRetrieveResponse {
|
|
20
|
+
/**
|
|
21
|
+
* Array of balance information for different currencies
|
|
22
|
+
*/
|
|
23
23
|
balances: Array<BalanceRetrieveResponse.Balance>;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -33,12 +33,15 @@ export namespace BalanceRetrieveResponse {
|
|
|
33
33
|
/**
|
|
34
34
|
* The currency of the balance
|
|
35
35
|
*/
|
|
36
|
-
currency: 'EUR' | 'GBP' | 'PLN';
|
|
36
|
+
currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export interface BalanceRetrieveParams {
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The currency to retrieve the balance for
|
|
43
|
+
*/
|
|
44
|
+
currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
export declare namespace Balance {
|