-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcounterparty.go
1350 lines (1200 loc) · 83.9 KB
/
counterparty.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"
"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"
)
// CounterpartyService 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 [NewCounterpartyService] method instead.
type CounterpartyService struct {
Options []option.RequestOption
}
// NewCounterpartyService 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 NewCounterpartyService(opts ...option.RequestOption) (r *CounterpartyService) {
r = &CounterpartyService{}
r.Options = opts
return
}
// Create a new counterparty.
func (r *CounterpartyService) New(ctx context.Context, body CounterpartyNewParams, opts ...option.RequestOption) (res *Counterparty, err error) {
opts = append(r.Options[:], opts...)
path := "api/counterparties"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Get details on a single counterparty.
func (r *CounterpartyService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Counterparty, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/counterparties/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Updates a given counterparty with new information.
func (r *CounterpartyService) Update(ctx context.Context, id string, body CounterpartyUpdateParams, opts ...option.RequestOption) (res *Counterparty, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/counterparties/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// Get a paginated list of all counterparties.
func (r *CounterpartyService) List(ctx context.Context, query CounterpartyListParams, opts ...option.RequestOption) (res *pagination.Page[Counterparty], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "api/counterparties"
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
}
// Get a paginated list of all counterparties.
func (r *CounterpartyService) ListAutoPaging(ctx context.Context, query CounterpartyListParams, opts ...option.RequestOption) *pagination.PageAutoPager[Counterparty] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// Deletes a given counterparty.
func (r *CounterpartyService) 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/counterparties/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return
}
// Send an email requesting account details.
func (r *CounterpartyService) CollectAccount(ctx context.Context, id string, body CounterpartyCollectAccountParams, opts ...option.RequestOption) (res *CounterpartyCollectAccountResponse, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/counterparties/%s/collect_account", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
type Counterparty struct {
ID string `json:"id,required" format:"uuid"`
// The accounts for this counterparty.
Accounts []CounterpartyAccount `json:"accounts,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
// The counterparty's email.
Email string `json:"email,required,nullable" format:"email"`
// The id of the legal entity.
LegalEntityID string `json:"legal_entity_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 human friendly name for this counterparty.
Name string `json:"name,required,nullable"`
Object string `json:"object,required"`
// Send an email to the counterparty whenever an associated payment order is sent
// to the bank.
SendRemittanceAdvice bool `json:"send_remittance_advice,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
// The verification status of the counterparty.
VerificationStatus CounterpartyVerificationStatus `json:"verification_status,required"`
JSON counterpartyJSON `json:"-"`
}
// counterpartyJSON contains the JSON metadata for the struct [Counterparty]
type counterpartyJSON struct {
ID apijson.Field
Accounts apijson.Field
CreatedAt apijson.Field
DiscardedAt apijson.Field
Email apijson.Field
LegalEntityID apijson.Field
LiveMode apijson.Field
Metadata apijson.Field
Name apijson.Field
Object apijson.Field
SendRemittanceAdvice apijson.Field
UpdatedAt apijson.Field
VerificationStatus apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *Counterparty) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r counterpartyJSON) RawJSON() string {
return r.raw
}
type CounterpartyAccount struct {
ID string `json:"id" format:"uuid"`
AccountDetails []AccountDetail `json:"account_details"`
// Can be `checking`, `savings` or `other`.
AccountType ExternalAccountType `json:"account_type"`
ContactDetails []CounterpartyAccountsContactDetail `json:"contact_details"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
DiscardedAt time.Time `json:"discarded_at,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,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"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata map[string]string `json:"metadata"`
// A nickname for the external account. This is only for internal usage and won't
// affect any payments
Name string `json:"name,nullable"`
Object string `json:"object"`
// The address associated with the owner or `null`.
PartyAddress CounterpartyAccountsPartyAddress `json:"party_address,nullable"`
// The legal name of the entity which owns the account.
PartyName string `json:"party_name"`
// Either `individual` or `business`.
PartyType CounterpartyAccountsPartyType `json:"party_type,nullable"`
RoutingDetails []RoutingDetail `json:"routing_details"`
UpdatedAt time.Time `json:"updated_at" format:"date-time"`
VerificationSource CounterpartyAccountsVerificationSource `json:"verification_source,nullable"`
VerificationStatus CounterpartyAccountsVerificationStatus `json:"verification_status"`
JSON counterpartyAccountJSON `json:"-"`
}
// counterpartyAccountJSON contains the JSON metadata for the struct
// [CounterpartyAccount]
type counterpartyAccountJSON struct {
ID apijson.Field
AccountDetails apijson.Field
AccountType apijson.Field
ContactDetails 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 *CounterpartyAccount) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r counterpartyAccountJSON) RawJSON() string {
return r.raw
}
type CounterpartyAccountsContactDetail struct {
ID string `json:"id,required" format:"uuid"`
ContactIdentifier string `json:"contact_identifier,required"`
ContactIdentifierType CounterpartyAccountsContactDetailsContactIdentifierType `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 counterpartyAccountsContactDetailJSON `json:"-"`
}
// counterpartyAccountsContactDetailJSON contains the JSON metadata for the struct
// [CounterpartyAccountsContactDetail]
type counterpartyAccountsContactDetailJSON 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 *CounterpartyAccountsContactDetail) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r counterpartyAccountsContactDetailJSON) RawJSON() string {
return r.raw
}
type CounterpartyAccountsContactDetailsContactIdentifierType string
const (
CounterpartyAccountsContactDetailsContactIdentifierTypeEmail CounterpartyAccountsContactDetailsContactIdentifierType = "email"
CounterpartyAccountsContactDetailsContactIdentifierTypePhoneNumber CounterpartyAccountsContactDetailsContactIdentifierType = "phone_number"
CounterpartyAccountsContactDetailsContactIdentifierTypeWebsite CounterpartyAccountsContactDetailsContactIdentifierType = "website"
)
func (r CounterpartyAccountsContactDetailsContactIdentifierType) IsKnown() bool {
switch r {
case CounterpartyAccountsContactDetailsContactIdentifierTypeEmail, CounterpartyAccountsContactDetailsContactIdentifierTypePhoneNumber, CounterpartyAccountsContactDetailsContactIdentifierTypeWebsite:
return true
}
return false
}
// The address associated with the owner or `null`.
type CounterpartyAccountsPartyAddress 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 counterpartyAccountsPartyAddressJSON `json:"-"`
}
// counterpartyAccountsPartyAddressJSON contains the JSON metadata for the struct
// [CounterpartyAccountsPartyAddress]
type counterpartyAccountsPartyAddressJSON 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 *CounterpartyAccountsPartyAddress) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r counterpartyAccountsPartyAddressJSON) RawJSON() string {
return r.raw
}
// Either `individual` or `business`.
type CounterpartyAccountsPartyType string
const (
CounterpartyAccountsPartyTypeBusiness CounterpartyAccountsPartyType = "business"
CounterpartyAccountsPartyTypeIndividual CounterpartyAccountsPartyType = "individual"
)
func (r CounterpartyAccountsPartyType) IsKnown() bool {
switch r {
case CounterpartyAccountsPartyTypeBusiness, CounterpartyAccountsPartyTypeIndividual:
return true
}
return false
}
type CounterpartyAccountsVerificationSource string
const (
CounterpartyAccountsVerificationSourceACHPrenote CounterpartyAccountsVerificationSource = "ach_prenote"
CounterpartyAccountsVerificationSourceMicrodeposits CounterpartyAccountsVerificationSource = "microdeposits"
CounterpartyAccountsVerificationSourcePlaid CounterpartyAccountsVerificationSource = "plaid"
)
func (r CounterpartyAccountsVerificationSource) IsKnown() bool {
switch r {
case CounterpartyAccountsVerificationSourceACHPrenote, CounterpartyAccountsVerificationSourceMicrodeposits, CounterpartyAccountsVerificationSourcePlaid:
return true
}
return false
}
type CounterpartyAccountsVerificationStatus string
const (
CounterpartyAccountsVerificationStatusPendingVerification CounterpartyAccountsVerificationStatus = "pending_verification"
CounterpartyAccountsVerificationStatusUnverified CounterpartyAccountsVerificationStatus = "unverified"
CounterpartyAccountsVerificationStatusVerified CounterpartyAccountsVerificationStatus = "verified"
)
func (r CounterpartyAccountsVerificationStatus) IsKnown() bool {
switch r {
case CounterpartyAccountsVerificationStatusPendingVerification, CounterpartyAccountsVerificationStatusUnverified, CounterpartyAccountsVerificationStatusVerified:
return true
}
return false
}
// The verification status of the counterparty.
type CounterpartyVerificationStatus string
const (
CounterpartyVerificationStatusDenied CounterpartyVerificationStatus = "denied"
CounterpartyVerificationStatusNeedsApproval CounterpartyVerificationStatus = "needs_approval"
CounterpartyVerificationStatusUnverified CounterpartyVerificationStatus = "unverified"
CounterpartyVerificationStatusVerified CounterpartyVerificationStatus = "verified"
)
func (r CounterpartyVerificationStatus) IsKnown() bool {
switch r {
case CounterpartyVerificationStatusDenied, CounterpartyVerificationStatusNeedsApproval, CounterpartyVerificationStatusUnverified, CounterpartyVerificationStatusVerified:
return true
}
return false
}
type CounterpartyCollectAccountResponse struct {
// The id of the existing counterparty.
ID string `json:"id,required"`
// This is the link to the secure Modern Treasury form. By default, Modern Treasury
// will send an email to your counterparty that includes a link to this form.
// However, if `send_email` is passed as `false` in the body then Modern Treasury
// will not send the email and you can send it to the counterparty directly.
FormLink string `json:"form_link,required" format:"uri"`
// This field will be `true` if an email requesting account details has already
// been sent to this counterparty.
IsResend bool `json:"is_resend,required"`
JSON counterpartyCollectAccountResponseJSON `json:"-"`
}
// counterpartyCollectAccountResponseJSON contains the JSON metadata for the struct
// [CounterpartyCollectAccountResponse]
type counterpartyCollectAccountResponseJSON struct {
ID apijson.Field
FormLink apijson.Field
IsResend apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CounterpartyCollectAccountResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r counterpartyCollectAccountResponseJSON) RawJSON() string {
return r.raw
}
type CounterpartyNewParams struct {
// A human friendly name for this counterparty.
Name param.Field[string] `json:"name,required"`
Accounting param.Field[CounterpartyNewParamsAccounting] `json:"accounting"`
// The accounts for this counterparty.
Accounts param.Field[[]CounterpartyNewParamsAccount] `json:"accounts"`
// The counterparty's email.
Email param.Field[string] `json:"email" format:"email"`
// An optional type to auto-sync the counterparty to your ledger. Either `customer`
// or `vendor`.
LedgerType param.Field[CounterpartyNewParamsLedgerType] `json:"ledger_type"`
LegalEntity param.Field[CounterpartyNewParamsLegalEntity] `json:"legal_entity"`
// The id of the legal entity.
LegalEntityID param.Field[string] `json:"legal_entity_id" format:"uuid"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata param.Field[map[string]string] `json:"metadata"`
// Send an email to the counterparty whenever an associated payment order is sent
// to the bank.
SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
// Either a valid SSN or EIN.
TaxpayerIdentifier param.Field[string] `json:"taxpayer_identifier"`
// The verification status of the counterparty.
VerificationStatus param.Field[CounterpartyNewParamsVerificationStatus] `json:"verification_status"`
}
func (r CounterpartyNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CounterpartyNewParamsAccounting struct {
// An optional type to auto-sync the counterparty to your ledger. Either `customer`
// or `vendor`.
Type param.Field[CounterpartyNewParamsAccountingType] `json:"type"`
}
func (r CounterpartyNewParamsAccounting) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// An optional type to auto-sync the counterparty to your ledger. Either `customer`
// or `vendor`.
type CounterpartyNewParamsAccountingType string
const (
CounterpartyNewParamsAccountingTypeCustomer CounterpartyNewParamsAccountingType = "customer"
CounterpartyNewParamsAccountingTypeVendor CounterpartyNewParamsAccountingType = "vendor"
)
func (r CounterpartyNewParamsAccountingType) IsKnown() bool {
switch r {
case CounterpartyNewParamsAccountingTypeCustomer, CounterpartyNewParamsAccountingTypeVendor:
return true
}
return false
}
type CounterpartyNewParamsAccount struct {
AccountDetails param.Field[[]CounterpartyNewParamsAccountsAccountDetail] `json:"account_details"`
// Can be `checking`, `savings` or `other`.
AccountType param.Field[ExternalAccountType] `json:"account_type"`
ContactDetails param.Field[[]CounterpartyNewParamsAccountsContactDetail] `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[CounterpartyNewParamsAccountsLedgerAccount] `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[CounterpartyNewParamsAccountsPartyAddress] `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[CounterpartyNewParamsAccountsPartyType] `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[[]CounterpartyNewParamsAccountsRoutingDetail] `json:"routing_details"`
}
func (r CounterpartyNewParamsAccount) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CounterpartyNewParamsAccountsAccountDetail struct {
AccountNumber param.Field[string] `json:"account_number,required"`
AccountNumberType param.Field[CounterpartyNewParamsAccountsAccountDetailsAccountNumberType] `json:"account_number_type"`
}
func (r CounterpartyNewParamsAccountsAccountDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CounterpartyNewParamsAccountsAccountDetailsAccountNumberType string
const (
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeAuNumber CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "au_number"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeClabe CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "clabe"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeHkNumber CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "hk_number"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeIban CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "iban"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeIDNumber CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "id_number"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeNzNumber CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "nz_number"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeOther CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "other"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypePan CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "pan"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeSgNumber CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "sg_number"
CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeWalletAddress CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "wallet_address"
)
func (r CounterpartyNewParamsAccountsAccountDetailsAccountNumberType) IsKnown() bool {
switch r {
case CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeAuNumber, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeClabe, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeHkNumber, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeIban, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeIDNumber, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeNzNumber, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeOther, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypePan, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeSgNumber, CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeWalletAddress:
return true
}
return false
}
type CounterpartyNewParamsAccountsContactDetail struct {
ContactIdentifier param.Field[string] `json:"contact_identifier"`
ContactIdentifierType param.Field[CounterpartyNewParamsAccountsContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}
func (r CounterpartyNewParamsAccountsContactDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CounterpartyNewParamsAccountsContactDetailsContactIdentifierType string
const (
CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypeEmail CounterpartyNewParamsAccountsContactDetailsContactIdentifierType = "email"
CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypePhoneNumber CounterpartyNewParamsAccountsContactDetailsContactIdentifierType = "phone_number"
CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypeWebsite CounterpartyNewParamsAccountsContactDetailsContactIdentifierType = "website"
)
func (r CounterpartyNewParamsAccountsContactDetailsContactIdentifierType) IsKnown() bool {
switch r {
case CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypeEmail, CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypePhoneNumber, CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypeWebsite:
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 CounterpartyNewParamsAccountsLedgerAccount 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[CounterpartyNewParamsAccountsLedgerAccountLedgerableType] `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 CounterpartyNewParamsAccountsLedgerAccount) 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 CounterpartyNewParamsAccountsLedgerAccountLedgerableType string
const (
CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeCounterparty CounterpartyNewParamsAccountsLedgerAccountLedgerableType = "counterparty"
CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeExternalAccount CounterpartyNewParamsAccountsLedgerAccountLedgerableType = "external_account"
CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeInternalAccount CounterpartyNewParamsAccountsLedgerAccountLedgerableType = "internal_account"
CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeVirtualAccount CounterpartyNewParamsAccountsLedgerAccountLedgerableType = "virtual_account"
)
func (r CounterpartyNewParamsAccountsLedgerAccountLedgerableType) IsKnown() bool {
switch r {
case CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeCounterparty, CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeExternalAccount, CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeInternalAccount, CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeVirtualAccount:
return true
}
return false
}
// Required if receiving wire payments.
type CounterpartyNewParamsAccountsPartyAddress 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 CounterpartyNewParamsAccountsPartyAddress) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Either `individual` or `business`.
type CounterpartyNewParamsAccountsPartyType string
const (
CounterpartyNewParamsAccountsPartyTypeBusiness CounterpartyNewParamsAccountsPartyType = "business"
CounterpartyNewParamsAccountsPartyTypeIndividual CounterpartyNewParamsAccountsPartyType = "individual"
)
func (r CounterpartyNewParamsAccountsPartyType) IsKnown() bool {
switch r {
case CounterpartyNewParamsAccountsPartyTypeBusiness, CounterpartyNewParamsAccountsPartyTypeIndividual:
return true
}
return false
}
type CounterpartyNewParamsAccountsRoutingDetail struct {
RoutingNumber param.Field[string] `json:"routing_number,required"`
RoutingNumberType param.Field[CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
PaymentType param.Field[CounterpartyNewParamsAccountsRoutingDetailsPaymentType] `json:"payment_type"`
}
func (r CounterpartyNewParamsAccountsRoutingDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType string
const (
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeAba CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "aba"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeAuBsb CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "au_bsb"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeBrCodigo CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "br_codigo"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeCaCpa CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "ca_cpa"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeChips CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "chips"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeCnaps CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "cnaps"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeDkInterbankClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "dk_interbank_clearing_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeGBSortCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "gb_sort_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeHkInterbankClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "hk_interbank_clearing_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeHuInterbankClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "hu_interbank_clearing_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeIDSknbiCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "id_sknbi_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeInIfsc CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "in_ifsc"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeJpZenginCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "jp_zengin_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeMyBranchCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "my_branch_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeMxBankIdentifier CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "mx_bank_identifier"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeNzNationalClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "nz_national_clearing_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypePlNationalClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "pl_national_clearing_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSgInterbankClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "sg_interbank_clearing_code"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSwift CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "swift"
CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeZaNationalClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "za_national_clearing_code"
)
func (r CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType) IsKnown() bool {
switch r {
case CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeAba, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeAuBsb, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeBrCodigo, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeCaCpa, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeChips, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeCnaps, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeDkInterbankClearingCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeGBSortCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeHkInterbankClearingCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeHuInterbankClearingCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeIDSknbiCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeInIfsc, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeJpZenginCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeMyBranchCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeMxBankIdentifier, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeNzNationalClearingCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypePlNationalClearingCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSgInterbankClearingCode, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSwift, CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeZaNationalClearingCode:
return true
}
return false
}
type CounterpartyNewParamsAccountsRoutingDetailsPaymentType string
const (
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeACH CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "ach"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeAuBecs CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "au_becs"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeBacs CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "bacs"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeBook CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "book"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCard CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "card"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeChats CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "chats"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCheck CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "check"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCrossBorder CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "cross_border"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeDkNets CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "dk_nets"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeEft CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "eft"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeHuIcs CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "hu_ics"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeInterac CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "interac"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeMasav CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "masav"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeMxCcen CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "mx_ccen"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNeft CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "neft"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNics CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "nics"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNzBecs CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "nz_becs"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypePlElixir CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "pl_elixir"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeProvxchange CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "provxchange"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeRoSent CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "ro_sent"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeRtp CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "rtp"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSeBankgirot CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "se_bankgirot"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSen CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sen"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSepa CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sepa"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSgGiro CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sg_giro"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSic CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sic"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSignet CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "signet"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSknbi CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sknbi"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeWire CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "wire"
CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeZengin CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "zengin"
)
func (r CounterpartyNewParamsAccountsRoutingDetailsPaymentType) IsKnown() bool {
switch r {
case CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeACH, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeAuBecs, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeBacs, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeBook, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCard, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeChats, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCheck, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCrossBorder, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeDkNets, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeEft, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeHuIcs, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeInterac, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeMasav, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeMxCcen, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNeft, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNics, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNzBecs, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypePlElixir, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeProvxchange, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeRoSent, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeRtp, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSeBankgirot, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSen, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSepa, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSgGiro, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSic, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSignet, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSknbi, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeWire, CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeZengin:
return true
}
return false
}
// An optional type to auto-sync the counterparty to your ledger. Either `customer`
// or `vendor`.
type CounterpartyNewParamsLedgerType string
const (
CounterpartyNewParamsLedgerTypeCustomer CounterpartyNewParamsLedgerType = "customer"
CounterpartyNewParamsLedgerTypeVendor CounterpartyNewParamsLedgerType = "vendor"
)
func (r CounterpartyNewParamsLedgerType) IsKnown() bool {
switch r {
case CounterpartyNewParamsLedgerTypeCustomer, CounterpartyNewParamsLedgerTypeVendor:
return true
}
return false
}
type CounterpartyNewParamsLegalEntity struct {
// The type of legal entity.
LegalEntityType param.Field[CounterpartyNewParamsLegalEntityLegalEntityType] `json:"legal_entity_type,required"`
// A list of addresses for the entity.
Addresses param.Field[[]CounterpartyNewParamsLegalEntityAddress] `json:"addresses"`
BankSettings param.Field[BankSettingsParam] `json:"bank_settings"`
// The business's legal business name.
BusinessName param.Field[string] `json:"business_name"`
// The country of citizenship for an individual.
CitizenshipCountry param.Field[string] `json:"citizenship_country"`
// A business's formation date (YYYY-MM-DD).
DateFormed param.Field[time.Time] `json:"date_formed" format:"date"`
// An individual's date of birth (YYYY-MM-DD).
DateOfBirth param.Field[time.Time] `json:"date_of_birth" format:"date"`
DoingBusinessAsNames param.Field[[]string] `json:"doing_business_as_names"`
// The entity's primary email.
Email param.Field[string] `json:"email"`
// An individual's first name.
FirstName param.Field[string] `json:"first_name"`
// A list of identifications for the legal entity.
Identifications param.Field[[]CounterpartyNewParamsLegalEntityIdentification] `json:"identifications"`
// An individual's last name.
LastName param.Field[string] `json:"last_name"`
// The legal entity associations and its child legal entities.
LegalEntityAssociations param.Field[[]CounterpartyNewParamsLegalEntityLegalEntityAssociation] `json:"legal_entity_associations"`
// The business's legal structure.
LegalStructure param.Field[CounterpartyNewParamsLegalEntityLegalStructure] `json:"legal_structure"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata param.Field[map[string]string] `json:"metadata"`
// An individual's middle name.
MiddleName param.Field[string] `json:"middle_name"`
PhoneNumbers param.Field[[]CounterpartyNewParamsLegalEntityPhoneNumber] `json:"phone_numbers"`
// Whether the individual is a politically exposed person.
PoliticallyExposedPerson param.Field[bool] `json:"politically_exposed_person"`
// An individual's preferred name.
PreferredName param.Field[string] `json:"preferred_name"`
// An individual's prefix.
Prefix param.Field[string] `json:"prefix"`
// The risk rating of the legal entity. One of low, medium, high.
RiskRating param.Field[CounterpartyNewParamsLegalEntityRiskRating] `json:"risk_rating"`
// An individual's suffix.
Suffix param.Field[string] `json:"suffix"`
WealthAndEmploymentDetails param.Field[WealthAndEmploymentDetailsParam] `json:"wealth_and_employment_details"`
// The entity's primary website URL.
Website param.Field[string] `json:"website"`
}
func (r CounterpartyNewParamsLegalEntity) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The type of legal entity.
type CounterpartyNewParamsLegalEntityLegalEntityType string
const (
CounterpartyNewParamsLegalEntityLegalEntityTypeBusiness CounterpartyNewParamsLegalEntityLegalEntityType = "business"
CounterpartyNewParamsLegalEntityLegalEntityTypeIndividual CounterpartyNewParamsLegalEntityLegalEntityType = "individual"
)
func (r CounterpartyNewParamsLegalEntityLegalEntityType) IsKnown() bool {
switch r {
case CounterpartyNewParamsLegalEntityLegalEntityTypeBusiness, CounterpartyNewParamsLegalEntityLegalEntityTypeIndividual:
return true
}
return false
}
type CounterpartyNewParamsLegalEntityAddress struct {
// Country code conforms to [ISO 3166-1 alpha-2]
Country param.Field[string] `json:"country,required"`
Line1 param.Field[string] `json:"line1,required"`
// Locality or City.
Locality param.Field[string] `json:"locality,required"`
// The postal code of the address.
PostalCode param.Field[string] `json:"postal_code,required"`
// Region or State.
Region param.Field[string] `json:"region,required"`
// The types of this address.
AddressTypes param.Field[[]CounterpartyNewParamsLegalEntityAddressesAddressType] `json:"address_types"`
Line2 param.Field[string] `json:"line2"`
}
func (r CounterpartyNewParamsLegalEntityAddress) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type CounterpartyNewParamsLegalEntityAddressesAddressType string
const (
CounterpartyNewParamsLegalEntityAddressesAddressTypeBusiness CounterpartyNewParamsLegalEntityAddressesAddressType = "business"
CounterpartyNewParamsLegalEntityAddressesAddressTypeMailing CounterpartyNewParamsLegalEntityAddressesAddressType = "mailing"
CounterpartyNewParamsLegalEntityAddressesAddressTypeOther CounterpartyNewParamsLegalEntityAddressesAddressType = "other"
CounterpartyNewParamsLegalEntityAddressesAddressTypePoBox CounterpartyNewParamsLegalEntityAddressesAddressType = "po_box"
CounterpartyNewParamsLegalEntityAddressesAddressTypeResidential CounterpartyNewParamsLegalEntityAddressesAddressType = "residential"
)
func (r CounterpartyNewParamsLegalEntityAddressesAddressType) IsKnown() bool {
switch r {
case CounterpartyNewParamsLegalEntityAddressesAddressTypeBusiness, CounterpartyNewParamsLegalEntityAddressesAddressTypeMailing, CounterpartyNewParamsLegalEntityAddressesAddressTypeOther, CounterpartyNewParamsLegalEntityAddressesAddressTypePoBox, CounterpartyNewParamsLegalEntityAddressesAddressTypeResidential:
return true
}
return false
}
type CounterpartyNewParamsLegalEntityIdentification struct {
// The ID number of identification document.
IDNumber param.Field[string] `json:"id_number,required"`
// The type of ID number.
IDType param.Field[CounterpartyNewParamsLegalEntityIdentificationsIDType] `json:"id_type,required"`
// The ISO 3166-1 alpha-2 country code of the country that issued the
// identification
IssuingCountry param.Field[string] `json:"issuing_country"`
}
func (r CounterpartyNewParamsLegalEntityIdentification) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The type of ID number.
type CounterpartyNewParamsLegalEntityIdentificationsIDType string
const (
CounterpartyNewParamsLegalEntityIdentificationsIDTypeArCuil CounterpartyNewParamsLegalEntityIdentificationsIDType = "ar_cuil"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeArCuit CounterpartyNewParamsLegalEntityIdentificationsIDType = "ar_cuit"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeBrCnpj CounterpartyNewParamsLegalEntityIdentificationsIDType = "br_cnpj"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeBrCpf CounterpartyNewParamsLegalEntityIdentificationsIDType = "br_cpf"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeClRun CounterpartyNewParamsLegalEntityIdentificationsIDType = "cl_run"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeClRut CounterpartyNewParamsLegalEntityIdentificationsIDType = "cl_rut"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeCoCedulas CounterpartyNewParamsLegalEntityIdentificationsIDType = "co_cedulas"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeCoNit CounterpartyNewParamsLegalEntityIdentificationsIDType = "co_nit"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeHnID CounterpartyNewParamsLegalEntityIdentificationsIDType = "hn_id"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeHnRtn CounterpartyNewParamsLegalEntityIdentificationsIDType = "hn_rtn"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeInLei CounterpartyNewParamsLegalEntityIdentificationsIDType = "in_lei"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeKrBrn CounterpartyNewParamsLegalEntityIdentificationsIDType = "kr_brn"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeKrCrn CounterpartyNewParamsLegalEntityIdentificationsIDType = "kr_crn"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeKrRrn CounterpartyNewParamsLegalEntityIdentificationsIDType = "kr_rrn"
CounterpartyNewParamsLegalEntityIdentificationsIDTypePassport CounterpartyNewParamsLegalEntityIdentificationsIDType = "passport"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeSaTin CounterpartyNewParamsLegalEntityIdentificationsIDType = "sa_tin"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeSaVat CounterpartyNewParamsLegalEntityIdentificationsIDType = "sa_vat"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeUsEin CounterpartyNewParamsLegalEntityIdentificationsIDType = "us_ein"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeUsItin CounterpartyNewParamsLegalEntityIdentificationsIDType = "us_itin"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeUsSsn CounterpartyNewParamsLegalEntityIdentificationsIDType = "us_ssn"
CounterpartyNewParamsLegalEntityIdentificationsIDTypeVnTin CounterpartyNewParamsLegalEntityIdentificationsIDType = "vn_tin"
)
func (r CounterpartyNewParamsLegalEntityIdentificationsIDType) IsKnown() bool {
switch r {
case CounterpartyNewParamsLegalEntityIdentificationsIDTypeArCuil, CounterpartyNewParamsLegalEntityIdentificationsIDTypeArCuit, CounterpartyNewParamsLegalEntityIdentificationsIDTypeBrCnpj, CounterpartyNewParamsLegalEntityIdentificationsIDTypeBrCpf, CounterpartyNewParamsLegalEntityIdentificationsIDTypeClRun, CounterpartyNewParamsLegalEntityIdentificationsIDTypeClRut, CounterpartyNewParamsLegalEntityIdentificationsIDTypeCoCedulas, CounterpartyNewParamsLegalEntityIdentificationsIDTypeCoNit, CounterpartyNewParamsLegalEntityIdentificationsIDTypeHnID, CounterpartyNewParamsLegalEntityIdentificationsIDTypeHnRtn, CounterpartyNewParamsLegalEntityIdentificationsIDTypeInLei, CounterpartyNewParamsLegalEntityIdentificationsIDTypeKrBrn, CounterpartyNewParamsLegalEntityIdentificationsIDTypeKrCrn, CounterpartyNewParamsLegalEntityIdentificationsIDTypeKrRrn, CounterpartyNewParamsLegalEntityIdentificationsIDTypePassport, CounterpartyNewParamsLegalEntityIdentificationsIDTypeSaTin, CounterpartyNewParamsLegalEntityIdentificationsIDTypeSaVat, CounterpartyNewParamsLegalEntityIdentificationsIDTypeUsEin, CounterpartyNewParamsLegalEntityIdentificationsIDTypeUsItin, CounterpartyNewParamsLegalEntityIdentificationsIDTypeUsSsn, CounterpartyNewParamsLegalEntityIdentificationsIDTypeVnTin:
return true
}
return false
}
type CounterpartyNewParamsLegalEntityLegalEntityAssociation struct {
RelationshipTypes param.Field[[]CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipType] `json:"relationship_types,required"`
// The child legal entity.
ChildLegalEntity param.Field[CounterpartyNewParamsLegalEntityLegalEntityAssociationsChildLegalEntity] `json:"child_legal_entity"`
// The ID of the child legal entity.
ChildLegalEntityID param.Field[string] `json:"child_legal_entity_id"`
// The child entity's ownership percentage iff they are a beneficial owner.
OwnershipPercentage param.Field[int64] `json:"ownership_percentage"`
// The job title of the child entity at the parent entity.
Title param.Field[string] `json:"title"`
}
func (r CounterpartyNewParamsLegalEntityLegalEntityAssociation) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// A list of relationship types for how the child entity relates to parent entity.
type CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipType string
const (
CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipTypeBeneficialOwner CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipType = "beneficial_owner"
CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipTypeControlPerson CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipType = "control_person"
)
func (r CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipType) IsKnown() bool {
switch r {
case CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipTypeBeneficialOwner, CounterpartyNewParamsLegalEntityLegalEntityAssociationsRelationshipTypeControlPerson:
return true
}
return false
}
// The child legal entity.
type CounterpartyNewParamsLegalEntityLegalEntityAssociationsChildLegalEntity struct {
// A list of addresses for the entity.
Addresses param.Field[[]CounterpartyNewParamsLegalEntityLegalEntityAssociationsChildLegalEntityAddress] `json:"addresses"`
BankSettings param.Field[BankSettingsParam] `json:"bank_settings"`
// The business's legal business name.
BusinessName param.Field[string] `json:"business_name"`
// The country of citizenship for an individual.
CitizenshipCountry param.Field[string] `json:"citizenship_country"`
// A business's formation date (YYYY-MM-DD).
DateFormed param.Field[time.Time] `json:"date_formed" format:"date"`
// An individual's date of birth (YYYY-MM-DD).
DateOfBirth param.Field[time.Time] `json:"date_of_birth" format:"date"`
DoingBusinessAsNames param.Field[[]string] `json:"doing_business_as_names"`
// The entity's primary email.
Email param.Field[string] `json:"email"`
// An individual's first name.
FirstName param.Field[string] `json:"first_name"`
// A list of identifications for the legal entity.
Identifications param.Field[[]CounterpartyNewParamsLegalEntityLegalEntityAssociationsChildLegalEntityIdentification] `json:"identifications"`
// An individual's last name.
LastName param.Field[string] `json:"last_name"`
// The type of legal entity.
LegalEntityType param.Field[CounterpartyNewParamsLegalEntityLegalEntityAssociationsChildLegalEntityLegalEntityType] `json:"legal_entity_type"`
// The business's legal structure.
LegalStructure param.Field[CounterpartyNewParamsLegalEntityLegalEntityAssociationsChildLegalEntityLegalStructure] `json:"legal_structure"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata param.Field[map[string]string] `json:"metadata"`
// An individual's middle name.