-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcheck-deposits.ts
More file actions
617 lines (539 loc) · 17.9 KB
/
check-deposits.ts
File metadata and controls
617 lines (539 loc) · 17.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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
// 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 CheckDeposits extends APIResource {
/**
* Create a Check Deposit
*
* @example
* ```ts
* const checkDeposit = await client.checkDeposits.create({
* account_id: 'account_in71c4amph0vgo2qllky',
* amount: 1000,
* back_image_file_id: 'file_26khfk98mzfz90a11oqx',
* front_image_file_id: 'file_hkv175ovmc2tb2v2zbrm',
* });
* ```
*/
create(body: CheckDepositCreateParams, options?: RequestOptions): APIPromise<CheckDeposit> {
return this._client.post('/check_deposits', { body, ...options });
}
/**
* Retrieve a Check Deposit
*
* @example
* ```ts
* const checkDeposit = await client.checkDeposits.retrieve(
* 'check_deposit_f06n9gpg7sxn8t19lfc1',
* );
* ```
*/
retrieve(checkDepositID: string, options?: RequestOptions): APIPromise<CheckDeposit> {
return this._client.get(path`/check_deposits/${checkDepositID}`, options);
}
/**
* List Check Deposits
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const checkDeposit of client.checkDeposits.list()) {
* // ...
* }
* ```
*/
list(
query: CheckDepositListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<CheckDepositsPage, CheckDeposit> {
return this._client.getAPIList('/check_deposits', Page<CheckDeposit>, { query, ...options });
}
}
export type CheckDepositsPage = Page<CheckDeposit>;
/**
* Check Deposits allow you to deposit images of paper checks into your account.
*/
export interface CheckDeposit {
/**
* The deposit's identifier.
*/
id: string;
/**
* The Account the check was deposited into.
*/
account_id: string;
/**
* The deposited amount in USD cents.
*/
amount: number;
/**
* The ID for the File containing the image of the back of the check.
*/
back_image_file_id: string | null;
/**
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
* the transfer was created.
*/
created_at: string;
/**
* Once your deposit is successfully parsed and accepted by Increase, this will
* contain details of the parsed check.
*/
deposit_acceptance: CheckDeposit.DepositAcceptance | null;
/**
* If the deposit or the return was adjusted by the receiving institution, this
* will contain details of the adjustments.
*/
deposit_adjustments: Array<CheckDeposit.DepositAdjustment>;
/**
* If your deposit is rejected by Increase, this will contain details as to why it
* was rejected.
*/
deposit_rejection: CheckDeposit.DepositRejection | null;
/**
* If your deposit is returned, this will contain details as to why it was
* returned.
*/
deposit_return: CheckDeposit.DepositReturn | null;
/**
* After the check is parsed, it is submitted to the Check21 network for
* processing. This will contain details of the submission.
*/
deposit_submission: CheckDeposit.DepositSubmission | null;
/**
* The description of the Check Deposit, for display purposes only.
*/
description: string | null;
/**
* The ID for the File containing the image of the front of the check.
*/
front_image_file_id: 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;
/**
* Increase will sometimes hold the funds for Check Deposits. If funds are held,
* this sub-object will contain details of the hold.
*/
inbound_funds_hold: CheckDeposit.InboundFundsHold | null;
/**
* If the Check Deposit was the result of an Inbound Mail Item, this will contain
* the identifier of the Inbound Mail Item.
*/
inbound_mail_item_id: string | null;
/**
* If the Check Deposit was the result of an Inbound Mail Item routed to a Lockbox
* Recipient, this will contain the identifier of the Lockbox Recipient that
* received it.
*/
lockbox_recipient_id: string | null;
/**
* The status of the Check Deposit.
*
* - `pending` - The Check Deposit is pending review.
* - `submitted` - The Check Deposit has been deposited.
* - `rejected` - The Check Deposit has been rejected.
* - `returned` - The Check Deposit has been returned.
*/
status: 'pending' | 'submitted' | 'rejected' | 'returned';
/**
* The ID for the Transaction created by the deposit.
*/
transaction_id: string | null;
/**
* A constant representing the object's type. For this resource it will always be
* `check_deposit`.
*/
type: 'check_deposit';
[k: string]: unknown;
}
export namespace CheckDeposit {
/**
* Once your deposit is successfully parsed and accepted by Increase, this will
* contain details of the parsed check.
*/
export interface DepositAcceptance {
/**
* The account number printed on the check. This is an account at the bank that
* issued the check.
*/
account_number: string;
/**
* The amount to be deposited in the minor unit of the transaction's currency. For
* dollars, for example, this is cents.
*/
amount: number;
/**
* An additional line of metadata printed on the check. This typically includes the
* check number for business checks.
*/
auxiliary_on_us: string | null;
/**
* The ID of the Check Deposit that was accepted.
*/
check_deposit_id: string;
/**
* The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
* transaction's currency.
*
* - `USD` - US Dollar (USD)
*/
currency: 'USD';
/**
* The routing number printed on the check. This is a routing number for the bank
* that issued the check.
*/
routing_number: string;
/**
* The check serial number, if present, for consumer checks. For business checks,
* the serial number is usually in the `auxiliary_on_us` field.
*/
serial_number: string | null;
[k: string]: unknown;
}
export interface DepositAdjustment {
/**
* The time at which the adjustment was received.
*/
adjusted_at: string;
/**
* The amount of the adjustment.
*/
amount: number;
/**
* The reason for the adjustment.
*
* - `adjusted_amount` - The check was deposited with a different amount than what
* was written on the check.
* - `non_conforming_item` - The recipient was not able to process the check. This
* usually happens for e.g., low quality images.
* - `paid` - The check has already been deposited elsewhere and so this is a
* duplicate.
*/
reason: 'adjusted_amount' | 'non_conforming_item' | 'paid';
/**
* The id of the transaction for the adjustment.
*/
transaction_id: string;
}
/**
* If your deposit is rejected by Increase, this will contain details as to why it
* was rejected.
*/
export interface DepositRejection {
/**
* The rejected amount in the minor unit of check's currency. For dollars, for
* example, this is cents.
*/
amount: number;
/**
* The identifier of the Check Deposit that was rejected.
*/
check_deposit_id: string;
/**
* The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's
* currency.
*
* - `USD` - US Dollar (USD)
*/
currency: 'USD';
/**
* The identifier of the associated declined transaction.
*/
declined_transaction_id: string;
/**
* Why the check deposit was rejected.
*
* - `incomplete_image` - The check's image is incomplete.
* - `duplicate` - This is a duplicate check submission.
* - `poor_image_quality` - This check has poor image quality.
* - `incorrect_amount` - The check was deposited with the incorrect amount.
* - `incorrect_recipient` - The check is made out to someone other than the
* account holder.
* - `not_eligible_for_mobile_deposit` - This check was not eligible for mobile
* deposit.
* - `missing_required_data_elements` - This check is missing at least one required
* field.
* - `suspected_fraud` - This check is suspected to be fraudulent.
* - `deposit_window_expired` - This check's deposit window has expired.
* - `requested_by_user` - The check was rejected at the user's request.
* - `international` - The check is not a U.S. domestic check and cannot be
* processed.
* - `unknown` - The check was rejected for an unknown reason.
*/
reason:
| 'incomplete_image'
| 'duplicate'
| 'poor_image_quality'
| 'incorrect_amount'
| 'incorrect_recipient'
| 'not_eligible_for_mobile_deposit'
| 'missing_required_data_elements'
| 'suspected_fraud'
| 'deposit_window_expired'
| 'requested_by_user'
| 'international'
| 'unknown';
/**
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
* the check deposit was rejected.
*/
rejected_at: string;
[k: string]: unknown;
}
/**
* If your deposit is returned, this will contain details as to why it was
* returned.
*/
export interface DepositReturn {
/**
* The returned amount in USD cents.
*/
amount: number;
/**
* The identifier of the Check Deposit that was returned.
*/
check_deposit_id: string;
/**
* The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
* transaction's currency.
*
* - `USD` - US Dollar (USD)
*/
currency: 'USD';
/**
* Why this check was returned by the bank holding the account it was drawn
* against.
*
* - `ach_conversion_not_supported` - The check doesn't allow ACH conversion.
* - `closed_account` - The account is closed. (Check21 return code `D`)
* - `duplicate_submission` - The check has already been deposited. (Check21 return
* code `Y`)
* - `insufficient_funds` - Insufficient funds (Check21 return code `A`)
* - `no_account` - No account was found matching the check details. (Check21
* return code `E`)
* - `not_authorized` - The check was not authorized. (Check21 return code `Q`)
* - `stale_dated` - The check is too old. (Check21 return code `G`)
* - `stop_payment` - The payment has been stopped by the account holder. (Check21
* return code `C`)
* - `unknown_reason` - The reason for the return is unknown.
* - `unmatched_details` - The image doesn't match the details submitted.
* - `unreadable_image` - The image could not be read. (Check21 return code `U`)
* - `endorsement_irregular` - The check endorsement was irregular. (Check21 return
* code `J`)
* - `altered_or_fictitious_item` - The check present was either altered or fake.
* (Check21 return code `N`)
* - `frozen_or_blocked_account` - The account this check is drawn on is frozen.
* (Check21 return code `F`)
* - `post_dated` - The check is post dated. (Check21 return code `H`)
* - `endorsement_missing` - The endorsement was missing. (Check21 return code `I`)
* - `signature_missing` - The check signature was missing. (Check21 return code
* `K`)
* - `stop_payment_suspect` - The bank suspects a stop payment will be placed.
* (Check21 return code `T`)
* - `unusable_image` - The bank cannot read the image. (Check21 return code `U`)
* - `image_fails_security_check` - The check image fails the bank's security
* check. (Check21 return code `V`)
* - `cannot_determine_amount` - The bank cannot determine the amount. (Check21
* return code `W`)
* - `signature_irregular` - The signature is inconsistent with prior signatures.
* (Check21 return code `L`)
* - `non_cash_item` - The check is a non-cash item and cannot be drawn against the
* account. (Check21 return code `M`)
* - `unable_to_process` - The bank is unable to process this check. (Check21
* return code `O`)
* - `item_exceeds_dollar_limit` - The check exceeds the bank or customer's limit.
* (Check21 return code `P`)
* - `branch_or_account_sold` - The bank sold this account and no longer services
* this customer. (Check21 return code `R`)
*/
return_reason:
| 'ach_conversion_not_supported'
| 'closed_account'
| 'duplicate_submission'
| 'insufficient_funds'
| 'no_account'
| 'not_authorized'
| 'stale_dated'
| 'stop_payment'
| 'unknown_reason'
| 'unmatched_details'
| 'unreadable_image'
| 'endorsement_irregular'
| 'altered_or_fictitious_item'
| 'frozen_or_blocked_account'
| 'post_dated'
| 'endorsement_missing'
| 'signature_missing'
| 'stop_payment_suspect'
| 'unusable_image'
| 'image_fails_security_check'
| 'cannot_determine_amount'
| 'signature_irregular'
| 'non_cash_item'
| 'unable_to_process'
| 'item_exceeds_dollar_limit'
| 'branch_or_account_sold';
/**
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
* the check deposit was returned.
*/
returned_at: string;
/**
* The identifier of the transaction that reversed the original check deposit
* transaction.
*/
transaction_id: string;
[k: string]: unknown;
}
/**
* After the check is parsed, it is submitted to the Check21 network for
* processing. This will contain details of the submission.
*/
export interface DepositSubmission {
/**
* The ID for the File containing the check back image that was submitted to the
* Check21 network.
*/
back_file_id: string;
/**
* The ID for the File containing the check front image that was submitted to the
* Check21 network.
*/
front_file_id: string;
/**
* When the check deposit was submitted to the Check21 network for processing.
* During business days, this happens within a few hours of the check being
* accepted by Increase.
*/
submitted_at: string;
}
/**
* Increase will sometimes hold the funds for Check Deposits. If funds are held,
* this sub-object will contain details of the hold.
*/
export interface InboundFundsHold {
/**
* The held amount in the minor unit of the account's currency. For dollars, for
* example, this is cents.
*/
amount: number;
/**
* When the hold will be released automatically. Certain conditions may cause it to
* be released before this time.
*/
automatically_releases_at: string;
/**
* The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the hold
* was created.
*/
created_at: string;
/**
* The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's
* currency.
*
* - `USD` - US Dollar (USD)
*/
currency: 'USD';
/**
* The ID of the Transaction for which funds were held.
*/
held_transaction_id: string | null;
/**
* The ID of the Pending Transaction representing the held funds.
*/
pending_transaction_id: string | null;
/**
* When the hold was released (if it has been released).
*/
released_at: string | null;
/**
* The status of the hold.
*
* - `held` - Funds are still being held.
* - `complete` - Funds have been released.
*/
status: 'held' | 'complete';
/**
* A constant representing the object's type. For this resource it will always be
* `inbound_funds_hold`.
*/
type: 'inbound_funds_hold';
[k: string]: unknown;
}
}
export interface CheckDepositCreateParams {
/**
* The identifier for the Account to deposit the check in.
*/
account_id: string;
/**
* The deposit amount in USD cents.
*/
amount: number;
/**
* The File containing the check's back image.
*/
back_image_file_id: string;
/**
* The File containing the check's front image.
*/
front_image_file_id: string;
/**
* The description you choose to give the Check Deposit, for display purposes only.
*/
description?: string;
[k: string]: unknown;
}
export interface CheckDepositListParams extends PageParams {
/**
* Filter Check Deposits to those belonging to the specified Account.
*/
account_id?: string;
created_at?: CheckDepositListParams.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;
}
export namespace CheckDepositListParams {
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 declare namespace CheckDeposits {
export {
type CheckDeposit as CheckDeposit,
type CheckDepositsPage as CheckDepositsPage,
type CheckDepositCreateParams as CheckDepositCreateParams,
type CheckDepositListParams as CheckDepositListParams,
};
}