-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathaccounts.ts
362 lines (308 loc) · 10.4 KB
/
accounts.ts
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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
import { CursorPage, type CursorPageParams } from '../pagination';
export class Accounts extends APIResource {
/**
* Get account configuration such as spend limits.
*/
retrieve(accountToken: string, options?: Core.RequestOptions): Core.APIPromise<Account> {
return this._client.get(`/v1/accounts/${accountToken}`, options);
}
/**
* Update account configuration such as state or spend limits. Can only be run on
* accounts that are part of the program managed by this API key. Accounts that are
* in the `PAUSED` state will not be able to transact or create new cards.
*/
update(
accountToken: string,
body: AccountUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<Account> {
return this._client.patch(`/v1/accounts/${accountToken}`, { body, ...options });
}
/**
* List account configurations.
*/
list(
query?: AccountListParams,
options?: Core.RequestOptions,
): Core.PagePromise<AccountsCursorPage, Account>;
list(options?: Core.RequestOptions): Core.PagePromise<AccountsCursorPage, Account>;
list(
query: AccountListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<AccountsCursorPage, Account> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/v1/accounts', AccountsCursorPage, { query, ...options });
}
/**
* Get an Account's available spend limits, which is based on the spend limit
* configured on the Account and the amount already spent over the spend limit's
* duration. For example, if the Account has a daily spend limit of $1000
* configured, and has spent $600 in the last 24 hours, the available spend limit
* returned would be $400.
*/
retrieveSpendLimits(
accountToken: string,
options?: Core.RequestOptions,
): Core.APIPromise<AccountSpendLimits> {
return this._client.get(`/v1/accounts/${accountToken}/spend_limits`, options);
}
}
export class AccountsCursorPage extends CursorPage<Account> {}
export interface Account {
/**
* Globally unique identifier for the account. This is the same as the
* account_token returned by the enroll endpoint. If using this parameter, do not
* include pagination.
*/
token: string;
/**
* Timestamp of when the account was created. For accounts created before
* 2023-05-11, this field will be null.
*/
created: string | null;
/**
* Spend limit information for the user containing the daily, monthly, and lifetime
* spend limit of the account. Any charges to a card owned by this account will be
* declined once their transaction volume has surpassed the value in the applicable
* time limit (rolling). A lifetime limit of 0 indicates that the lifetime limit
* feature is disabled.
*/
spend_limit: Account.SpendLimit;
/**
* Account state:
*
* - `ACTIVE` - Account is able to transact and create new cards.
* - `PAUSED` - Account will not be able to transact or create new cards. It can be
* set back to `ACTIVE`.
* - `CLOSED` - Account will not be able to transact or create new cards. `CLOSED`
* accounts are also unable to be transitioned to `ACTIVE` or `PAUSED` states.
* `CLOSED` accounts result from failing to pass KYB/KYC or Lithic closing for
* risk/compliance reasons. Please contact
* [[email protected]](mailto:[email protected]) if you believe this was in
* error.
*/
state: 'ACTIVE' | 'PAUSED' | 'CLOSED';
account_holder?: Account.AccountHolder;
/**
* @deprecated List of identifiers for the Auth Rule(s) that are applied on the
* account. This field is deprecated and will no longer be populated in the
* `account_holder` object. The key will be removed from the schema in a future
* release. Use the `/auth_rules` endpoints to fetch Auth Rule information instead.
*/
auth_rule_tokens?: Array<string>;
/**
* 3-digit alphabetic ISO 4217 code for the currency of the cardholder.
*/
cardholder_currency?: string;
/**
* @deprecated
*/
verification_address?: Account.VerificationAddress;
}
export namespace Account {
/**
* Spend limit information for the user containing the daily, monthly, and lifetime
* spend limit of the account. Any charges to a card owned by this account will be
* declined once their transaction volume has surpassed the value in the applicable
* time limit (rolling). A lifetime limit of 0 indicates that the lifetime limit
* feature is disabled.
*/
export interface SpendLimit {
/**
* Daily spend limit (in cents).
*/
daily: number;
/**
* Total spend limit over account lifetime (in cents).
*/
lifetime: number;
/**
* Monthly spend limit (in cents).
*/
monthly: number;
}
export interface AccountHolder {
/**
* Globally unique identifier for the account holder.
*/
token: string;
/**
* Only applicable for customers using the KYC-Exempt workflow to enroll authorized
* users of businesses. Account_token of the enrolled business associated with an
* enrolled AUTHORIZED_USER individual.
*/
business_account_token: string;
/**
* Email address.
*/
email: string;
/**
* Phone number of the individual.
*/
phone_number: string;
}
/**
* @deprecated
*/
export interface VerificationAddress {
/**
* Valid deliverable address (no PO boxes).
*/
address1: string;
/**
* City name.
*/
city: string;
/**
* Country name. Only USA is currently supported.
*/
country: string;
/**
* Valid postal code. Only USA postal codes (ZIP codes) are currently supported,
* entered as a five-digit postal code or nine-digit postal code (ZIP+4) using the
* format 12345-1234.
*/
postal_code: string;
/**
* Valid state code. Only USA state codes are currently supported, entered in
* uppercase ISO 3166-2 two-character format.
*/
state: string;
/**
* Unit or apartment number (if applicable).
*/
address2?: string;
}
}
export interface AccountSpendLimits {
available_spend_limit: AccountSpendLimits.AvailableSpendLimit;
spend_limit?: AccountSpendLimits.SpendLimit;
spend_velocity?: AccountSpendLimits.SpendVelocity;
}
export namespace AccountSpendLimits {
export interface AvailableSpendLimit {
/**
* The available spend limit (in cents) relative to the daily limit configured on
* the Account (e.g. 100000 would be a $1,000 limit).
*/
daily?: number;
/**
* The available spend limit (in cents) relative to the lifetime limit configured
* on the Account.
*/
lifetime?: number;
/**
* The available spend limit (in cents) relative to the monthly limit configured on
* the Account.
*/
monthly?: number;
}
export interface SpendLimit {
/**
* The configured daily spend limit (in cents) on the Account.
*/
daily?: number;
/**
* The configured lifetime spend limit (in cents) on the Account.
*/
lifetime?: number;
/**
* The configured monthly spend limit (in cents) on the Account.
*/
monthly?: number;
}
export interface SpendVelocity {
/**
* Current daily spend velocity (in cents) on the Account. Present if daily spend
* limit is set.
*/
daily?: number;
/**
* Current lifetime spend velocity (in cents) on the Account. Present if lifetime
* spend limit is set.
*/
lifetime?: number;
/**
* Current monthly spend velocity (in cents) on the Account. Present if monthly
* spend limit is set.
*/
monthly?: number;
}
}
export interface AccountUpdateParams {
/**
* Amount (in cents) for the account's daily spend limit (e.g. 100000 would be a
* $1,000 limit). By default the daily spend limit is set to $1,250.
*/
daily_spend_limit?: number;
/**
* Amount (in cents) for the account's lifetime spend limit (e.g. 100000 would be a
* $1,000 limit). Once this limit is reached, no transactions will be accepted on
* any card created for this account until the limit is updated. Note that a spend
* limit of 0 is effectively no limit, and should only be used to reset or remove a
* prior limit. Only a limit of 1 or above will result in declined transactions due
* to checks against the account limit. This behavior differs from the daily spend
* limit and the monthly spend limit.
*/
lifetime_spend_limit?: number;
/**
* Amount (in cents) for the account's monthly spend limit (e.g. 100000 would be a
* $1,000 limit). By default the monthly spend limit is set to $5,000.
*/
monthly_spend_limit?: number;
/**
* Account states.
*/
state?: 'ACTIVE' | 'PAUSED';
/**
* Address used during Address Verification Service (AVS) checks during
* transactions if enabled via Auth Rules. This field is deprecated as AVS checks
* are no longer supported by Authorization Rules. The field will be removed from
* the schema in a future release.
*/
verification_address?: AccountUpdateParams.VerificationAddress;
}
export namespace AccountUpdateParams {
/**
* @deprecated Address used during Address Verification Service (AVS) checks during
* transactions if enabled via Auth Rules. This field is deprecated as AVS checks
* are no longer supported by Authorization Rules. The field will be removed from
* the schema in a future release.
*/
export interface VerificationAddress {
address1?: string;
address2?: string;
city?: string;
country?: string;
postal_code?: string;
state?: string;
}
}
export interface AccountListParams extends CursorPageParams {
/**
* Date string in RFC 3339 format. Only entries created after the specified time
* will be included. UTC time zone.
*/
begin?: string;
/**
* Date string in RFC 3339 format. Only entries created before the specified time
* will be included. UTC time zone.
*/
end?: string;
}
Accounts.AccountsCursorPage = AccountsCursorPage;
export declare namespace Accounts {
export {
type Account as Account,
type AccountSpendLimits as AccountSpendLimits,
AccountsCursorPage as AccountsCursorPage,
type AccountUpdateParams as AccountUpdateParams,
type AccountListParams as AccountListParams,
};
}