-
Notifications
You must be signed in to change notification settings - Fork 2
/
externalaccount.go
1209 lines (1077 loc) · 71.4 KB
/
externalaccount.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 moderntreasury
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"reflect"
"time"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apijson"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apiquery"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/param"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/requestconfig"
"github.com/Modern-Treasury/modern-treasury-go/v2/option"
"github.com/Modern-Treasury/modern-treasury-go/v2/packages/pagination"
"github.com/Modern-Treasury/modern-treasury-go/v2/shared"
"github.com/tidwall/gjson"
)
// ExternalAccountService contains methods and other services that help with
// interacting with the Modern Treasury 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 [NewExternalAccountService] method instead.
type ExternalAccountService struct {
Options []option.RequestOption
}
// NewExternalAccountService 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 NewExternalAccountService(opts ...option.RequestOption) (r *ExternalAccountService) {
r = &ExternalAccountService{}
r.Options = opts
return
}
// create external account
func (r *ExternalAccountService) New(ctx context.Context, body ExternalAccountNewParams, opts ...option.RequestOption) (res *ExternalAccount, err error) {
opts = append(r.Options[:], opts...)
path := "api/external_accounts"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// show external account
func (r *ExternalAccountService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ExternalAccount, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/external_accounts/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// update external account
func (r *ExternalAccountService) Update(ctx context.Context, id string, body ExternalAccountUpdateParams, opts ...option.RequestOption) (res *ExternalAccount, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/external_accounts/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// list external accounts
func (r *ExternalAccountService) List(ctx context.Context, query ExternalAccountListParams, opts ...option.RequestOption) (res *pagination.Page[ExternalAccount], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "api/external_accounts"
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 external accounts
func (r *ExternalAccountService) ListAutoPaging(ctx context.Context, query ExternalAccountListParams, opts ...option.RequestOption) *pagination.PageAutoPager[ExternalAccount] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// delete external account
func (r *ExternalAccountService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/external_accounts/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return
}
// complete verification of external account
func (r *ExternalAccountService) CompleteVerification(ctx context.Context, id string, body ExternalAccountCompleteVerificationParams, opts ...option.RequestOption) (res *ExternalAccount, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/external_accounts/%s/complete_verification", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// verify external account
func (r *ExternalAccountService) Verify(ctx context.Context, id string, body ExternalAccountVerifyParams, opts ...option.RequestOption) (res *ExternalAccountVerifyResponse, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/external_accounts/%s/verify", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
type ExternalAccount struct {
ID string `json:"id,required" format:"uuid"`
AccountDetails []AccountDetail `json:"account_details,required"`
// Can be `checking`, `savings` or `other`.
AccountType ExternalAccountType `json:"account_type,required"`
ContactDetails []ExternalAccountContactDetail `json:"contact_details,required"`
CounterpartyID string `json:"counterparty_id,required,nullable" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
// If the external account links to a ledger account in Modern Treasury, the id of
// the ledger account will be populated here.
LedgerAccountID string `json:"ledger_account_id,required,nullable" format:"uuid"`
// This field will be true if this object exists in the live environment or false
// if it exists in the test environment.
LiveMode bool `json:"live_mode,required"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata map[string]string `json:"metadata,required"`
// A nickname for the external account. This is only for internal usage and won't
// affect any payments
Name string `json:"name,required,nullable"`
Object string `json:"object,required"`
// The address associated with the owner or `null`.
PartyAddress ExternalAccountPartyAddress `json:"party_address,required,nullable"`
// The legal name of the entity which owns the account.
PartyName string `json:"party_name,required"`
// Either `individual` or `business`.
PartyType ExternalAccountPartyType `json:"party_type,required,nullable"`
RoutingDetails []RoutingDetail `json:"routing_details,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
VerificationSource ExternalAccountVerificationSource `json:"verification_source,required,nullable"`
VerificationStatus ExternalAccountVerificationStatus `json:"verification_status,required"`
JSON externalAccountJSON `json:"-"`
}
// externalAccountJSON contains the JSON metadata for the struct [ExternalAccount]
type externalAccountJSON struct {
ID apijson.Field
AccountDetails apijson.Field
AccountType apijson.Field
ContactDetails apijson.Field
CounterpartyID apijson.Field
CreatedAt apijson.Field
DiscardedAt apijson.Field
LedgerAccountID apijson.Field
LiveMode apijson.Field
Metadata apijson.Field
Name apijson.Field
Object apijson.Field
PartyAddress apijson.Field
PartyName apijson.Field
PartyType apijson.Field
RoutingDetails apijson.Field
UpdatedAt apijson.Field
VerificationSource apijson.Field
VerificationStatus apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExternalAccount) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r externalAccountJSON) RawJSON() string {
return r.raw
}
func (r ExternalAccount) implementsExternalAccountVerifyResponse() {}
type ExternalAccountContactDetail struct {
ID string `json:"id,required" format:"uuid"`
ContactIdentifier string `json:"contact_identifier,required"`
ContactIdentifierType ExternalAccountContactDetailsContactIdentifierType `json:"contact_identifier_type,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
// This field will be true if this object exists in the live environment or false
// if it exists in the test environment.
LiveMode bool `json:"live_mode,required"`
Object string `json:"object,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON externalAccountContactDetailJSON `json:"-"`
}
// externalAccountContactDetailJSON contains the JSON metadata for the struct
// [ExternalAccountContactDetail]
type externalAccountContactDetailJSON struct {
ID apijson.Field
ContactIdentifier apijson.Field
ContactIdentifierType apijson.Field
CreatedAt apijson.Field
DiscardedAt apijson.Field
LiveMode apijson.Field
Object apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExternalAccountContactDetail) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r externalAccountContactDetailJSON) RawJSON() string {
return r.raw
}
type ExternalAccountContactDetailsContactIdentifierType string
const (
ExternalAccountContactDetailsContactIdentifierTypeEmail ExternalAccountContactDetailsContactIdentifierType = "email"
ExternalAccountContactDetailsContactIdentifierTypePhoneNumber ExternalAccountContactDetailsContactIdentifierType = "phone_number"
ExternalAccountContactDetailsContactIdentifierTypeWebsite ExternalAccountContactDetailsContactIdentifierType = "website"
)
func (r ExternalAccountContactDetailsContactIdentifierType) IsKnown() bool {
switch r {
case ExternalAccountContactDetailsContactIdentifierTypeEmail, ExternalAccountContactDetailsContactIdentifierTypePhoneNumber, ExternalAccountContactDetailsContactIdentifierTypeWebsite:
return true
}
return false
}
// The address associated with the owner or `null`.
type ExternalAccountPartyAddress struct {
ID string `json:"id,required" format:"uuid"`
// Country code conforms to [ISO 3166-1 alpha-2]
Country string `json:"country,required,nullable"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Line1 string `json:"line1,required,nullable"`
Line2 string `json:"line2,required,nullable"`
// This field will be true if this object exists in the live environment or false
// if it exists in the test environment.
LiveMode bool `json:"live_mode,required"`
// Locality or City.
Locality string `json:"locality,required,nullable"`
Object string `json:"object,required"`
// The postal code of the address.
PostalCode string `json:"postal_code,required,nullable"`
// Region or State.
Region string `json:"region,required,nullable"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON externalAccountPartyAddressJSON `json:"-"`
}
// externalAccountPartyAddressJSON contains the JSON metadata for the struct
// [ExternalAccountPartyAddress]
type externalAccountPartyAddressJSON struct {
ID apijson.Field
Country apijson.Field
CreatedAt apijson.Field
Line1 apijson.Field
Line2 apijson.Field
LiveMode apijson.Field
Locality apijson.Field
Object apijson.Field
PostalCode apijson.Field
Region apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExternalAccountPartyAddress) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r externalAccountPartyAddressJSON) RawJSON() string {
return r.raw
}
// Either `individual` or `business`.
type ExternalAccountPartyType string
const (
ExternalAccountPartyTypeBusiness ExternalAccountPartyType = "business"
ExternalAccountPartyTypeIndividual ExternalAccountPartyType = "individual"
)
func (r ExternalAccountPartyType) IsKnown() bool {
switch r {
case ExternalAccountPartyTypeBusiness, ExternalAccountPartyTypeIndividual:
return true
}
return false
}
type ExternalAccountVerificationSource string
const (
ExternalAccountVerificationSourceACHPrenote ExternalAccountVerificationSource = "ach_prenote"
ExternalAccountVerificationSourceMicrodeposits ExternalAccountVerificationSource = "microdeposits"
ExternalAccountVerificationSourcePlaid ExternalAccountVerificationSource = "plaid"
)
func (r ExternalAccountVerificationSource) IsKnown() bool {
switch r {
case ExternalAccountVerificationSourceACHPrenote, ExternalAccountVerificationSourceMicrodeposits, ExternalAccountVerificationSourcePlaid:
return true
}
return false
}
type ExternalAccountVerificationStatus string
const (
ExternalAccountVerificationStatusPendingVerification ExternalAccountVerificationStatus = "pending_verification"
ExternalAccountVerificationStatusUnverified ExternalAccountVerificationStatus = "unverified"
ExternalAccountVerificationStatusVerified ExternalAccountVerificationStatus = "verified"
)
func (r ExternalAccountVerificationStatus) IsKnown() bool {
switch r {
case ExternalAccountVerificationStatusPendingVerification, ExternalAccountVerificationStatusUnverified, ExternalAccountVerificationStatusVerified:
return true
}
return false
}
// Can be `checking`, `savings` or `other`.
type ExternalAccountType string
const (
ExternalAccountTypeCash ExternalAccountType = "cash"
ExternalAccountTypeChecking ExternalAccountType = "checking"
ExternalAccountTypeGeneralLedger ExternalAccountType = "general_ledger"
ExternalAccountTypeLoan ExternalAccountType = "loan"
ExternalAccountTypeNonResident ExternalAccountType = "non_resident"
ExternalAccountTypeOther ExternalAccountType = "other"
ExternalAccountTypeOverdraft ExternalAccountType = "overdraft"
ExternalAccountTypeSavings ExternalAccountType = "savings"
)
func (r ExternalAccountType) IsKnown() bool {
switch r {
case ExternalAccountTypeCash, ExternalAccountTypeChecking, ExternalAccountTypeGeneralLedger, ExternalAccountTypeLoan, ExternalAccountTypeNonResident, ExternalAccountTypeOther, ExternalAccountTypeOverdraft, ExternalAccountTypeSavings:
return true
}
return false
}
type ExternalAccountVerifyResponse struct {
ID string `json:"id,required" format:"uuid"`
Object string `json:"object,required"`
// This field will be true if this object exists in the live environment or false
// if it exists in the test environment.
LiveMode bool `json:"live_mode,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
DiscardedAt time.Time `json:"discarded_at,nullable" format:"date-time"`
// Can be `checking`, `savings` or `other`.
AccountType ExternalAccountType `json:"account_type"`
// Either `individual` or `business`.
PartyType ExternalAccountVerifyResponsePartyType `json:"party_type,nullable"`
// This field can have the runtime type of [ExternalAccountPartyAddress].
PartyAddress interface{} `json:"party_address,required"`
// A nickname for the external account. This is only for internal usage and won't
// affect any payments
Name string `json:"name,nullable"`
CounterpartyID string `json:"counterparty_id,nullable" format:"uuid"`
// This field can have the runtime type of [[]AccountDetail].
AccountDetails interface{} `json:"account_details,required"`
// This field can have the runtime type of [[]RoutingDetail].
RoutingDetails interface{} `json:"routing_details,required"`
// This field can have the runtime type of [map[string]string].
Metadata interface{} `json:"metadata,required"`
// The legal name of the entity which owns the account.
PartyName string `json:"party_name"`
// This field can have the runtime type of [[]ExternalAccountContactDetail].
ContactDetails interface{} `json:"contact_details,required"`
// If the external account links to a ledger account in Modern Treasury, the id of
// the ledger account will be populated here.
LedgerAccountID string `json:"ledger_account_id,nullable" format:"uuid"`
VerificationStatus ExternalAccountVerifyResponseVerificationStatus `json:"verification_status"`
VerificationSource ExternalAccountVerifyResponseVerificationSource `json:"verification_source,nullable"`
// The ID of the external account.
ExternalAccountID string `json:"external_account_id" format:"uuid"`
// The ID of the internal account where the micro-deposits originate from.
OriginatingAccountID string `json:"originating_account_id" format:"uuid"`
// The type of payment that can be made to this account. Can be `ach`, `eft`, or
// `rtp`.
PaymentType ExternalAccountVerifyResponsePaymentType `json:"payment_type"`
// The priority of the payment. Can be `normal` or `high`.
Priority ExternalAccountVerifyResponsePriority `json:"priority,nullable"`
// The status of the verification attempt. Can be `pending_verification`,
// `verified`, `failed`, or `cancelled`.
Status ExternalAccountVerifyResponseStatus `json:"status"`
JSON externalAccountVerifyResponseJSON `json:"-"`
union ExternalAccountVerifyResponseUnion
}
// externalAccountVerifyResponseJSON contains the JSON metadata for the struct
// [ExternalAccountVerifyResponse]
type externalAccountVerifyResponseJSON struct {
ID apijson.Field
Object apijson.Field
LiveMode apijson.Field
CreatedAt apijson.Field
UpdatedAt apijson.Field
DiscardedAt apijson.Field
AccountType apijson.Field
PartyType apijson.Field
PartyAddress apijson.Field
Name apijson.Field
CounterpartyID apijson.Field
AccountDetails apijson.Field
RoutingDetails apijson.Field
Metadata apijson.Field
PartyName apijson.Field
ContactDetails apijson.Field
LedgerAccountID apijson.Field
VerificationStatus apijson.Field
VerificationSource apijson.Field
ExternalAccountID apijson.Field
OriginatingAccountID apijson.Field
PaymentType apijson.Field
Priority apijson.Field
Status apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r externalAccountVerifyResponseJSON) RawJSON() string {
return r.raw
}
func (r *ExternalAccountVerifyResponse) UnmarshalJSON(data []byte) (err error) {
*r = ExternalAccountVerifyResponse{}
err = apijson.UnmarshalRoot(data, &r.union)
if err != nil {
return err
}
return apijson.Port(r.union, &r)
}
// AsUnion returns a [ExternalAccountVerifyResponseUnion] interface which you can
// cast to the specific types for more type safety.
//
// Possible runtime types of the union are [ExternalAccount],
// [ExternalAccountVerifyResponseExternalAccountVerificationAttempt].
func (r ExternalAccountVerifyResponse) AsUnion() ExternalAccountVerifyResponseUnion {
return r.union
}
// Union satisfied by [ExternalAccount] or
// [ExternalAccountVerifyResponseExternalAccountVerificationAttempt].
type ExternalAccountVerifyResponseUnion interface {
implementsExternalAccountVerifyResponse()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*ExternalAccountVerifyResponseUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(ExternalAccount{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(ExternalAccountVerifyResponseExternalAccountVerificationAttempt{}),
},
)
}
type ExternalAccountVerifyResponseExternalAccountVerificationAttempt struct {
ID string `json:"id,required" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// The ID of the external account.
ExternalAccountID string `json:"external_account_id,required" format:"uuid"`
// This field will be true if this object exists in the live environment or false
// if it exists in the test environment.
LiveMode bool `json:"live_mode,required"`
Object string `json:"object,required"`
// The ID of the internal account where the micro-deposits originate from.
OriginatingAccountID string `json:"originating_account_id,required" format:"uuid"`
// The type of payment that can be made to this account. Can be `ach`, `eft`, or
// `rtp`.
PaymentType ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType `json:"payment_type,required"`
// The priority of the payment. Can be `normal` or `high`.
Priority ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriority `json:"priority,required,nullable"`
// The status of the verification attempt. Can be `pending_verification`,
// `verified`, `failed`, or `cancelled`.
Status ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatus `json:"status,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON externalAccountVerifyResponseExternalAccountVerificationAttemptJSON `json:"-"`
}
// externalAccountVerifyResponseExternalAccountVerificationAttemptJSON contains the
// JSON metadata for the struct
// [ExternalAccountVerifyResponseExternalAccountVerificationAttempt]
type externalAccountVerifyResponseExternalAccountVerificationAttemptJSON struct {
ID apijson.Field
CreatedAt apijson.Field
ExternalAccountID apijson.Field
LiveMode apijson.Field
Object apijson.Field
OriginatingAccountID apijson.Field
PaymentType apijson.Field
Priority apijson.Field
Status apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExternalAccountVerifyResponseExternalAccountVerificationAttempt) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r externalAccountVerifyResponseExternalAccountVerificationAttemptJSON) RawJSON() string {
return r.raw
}
func (r ExternalAccountVerifyResponseExternalAccountVerificationAttempt) implementsExternalAccountVerifyResponse() {
}
// The type of payment that can be made to this account. Can be `ach`, `eft`, or
// `rtp`.
type ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType string
const (
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeACH ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "ach"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeAuBecs ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "au_becs"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeBacs ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "bacs"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeBook ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "book"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeCard ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "card"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeChats ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "chats"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeCheck ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "check"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeCrossBorder ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "cross_border"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeDkNets ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "dk_nets"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeEft ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "eft"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeHuIcs ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "hu_ics"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeInterac ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "interac"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeMasav ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "masav"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeMxCcen ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "mx_ccen"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeNeft ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "neft"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeNics ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "nics"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeNzBecs ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "nz_becs"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypePlElixir ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "pl_elixir"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeProvxchange ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "provxchange"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeRoSent ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "ro_sent"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeRtp ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "rtp"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSeBankgirot ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "se_bankgirot"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSen ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "sen"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSepa ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "sepa"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSgGiro ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "sg_giro"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSic ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "sic"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSignet ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "signet"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSknbi ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "sknbi"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeWire ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "wire"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeZengin ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType = "zengin"
)
func (r ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentType) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeACH, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeAuBecs, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeBacs, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeBook, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeCard, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeChats, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeCheck, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeCrossBorder, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeDkNets, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeEft, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeHuIcs, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeInterac, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeMasav, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeMxCcen, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeNeft, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeNics, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeNzBecs, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypePlElixir, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeProvxchange, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeRoSent, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeRtp, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSeBankgirot, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSen, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSepa, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSgGiro, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSic, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSignet, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeSknbi, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeWire, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPaymentTypeZengin:
return true
}
return false
}
// The priority of the payment. Can be `normal` or `high`.
type ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriority string
const (
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriorityHigh ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriority = "high"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriorityNormal ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriority = "normal"
)
func (r ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriority) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriorityHigh, ExternalAccountVerifyResponseExternalAccountVerificationAttemptPriorityNormal:
return true
}
return false
}
// The status of the verification attempt. Can be `pending_verification`,
// `verified`, `failed`, or `cancelled`.
type ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatus string
const (
ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusCancelled ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatus = "cancelled"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusFailed ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatus = "failed"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusPendingVerification ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatus = "pending_verification"
ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusVerified ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatus = "verified"
)
func (r ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatus) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusCancelled, ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusFailed, ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusPendingVerification, ExternalAccountVerifyResponseExternalAccountVerificationAttemptStatusVerified:
return true
}
return false
}
// Either `individual` or `business`.
type ExternalAccountVerifyResponsePartyType string
const (
ExternalAccountVerifyResponsePartyTypeBusiness ExternalAccountVerifyResponsePartyType = "business"
ExternalAccountVerifyResponsePartyTypeIndividual ExternalAccountVerifyResponsePartyType = "individual"
)
func (r ExternalAccountVerifyResponsePartyType) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponsePartyTypeBusiness, ExternalAccountVerifyResponsePartyTypeIndividual:
return true
}
return false
}
type ExternalAccountVerifyResponseVerificationStatus string
const (
ExternalAccountVerifyResponseVerificationStatusPendingVerification ExternalAccountVerifyResponseVerificationStatus = "pending_verification"
ExternalAccountVerifyResponseVerificationStatusUnverified ExternalAccountVerifyResponseVerificationStatus = "unverified"
ExternalAccountVerifyResponseVerificationStatusVerified ExternalAccountVerifyResponseVerificationStatus = "verified"
)
func (r ExternalAccountVerifyResponseVerificationStatus) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponseVerificationStatusPendingVerification, ExternalAccountVerifyResponseVerificationStatusUnverified, ExternalAccountVerifyResponseVerificationStatusVerified:
return true
}
return false
}
type ExternalAccountVerifyResponseVerificationSource string
const (
ExternalAccountVerifyResponseVerificationSourceACHPrenote ExternalAccountVerifyResponseVerificationSource = "ach_prenote"
ExternalAccountVerifyResponseVerificationSourceMicrodeposits ExternalAccountVerifyResponseVerificationSource = "microdeposits"
ExternalAccountVerifyResponseVerificationSourcePlaid ExternalAccountVerifyResponseVerificationSource = "plaid"
)
func (r ExternalAccountVerifyResponseVerificationSource) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponseVerificationSourceACHPrenote, ExternalAccountVerifyResponseVerificationSourceMicrodeposits, ExternalAccountVerifyResponseVerificationSourcePlaid:
return true
}
return false
}
// The type of payment that can be made to this account. Can be `ach`, `eft`, or
// `rtp`.
type ExternalAccountVerifyResponsePaymentType string
const (
ExternalAccountVerifyResponsePaymentTypeACH ExternalAccountVerifyResponsePaymentType = "ach"
ExternalAccountVerifyResponsePaymentTypeAuBecs ExternalAccountVerifyResponsePaymentType = "au_becs"
ExternalAccountVerifyResponsePaymentTypeBacs ExternalAccountVerifyResponsePaymentType = "bacs"
ExternalAccountVerifyResponsePaymentTypeBook ExternalAccountVerifyResponsePaymentType = "book"
ExternalAccountVerifyResponsePaymentTypeCard ExternalAccountVerifyResponsePaymentType = "card"
ExternalAccountVerifyResponsePaymentTypeChats ExternalAccountVerifyResponsePaymentType = "chats"
ExternalAccountVerifyResponsePaymentTypeCheck ExternalAccountVerifyResponsePaymentType = "check"
ExternalAccountVerifyResponsePaymentTypeCrossBorder ExternalAccountVerifyResponsePaymentType = "cross_border"
ExternalAccountVerifyResponsePaymentTypeDkNets ExternalAccountVerifyResponsePaymentType = "dk_nets"
ExternalAccountVerifyResponsePaymentTypeEft ExternalAccountVerifyResponsePaymentType = "eft"
ExternalAccountVerifyResponsePaymentTypeHuIcs ExternalAccountVerifyResponsePaymentType = "hu_ics"
ExternalAccountVerifyResponsePaymentTypeInterac ExternalAccountVerifyResponsePaymentType = "interac"
ExternalAccountVerifyResponsePaymentTypeMasav ExternalAccountVerifyResponsePaymentType = "masav"
ExternalAccountVerifyResponsePaymentTypeMxCcen ExternalAccountVerifyResponsePaymentType = "mx_ccen"
ExternalAccountVerifyResponsePaymentTypeNeft ExternalAccountVerifyResponsePaymentType = "neft"
ExternalAccountVerifyResponsePaymentTypeNics ExternalAccountVerifyResponsePaymentType = "nics"
ExternalAccountVerifyResponsePaymentTypeNzBecs ExternalAccountVerifyResponsePaymentType = "nz_becs"
ExternalAccountVerifyResponsePaymentTypePlElixir ExternalAccountVerifyResponsePaymentType = "pl_elixir"
ExternalAccountVerifyResponsePaymentTypeProvxchange ExternalAccountVerifyResponsePaymentType = "provxchange"
ExternalAccountVerifyResponsePaymentTypeRoSent ExternalAccountVerifyResponsePaymentType = "ro_sent"
ExternalAccountVerifyResponsePaymentTypeRtp ExternalAccountVerifyResponsePaymentType = "rtp"
ExternalAccountVerifyResponsePaymentTypeSeBankgirot ExternalAccountVerifyResponsePaymentType = "se_bankgirot"
ExternalAccountVerifyResponsePaymentTypeSen ExternalAccountVerifyResponsePaymentType = "sen"
ExternalAccountVerifyResponsePaymentTypeSepa ExternalAccountVerifyResponsePaymentType = "sepa"
ExternalAccountVerifyResponsePaymentTypeSgGiro ExternalAccountVerifyResponsePaymentType = "sg_giro"
ExternalAccountVerifyResponsePaymentTypeSic ExternalAccountVerifyResponsePaymentType = "sic"
ExternalAccountVerifyResponsePaymentTypeSignet ExternalAccountVerifyResponsePaymentType = "signet"
ExternalAccountVerifyResponsePaymentTypeSknbi ExternalAccountVerifyResponsePaymentType = "sknbi"
ExternalAccountVerifyResponsePaymentTypeWire ExternalAccountVerifyResponsePaymentType = "wire"
ExternalAccountVerifyResponsePaymentTypeZengin ExternalAccountVerifyResponsePaymentType = "zengin"
)
func (r ExternalAccountVerifyResponsePaymentType) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponsePaymentTypeACH, ExternalAccountVerifyResponsePaymentTypeAuBecs, ExternalAccountVerifyResponsePaymentTypeBacs, ExternalAccountVerifyResponsePaymentTypeBook, ExternalAccountVerifyResponsePaymentTypeCard, ExternalAccountVerifyResponsePaymentTypeChats, ExternalAccountVerifyResponsePaymentTypeCheck, ExternalAccountVerifyResponsePaymentTypeCrossBorder, ExternalAccountVerifyResponsePaymentTypeDkNets, ExternalAccountVerifyResponsePaymentTypeEft, ExternalAccountVerifyResponsePaymentTypeHuIcs, ExternalAccountVerifyResponsePaymentTypeInterac, ExternalAccountVerifyResponsePaymentTypeMasav, ExternalAccountVerifyResponsePaymentTypeMxCcen, ExternalAccountVerifyResponsePaymentTypeNeft, ExternalAccountVerifyResponsePaymentTypeNics, ExternalAccountVerifyResponsePaymentTypeNzBecs, ExternalAccountVerifyResponsePaymentTypePlElixir, ExternalAccountVerifyResponsePaymentTypeProvxchange, ExternalAccountVerifyResponsePaymentTypeRoSent, ExternalAccountVerifyResponsePaymentTypeRtp, ExternalAccountVerifyResponsePaymentTypeSeBankgirot, ExternalAccountVerifyResponsePaymentTypeSen, ExternalAccountVerifyResponsePaymentTypeSepa, ExternalAccountVerifyResponsePaymentTypeSgGiro, ExternalAccountVerifyResponsePaymentTypeSic, ExternalAccountVerifyResponsePaymentTypeSignet, ExternalAccountVerifyResponsePaymentTypeSknbi, ExternalAccountVerifyResponsePaymentTypeWire, ExternalAccountVerifyResponsePaymentTypeZengin:
return true
}
return false
}
// The priority of the payment. Can be `normal` or `high`.
type ExternalAccountVerifyResponsePriority string
const (
ExternalAccountVerifyResponsePriorityHigh ExternalAccountVerifyResponsePriority = "high"
ExternalAccountVerifyResponsePriorityNormal ExternalAccountVerifyResponsePriority = "normal"
)
func (r ExternalAccountVerifyResponsePriority) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponsePriorityHigh, ExternalAccountVerifyResponsePriorityNormal:
return true
}
return false
}
// The status of the verification attempt. Can be `pending_verification`,
// `verified`, `failed`, or `cancelled`.
type ExternalAccountVerifyResponseStatus string
const (
ExternalAccountVerifyResponseStatusCancelled ExternalAccountVerifyResponseStatus = "cancelled"
ExternalAccountVerifyResponseStatusFailed ExternalAccountVerifyResponseStatus = "failed"
ExternalAccountVerifyResponseStatusPendingVerification ExternalAccountVerifyResponseStatus = "pending_verification"
ExternalAccountVerifyResponseStatusVerified ExternalAccountVerifyResponseStatus = "verified"
)
func (r ExternalAccountVerifyResponseStatus) IsKnown() bool {
switch r {
case ExternalAccountVerifyResponseStatusCancelled, ExternalAccountVerifyResponseStatusFailed, ExternalAccountVerifyResponseStatusPendingVerification, ExternalAccountVerifyResponseStatusVerified:
return true
}
return false
}
type ExternalAccountNewParams struct {
CounterpartyID param.Field[string] `json:"counterparty_id,required" format:"uuid"`
AccountDetails param.Field[[]ExternalAccountNewParamsAccountDetail] `json:"account_details"`
// Can be `checking`, `savings` or `other`.
AccountType param.Field[ExternalAccountType] `json:"account_type"`
ContactDetails param.Field[[]ExternalAccountNewParamsContactDetail] `json:"contact_details"`
// Specifies a ledger account object that will be created with the external
// account. The resulting ledger account is linked to the external account for
// auto-ledgering Payment objects. See
// https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
// for more details.
LedgerAccount param.Field[ExternalAccountNewParamsLedgerAccount] `json:"ledger_account"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata param.Field[map[string]string] `json:"metadata"`
// A nickname for the external account. This is only for internal usage and won't
// affect any payments
Name param.Field[string] `json:"name"`
// Required if receiving wire payments.
PartyAddress param.Field[ExternalAccountNewParamsPartyAddress] `json:"party_address"`
PartyIdentifier param.Field[string] `json:"party_identifier"`
// If this value isn't provided, it will be inherited from the counterparty's name.
PartyName param.Field[string] `json:"party_name"`
// Either `individual` or `business`.
PartyType param.Field[ExternalAccountNewParamsPartyType] `json:"party_type"`
// If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
// you can pass the processor token in this field.
PlaidProcessorToken param.Field[string] `json:"plaid_processor_token"`
RoutingDetails param.Field[[]ExternalAccountNewParamsRoutingDetail] `json:"routing_details"`
}
func (r ExternalAccountNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ExternalAccountNewParamsAccountDetail struct {
AccountNumber param.Field[string] `json:"account_number,required"`
AccountNumberType param.Field[ExternalAccountNewParamsAccountDetailsAccountNumberType] `json:"account_number_type"`
}
func (r ExternalAccountNewParamsAccountDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ExternalAccountNewParamsAccountDetailsAccountNumberType string
const (
ExternalAccountNewParamsAccountDetailsAccountNumberTypeAuNumber ExternalAccountNewParamsAccountDetailsAccountNumberType = "au_number"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeClabe ExternalAccountNewParamsAccountDetailsAccountNumberType = "clabe"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeHkNumber ExternalAccountNewParamsAccountDetailsAccountNumberType = "hk_number"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeIban ExternalAccountNewParamsAccountDetailsAccountNumberType = "iban"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeIDNumber ExternalAccountNewParamsAccountDetailsAccountNumberType = "id_number"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeNzNumber ExternalAccountNewParamsAccountDetailsAccountNumberType = "nz_number"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeOther ExternalAccountNewParamsAccountDetailsAccountNumberType = "other"
ExternalAccountNewParamsAccountDetailsAccountNumberTypePan ExternalAccountNewParamsAccountDetailsAccountNumberType = "pan"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeSgNumber ExternalAccountNewParamsAccountDetailsAccountNumberType = "sg_number"
ExternalAccountNewParamsAccountDetailsAccountNumberTypeWalletAddress ExternalAccountNewParamsAccountDetailsAccountNumberType = "wallet_address"
)
func (r ExternalAccountNewParamsAccountDetailsAccountNumberType) IsKnown() bool {
switch r {
case ExternalAccountNewParamsAccountDetailsAccountNumberTypeAuNumber, ExternalAccountNewParamsAccountDetailsAccountNumberTypeClabe, ExternalAccountNewParamsAccountDetailsAccountNumberTypeHkNumber, ExternalAccountNewParamsAccountDetailsAccountNumberTypeIban, ExternalAccountNewParamsAccountDetailsAccountNumberTypeIDNumber, ExternalAccountNewParamsAccountDetailsAccountNumberTypeNzNumber, ExternalAccountNewParamsAccountDetailsAccountNumberTypeOther, ExternalAccountNewParamsAccountDetailsAccountNumberTypePan, ExternalAccountNewParamsAccountDetailsAccountNumberTypeSgNumber, ExternalAccountNewParamsAccountDetailsAccountNumberTypeWalletAddress:
return true
}
return false
}
type ExternalAccountNewParamsContactDetail struct {
ContactIdentifier param.Field[string] `json:"contact_identifier"`
ContactIdentifierType param.Field[ExternalAccountNewParamsContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}
func (r ExternalAccountNewParamsContactDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ExternalAccountNewParamsContactDetailsContactIdentifierType string
const (
ExternalAccountNewParamsContactDetailsContactIdentifierTypeEmail ExternalAccountNewParamsContactDetailsContactIdentifierType = "email"
ExternalAccountNewParamsContactDetailsContactIdentifierTypePhoneNumber ExternalAccountNewParamsContactDetailsContactIdentifierType = "phone_number"
ExternalAccountNewParamsContactDetailsContactIdentifierTypeWebsite ExternalAccountNewParamsContactDetailsContactIdentifierType = "website"
)
func (r ExternalAccountNewParamsContactDetailsContactIdentifierType) IsKnown() bool {
switch r {
case ExternalAccountNewParamsContactDetailsContactIdentifierTypeEmail, ExternalAccountNewParamsContactDetailsContactIdentifierTypePhoneNumber, ExternalAccountNewParamsContactDetailsContactIdentifierTypeWebsite:
return true
}
return false
}
// Specifies a ledger account object that will be created with the external
// account. The resulting ledger account is linked to the external account for
// auto-ledgering Payment objects. See
// https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
// for more details.
type ExternalAccountNewParamsLedgerAccount struct {
// The currency of the ledger account.
Currency param.Field[string] `json:"currency,required"`
// The id of the ledger that this account belongs to.
LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
// The name of the ledger account.
Name param.Field[string] `json:"name,required"`
// The normal balance of the ledger account.
NormalBalance param.Field[shared.TransactionDirection] `json:"normal_balance,required"`
// The currency exponent of the ledger account.
CurrencyExponent param.Field[int64] `json:"currency_exponent"`
// The description of the ledger account.
Description param.Field[string] `json:"description"`
// The array of ledger account category ids that this ledger account should be a
// child of.
LedgerAccountCategoryIDs param.Field[[]string] `json:"ledger_account_category_ids" format:"uuid"`
// If the ledger account links to another object in Modern Treasury, the id will be
// populated here, otherwise null.
LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
// If the ledger account links to another object in Modern Treasury, the type will
// be populated here, otherwise null. The value is one of internal_account or
// external_account.
LedgerableType param.Field[ExternalAccountNewParamsLedgerAccountLedgerableType] `json:"ledgerable_type"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata param.Field[map[string]string] `json:"metadata"`
}
func (r ExternalAccountNewParamsLedgerAccount) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// If the ledger account links to another object in Modern Treasury, the type will
// be populated here, otherwise null. The value is one of internal_account or
// external_account.
type ExternalAccountNewParamsLedgerAccountLedgerableType string
const (
ExternalAccountNewParamsLedgerAccountLedgerableTypeCounterparty ExternalAccountNewParamsLedgerAccountLedgerableType = "counterparty"
ExternalAccountNewParamsLedgerAccountLedgerableTypeExternalAccount ExternalAccountNewParamsLedgerAccountLedgerableType = "external_account"
ExternalAccountNewParamsLedgerAccountLedgerableTypeInternalAccount ExternalAccountNewParamsLedgerAccountLedgerableType = "internal_account"
ExternalAccountNewParamsLedgerAccountLedgerableTypeVirtualAccount ExternalAccountNewParamsLedgerAccountLedgerableType = "virtual_account"
)
func (r ExternalAccountNewParamsLedgerAccountLedgerableType) IsKnown() bool {
switch r {
case ExternalAccountNewParamsLedgerAccountLedgerableTypeCounterparty, ExternalAccountNewParamsLedgerAccountLedgerableTypeExternalAccount, ExternalAccountNewParamsLedgerAccountLedgerableTypeInternalAccount, ExternalAccountNewParamsLedgerAccountLedgerableTypeVirtualAccount:
return true
}
return false
}
// Required if receiving wire payments.
type ExternalAccountNewParamsPartyAddress struct {
// Country code conforms to [ISO 3166-1 alpha-2]
Country param.Field[string] `json:"country"`
Line1 param.Field[string] `json:"line1"`
Line2 param.Field[string] `json:"line2"`
// Locality or City.
Locality param.Field[string] `json:"locality"`
// The postal code of the address.
PostalCode param.Field[string] `json:"postal_code"`
// Region or State.
Region param.Field[string] `json:"region"`
}
func (r ExternalAccountNewParamsPartyAddress) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Either `individual` or `business`.
type ExternalAccountNewParamsPartyType string
const (
ExternalAccountNewParamsPartyTypeBusiness ExternalAccountNewParamsPartyType = "business"
ExternalAccountNewParamsPartyTypeIndividual ExternalAccountNewParamsPartyType = "individual"
)
func (r ExternalAccountNewParamsPartyType) IsKnown() bool {
switch r {
case ExternalAccountNewParamsPartyTypeBusiness, ExternalAccountNewParamsPartyTypeIndividual:
return true
}
return false
}
type ExternalAccountNewParamsRoutingDetail struct {
RoutingNumber param.Field[string] `json:"routing_number,required"`
RoutingNumberType param.Field[ExternalAccountNewParamsRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
PaymentType param.Field[ExternalAccountNewParamsRoutingDetailsPaymentType] `json:"payment_type"`
}
func (r ExternalAccountNewParamsRoutingDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ExternalAccountNewParamsRoutingDetailsRoutingNumberType string
const (
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeAba ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "aba"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeAuBsb ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "au_bsb"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeBrCodigo ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "br_codigo"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeCaCpa ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "ca_cpa"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeChips ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "chips"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeCnaps ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "cnaps"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeDkInterbankClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "dk_interbank_clearing_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeGBSortCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "gb_sort_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeHkInterbankClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "hk_interbank_clearing_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeHuInterbankClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "hu_interbank_clearing_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeIDSknbiCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "id_sknbi_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeInIfsc ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "in_ifsc"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeJpZenginCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "jp_zengin_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeMyBranchCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "my_branch_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeMxBankIdentifier ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "mx_bank_identifier"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeNzNationalClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "nz_national_clearing_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypePlNationalClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "pl_national_clearing_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeSwift ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "swift"
ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeZaNationalClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "za_national_clearing_code"
)
func (r ExternalAccountNewParamsRoutingDetailsRoutingNumberType) IsKnown() bool {
switch r {
case ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeAba, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeAuBsb, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeBrCodigo, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeCaCpa, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeChips, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeCnaps, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeDkInterbankClearingCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeGBSortCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeHkInterbankClearingCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeHuInterbankClearingCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeIDSknbiCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeInIfsc, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeJpZenginCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeMyBranchCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeMxBankIdentifier, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeNzNationalClearingCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypePlNationalClearingCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeSwift, ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeZaNationalClearingCode:
return true
}
return false
}
type ExternalAccountNewParamsRoutingDetailsPaymentType string
const (
ExternalAccountNewParamsRoutingDetailsPaymentTypeACH ExternalAccountNewParamsRoutingDetailsPaymentType = "ach"
ExternalAccountNewParamsRoutingDetailsPaymentTypeAuBecs ExternalAccountNewParamsRoutingDetailsPaymentType = "au_becs"
ExternalAccountNewParamsRoutingDetailsPaymentTypeBacs ExternalAccountNewParamsRoutingDetailsPaymentType = "bacs"
ExternalAccountNewParamsRoutingDetailsPaymentTypeBook ExternalAccountNewParamsRoutingDetailsPaymentType = "book"
ExternalAccountNewParamsRoutingDetailsPaymentTypeCard ExternalAccountNewParamsRoutingDetailsPaymentType = "card"
ExternalAccountNewParamsRoutingDetailsPaymentTypeChats ExternalAccountNewParamsRoutingDetailsPaymentType = "chats"
ExternalAccountNewParamsRoutingDetailsPaymentTypeCheck ExternalAccountNewParamsRoutingDetailsPaymentType = "check"
ExternalAccountNewParamsRoutingDetailsPaymentTypeCrossBorder ExternalAccountNewParamsRoutingDetailsPaymentType = "cross_border"
ExternalAccountNewParamsRoutingDetailsPaymentTypeDkNets ExternalAccountNewParamsRoutingDetailsPaymentType = "dk_nets"
ExternalAccountNewParamsRoutingDetailsPaymentTypeEft ExternalAccountNewParamsRoutingDetailsPaymentType = "eft"
ExternalAccountNewParamsRoutingDetailsPaymentTypeHuIcs ExternalAccountNewParamsRoutingDetailsPaymentType = "hu_ics"
ExternalAccountNewParamsRoutingDetailsPaymentTypeInterac ExternalAccountNewParamsRoutingDetailsPaymentType = "interac"