-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheckdeposit.go
More file actions
705 lines (629 loc) · 31.8 KB
/
checkdeposit.go
File metadata and controls
705 lines (629 loc) · 31.8 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
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package increase
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"slices"
"time"
"github.com/Increase/increase-go/internal/apijson"
"github.com/Increase/increase-go/internal/apiquery"
"github.com/Increase/increase-go/internal/param"
"github.com/Increase/increase-go/internal/requestconfig"
"github.com/Increase/increase-go/option"
"github.com/Increase/increase-go/packages/pagination"
)
// CheckDepositService contains methods and other services that help with
// interacting with the increase API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewCheckDepositService] method instead.
type CheckDepositService struct {
Options []option.RequestOption
}
// NewCheckDepositService generates a new service that applies the given options to
// each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewCheckDepositService(opts ...option.RequestOption) (r *CheckDepositService) {
r = &CheckDepositService{}
r.Options = opts
return
}
// Create a Check Deposit
func (r *CheckDepositService) New(ctx context.Context, body CheckDepositNewParams, opts ...option.RequestOption) (res *CheckDeposit, err error) {
opts = slices.Concat(r.Options, opts)
path := "check_deposits"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Retrieve a Check Deposit
func (r *CheckDepositService) Get(ctx context.Context, checkDepositID string, opts ...option.RequestOption) (res *CheckDeposit, err error) {
opts = slices.Concat(r.Options, opts)
if checkDepositID == "" {
err = errors.New("missing required check_deposit_id parameter")
return nil, err
}
path := fmt.Sprintf("check_deposits/%s", checkDepositID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// List Check Deposits
func (r *CheckDepositService) List(ctx context.Context, query CheckDepositListParams, opts ...option.RequestOption) (res *pagination.Page[CheckDeposit], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "check_deposits"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// List Check Deposits
func (r *CheckDepositService) ListAutoPaging(ctx context.Context, query CheckDepositListParams, opts ...option.RequestOption) *pagination.PageAutoPager[CheckDeposit] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// Check Deposits allow you to deposit images of paper checks into your account.
type CheckDeposit struct {
// The deposit's identifier.
ID string `json:"id" api:"required"`
// The Account the check was deposited into.
AccountID string `json:"account_id" api:"required"`
// The deposited amount in USD cents.
Amount int64 `json:"amount" api:"required"`
// The ID for the File containing the image of the back of the check.
BackImageFileID string `json:"back_image_file_id" api:"required,nullable"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the transfer was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Once your deposit is successfully parsed and accepted by Increase, this will
// contain details of the parsed check.
DepositAcceptance CheckDepositDepositAcceptance `json:"deposit_acceptance" api:"required,nullable"`
// If the deposit or the return was adjusted by the receiving institution, this
// will contain details of the adjustments.
DepositAdjustments []CheckDepositDepositAdjustment `json:"deposit_adjustments" api:"required"`
// If your deposit is rejected by Increase, this will contain details as to why it
// was rejected.
DepositRejection CheckDepositDepositRejection `json:"deposit_rejection" api:"required,nullable"`
// If your deposit is returned, this will contain details as to why it was
// returned.
DepositReturn CheckDepositDepositReturn `json:"deposit_return" api:"required,nullable"`
// After the check is parsed, it is submitted to the Check21 network for
// processing. This will contain details of the submission.
DepositSubmission CheckDepositDepositSubmission `json:"deposit_submission" api:"required,nullable"`
// The description of the Check Deposit, for display purposes only.
Description string `json:"description" api:"required,nullable"`
// The ID for the File containing the image of the front of the check.
FrontImageFileID string `json:"front_image_file_id" api:"required"`
// 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).
IdempotencyKey string `json:"idempotency_key" api:"required,nullable"`
// Increase will sometimes hold the funds for Check Deposits. If funds are held,
// this sub-object will contain details of the hold.
InboundFundsHold CheckDepositInboundFundsHold `json:"inbound_funds_hold" api:"required,nullable"`
// If the Check Deposit was the result of an Inbound Mail Item, this will contain
// the identifier of the Inbound Mail Item.
InboundMailItemID string `json:"inbound_mail_item_id" api:"required,nullable"`
// If the Check Deposit was the result of an Inbound Mail Item, this will contain
// the identifier of the Lockbox that received it.
LockboxID string `json:"lockbox_id" api:"required,nullable"`
// The status of the Check Deposit.
Status CheckDepositStatus `json:"status" api:"required"`
// The ID for the Transaction created by the deposit.
TransactionID string `json:"transaction_id" api:"required,nullable"`
// A constant representing the object's type. For this resource it will always be
// `check_deposit`.
Type CheckDepositType `json:"type" api:"required"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON checkDepositJSON `json:"-"`
}
// checkDepositJSON contains the JSON metadata for the struct [CheckDeposit]
type checkDepositJSON struct {
ID apijson.Field
AccountID apijson.Field
Amount apijson.Field
BackImageFileID apijson.Field
CreatedAt apijson.Field
DepositAcceptance apijson.Field
DepositAdjustments apijson.Field
DepositRejection apijson.Field
DepositReturn apijson.Field
DepositSubmission apijson.Field
Description apijson.Field
FrontImageFileID apijson.Field
IdempotencyKey apijson.Field
InboundFundsHold apijson.Field
InboundMailItemID apijson.Field
LockboxID apijson.Field
Status apijson.Field
TransactionID apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckDeposit) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkDepositJSON) RawJSON() string {
return r.raw
}
// Once your deposit is successfully parsed and accepted by Increase, this will
// contain details of the parsed check.
type CheckDepositDepositAcceptance struct {
// The account number printed on the check. This is an account at the bank that
// issued the check.
AccountNumber string `json:"account_number" api:"required"`
// The amount to be deposited in the minor unit of the transaction's currency. For
// dollars, for example, this is cents.
Amount int64 `json:"amount" api:"required"`
// An additional line of metadata printed on the check. This typically includes the
// check number for business checks.
AuxiliaryOnUs string `json:"auxiliary_on_us" api:"required,nullable"`
// The ID of the Check Deposit that was accepted.
CheckDepositID string `json:"check_deposit_id" api:"required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
// transaction's currency.
Currency CheckDepositDepositAcceptanceCurrency `json:"currency" api:"required"`
// The routing number printed on the check. This is a routing number for the bank
// that issued the check.
RoutingNumber string `json:"routing_number" api:"required"`
// The check serial number, if present, for consumer checks. For business checks,
// the serial number is usually in the `auxiliary_on_us` field.
SerialNumber string `json:"serial_number" api:"required,nullable"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON checkDepositDepositAcceptanceJSON `json:"-"`
}
// checkDepositDepositAcceptanceJSON contains the JSON metadata for the struct
// [CheckDepositDepositAcceptance]
type checkDepositDepositAcceptanceJSON struct {
AccountNumber apijson.Field
Amount apijson.Field
AuxiliaryOnUs apijson.Field
CheckDepositID apijson.Field
Currency apijson.Field
RoutingNumber apijson.Field
SerialNumber apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckDepositDepositAcceptance) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkDepositDepositAcceptanceJSON) RawJSON() string {
return r.raw
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
// transaction's currency.
type CheckDepositDepositAcceptanceCurrency string
const (
CheckDepositDepositAcceptanceCurrencyUsd CheckDepositDepositAcceptanceCurrency = "USD"
)
func (r CheckDepositDepositAcceptanceCurrency) IsKnown() bool {
switch r {
case CheckDepositDepositAcceptanceCurrencyUsd:
return true
}
return false
}
type CheckDepositDepositAdjustment struct {
// The time at which the adjustment was received.
AdjustedAt time.Time `json:"adjusted_at" api:"required" format:"date-time"`
// The amount of the adjustment.
Amount int64 `json:"amount" api:"required"`
// The reason for the adjustment.
Reason CheckDepositDepositAdjustmentsReason `json:"reason" api:"required"`
// The id of the transaction for the adjustment.
TransactionID string `json:"transaction_id" api:"required"`
JSON checkDepositDepositAdjustmentJSON `json:"-"`
}
// checkDepositDepositAdjustmentJSON contains the JSON metadata for the struct
// [CheckDepositDepositAdjustment]
type checkDepositDepositAdjustmentJSON struct {
AdjustedAt apijson.Field
Amount apijson.Field
Reason apijson.Field
TransactionID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckDepositDepositAdjustment) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkDepositDepositAdjustmentJSON) RawJSON() string {
return r.raw
}
// The reason for the adjustment.
type CheckDepositDepositAdjustmentsReason string
const (
CheckDepositDepositAdjustmentsReasonAdjustedAmount CheckDepositDepositAdjustmentsReason = "adjusted_amount"
CheckDepositDepositAdjustmentsReasonNonConformingItem CheckDepositDepositAdjustmentsReason = "non_conforming_item"
CheckDepositDepositAdjustmentsReasonPaid CheckDepositDepositAdjustmentsReason = "paid"
)
func (r CheckDepositDepositAdjustmentsReason) IsKnown() bool {
switch r {
case CheckDepositDepositAdjustmentsReasonAdjustedAmount, CheckDepositDepositAdjustmentsReasonNonConformingItem, CheckDepositDepositAdjustmentsReasonPaid:
return true
}
return false
}
// If your deposit is rejected by Increase, this will contain details as to why it
// was rejected.
type CheckDepositDepositRejection struct {
// The rejected amount in the minor unit of check's currency. For dollars, for
// example, this is cents.
Amount int64 `json:"amount" api:"required"`
// The identifier of the Check Deposit that was rejected.
CheckDepositID string `json:"check_deposit_id" api:"required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's
// currency.
Currency CheckDepositDepositRejectionCurrency `json:"currency" api:"required"`
// The identifier of the associated declined transaction.
DeclinedTransactionID string `json:"declined_transaction_id" api:"required"`
// Why the check deposit was rejected.
Reason CheckDepositDepositRejectionReason `json:"reason" api:"required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the check deposit was rejected.
RejectedAt time.Time `json:"rejected_at" api:"required" format:"date-time"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON checkDepositDepositRejectionJSON `json:"-"`
}
// checkDepositDepositRejectionJSON contains the JSON metadata for the struct
// [CheckDepositDepositRejection]
type checkDepositDepositRejectionJSON struct {
Amount apijson.Field
CheckDepositID apijson.Field
Currency apijson.Field
DeclinedTransactionID apijson.Field
Reason apijson.Field
RejectedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckDepositDepositRejection) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkDepositDepositRejectionJSON) RawJSON() string {
return r.raw
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's
// currency.
type CheckDepositDepositRejectionCurrency string
const (
CheckDepositDepositRejectionCurrencyUsd CheckDepositDepositRejectionCurrency = "USD"
)
func (r CheckDepositDepositRejectionCurrency) IsKnown() bool {
switch r {
case CheckDepositDepositRejectionCurrencyUsd:
return true
}
return false
}
// Why the check deposit was rejected.
type CheckDepositDepositRejectionReason string
const (
CheckDepositDepositRejectionReasonIncompleteImage CheckDepositDepositRejectionReason = "incomplete_image"
CheckDepositDepositRejectionReasonDuplicate CheckDepositDepositRejectionReason = "duplicate"
CheckDepositDepositRejectionReasonPoorImageQuality CheckDepositDepositRejectionReason = "poor_image_quality"
CheckDepositDepositRejectionReasonIncorrectAmount CheckDepositDepositRejectionReason = "incorrect_amount"
CheckDepositDepositRejectionReasonIncorrectRecipient CheckDepositDepositRejectionReason = "incorrect_recipient"
CheckDepositDepositRejectionReasonNotEligibleForMobileDeposit CheckDepositDepositRejectionReason = "not_eligible_for_mobile_deposit"
CheckDepositDepositRejectionReasonMissingRequiredDataElements CheckDepositDepositRejectionReason = "missing_required_data_elements"
CheckDepositDepositRejectionReasonSuspectedFraud CheckDepositDepositRejectionReason = "suspected_fraud"
CheckDepositDepositRejectionReasonDepositWindowExpired CheckDepositDepositRejectionReason = "deposit_window_expired"
CheckDepositDepositRejectionReasonRequestedByUser CheckDepositDepositRejectionReason = "requested_by_user"
CheckDepositDepositRejectionReasonInternational CheckDepositDepositRejectionReason = "international"
CheckDepositDepositRejectionReasonUnknown CheckDepositDepositRejectionReason = "unknown"
)
func (r CheckDepositDepositRejectionReason) IsKnown() bool {
switch r {
case CheckDepositDepositRejectionReasonIncompleteImage, CheckDepositDepositRejectionReasonDuplicate, CheckDepositDepositRejectionReasonPoorImageQuality, CheckDepositDepositRejectionReasonIncorrectAmount, CheckDepositDepositRejectionReasonIncorrectRecipient, CheckDepositDepositRejectionReasonNotEligibleForMobileDeposit, CheckDepositDepositRejectionReasonMissingRequiredDataElements, CheckDepositDepositRejectionReasonSuspectedFraud, CheckDepositDepositRejectionReasonDepositWindowExpired, CheckDepositDepositRejectionReasonRequestedByUser, CheckDepositDepositRejectionReasonInternational, CheckDepositDepositRejectionReasonUnknown:
return true
}
return false
}
// If your deposit is returned, this will contain details as to why it was
// returned.
type CheckDepositDepositReturn struct {
// The returned amount in USD cents.
Amount int64 `json:"amount" api:"required"`
// The identifier of the Check Deposit that was returned.
CheckDepositID string `json:"check_deposit_id" api:"required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
// transaction's currency.
Currency CheckDepositDepositReturnCurrency `json:"currency" api:"required"`
// Why this check was returned by the bank holding the account it was drawn
// against.
ReturnReason CheckDepositDepositReturnReturnReason `json:"return_reason" api:"required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the check deposit was returned.
ReturnedAt time.Time `json:"returned_at" api:"required" format:"date-time"`
// The identifier of the transaction that reversed the original check deposit
// transaction.
TransactionID string `json:"transaction_id" api:"required"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON checkDepositDepositReturnJSON `json:"-"`
}
// checkDepositDepositReturnJSON contains the JSON metadata for the struct
// [CheckDepositDepositReturn]
type checkDepositDepositReturnJSON struct {
Amount apijson.Field
CheckDepositID apijson.Field
Currency apijson.Field
ReturnReason apijson.Field
ReturnedAt apijson.Field
TransactionID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckDepositDepositReturn) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkDepositDepositReturnJSON) RawJSON() string {
return r.raw
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
// transaction's currency.
type CheckDepositDepositReturnCurrency string
const (
CheckDepositDepositReturnCurrencyUsd CheckDepositDepositReturnCurrency = "USD"
)
func (r CheckDepositDepositReturnCurrency) IsKnown() bool {
switch r {
case CheckDepositDepositReturnCurrencyUsd:
return true
}
return false
}
// Why this check was returned by the bank holding the account it was drawn
// against.
type CheckDepositDepositReturnReturnReason string
const (
CheckDepositDepositReturnReturnReasonACHConversionNotSupported CheckDepositDepositReturnReturnReason = "ach_conversion_not_supported"
CheckDepositDepositReturnReturnReasonClosedAccount CheckDepositDepositReturnReturnReason = "closed_account"
CheckDepositDepositReturnReturnReasonDuplicateSubmission CheckDepositDepositReturnReturnReason = "duplicate_submission"
CheckDepositDepositReturnReturnReasonInsufficientFunds CheckDepositDepositReturnReturnReason = "insufficient_funds"
CheckDepositDepositReturnReturnReasonNoAccount CheckDepositDepositReturnReturnReason = "no_account"
CheckDepositDepositReturnReturnReasonNotAuthorized CheckDepositDepositReturnReturnReason = "not_authorized"
CheckDepositDepositReturnReturnReasonStaleDated CheckDepositDepositReturnReturnReason = "stale_dated"
CheckDepositDepositReturnReturnReasonStopPayment CheckDepositDepositReturnReturnReason = "stop_payment"
CheckDepositDepositReturnReturnReasonUnknownReason CheckDepositDepositReturnReturnReason = "unknown_reason"
CheckDepositDepositReturnReturnReasonUnmatchedDetails CheckDepositDepositReturnReturnReason = "unmatched_details"
CheckDepositDepositReturnReturnReasonUnreadableImage CheckDepositDepositReturnReturnReason = "unreadable_image"
CheckDepositDepositReturnReturnReasonEndorsementIrregular CheckDepositDepositReturnReturnReason = "endorsement_irregular"
CheckDepositDepositReturnReturnReasonAlteredOrFictitiousItem CheckDepositDepositReturnReturnReason = "altered_or_fictitious_item"
CheckDepositDepositReturnReturnReasonFrozenOrBlockedAccount CheckDepositDepositReturnReturnReason = "frozen_or_blocked_account"
CheckDepositDepositReturnReturnReasonPostDated CheckDepositDepositReturnReturnReason = "post_dated"
CheckDepositDepositReturnReturnReasonEndorsementMissing CheckDepositDepositReturnReturnReason = "endorsement_missing"
CheckDepositDepositReturnReturnReasonSignatureMissing CheckDepositDepositReturnReturnReason = "signature_missing"
CheckDepositDepositReturnReturnReasonStopPaymentSuspect CheckDepositDepositReturnReturnReason = "stop_payment_suspect"
CheckDepositDepositReturnReturnReasonUnusableImage CheckDepositDepositReturnReturnReason = "unusable_image"
CheckDepositDepositReturnReturnReasonImageFailsSecurityCheck CheckDepositDepositReturnReturnReason = "image_fails_security_check"
CheckDepositDepositReturnReturnReasonCannotDetermineAmount CheckDepositDepositReturnReturnReason = "cannot_determine_amount"
CheckDepositDepositReturnReturnReasonSignatureIrregular CheckDepositDepositReturnReturnReason = "signature_irregular"
CheckDepositDepositReturnReturnReasonNonCashItem CheckDepositDepositReturnReturnReason = "non_cash_item"
CheckDepositDepositReturnReturnReasonUnableToProcess CheckDepositDepositReturnReturnReason = "unable_to_process"
CheckDepositDepositReturnReturnReasonItemExceedsDollarLimit CheckDepositDepositReturnReturnReason = "item_exceeds_dollar_limit"
CheckDepositDepositReturnReturnReasonBranchOrAccountSold CheckDepositDepositReturnReturnReason = "branch_or_account_sold"
)
func (r CheckDepositDepositReturnReturnReason) IsKnown() bool {
switch r {
case CheckDepositDepositReturnReturnReasonACHConversionNotSupported, CheckDepositDepositReturnReturnReasonClosedAccount, CheckDepositDepositReturnReturnReasonDuplicateSubmission, CheckDepositDepositReturnReturnReasonInsufficientFunds, CheckDepositDepositReturnReturnReasonNoAccount, CheckDepositDepositReturnReturnReasonNotAuthorized, CheckDepositDepositReturnReturnReasonStaleDated, CheckDepositDepositReturnReturnReasonStopPayment, CheckDepositDepositReturnReturnReasonUnknownReason, CheckDepositDepositReturnReturnReasonUnmatchedDetails, CheckDepositDepositReturnReturnReasonUnreadableImage, CheckDepositDepositReturnReturnReasonEndorsementIrregular, CheckDepositDepositReturnReturnReasonAlteredOrFictitiousItem, CheckDepositDepositReturnReturnReasonFrozenOrBlockedAccount, CheckDepositDepositReturnReturnReasonPostDated, CheckDepositDepositReturnReturnReasonEndorsementMissing, CheckDepositDepositReturnReturnReasonSignatureMissing, CheckDepositDepositReturnReturnReasonStopPaymentSuspect, CheckDepositDepositReturnReturnReasonUnusableImage, CheckDepositDepositReturnReturnReasonImageFailsSecurityCheck, CheckDepositDepositReturnReturnReasonCannotDetermineAmount, CheckDepositDepositReturnReturnReasonSignatureIrregular, CheckDepositDepositReturnReturnReasonNonCashItem, CheckDepositDepositReturnReturnReasonUnableToProcess, CheckDepositDepositReturnReturnReasonItemExceedsDollarLimit, CheckDepositDepositReturnReturnReasonBranchOrAccountSold:
return true
}
return false
}
// After the check is parsed, it is submitted to the Check21 network for
// processing. This will contain details of the submission.
type CheckDepositDepositSubmission struct {
// The ID for the File containing the check back image that was submitted to the
// Check21 network.
BackFileID string `json:"back_file_id" api:"required"`
// The ID for the File containing the check front image that was submitted to the
// Check21 network.
FrontFileID string `json:"front_file_id" api:"required"`
// 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.
SubmittedAt time.Time `json:"submitted_at" api:"required" format:"date-time"`
JSON checkDepositDepositSubmissionJSON `json:"-"`
}
// checkDepositDepositSubmissionJSON contains the JSON metadata for the struct
// [CheckDepositDepositSubmission]
type checkDepositDepositSubmissionJSON struct {
BackFileID apijson.Field
FrontFileID apijson.Field
SubmittedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckDepositDepositSubmission) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkDepositDepositSubmissionJSON) RawJSON() string {
return r.raw
}
// Increase will sometimes hold the funds for Check Deposits. If funds are held,
// this sub-object will contain details of the hold.
type CheckDepositInboundFundsHold struct {
// The held amount in the minor unit of the account's currency. For dollars, for
// example, this is cents.
Amount int64 `json:"amount" api:"required"`
// When the hold will be released automatically. Certain conditions may cause it to
// be released before this time.
AutomaticallyReleasesAt time.Time `json:"automatically_releases_at" api:"required" format:"date-time"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the hold
// was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's
// currency.
Currency CheckDepositInboundFundsHoldCurrency `json:"currency" api:"required"`
// The ID of the Transaction for which funds were held.
HeldTransactionID string `json:"held_transaction_id" api:"required,nullable"`
// The ID of the Pending Transaction representing the held funds.
PendingTransactionID string `json:"pending_transaction_id" api:"required,nullable"`
// When the hold was released (if it has been released).
ReleasedAt time.Time `json:"released_at" api:"required,nullable" format:"date-time"`
// The status of the hold.
Status CheckDepositInboundFundsHoldStatus `json:"status" api:"required"`
// A constant representing the object's type. For this resource it will always be
// `inbound_funds_hold`.
Type CheckDepositInboundFundsHoldType `json:"type" api:"required"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON checkDepositInboundFundsHoldJSON `json:"-"`
}
// checkDepositInboundFundsHoldJSON contains the JSON metadata for the struct
// [CheckDepositInboundFundsHold]
type checkDepositInboundFundsHoldJSON struct {
Amount apijson.Field
AutomaticallyReleasesAt apijson.Field
CreatedAt apijson.Field
Currency apijson.Field
HeldTransactionID apijson.Field
PendingTransactionID apijson.Field
ReleasedAt apijson.Field
Status apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckDepositInboundFundsHold) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkDepositInboundFundsHoldJSON) RawJSON() string {
return r.raw
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's
// currency.
type CheckDepositInboundFundsHoldCurrency string
const (
CheckDepositInboundFundsHoldCurrencyUsd CheckDepositInboundFundsHoldCurrency = "USD"
)
func (r CheckDepositInboundFundsHoldCurrency) IsKnown() bool {
switch r {
case CheckDepositInboundFundsHoldCurrencyUsd:
return true
}
return false
}
// The status of the hold.
type CheckDepositInboundFundsHoldStatus string
const (
CheckDepositInboundFundsHoldStatusHeld CheckDepositInboundFundsHoldStatus = "held"
CheckDepositInboundFundsHoldStatusComplete CheckDepositInboundFundsHoldStatus = "complete"
)
func (r CheckDepositInboundFundsHoldStatus) IsKnown() bool {
switch r {
case CheckDepositInboundFundsHoldStatusHeld, CheckDepositInboundFundsHoldStatusComplete:
return true
}
return false
}
// A constant representing the object's type. For this resource it will always be
// `inbound_funds_hold`.
type CheckDepositInboundFundsHoldType string
const (
CheckDepositInboundFundsHoldTypeInboundFundsHold CheckDepositInboundFundsHoldType = "inbound_funds_hold"
)
func (r CheckDepositInboundFundsHoldType) IsKnown() bool {
switch r {
case CheckDepositInboundFundsHoldTypeInboundFundsHold:
return true
}
return false
}
// The status of the Check Deposit.
type CheckDepositStatus string
const (
CheckDepositStatusPending CheckDepositStatus = "pending"
CheckDepositStatusSubmitted CheckDepositStatus = "submitted"
CheckDepositStatusRejected CheckDepositStatus = "rejected"
CheckDepositStatusReturned CheckDepositStatus = "returned"
)
func (r CheckDepositStatus) IsKnown() bool {
switch r {
case CheckDepositStatusPending, CheckDepositStatusSubmitted, CheckDepositStatusRejected, CheckDepositStatusReturned:
return true
}
return false
}
// A constant representing the object's type. For this resource it will always be
// `check_deposit`.
type CheckDepositType string
const (
CheckDepositTypeCheckDeposit CheckDepositType = "check_deposit"
)
func (r CheckDepositType) IsKnown() bool {
switch r {
case CheckDepositTypeCheckDeposit:
return true
}
return false
}
type CheckDepositNewParams struct {
// The identifier for the Account to deposit the check in.
AccountID param.Field[string] `json:"account_id" api:"required"`
// The deposit amount in USD cents.
Amount param.Field[int64] `json:"amount" api:"required"`
// The File containing the check's back image.
BackImageFileID param.Field[string] `json:"back_image_file_id" api:"required"`
// The File containing the check's front image.
FrontImageFileID param.Field[string] `json:"front_image_file_id" api:"required"`
// The description you choose to give the Check Deposit, for display purposes only.
Description param.Field[string] `json:"description"`
}
func (r CheckDepositNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CheckDepositListParams struct {
// Filter Check Deposits to those belonging to the specified Account.
AccountID param.Field[string] `query:"account_id"`
CreatedAt param.Field[CheckDepositListParamsCreatedAt] `query:"created_at"`
// Return the page of entries after this one.
Cursor param.Field[string] `query:"cursor"`
// 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).
IdempotencyKey param.Field[string] `query:"idempotency_key"`
// Limit the size of the list that is returned. The default (and maximum) is 100
// objects.
Limit param.Field[int64] `query:"limit"`
}
// URLQuery serializes [CheckDepositListParams]'s query parameters as `url.Values`.
func (r CheckDepositListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatDots,
})
}
type CheckDepositListParamsCreatedAt struct {
// Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
After param.Field[time.Time] `query:"after" format:"date-time"`
// Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
Before param.Field[time.Time] `query:"before" format:"date-time"`
// Return results on or after this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrAfter param.Field[time.Time] `query:"on_or_after" format:"date-time"`
// Return results on or before this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrBefore param.Field[time.Time] `query:"on_or_before" format:"date-time"`
}
// URLQuery serializes [CheckDepositListParamsCreatedAt]'s query parameters as
// `url.Values`.
func (r CheckDepositListParamsCreatedAt) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatDots,
})
}