-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaccount-numbers.ts
More file actions
376 lines (331 loc) · 10.9 KB
/
account-numbers.ts
File metadata and controls
376 lines (331 loc) · 10.9 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
// 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 AccountNumbers extends APIResource {
/**
* Create an Account Number
*
* @example
* ```ts
* const accountNumber = await client.accountNumbers.create({
* account_id: 'account_in71c4amph0vgo2qllky',
* name: 'Rent payments',
* });
* ```
*/
create(body: AccountNumberCreateParams, options?: RequestOptions): APIPromise<AccountNumber> {
return this._client.post('/account_numbers', { body, ...options });
}
/**
* Retrieve an Account Number
*
* @example
* ```ts
* const accountNumber = await client.accountNumbers.retrieve(
* 'account_number_v18nkfqm6afpsrvy82b2',
* );
* ```
*/
retrieve(accountNumberID: string, options?: RequestOptions): APIPromise<AccountNumber> {
return this._client.get(path`/account_numbers/${accountNumberID}`, options);
}
/**
* Update an Account Number
*
* @example
* ```ts
* const accountNumber = await client.accountNumbers.update(
* 'account_number_v18nkfqm6afpsrvy82b2',
* );
* ```
*/
update(
accountNumberID: string,
body: AccountNumberUpdateParams,
options?: RequestOptions,
): APIPromise<AccountNumber> {
return this._client.patch(path`/account_numbers/${accountNumberID}`, { body, ...options });
}
/**
* List Account Numbers
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const accountNumber of client.accountNumbers.list()) {
* // ...
* }
* ```
*/
list(
query: AccountNumberListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<AccountNumbersPage, AccountNumber> {
return this._client.getAPIList('/account_numbers', Page<AccountNumber>, { query, ...options });
}
}
export type AccountNumbersPage = Page<AccountNumber>;
/**
* Each account can have multiple account and routing numbers. We recommend that
* you use a set per vendor. This is similar to how you use different passwords for
* different websites. Account numbers can also be used to seamlessly reconcile
* inbound payments. Generating a unique account number per vendor ensures you
* always know the originator of an incoming payment.
*/
export interface AccountNumber {
/**
* The Account Number identifier.
*/
id: string;
/**
* The identifier for the account this Account Number belongs to.
*/
account_id: string;
/**
* The account number.
*/
account_number: string;
/**
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Account
* Number was created.
*/
created_at: string;
/**
* 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;
/**
* Properties related to how this Account Number handles inbound ACH transfers.
*/
inbound_ach: AccountNumber.InboundACH;
/**
* Properties related to how this Account Number should handle inbound check
* withdrawals.
*/
inbound_checks: AccountNumber.InboundChecks;
/**
* The name you choose for the Account Number.
*/
name: string;
/**
* The American Bankers' Association (ABA) Routing Transit Number (RTN).
*/
routing_number: string;
/**
* This indicates if payments can be made to the Account Number.
*
* - `active` - The account number is active.
* - `disabled` - The account number is temporarily disabled.
* - `canceled` - The account number is permanently disabled.
*/
status: 'active' | 'disabled' | 'canceled';
/**
* A constant representing the object's type. For this resource it will always be
* `account_number`.
*/
type: 'account_number';
[k: string]: unknown;
}
export namespace AccountNumber {
/**
* Properties related to how this Account Number handles inbound ACH transfers.
*/
export interface InboundACH {
/**
* Whether ACH debits are allowed against this Account Number. Note that they will
* still be declined if this is `allowed` if the Account Number is not active.
*
* - `allowed` - ACH Debits are allowed.
* - `blocked` - ACH Debits are blocked.
*/
debit_status: 'allowed' | 'blocked';
}
/**
* Properties related to how this Account Number should handle inbound check
* withdrawals.
*/
export interface InboundChecks {
/**
* How Increase should process checks with this account number printed on them.
*
* - `allowed` - Checks with this Account Number will be processed even if they are
* not associated with a Check Transfer.
* - `check_transfers_only` - Checks with this Account Number will be processed
* only if they can be matched to an existing Check Transfer.
*/
status: 'allowed' | 'check_transfers_only';
}
}
export interface AccountNumberCreateParams {
/**
* The Account the Account Number should belong to.
*/
account_id: string;
/**
* The name you choose for the Account Number.
*/
name: string;
/**
* Options related to how this Account Number should handle inbound ACH transfers.
*/
inbound_ach?: AccountNumberCreateParams.InboundACH;
/**
* Options related to how this Account Number should handle inbound check
* withdrawals.
*/
inbound_checks?: AccountNumberCreateParams.InboundChecks;
[k: string]: unknown;
}
export namespace AccountNumberCreateParams {
/**
* Options related to how this Account Number should handle inbound ACH transfers.
*/
export interface InboundACH {
/**
* Whether ACH debits are allowed against this Account Number. Note that ACH debits
* will be declined if this is `allowed` but the Account Number is not active. If
* you do not specify this field, the default is `allowed`.
*
* - `allowed` - ACH Debits are allowed.
* - `blocked` - ACH Debits are blocked.
*/
debit_status: 'allowed' | 'blocked';
}
/**
* Options related to how this Account Number should handle inbound check
* withdrawals.
*/
export interface InboundChecks {
/**
* How Increase should process checks with this account number printed on them. If
* you do not specify this field, the default is `check_transfers_only`.
*
* - `allowed` - Checks with this Account Number will be processed even if they are
* not associated with a Check Transfer.
* - `check_transfers_only` - Checks with this Account Number will be processed
* only if they can be matched to an existing Check Transfer.
*/
status: 'allowed' | 'check_transfers_only';
}
}
export interface AccountNumberUpdateParams {
/**
* Options related to how this Account Number handles inbound ACH transfers.
*/
inbound_ach?: AccountNumberUpdateParams.InboundACH;
/**
* Options related to how this Account Number should handle inbound check
* withdrawals.
*/
inbound_checks?: AccountNumberUpdateParams.InboundChecks;
/**
* The name you choose for the Account Number.
*/
name?: string;
/**
* This indicates if transfers can be made to the Account Number.
*
* - `active` - The account number is active.
* - `disabled` - The account number is temporarily disabled.
* - `canceled` - The account number is permanently disabled.
*/
status?: 'active' | 'disabled' | 'canceled';
}
export namespace AccountNumberUpdateParams {
/**
* Options related to how this Account Number handles inbound ACH transfers.
*/
export interface InboundACH {
/**
* Whether ACH debits are allowed against this Account Number. Note that ACH debits
* will be declined if this is `allowed` but the Account Number is not active.
*
* - `allowed` - ACH Debits are allowed.
* - `blocked` - ACH Debits are blocked.
*/
debit_status?: 'allowed' | 'blocked';
}
/**
* Options related to how this Account Number should handle inbound check
* withdrawals.
*/
export interface InboundChecks {
/**
* How Increase should process checks with this account number printed on them.
*
* - `allowed` - Checks with this Account Number will be processed even if they are
* not associated with a Check Transfer.
* - `check_transfers_only` - Checks with this Account Number will be processed
* only if they can be matched to an existing Check Transfer.
*/
status: 'allowed' | 'check_transfers_only';
}
}
export interface AccountNumberListParams extends PageParams {
/**
* Filter Account Numbers to those belonging to the specified Account.
*/
account_id?: string;
ach_debit_status?: AccountNumberListParams.ACHDebitStatus;
created_at?: AccountNumberListParams.CreatedAt;
/**
* 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;
status?: AccountNumberListParams.Status;
}
export namespace AccountNumberListParams {
export interface ACHDebitStatus {
/**
* The ACH Debit status to retrieve Account Numbers for. For GET requests, this
* should be encoded as a comma-delimited string, such as `?in=one,two,three`.
*/
in?: Array<'allowed' | 'blocked'>;
}
export interface CreatedAt {
/**
* Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
* timestamp.
*/
after?: string;
/**
* Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
* timestamp.
*/
before?: string;
/**
* Return results on or after this
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
*/
on_or_after?: string;
/**
* Return results on or before this
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
*/
on_or_before?: string;
}
export interface Status {
/**
* The status to retrieve Account Numbers for. For GET requests, this should be
* encoded as a comma-delimited string, such as `?in=one,two,three`.
*/
in?: Array<'active' | 'disabled' | 'canceled'>;
}
}
export declare namespace AccountNumbers {
export {
type AccountNumber as AccountNumber,
type AccountNumbersPage as AccountNumbersPage,
type AccountNumberCreateParams as AccountNumberCreateParams,
type AccountNumberUpdateParams as AccountNumberUpdateParams,
type AccountNumberListParams as AccountNumberListParams,
};
}