-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecktransfer.go
1144 lines (1008 loc) · 47.5 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
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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/param"
"github.com/Increase/increase-go/internal/requestconfig"
"github.com/Increase/increase-go/option"
"github.com/Increase/increase-go/packages/pagination"
)
// 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 (
CheckTransferCreatedByCategoryAPIKey CheckTransferCreatedByCategory = "api_key"
CheckTransferCreatedByCategoryOAuthApplication CheckTransferCreatedByCategory = "oauth_application"
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 (
CheckTransferCurrencyCad CheckTransferCurrency = "CAD"
CheckTransferCurrencyChf CheckTransferCurrency = "CHF"
CheckTransferCurrencyEur CheckTransferCurrency = "EUR"
CheckTransferCurrencyGbp CheckTransferCurrency = "GBP"
CheckTransferCurrencyJpy CheckTransferCurrency = "JPY"
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 (
CheckTransferFulfillmentMethodPhysicalCheck CheckTransferFulfillmentMethod = "physical_check"
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"`
// The tracking number of the shipment, if available for the shipping method.
TrackingNumber string `json:"tracking_number,required,nullable"`
JSON checkTransferMailingJSON `json:"-"`
}
// checkTransferMailingJSON contains the JSON metadata for the struct
// [CheckTransferMailing]
type checkTransferMailingJSON struct {
ImageID apijson.Field
MailedAt apijson.Field
TrackingNumber 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 {
// The ID of the file for the check attachment.
AttachmentFileID string `json:"attachment_file_id,required,nullable"`
// 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 shipping method for the check.
ShippingMethod CheckTransferPhysicalCheckShippingMethod `json:"shipping_method,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"`
// Tracking updates relating to the physical check's delivery.
TrackingUpdates []CheckTransferPhysicalCheckTrackingUpdate `json:"tracking_updates,required"`
JSON checkTransferPhysicalCheckJSON `json:"-"`
}
// checkTransferPhysicalCheckJSON contains the JSON metadata for the struct
// [CheckTransferPhysicalCheck]
type checkTransferPhysicalCheckJSON struct {
AttachmentFileID apijson.Field
MailingAddress apijson.Field
Memo apijson.Field
Note apijson.Field
RecipientName apijson.Field
ReturnAddress apijson.Field
ShippingMethod apijson.Field
SignatureText apijson.Field
TrackingUpdates 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 shipping method for the check.
type CheckTransferPhysicalCheckShippingMethod string
const (
CheckTransferPhysicalCheckShippingMethodUspsFirstClass CheckTransferPhysicalCheckShippingMethod = "usps_first_class"
CheckTransferPhysicalCheckShippingMethodFedexOvernight CheckTransferPhysicalCheckShippingMethod = "fedex_overnight"
)
func (r CheckTransferPhysicalCheckShippingMethod) IsKnown() bool {
switch r {
case CheckTransferPhysicalCheckShippingMethodUspsFirstClass, CheckTransferPhysicalCheckShippingMethodFedexOvernight:
return true
}
return false
}
type CheckTransferPhysicalCheckTrackingUpdate struct {
// The type of tracking event.
Category CheckTransferPhysicalCheckTrackingUpdatesCategory `json:"category,required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the tracking event took place.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// The postal code where the event took place.
PostalCode string `json:"postal_code,required"`
JSON checkTransferPhysicalCheckTrackingUpdateJSON `json:"-"`
}
// checkTransferPhysicalCheckTrackingUpdateJSON contains the JSON metadata for the
// struct [CheckTransferPhysicalCheckTrackingUpdate]
type checkTransferPhysicalCheckTrackingUpdateJSON struct {
Category apijson.Field
CreatedAt apijson.Field
PostalCode apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferPhysicalCheckTrackingUpdate) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferPhysicalCheckTrackingUpdateJSON) RawJSON() string {
return r.raw
}
// The type of tracking event.
type CheckTransferPhysicalCheckTrackingUpdatesCategory string
const (
CheckTransferPhysicalCheckTrackingUpdatesCategoryInTransit CheckTransferPhysicalCheckTrackingUpdatesCategory = "in_transit"
CheckTransferPhysicalCheckTrackingUpdatesCategoryProcessedForDelivery CheckTransferPhysicalCheckTrackingUpdatesCategory = "processed_for_delivery"
CheckTransferPhysicalCheckTrackingUpdatesCategoryDelivered CheckTransferPhysicalCheckTrackingUpdatesCategory = "delivered"
CheckTransferPhysicalCheckTrackingUpdatesCategoryReturnedToSender CheckTransferPhysicalCheckTrackingUpdatesCategory = "returned_to_sender"
)
func (r CheckTransferPhysicalCheckTrackingUpdatesCategory) IsKnown() bool {
switch r {
case CheckTransferPhysicalCheckTrackingUpdatesCategoryInTransit, CheckTransferPhysicalCheckTrackingUpdatesCategoryProcessedForDelivery, CheckTransferPhysicalCheckTrackingUpdatesCategoryDelivered, CheckTransferPhysicalCheckTrackingUpdatesCategoryReturnedToSender:
return true
}
return false
}
// The lifecycle status of the transfer.
type CheckTransferStatus string
const (
CheckTransferStatusPendingApproval CheckTransferStatus = "pending_approval"
CheckTransferStatusCanceled CheckTransferStatus = "canceled"
CheckTransferStatusPendingSubmission CheckTransferStatus = "pending_submission"
CheckTransferStatusRequiresAttention CheckTransferStatus = "requires_attention"
CheckTransferStatusRejected CheckTransferStatus = "rejected"
CheckTransferStatusPendingMailing CheckTransferStatus = "pending_mailing"
CheckTransferStatusMailed CheckTransferStatus = "mailed"
CheckTransferStatusDeposited CheckTransferStatus = "deposited"
CheckTransferStatusStopped CheckTransferStatus = "stopped"
CheckTransferStatusReturned CheckTransferStatus = "returned"
)
func (r CheckTransferStatus) IsKnown() bool {
switch r {
case CheckTransferStatusPendingApproval, CheckTransferStatusCanceled, CheckTransferStatusPendingSubmission, CheckTransferStatusRequiresAttention, CheckTransferStatusRejected, CheckTransferStatusPendingMailing, CheckTransferStatusMailed, CheckTransferStatusDeposited, CheckTransferStatusStopped, 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 (
CheckTransferStopPaymentRequestReasonMailDeliveryFailed CheckTransferStopPaymentRequestReason = "mail_delivery_failed"
CheckTransferStopPaymentRequestReasonRejectedByIncrease CheckTransferStopPaymentRequestReason = "rejected_by_increase"
CheckTransferStopPaymentRequestReasonNotAuthorized CheckTransferStopPaymentRequestReason = "not_authorized"
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 {
// Per USPS requirements, Increase will standardize the address to USPS standards
// and check it against the USPS National Change of Address (NCOA) database before
// mailing it. This indicates what modifications, if any, were made to the address
// before printing and mailing the check.
AddressCorrectionAction CheckTransferSubmissionAddressCorrectionAction `json:"address_correction_action,required"`
// The address we submitted to the printer. This is what is physically printed on
// the check.
SubmittedAddress CheckTransferSubmissionSubmittedAddress `json:"submitted_address,required"`
// 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 {
AddressCorrectionAction apijson.Field
SubmittedAddress apijson.Field
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
}
// Per USPS requirements, Increase will standardize the address to USPS standards
// and check it against the USPS National Change of Address (NCOA) database before
// mailing it. This indicates what modifications, if any, were made to the address
// before printing and mailing the check.
type CheckTransferSubmissionAddressCorrectionAction string
const (
CheckTransferSubmissionAddressCorrectionActionNone CheckTransferSubmissionAddressCorrectionAction = "none"
CheckTransferSubmissionAddressCorrectionActionStandardization CheckTransferSubmissionAddressCorrectionAction = "standardization"
CheckTransferSubmissionAddressCorrectionActionStandardizationWithAddressChange CheckTransferSubmissionAddressCorrectionAction = "standardization_with_address_change"
CheckTransferSubmissionAddressCorrectionActionError CheckTransferSubmissionAddressCorrectionAction = "error"
)
func (r CheckTransferSubmissionAddressCorrectionAction) IsKnown() bool {
switch r {
case CheckTransferSubmissionAddressCorrectionActionNone, CheckTransferSubmissionAddressCorrectionActionStandardization, CheckTransferSubmissionAddressCorrectionActionStandardizationWithAddressChange, CheckTransferSubmissionAddressCorrectionActionError:
return true
}
return false
}
// The address we submitted to the printer. This is what is physically printed on
// the check.
type CheckTransferSubmissionSubmittedAddress struct {
// The submitted address city.
City string `json:"city,required"`
// The submitted address line 1.
Line1 string `json:"line1,required"`
// The submitted address line 2.
Line2 string `json:"line2,required,nullable"`
// The submitted recipient name.
RecipientName string `json:"recipient_name,required"`
// The submitted address state.
State string `json:"state,required"`
// The submitted address zip.
Zip string `json:"zip,required"`
JSON checkTransferSubmissionSubmittedAddressJSON `json:"-"`
}
// checkTransferSubmissionSubmittedAddressJSON contains the JSON metadata for the
// struct [CheckTransferSubmissionSubmittedAddress]
type checkTransferSubmissionSubmittedAddressJSON struct {
City apijson.Field
Line1 apijson.Field
Line2 apijson.Field
RecipientName apijson.Field
State apijson.Field
Zip apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CheckTransferSubmissionSubmittedAddress) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r checkTransferSubmissionSubmittedAddressJSON) 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 name that you will print on the check.
RecipientName string `json:"recipient_name,required,nullable"`
JSON checkTransferThirdPartyJSON `json:"-"`
}
// checkTransferThirdPartyJSON contains the JSON metadata for the struct
// [CheckTransferThirdParty]
type checkTransferThirdPartyJSON struct {
RecipientName 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 USD cents.
Amount param.Field[int64] `json:"amount,required"`
// Whether Increase will print and mail the check or if you will do it yourself.
FulfillmentMethod param.Field[CheckTransferNewParamsFulfillmentMethod] `json:"fulfillment_method,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"`
// 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 (
CheckTransferNewParamsFulfillmentMethodPhysicalCheck CheckTransferNewParamsFulfillmentMethod = "physical_check"
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 ID of a File to be attached to the check. This must have
// `purpose: check_attachment`. For details on pricing and restrictions, see
// https://increase.com/documentation/originating-checks#printing-checks .
AttachmentFileID param.Field[string] `json:"attachment_file_id"`
// The check number Increase should print on the check. This should not contain
// leading zeroes and must be unique across the `source_account_number`. If this is
// omitted, Increase will generate a check number for you.
CheckNumber param.Field[string] `json:"check_number"`
// 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
// an Increase-owned address that will mark checks as delivery failed and shred
// them.
ReturnAddress param.Field[CheckTransferNewParamsPhysicalCheckReturnAddress] `json:"return_address"`
// How to ship the check. For details on pricing, timing, and restrictions, see
// https://increase.com/documentation/originating-checks#printing-checks .
ShippingMethod param.Field[CheckTransferNewParamsPhysicalCheckShippingMethod] `json:"shipping_method"`
// 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"`
}
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
// an Increase-owned address that will mark checks as delivery failed and shred
// them.
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)
}
// How to ship the check. For details on pricing, timing, and restrictions, see