-
Notifications
You must be signed in to change notification settings - Fork 0
/
checktransfer.go
968 lines (857 loc) · 38.6 KB
/
checktransfer.go
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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package increase
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/increase/increase-go/internal/apijson"
"github.com/increase/increase-go/internal/apiquery"
"github.com/increase/increase-go/internal/pagination"
"github.com/increase/increase-go/internal/param"
"github.com/increase/increase-go/internal/requestconfig"
"github.com/increase/increase-go/option"
)
// CheckTransferService 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 [NewCheckTransferService] method instead.
type CheckTransferService struct {
Options []option.RequestOption
}
// NewCheckTransferService 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 NewCheckTransferService(opts ...option.RequestOption) (r *CheckTransferService) {
r = &CheckTransferService{}
r.Options = opts
return
}
// Create a Check Transfer
func (r *CheckTransferService) New(ctx context.Context, body CheckTransferNewParams, opts ...option.RequestOption) (res *CheckTransfer, err error) {
opts = append(r.Options[:], opts...)
path := "check_transfers"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Retrieve a Check Transfer
func (r *CheckTransferService) Get(ctx context.Context, checkTransferID string, opts ...option.RequestOption) (res *CheckTransfer, err error) {
opts = append(r.Options[:], opts...)
if checkTransferID == "" {
err = errors.New("missing required check_transfer_id parameter")
return
}
path := fmt.Sprintf("check_transfers/%s", checkTransferID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// List Check Transfers
func (r *CheckTransferService) List(ctx context.Context, query CheckTransferListParams, opts ...option.RequestOption) (res *pagination.Page[CheckTransfer], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "check_transfers"
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 Transfers
func (r *CheckTransferService) ListAutoPaging(ctx context.Context, query CheckTransferListParams, opts ...option.RequestOption) *pagination.PageAutoPager[CheckTransfer] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// Approve a Check Transfer
func (r *CheckTransferService) Approve(ctx context.Context, checkTransferID string, opts ...option.RequestOption) (res *CheckTransfer, err error) {
opts = append(r.Options[:], opts...)
if checkTransferID == "" {
err = errors.New("missing required check_transfer_id parameter")
return
}
path := fmt.Sprintf("check_transfers/%s/approve", checkTransferID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return
}
// Cancel a pending Check Transfer
func (r *CheckTransferService) Cancel(ctx context.Context, checkTransferID string, opts ...option.RequestOption) (res *CheckTransfer, err error) {
opts = append(r.Options[:], opts...)
if checkTransferID == "" {
err = errors.New("missing required check_transfer_id parameter")
return
}
path := fmt.Sprintf("check_transfers/%s/cancel", checkTransferID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return
}
// Request a stop payment on a Check Transfer
func (r *CheckTransferService) StopPayment(ctx context.Context, checkTransferID string, body CheckTransferStopPaymentParams, opts ...option.RequestOption) (res *CheckTransfer, err error) {
opts = append(r.Options[:], opts...)
if checkTransferID == "" {
err = errors.New("missing required check_transfer_id parameter")
return
}
path := fmt.Sprintf("check_transfers/%s/stop_payment", checkTransferID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Check Transfers move funds from your Increase account by mailing a physical
// check.
type CheckTransfer struct {
// The Check transfer's identifier.
ID string `json:"id,required"`
// The identifier of the Account from which funds will be transferred.
AccountID string `json:"account_id,required"`
// The account number printed on the check.
AccountNumber string `json:"account_number,required"`
// The transfer amount in USD cents.
Amount int64 `json:"amount,required"`
// If your account requires approvals for transfers and the transfer was approved,
// this will contain details of the approval.
Approval CheckTransferApproval `json:"approval,required,nullable"`
// If the Check Transfer was successfully deposited, this will contain the
// identifier of the Inbound Check Deposit object with details of the deposit.
ApprovedInboundCheckDepositID string `json:"approved_inbound_check_deposit_id,required,nullable"`
// If your account requires approvals for transfers and the transfer was not
// approved, this will contain details of the cancellation.
Cancellation CheckTransferCancellation `json:"cancellation,required,nullable"`
// The check number printed on the check.
CheckNumber string `json:"check_number,required"`
// 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,required" format:"date-time"`
// What object created the transfer, either via the API or the dashboard.
CreatedBy CheckTransferCreatedBy `json:"created_by,required,nullable"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's
// currency.
Currency CheckTransferCurrency `json:"currency,required"`
// Whether Increase will print and mail the check or if you will do it yourself.
FulfillmentMethod CheckTransferFulfillmentMethod `json:"fulfillment_method,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,required,nullable"`
// If the check has been mailed by Increase, this will contain details of the
// shipment.
Mailing CheckTransferMailing `json:"mailing,required,nullable"`
// The ID for the pending transaction representing the transfer. A pending
// transaction is created when the transfer
// [requires approval](https://increase.com/documentation/transfer-approvals#transfer-approvals)
// by someone else in your organization.
PendingTransactionID string `json:"pending_transaction_id,required,nullable"`
// Details relating to the physical check that Increase will print and mail. Will
// be present if and only if `fulfillment_method` is equal to `physical_check`.
PhysicalCheck CheckTransferPhysicalCheck `json:"physical_check,required,nullable"`
// The routing number printed on the check.
RoutingNumber string `json:"routing_number,required"`
// The identifier of the Account Number from which to send the transfer and print
// on the check.
SourceAccountNumberID string `json:"source_account_number_id,required,nullable"`
// The lifecycle status of the transfer.
Status CheckTransferStatus `json:"status,required"`
// After a stop-payment is requested on the check, this will contain supplemental
// details.
StopPaymentRequest CheckTransferStopPaymentRequest `json:"stop_payment_request,required,nullable"`
// After the transfer is submitted, this will contain supplemental details.
Submission CheckTransferSubmission `json:"submission,required,nullable"`
// Details relating to the custom fulfillment you will perform. Will be present if
// and only if `fulfillment_method` is equal to `third_party`.
ThirdParty CheckTransferThirdParty `json:"third_party,required,nullable"`
// A constant representing the object's type. For this resource it will always be
// `check_transfer`.
Type CheckTransferType `json:"type,required"`
JSON checkTransferJSON `json:"-"`
}
// checkTransferJSON contains the JSON metadata for the struct [CheckTransfer]
type checkTransferJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountNumber apijson.Field
Amount apijson.Field
Approval apijson.Field
ApprovedInboundCheckDepositID apijson.Field
Cancellation apijson.Field
CheckNumber apijson.Field
CreatedAt apijson.Field
CreatedBy apijson.Field
Currency apijson.Field
FulfillmentMethod apijson.Field
IdempotencyKey apijson.Field
Mailing apijson.Field
PendingTransactionID apijson.Field
PhysicalCheck apijson.Field
RoutingNumber apijson.Field
SourceAccountNumberID apijson.Field
Status apijson.Field
StopPaymentRequest apijson.Field
Submission apijson.Field
ThirdParty apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransfer) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferJSON) RawJSON() string {
return r.raw
}
// If your account requires approvals for transfers and the transfer was approved,
// this will contain details of the approval.
type CheckTransferApproval struct {
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the transfer was approved.
ApprovedAt time.Time `json:"approved_at,required" format:"date-time"`
// If the Transfer was approved by a user in the dashboard, the email address of
// that user.
ApprovedBy string `json:"approved_by,required,nullable"`
JSON checkTransferApprovalJSON `json:"-"`
}
// checkTransferApprovalJSON contains the JSON metadata for the struct
// [CheckTransferApproval]
type checkTransferApprovalJSON struct {
ApprovedAt apijson.Field
ApprovedBy apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferApproval) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferApprovalJSON) RawJSON() string {
return r.raw
}
// If your account requires approvals for transfers and the transfer was not
// approved, this will contain details of the cancellation.
type CheckTransferCancellation struct {
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the Transfer was canceled.
CanceledAt time.Time `json:"canceled_at,required" format:"date-time"`
// If the Transfer was canceled by a user in the dashboard, the email address of
// that user.
CanceledBy string `json:"canceled_by,required,nullable"`
JSON checkTransferCancellationJSON `json:"-"`
}
// checkTransferCancellationJSON contains the JSON metadata for the struct
// [CheckTransferCancellation]
type checkTransferCancellationJSON struct {
CanceledAt apijson.Field
CanceledBy apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferCancellation) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferCancellationJSON) RawJSON() string {
return r.raw
}
// What object created the transfer, either via the API or the dashboard.
type CheckTransferCreatedBy struct {
// If present, details about the API key that created the transfer.
APIKey CheckTransferCreatedByAPIKey `json:"api_key,required,nullable"`
// The type of object that created this transfer.
Category CheckTransferCreatedByCategory `json:"category,required"`
// If present, details about the OAuth Application that created the transfer.
OAuthApplication CheckTransferCreatedByOAuthApplication `json:"oauth_application,required,nullable"`
// If present, details about the User that created the transfer.
User CheckTransferCreatedByUser `json:"user,required,nullable"`
JSON checkTransferCreatedByJSON `json:"-"`
}
// checkTransferCreatedByJSON contains the JSON metadata for the struct
// [CheckTransferCreatedBy]
type checkTransferCreatedByJSON struct {
APIKey apijson.Field
Category apijson.Field
OAuthApplication apijson.Field
User apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferCreatedBy) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferCreatedByJSON) RawJSON() string {
return r.raw
}
// If present, details about the API key that created the transfer.
type CheckTransferCreatedByAPIKey struct {
// The description set for the API key when it was created.
Description string `json:"description,required,nullable"`
JSON checkTransferCreatedByAPIKeyJSON `json:"-"`
}
// checkTransferCreatedByAPIKeyJSON contains the JSON metadata for the struct
// [CheckTransferCreatedByAPIKey]
type checkTransferCreatedByAPIKeyJSON struct {
Description apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferCreatedByAPIKey) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferCreatedByAPIKeyJSON) RawJSON() string {
return r.raw
}
// The type of object that created this transfer.
type CheckTransferCreatedByCategory string
const (
// An API key. Details will be under the `api_key` object.
CheckTransferCreatedByCategoryAPIKey CheckTransferCreatedByCategory = "api_key"
// An OAuth application you connected to Increase. Details will be under the
// `oauth_application` object.
CheckTransferCreatedByCategoryOAuthApplication CheckTransferCreatedByCategory = "oauth_application"
// A User in the Increase dashboard. Details will be under the `user` object.
CheckTransferCreatedByCategoryUser CheckTransferCreatedByCategory = "user"
)
func (r CheckTransferCreatedByCategory) IsKnown() bool {
switch r {
case CheckTransferCreatedByCategoryAPIKey, CheckTransferCreatedByCategoryOAuthApplication, CheckTransferCreatedByCategoryUser:
return true
}
return false
}
// If present, details about the OAuth Application that created the transfer.
type CheckTransferCreatedByOAuthApplication struct {
// The name of the OAuth Application.
Name string `json:"name,required"`
JSON checkTransferCreatedByOAuthApplicationJSON `json:"-"`
}
// checkTransferCreatedByOAuthApplicationJSON contains the JSON metadata for the
// struct [CheckTransferCreatedByOAuthApplication]
type checkTransferCreatedByOAuthApplicationJSON struct {
Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferCreatedByOAuthApplication) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferCreatedByOAuthApplicationJSON) RawJSON() string {
return r.raw
}
// If present, details about the User that created the transfer.
type CheckTransferCreatedByUser struct {
// The email address of the User.
Email string `json:"email,required"`
JSON checkTransferCreatedByUserJSON `json:"-"`
}
// checkTransferCreatedByUserJSON contains the JSON metadata for the struct
// [CheckTransferCreatedByUser]
type checkTransferCreatedByUserJSON struct {
Email apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferCreatedByUser) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferCreatedByUserJSON) RawJSON() string {
return r.raw
}
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's
// currency.
type CheckTransferCurrency string
const (
// Canadian Dollar (CAD)
CheckTransferCurrencyCad CheckTransferCurrency = "CAD"
// Swiss Franc (CHF)
CheckTransferCurrencyChf CheckTransferCurrency = "CHF"
// Euro (EUR)
CheckTransferCurrencyEur CheckTransferCurrency = "EUR"
// British Pound (GBP)
CheckTransferCurrencyGbp CheckTransferCurrency = "GBP"
// Japanese Yen (JPY)
CheckTransferCurrencyJpy CheckTransferCurrency = "JPY"
// US Dollar (USD)
CheckTransferCurrencyUsd CheckTransferCurrency = "USD"
)
func (r CheckTransferCurrency) IsKnown() bool {
switch r {
case CheckTransferCurrencyCad, CheckTransferCurrencyChf, CheckTransferCurrencyEur, CheckTransferCurrencyGbp, CheckTransferCurrencyJpy, CheckTransferCurrencyUsd:
return true
}
return false
}
// Whether Increase will print and mail the check or if you will do it yourself.
type CheckTransferFulfillmentMethod string
const (
// Increase will print and mail a physical check.
CheckTransferFulfillmentMethodPhysicalCheck CheckTransferFulfillmentMethod = "physical_check"
// Increase will not print a check; you are responsible for printing and mailing a
// check with the provided account number, routing number, check number, and
// amount.
CheckTransferFulfillmentMethodThirdParty CheckTransferFulfillmentMethod = "third_party"
)
func (r CheckTransferFulfillmentMethod) IsKnown() bool {
switch r {
case CheckTransferFulfillmentMethodPhysicalCheck, CheckTransferFulfillmentMethodThirdParty:
return true
}
return false
}
// If the check has been mailed by Increase, this will contain details of the
// shipment.
type CheckTransferMailing struct {
// The ID of the file corresponding to an image of the check that was mailed, if
// available.
ImageID string `json:"image_id,required,nullable"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the check was mailed.
MailedAt time.Time `json:"mailed_at,required" format:"date-time"`
JSON checkTransferMailingJSON `json:"-"`
}
// checkTransferMailingJSON contains the JSON metadata for the struct
// [CheckTransferMailing]
type checkTransferMailingJSON struct {
ImageID apijson.Field
MailedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferMailing) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferMailingJSON) RawJSON() string {
return r.raw
}
// Details relating to the physical check that Increase will print and mail. Will
// be present if and only if `fulfillment_method` is equal to `physical_check`.
type CheckTransferPhysicalCheck struct {
// Details for where Increase will mail the check.
MailingAddress CheckTransferPhysicalCheckMailingAddress `json:"mailing_address,required"`
// The descriptor that will be printed on the memo field on the check.
Memo string `json:"memo,required,nullable"`
// The descriptor that will be printed on the letter included with the check.
Note string `json:"note,required,nullable"`
// The name that will be printed on the check.
RecipientName string `json:"recipient_name,required"`
// The return address to be printed on the check.
ReturnAddress CheckTransferPhysicalCheckReturnAddress `json:"return_address,required,nullable"`
// The text that will appear as the signature on the check in cursive font. If
// blank, the check will be printed with 'No signature required'.
SignatureText string `json:"signature_text,required,nullable"`
JSON checkTransferPhysicalCheckJSON `json:"-"`
}
// checkTransferPhysicalCheckJSON contains the JSON metadata for the struct
// [CheckTransferPhysicalCheck]
type checkTransferPhysicalCheckJSON struct {
MailingAddress apijson.Field
Memo apijson.Field
Note apijson.Field
RecipientName apijson.Field
ReturnAddress apijson.Field
SignatureText apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferPhysicalCheck) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferPhysicalCheckJSON) RawJSON() string {
return r.raw
}
// Details for where Increase will mail the check.
type CheckTransferPhysicalCheckMailingAddress struct {
// The city of the check's destination.
City string `json:"city,required,nullable"`
// The street address of the check's destination.
Line1 string `json:"line1,required,nullable"`
// The second line of the address of the check's destination.
Line2 string `json:"line2,required,nullable"`
// The name component of the check's mailing address.
Name string `json:"name,required,nullable"`
// The postal code of the check's destination.
PostalCode string `json:"postal_code,required,nullable"`
// The state of the check's destination.
State string `json:"state,required,nullable"`
JSON checkTransferPhysicalCheckMailingAddressJSON `json:"-"`
}
// checkTransferPhysicalCheckMailingAddressJSON contains the JSON metadata for the
// struct [CheckTransferPhysicalCheckMailingAddress]
type checkTransferPhysicalCheckMailingAddressJSON struct {
City apijson.Field
Line1 apijson.Field
Line2 apijson.Field
Name apijson.Field
PostalCode apijson.Field
State apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferPhysicalCheckMailingAddress) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferPhysicalCheckMailingAddressJSON) RawJSON() string {
return r.raw
}
// The return address to be printed on the check.
type CheckTransferPhysicalCheckReturnAddress struct {
// The city of the check's destination.
City string `json:"city,required,nullable"`
// The street address of the check's destination.
Line1 string `json:"line1,required,nullable"`
// The second line of the address of the check's destination.
Line2 string `json:"line2,required,nullable"`
// The name component of the check's return address.
Name string `json:"name,required,nullable"`
// The postal code of the check's destination.
PostalCode string `json:"postal_code,required,nullable"`
// The state of the check's destination.
State string `json:"state,required,nullable"`
JSON checkTransferPhysicalCheckReturnAddressJSON `json:"-"`
}
// checkTransferPhysicalCheckReturnAddressJSON contains the JSON metadata for the
// struct [CheckTransferPhysicalCheckReturnAddress]
type checkTransferPhysicalCheckReturnAddressJSON struct {
City apijson.Field
Line1 apijson.Field
Line2 apijson.Field
Name apijson.Field
PostalCode apijson.Field
State apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferPhysicalCheckReturnAddress) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferPhysicalCheckReturnAddressJSON) RawJSON() string {
return r.raw
}
// The lifecycle status of the transfer.
type CheckTransferStatus string
const (
// The transfer is awaiting approval.
CheckTransferStatusPendingApproval CheckTransferStatus = "pending_approval"
// The transfer is pending submission.
CheckTransferStatusPendingSubmission CheckTransferStatus = "pending_submission"
// The check is queued for mailing.
CheckTransferStatusPendingMailing CheckTransferStatus = "pending_mailing"
// The check has been mailed.
CheckTransferStatusMailed CheckTransferStatus = "mailed"
// The transfer has been canceled.
CheckTransferStatusCanceled CheckTransferStatus = "canceled"
// The check has been deposited.
CheckTransferStatusDeposited CheckTransferStatus = "deposited"
// A stop-payment was requested for this check.
CheckTransferStatusStopped CheckTransferStatus = "stopped"
// The transfer has been rejected.
CheckTransferStatusRejected CheckTransferStatus = "rejected"
// The transfer requires attention from an Increase operator.
CheckTransferStatusRequiresAttention CheckTransferStatus = "requires_attention"
// The transfer has been returned.
CheckTransferStatusReturned CheckTransferStatus = "returned"
)
func (r CheckTransferStatus) IsKnown() bool {
switch r {
case CheckTransferStatusPendingApproval, CheckTransferStatusPendingSubmission, CheckTransferStatusPendingMailing, CheckTransferStatusMailed, CheckTransferStatusCanceled, CheckTransferStatusDeposited, CheckTransferStatusStopped, CheckTransferStatusRejected, CheckTransferStatusRequiresAttention, CheckTransferStatusReturned:
return true
}
return false
}
// After a stop-payment is requested on the check, this will contain supplemental
// details.
type CheckTransferStopPaymentRequest struct {
// The reason why this transfer was stopped.
Reason CheckTransferStopPaymentRequestReason `json:"reason,required"`
// The time the stop-payment was requested.
RequestedAt time.Time `json:"requested_at,required" format:"date-time"`
// The ID of the check transfer that was stopped.
TransferID string `json:"transfer_id,required"`
// A constant representing the object's type. For this resource it will always be
// `check_transfer_stop_payment_request`.
Type CheckTransferStopPaymentRequestType `json:"type,required"`
JSON checkTransferStopPaymentRequestJSON `json:"-"`
}
// checkTransferStopPaymentRequestJSON contains the JSON metadata for the struct
// [CheckTransferStopPaymentRequest]
type checkTransferStopPaymentRequestJSON struct {
Reason apijson.Field
RequestedAt apijson.Field
TransferID apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferStopPaymentRequest) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferStopPaymentRequestJSON) RawJSON() string {
return r.raw
}
// The reason why this transfer was stopped.
type CheckTransferStopPaymentRequestReason string
const (
// The check could not be delivered.
CheckTransferStopPaymentRequestReasonMailDeliveryFailed CheckTransferStopPaymentRequestReason = "mail_delivery_failed"
// The check was canceled by an Increase operator who will provide details
// out-of-band.
CheckTransferStopPaymentRequestReasonRejectedByIncrease CheckTransferStopPaymentRequestReason = "rejected_by_increase"
// The check was not authorized.
CheckTransferStopPaymentRequestReasonNotAuthorized CheckTransferStopPaymentRequestReason = "not_authorized"
// The check was stopped for another reason.
CheckTransferStopPaymentRequestReasonUnknown CheckTransferStopPaymentRequestReason = "unknown"
)
func (r CheckTransferStopPaymentRequestReason) IsKnown() bool {
switch r {
case CheckTransferStopPaymentRequestReasonMailDeliveryFailed, CheckTransferStopPaymentRequestReasonRejectedByIncrease, CheckTransferStopPaymentRequestReasonNotAuthorized, CheckTransferStopPaymentRequestReasonUnknown:
return true
}
return false
}
// A constant representing the object's type. For this resource it will always be
// `check_transfer_stop_payment_request`.
type CheckTransferStopPaymentRequestType string
const (
CheckTransferStopPaymentRequestTypeCheckTransferStopPaymentRequest CheckTransferStopPaymentRequestType = "check_transfer_stop_payment_request"
)
func (r CheckTransferStopPaymentRequestType) IsKnown() bool {
switch r {
case CheckTransferStopPaymentRequestTypeCheckTransferStopPaymentRequest:
return true
}
return false
}
// After the transfer is submitted, this will contain supplemental details.
type CheckTransferSubmission struct {
// When this check transfer was submitted to our check printer.
SubmittedAt time.Time `json:"submitted_at,required" format:"date-time"`
JSON checkTransferSubmissionJSON `json:"-"`
}
// checkTransferSubmissionJSON contains the JSON metadata for the struct
// [CheckTransferSubmission]
type checkTransferSubmissionJSON struct {
SubmittedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferSubmission) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferSubmissionJSON) RawJSON() string {
return r.raw
}
// Details relating to the custom fulfillment you will perform. Will be present if
// and only if `fulfillment_method` is equal to `third_party`.
type CheckTransferThirdParty struct {
// The check number that will be printed on the check.
CheckNumber string `json:"check_number,required,nullable"`
JSON checkTransferThirdPartyJSON `json:"-"`
}
// checkTransferThirdPartyJSON contains the JSON metadata for the struct
// [CheckTransferThirdParty]
type checkTransferThirdPartyJSON struct {
CheckNumber apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferThirdParty) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferThirdPartyJSON) RawJSON() string {
return r.raw
}
// A constant representing the object's type. For this resource it will always be
// `check_transfer`.
type CheckTransferType string
const (
CheckTransferTypeCheckTransfer CheckTransferType = "check_transfer"
)
func (r CheckTransferType) IsKnown() bool {
switch r {
case CheckTransferTypeCheckTransfer:
return true
}
return false
}
type CheckTransferNewParams struct {
// The identifier for the account that will send the transfer.
AccountID param.Field[string] `json:"account_id,required"`
// The transfer amount in cents.
Amount param.Field[int64] `json:"amount,required"`
// The identifier of the Account Number from which to send the transfer and print
// on the check.
SourceAccountNumberID param.Field[string] `json:"source_account_number_id,required"`
// Whether Increase will print and mail the check or if you will do it yourself.
FulfillmentMethod param.Field[CheckTransferNewParamsFulfillmentMethod] `json:"fulfillment_method"`
// Details relating to the physical check that Increase will print and mail. This
// is required if `fulfillment_method` is equal to `physical_check`. It must not be
// included if any other `fulfillment_method` is provided.
PhysicalCheck param.Field[CheckTransferNewParamsPhysicalCheck] `json:"physical_check"`
// Whether the transfer requires explicit approval via the dashboard or API.
RequireApproval param.Field[bool] `json:"require_approval"`
// Details relating to the custom fulfillment you will perform. This is required if
// `fulfillment_method` is equal to `third_party`. It must not be included if any
// other `fulfillment_method` is provided.
ThirdParty param.Field[CheckTransferNewParamsThirdParty] `json:"third_party"`
}
func (r CheckTransferNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Whether Increase will print and mail the check or if you will do it yourself.
type CheckTransferNewParamsFulfillmentMethod string
const (
// Increase will print and mail a physical check.
CheckTransferNewParamsFulfillmentMethodPhysicalCheck CheckTransferNewParamsFulfillmentMethod = "physical_check"
// Increase will not print a check; you are responsible for printing and mailing a
// check with the provided account number, routing number, check number, and
// amount.
CheckTransferNewParamsFulfillmentMethodThirdParty CheckTransferNewParamsFulfillmentMethod = "third_party"
)
func (r CheckTransferNewParamsFulfillmentMethod) IsKnown() bool {
switch r {
case CheckTransferNewParamsFulfillmentMethodPhysicalCheck, CheckTransferNewParamsFulfillmentMethodThirdParty:
return true
}
return false
}
// Details relating to the physical check that Increase will print and mail. This
// is required if `fulfillment_method` is equal to `physical_check`. It must not be
// included if any other `fulfillment_method` is provided.
type CheckTransferNewParamsPhysicalCheck struct {
// Details for where Increase will mail the check.
MailingAddress param.Field[CheckTransferNewParamsPhysicalCheckMailingAddress] `json:"mailing_address,required"`
// The descriptor that will be printed on the memo field on the check.
Memo param.Field[string] `json:"memo,required"`
// The name that will be printed on the check in the 'To:' field.
RecipientName param.Field[string] `json:"recipient_name,required"`
// The descriptor that will be printed on the letter included with the check.
Note param.Field[string] `json:"note"`
// The return address to be printed on the check. If omitted this will default to
// the address of the Entity of the Account used to make the Check Transfer.
ReturnAddress param.Field[CheckTransferNewParamsPhysicalCheckReturnAddress] `json:"return_address"`
// The text that will appear as the signature on the check in cursive font. If not
// provided, the check will be printed with 'No signature required'.
SignatureText param.Field[string] `json:"signature_text"`
}
func (r CheckTransferNewParamsPhysicalCheck) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Details for where Increase will mail the check.
type CheckTransferNewParamsPhysicalCheckMailingAddress struct {
// The city component of the check's destination address.
City param.Field[string] `json:"city,required"`
// The first line of the address component of the check's destination address.
Line1 param.Field[string] `json:"line1,required"`
// The postal code component of the check's destination address.
PostalCode param.Field[string] `json:"postal_code,required"`
// The US state component of the check's destination address.
State param.Field[string] `json:"state,required"`
// The second line of the address component of the check's destination address.
Line2 param.Field[string] `json:"line2"`
// The name component of the check's destination address. Defaults to the provided
// `recipient_name` parameter.
Name param.Field[string] `json:"name"`
}
func (r CheckTransferNewParamsPhysicalCheckMailingAddress) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The return address to be printed on the check. If omitted this will default to
// the address of the Entity of the Account used to make the Check Transfer.
type CheckTransferNewParamsPhysicalCheckReturnAddress struct {
// The city of the return address.
City param.Field[string] `json:"city,required"`
// The first line of the return address.
Line1 param.Field[string] `json:"line1,required"`
// The name of the return address.
Name param.Field[string] `json:"name,required"`
// The postal code of the return address.
PostalCode param.Field[string] `json:"postal_code,required"`
// The US state of the return address.
State param.Field[string] `json:"state,required"`
// The second line of the return address.
Line2 param.Field[string] `json:"line2"`
}
func (r CheckTransferNewParamsPhysicalCheckReturnAddress) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Details relating to the custom fulfillment you will perform. This is required if
// `fulfillment_method` is equal to `third_party`. It must not be included if any
// other `fulfillment_method` is provided.
type CheckTransferNewParamsThirdParty struct {
// The check number you will print on the check. This should not contain leading
// zeroes. If this is omitted, Increase will generate a check number for you; you
// should inspect the response and use that check number.
CheckNumber param.Field[string] `json:"check_number"`
}
func (r CheckTransferNewParamsThirdParty) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CheckTransferListParams struct {
// Filter Check Transfers to those that originated from the specified Account.
AccountID param.Field[string] `query:"account_id"`
CreatedAt param.Field[CheckTransferListParamsCreatedAt] `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 [CheckTransferListParams]'s query parameters as
// `url.Values`.
func (r CheckTransferListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatDots,
})
}
type CheckTransferListParamsCreatedAt 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 [CheckTransferListParamsCreatedAt]'s query parameters as
// `url.Values`.
func (r CheckTransferListParamsCreatedAt) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatDots,
})
}
type CheckTransferStopPaymentParams struct {
// The reason why this transfer should be stopped.
Reason param.Field[CheckTransferStopPaymentParamsReason] `json:"reason"`
}
func (r CheckTransferStopPaymentParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The reason why this transfer should be stopped.
type CheckTransferStopPaymentParamsReason string
const (
// The check could not be delivered.
CheckTransferStopPaymentParamsReasonMailDeliveryFailed CheckTransferStopPaymentParamsReason = "mail_delivery_failed"
// The check was not authorized.
CheckTransferStopPaymentParamsReasonNotAuthorized CheckTransferStopPaymentParamsReason = "not_authorized"
// The check was stopped for another reason.
CheckTransferStopPaymentParamsReasonUnknown CheckTransferStopPaymentParamsReason = "unknown"
)
func (r CheckTransferStopPaymentParamsReason) IsKnown() bool {
switch r {
case CheckTransferStopPaymentParamsReasonMailDeliveryFailed, CheckTransferStopPaymentParamsReasonNotAuthorized, CheckTransferStopPaymentParamsReasonUnknown:
return true
}
return false
}