-
Notifications
You must be signed in to change notification settings - Fork 0
/
accounts.ts
343 lines (289 loc) · 9.81 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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as AccountsAPI from './accounts';
import * as CreditConfigurationsAPI from './credit-configurations';
export class Accounts extends APIResource {
creditConfigurations: CreditConfigurationsAPI.CreditConfigurations =
new CreditConfigurationsAPI.CreditConfigurations(this._client);
/**
* Get account configuration such as spend limits.
*/
retrieve(accountToken: string, options?: Core.RequestOptions): Core.APIPromise<AccountRetrieveResponse> {
return this._client.get(`/accounts/${accountToken}`, options);
}
/**
* Update account configuration such as spend limits and verification address. 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<AccountUpdateResponse> {
return this._client.patch(`/accounts/${accountToken}`, { body, ...options });
}
}
export interface AccountRetrieveResponse {
/**
* 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;
/**
* 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: AccountRetrieveResponse.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 permanently not be able to transact or create new
* cards.
*/
state: 'ACTIVE' | 'PAUSED' | 'CLOSED';
account_holder?: AccountRetrieveResponse.AccountHolder;
/**
* List of identifiers for the Auth Rule(s) that are applied on the account.
*/
auth_rule_tokens?: Array<string>;
verification_address?: AccountRetrieveResponse.VerificationAddress;
}
export namespace AccountRetrieveResponse {
/**
* 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;
}
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 ZIP codes are currently supported, entered as a
* five-digit ZIP or nine-digit ZIP+4.
*/
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 AccountUpdateResponse {
/**
* 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;
/**
* 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: AccountUpdateResponse.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 permanently not be able to transact or create new
* cards.
*/
state: 'ACTIVE' | 'PAUSED' | 'CLOSED';
account_holder?: AccountUpdateResponse.AccountHolder;
/**
* List of identifiers for the Auth Rule(s) that are applied on the account.
*/
auth_rule_tokens?: Array<string>;
verification_address?: AccountUpdateResponse.VerificationAddress;
}
export namespace AccountUpdateResponse {
/**
* 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;
}
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 ZIP codes are currently supported, entered as a
* five-digit ZIP or nine-digit ZIP+4.
*/
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 AccountUpdateParams {
/**
* Amount (in cents) for the account's daily spend 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. 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. 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.
*/
verification_address?: AccountUpdateParams.VerificationAddress;
}
export namespace AccountUpdateParams {
/**
* Address used during Address Verification Service (AVS) checks during
* transactions if enabled via Auth Rules.
*/
export interface VerificationAddress {
address1?: string;
address2?: string;
city?: string;
country?: string;
postal_code?: string;
state?: string;
}
}
export namespace Accounts {
export import AccountRetrieveResponse = AccountsAPI.AccountRetrieveResponse;
export import AccountUpdateResponse = AccountsAPI.AccountUpdateResponse;
export import AccountUpdateParams = AccountsAPI.AccountUpdateParams;
export import CreditConfigurations = CreditConfigurationsAPI.CreditConfigurations;
export import CreditConfigurationListResponse = CreditConfigurationsAPI.CreditConfigurationListResponse;
export import CreditConfigurationPatchAccountCreditConfigurationResponse = CreditConfigurationsAPI.CreditConfigurationPatchAccountCreditConfigurationResponse;
export import CreditConfigurationPatchAccountCreditConfigurationParams = CreditConfigurationsAPI.CreditConfigurationPatchAccountCreditConfigurationParams;
}