-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexternal-accounts.ts
More file actions
266 lines (234 loc) · 7.46 KB
/
external-accounts.ts
File metadata and controls
266 lines (234 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { Page, type PageParams, PagePromise } from '../core/pagination';
import { RequestOptions } from '../internal/request-options';
import { path } from '../internal/utils/path';
export class ExternalAccounts extends APIResource {
/**
* Create an External Account
*
* @example
* ```ts
* const externalAccount =
* await client.externalAccounts.create({
* account_number: '987654321',
* description: 'Landlord',
* routing_number: '101050001',
* });
* ```
*/
create(body: ExternalAccountCreateParams, options?: RequestOptions): APIPromise<ExternalAccount> {
return this._client.post('/external_accounts', { body, ...options });
}
/**
* Retrieve an External Account
*
* @example
* ```ts
* const externalAccount =
* await client.externalAccounts.retrieve(
* 'external_account_ukk55lr923a3ac0pp7iv',
* );
* ```
*/
retrieve(externalAccountID: string, options?: RequestOptions): APIPromise<ExternalAccount> {
return this._client.get(path`/external_accounts/${externalAccountID}`, options);
}
/**
* Update an External Account
*
* @example
* ```ts
* const externalAccount =
* await client.externalAccounts.update(
* 'external_account_ukk55lr923a3ac0pp7iv',
* );
* ```
*/
update(
externalAccountID: string,
body: ExternalAccountUpdateParams,
options?: RequestOptions,
): APIPromise<ExternalAccount> {
return this._client.patch(path`/external_accounts/${externalAccountID}`, { body, ...options });
}
/**
* List External Accounts
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const externalAccount of client.externalAccounts.list()) {
* // ...
* }
* ```
*/
list(
query: ExternalAccountListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<ExternalAccountsPage, ExternalAccount> {
return this._client.getAPIList('/external_accounts', Page<ExternalAccount>, { query, ...options });
}
}
export type ExternalAccountsPage = Page<ExternalAccount>;
/**
* External Accounts represent accounts at financial institutions other than
* Increase. You can use this API to store their details for reuse.
*/
export interface ExternalAccount {
/**
* The External Account's identifier.
*/
id: string;
/**
* The type of entity that owns the External Account.
*
* - `business` - The External Account is owned by a business.
* - `individual` - The External Account is owned by an individual.
* - `unknown` - It's unknown what kind of entity owns the External Account.
*/
account_holder: 'business' | 'individual' | 'unknown';
/**
* The destination account number.
*/
account_number: string;
/**
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
* the External Account was created.
*/
created_at: string;
/**
* The External Account's description for display purposes.
*/
description: string;
/**
* The type of the account to which the transfer will be sent.
*
* - `checking` - A checking account.
* - `savings` - A savings account.
* - `general_ledger` - A general ledger account.
* - `other` - A different type of account.
*/
funding: 'checking' | 'savings' | 'general_ledger' | 'other';
/**
* The idempotency key you chose for this object. This value is unique across
* Increase and is used to ensure that a request is only processed once. Learn more
* about [idempotency](https://increase.com/documentation/idempotency-keys).
*/
idempotency_key: string | null;
/**
* The American Bankers' Association (ABA) Routing Transit Number (RTN).
*/
routing_number: string;
/**
* The External Account's status.
*
* - `active` - The External Account is active.
* - `archived` - The External Account is archived and won't appear in the
* dashboard.
*/
status: 'active' | 'archived';
/**
* A constant representing the object's type. For this resource it will always be
* `external_account`.
*/
type: 'external_account';
[k: string]: unknown;
}
export interface ExternalAccountCreateParams {
/**
* The account number for the destination account.
*/
account_number: string;
/**
* The name you choose for the Account.
*/
description: string;
/**
* The American Bankers' Association (ABA) Routing Transit Number (RTN) for the
* destination account.
*/
routing_number: string;
/**
* The type of entity that owns the External Account.
*
* - `business` - The External Account is owned by a business.
* - `individual` - The External Account is owned by an individual.
* - `unknown` - It's unknown what kind of entity owns the External Account.
*/
account_holder?: 'business' | 'individual' | 'unknown';
/**
* The type of the destination account. Defaults to `checking`.
*
* - `checking` - A checking account.
* - `savings` - A savings account.
* - `general_ledger` - A general ledger account.
* - `other` - A different type of account.
*/
funding?: 'checking' | 'savings' | 'general_ledger' | 'other';
[k: string]: unknown;
}
export interface ExternalAccountUpdateParams {
/**
* The type of entity that owns the External Account.
*
* - `business` - The External Account is owned by a business.
* - `individual` - The External Account is owned by an individual.
*/
account_holder?: 'business' | 'individual';
/**
* The description you choose to give the external account.
*/
description?: string;
/**
* The funding type of the External Account.
*
* - `checking` - A checking account.
* - `savings` - A savings account.
* - `general_ledger` - A general ledger account.
* - `other` - A different type of account.
*/
funding?: 'checking' | 'savings' | 'general_ledger' | 'other';
/**
* The status of the External Account.
*
* - `active` - The External Account is active.
* - `archived` - The External Account is archived and won't appear in the
* dashboard.
*/
status?: 'active' | 'archived';
}
export interface ExternalAccountListParams extends PageParams {
/**
* Filter records to the one with the specified `idempotency_key` you chose for
* that object. This value is unique across Increase and is used to ensure that a
* request is only processed once. Learn more about
* [idempotency](https://increase.com/documentation/idempotency-keys).
*/
idempotency_key?: string;
/**
* Filter External Accounts to those with the specified Routing Number.
*/
routing_number?: string;
status?: ExternalAccountListParams.Status;
}
export namespace ExternalAccountListParams {
export interface Status {
/**
* Filter External Accounts for those with the specified status or statuses. For
* GET requests, this should be encoded as a comma-delimited string, such as
* `?in=one,two,three`.
*/
in?: Array<'active' | 'archived'>;
}
}
export declare namespace ExternalAccounts {
export {
type ExternalAccount as ExternalAccount,
type ExternalAccountsPage as ExternalAccountsPage,
type ExternalAccountCreateParams as ExternalAccountCreateParams,
type ExternalAccountUpdateParams as ExternalAccountUpdateParams,
type ExternalAccountListParams as ExternalAccountListParams,
};
}