-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbulkrequest.go
2457 lines (2216 loc) · 182 KB
/
bulkrequest.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"
)
// BulkRequestService 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 [NewBulkRequestService] method instead.
type BulkRequestService struct {
Options []option.RequestOption
}
// NewBulkRequestService 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 NewBulkRequestService(opts ...option.RequestOption) (r *BulkRequestService) {
r = &BulkRequestService{}
r.Options = opts
return
}
// create bulk_request
func (r *BulkRequestService) New(ctx context.Context, body BulkRequestNewParams, opts ...option.RequestOption) (res *BulkRequest, err error) {
opts = append(r.Options[:], opts...)
path := "api/bulk_requests"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// get bulk_request
func (r *BulkRequestService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *BulkRequest, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/bulk_requests/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// list bulk_requests
func (r *BulkRequestService) List(ctx context.Context, query BulkRequestListParams, opts ...option.RequestOption) (res *pagination.Page[BulkRequest], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "api/bulk_requests"
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 bulk_requests
func (r *BulkRequestService) ListAutoPaging(ctx context.Context, query BulkRequestListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BulkRequest] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
type BulkRequest struct {
ID string `json:"id,required" format:"uuid"`
// One of create, or update.
ActionType BulkRequestActionType `json:"action_type,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Total number of failed bulk results so far for this request
FailedResultCount int64 `json:"failed_result_count,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"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata map[string]string `json:"metadata,required"`
Object string `json:"object,required"`
// One of payment_order, expected_payment, or ledger_transaction.
ResourceType BulkRequestResourceType `json:"resource_type,required"`
// One of pending, processing, or completed.
Status BulkRequestStatus `json:"status,required"`
// Total number of successful bulk results so far for this request
SuccessResultCount int64 `json:"success_result_count,required"`
// Total number of items in the `resources` array. Once a bulk request is
// completed, `success_result_count` + `failed_result_count` will be equal to
// `total_result_count`.
TotalResourceCount int64 `json:"total_resource_count,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON bulkRequestJSON `json:"-"`
}
// bulkRequestJSON contains the JSON metadata for the struct [BulkRequest]
type bulkRequestJSON struct {
ID apijson.Field
ActionType apijson.Field
CreatedAt apijson.Field
FailedResultCount apijson.Field
LiveMode apijson.Field
Metadata apijson.Field
Object apijson.Field
ResourceType apijson.Field
Status apijson.Field
SuccessResultCount apijson.Field
TotalResourceCount apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BulkRequest) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bulkRequestJSON) RawJSON() string {
return r.raw
}
// One of create, or update.
type BulkRequestActionType string
const (
BulkRequestActionTypeCreate BulkRequestActionType = "create"
BulkRequestActionTypeUpdate BulkRequestActionType = "update"
BulkRequestActionTypeDelete BulkRequestActionType = "delete"
)
func (r BulkRequestActionType) IsKnown() bool {
switch r {
case BulkRequestActionTypeCreate, BulkRequestActionTypeUpdate, BulkRequestActionTypeDelete:
return true
}
return false
}
// One of payment_order, expected_payment, or ledger_transaction.
type BulkRequestResourceType string
const (
BulkRequestResourceTypePaymentOrder BulkRequestResourceType = "payment_order"
BulkRequestResourceTypeLedgerTransaction BulkRequestResourceType = "ledger_transaction"
BulkRequestResourceTypeTransaction BulkRequestResourceType = "transaction"
BulkRequestResourceTypeExpectedPayment BulkRequestResourceType = "expected_payment"
)
func (r BulkRequestResourceType) IsKnown() bool {
switch r {
case BulkRequestResourceTypePaymentOrder, BulkRequestResourceTypeLedgerTransaction, BulkRequestResourceTypeTransaction, BulkRequestResourceTypeExpectedPayment:
return true
}
return false
}
// One of pending, processing, or completed.
type BulkRequestStatus string
const (
BulkRequestStatusPending BulkRequestStatus = "pending"
BulkRequestStatusProcessing BulkRequestStatus = "processing"
BulkRequestStatusCompleted BulkRequestStatus = "completed"
)
func (r BulkRequestStatus) IsKnown() bool {
switch r {
case BulkRequestStatusPending, BulkRequestStatusProcessing, BulkRequestStatusCompleted:
return true
}
return false
}
type BulkRequestNewParams struct {
// One of create, or update.
ActionType param.Field[BulkRequestNewParamsActionType] `json:"action_type,required"`
// One of payment_order, expected_payment, or ledger_transaction.
ResourceType param.Field[BulkRequestNewParamsResourceType] `json:"resource_type,required"`
// An array of objects where each object contains the input params for a single
// `action_type` request on a `resource_type` resource
Resources param.Field[[]BulkRequestNewParamsResourceUnion] `json:"resources,required"`
// 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 BulkRequestNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// One of create, or update.
type BulkRequestNewParamsActionType string
const (
BulkRequestNewParamsActionTypeCreate BulkRequestNewParamsActionType = "create"
BulkRequestNewParamsActionTypeUpdate BulkRequestNewParamsActionType = "update"
BulkRequestNewParamsActionTypeDelete BulkRequestNewParamsActionType = "delete"
)
func (r BulkRequestNewParamsActionType) IsKnown() bool {
switch r {
case BulkRequestNewParamsActionTypeCreate, BulkRequestNewParamsActionTypeUpdate, BulkRequestNewParamsActionTypeDelete:
return true
}
return false
}
// One of payment_order, expected_payment, or ledger_transaction.
type BulkRequestNewParamsResourceType string
const (
BulkRequestNewParamsResourceTypePaymentOrder BulkRequestNewParamsResourceType = "payment_order"
BulkRequestNewParamsResourceTypeLedgerTransaction BulkRequestNewParamsResourceType = "ledger_transaction"
BulkRequestNewParamsResourceTypeTransaction BulkRequestNewParamsResourceType = "transaction"
BulkRequestNewParamsResourceTypeExpectedPayment BulkRequestNewParamsResourceType = "expected_payment"
)
func (r BulkRequestNewParamsResourceType) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourceTypePaymentOrder, BulkRequestNewParamsResourceTypeLedgerTransaction, BulkRequestNewParamsResourceTypeTransaction, BulkRequestNewParamsResourceTypeExpectedPayment:
return true
}
return false
}
type BulkRequestNewParamsResource struct {
ID param.Field[string] `json:"id" format:"uuid"`
Accounting param.Field[interface{}] `json:"accounting"`
// The ID of one of your accounting categories. Note that these will only be
// accessible if your accounting system has been connected.
AccountingCategoryID param.Field[string] `json:"accounting_category_id" format:"uuid"`
// The ID of one of your accounting ledger classes. Note that these will only be
// accessible if your accounting system has been connected.
AccountingLedgerClassID param.Field[string] `json:"accounting_ledger_class_id" format:"uuid"`
// Value in specified currency's smallest unit. e.g. $10 would be represented as
// 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000.
Amount param.Field[int64] `json:"amount"`
// The lowest amount this expected payment may be equal to. Value in specified
// currency's smallest unit. e.g. $10 would be represented as 1000.
AmountLowerBound param.Field[int64] `json:"amount_lower_bound"`
// The highest amount this expected payment may be equal to. Value in specified
// currency's smallest unit. e.g. $10 would be represented as 1000.
AmountUpperBound param.Field[int64] `json:"amount_upper_bound"`
// The date on which the transaction occurred.
AsOfDate param.Field[time.Time] `json:"as_of_date" format:"date"`
// The party that will pay the fees for the payment order. Only applies to wire
// payment orders. Can be one of shared, sender, or receiver, which correspond
// respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`.
ChargeBearer param.Field[BulkRequestNewParamsResourcesChargeBearer] `json:"charge_bearer"`
// The ID of the counterparty you expect for this payment.
CounterpartyID param.Field[string] `json:"counterparty_id" format:"uuid"`
// Defaults to the currency of the originating account.
Currency param.Field[shared.Currency] `json:"currency"`
// The earliest date the payment may come in. Format: yyyy-mm-dd
DateLowerBound param.Field[time.Time] `json:"date_lower_bound" format:"date"`
// The latest date the payment may come in. Format: yyyy-mm-dd
DateUpperBound param.Field[time.Time] `json:"date_upper_bound" format:"date"`
// An optional description for internal use.
Description param.Field[string] `json:"description"`
// One of `credit`, `debit`. Describes the direction money is flowing in the
// transaction. A `credit` moves money from your account to someone else's. A
// `debit` pulls money from someone else's account to your own. Note that wire,
// rtp, and check payments will always be `credit`.
Direction param.Field[string] `json:"direction"`
// The timestamp (ISO8601 format) at which the ledger transaction happened for
// reporting purposes.
EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date-time"`
// Date transactions are to be posted to the participants' account. Defaults to the
// current business day or the next business day if the current day is a bank
// holiday or weekend. Format: yyyy-mm-dd.
EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
// RFP payments require an expires_at. This value must be past the effective_date.
ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
// A unique string to represent the ledger transaction. Only one pending or posted
// ledger transaction may have this ID in the ledger.
ExternalID param.Field[string] `json:"external_id"`
// A payment type to fallback to if the original type is not valid for the
// receiving account. Currently, this only supports falling back from RTP to ACH
// (type=rtp and fallback_type=ach)
FallbackType param.Field[BulkRequestNewParamsResourcesFallbackType] `json:"fallback_type"`
// If present, indicates a specific foreign exchange contract number that has been
// generated by your financial institution.
ForeignExchangeContract param.Field[string] `json:"foreign_exchange_contract"`
// Indicates the type of FX transfer to initiate, can be either
// `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order
// currency matches the originating account currency.
ForeignExchangeIndicator param.Field[BulkRequestNewParamsResourcesForeignExchangeIndicator] `json:"foreign_exchange_indicator"`
// The ID of the Internal Account for the expected payment.
InternalAccountID param.Field[string] `json:"internal_account_id" format:"uuid"`
LedgerEntries param.Field[interface{}] `json:"ledger_entries"`
LedgerTransaction param.Field[interface{}] `json:"ledger_transaction"`
// Either ledger_transaction or ledger_transaction_id can be provided. Only a
// pending ledger transaction can be attached upon payment order creation. Once the
// payment order is created, the status of the ledger transaction tracks the
// payment order automatically.
LedgerTransactionID param.Field[string] `json:"ledger_transaction_id" format:"uuid"`
// If the ledger transaction can be reconciled 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 transaction can be reconciled to another object in Modern
// Treasury, the type will be populated here, otherwise null. This can be one of
// payment_order, incoming_payment_detail, expected_payment, return, paper_item, or
// reversal.
LedgerableType param.Field[BulkRequestNewParamsResourcesLedgerableType] `json:"ledgerable_type"`
LineItems param.Field[interface{}] `json:"line_items"`
Metadata param.Field[interface{}] `json:"metadata"`
// A boolean to determine if NSF Protection is enabled for this payment order. Note
// that this setting must also be turned on in your organization settings page.
NsfProtected param.Field[bool] `json:"nsf_protected"`
// The ID of one of your organization's internal accounts.
OriginatingAccountID param.Field[string] `json:"originating_account_id" format:"uuid"`
// If present, this will replace your default company name on receiver's bank
// statement. This field can only be used for ACH payments currently. For ACH, only
// the first 16 characters of this string will be used. Any additional characters
// will be truncated.
OriginatingPartyName param.Field[string] `json:"originating_party_name"`
// This field will be `true` if the transaction has posted to the account.
Posted param.Field[bool] `json:"posted"`
// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
// an overnight check rather than standard mail.
Priority param.Field[BulkRequestNewParamsResourcesPriority] `json:"priority"`
// If present, Modern Treasury will not process the payment until after this time.
// If `process_after` is past the cutoff for `effective_date`, `process_after` will
// take precedence and `effective_date` will automatically update to reflect the
// earliest possible sending date after `process_after`. Format is ISO8601
// timestamp.
ProcessAfter param.Field[time.Time] `json:"process_after" format:"date-time"`
// For `wire`, this is usually the purpose which is transmitted via the
// "InstrForDbtrAgt" field in the ISO20022 file. For `eft`, this field is the 3
// digit CPA Code that will be attached to the payment.
Purpose param.Field[string] `json:"purpose"`
ReceivingAccount param.Field[interface{}] `json:"receiving_account"`
// Either `receiving_account` or `receiving_account_id` must be present. When using
// `receiving_account_id`, you may pass the id of an external account or an
// internal account.
ReceivingAccountID param.Field[string] `json:"receiving_account_id" format:"uuid"`
ReconciliationFilters param.Field[interface{}] `json:"reconciliation_filters"`
ReconciliationGroups param.Field[interface{}] `json:"reconciliation_groups"`
ReconciliationRuleVariables param.Field[interface{}] `json:"reconciliation_rule_variables"`
// For `ach`, this field will be passed through on an addenda record. For `wire`
// payments the field will be passed through as the "Originator to Beneficiary
// Information", also known as OBI or Fedwire tag 6000.
RemittanceInformation param.Field[string] `json:"remittance_information"`
// Send an email to the counterparty when the payment order is sent to the bank. If
// `null`, `send_remittance_advice` on the Counterparty is used.
SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
// An optional descriptor which will appear in the receiver's statement. For
// `check` payments this field will be used as the memo line. For `ach` the maximum
// length is 10 characters. Note that for ACH payments, the name on your bank
// account will be included automatically by the bank, so you can use the
// characters for other useful information. For `eft` the maximum length is 15
// characters.
StatementDescriptor param.Field[string] `json:"statement_descriptor"`
// To post a ledger transaction at creation, use `posted`.
Status param.Field[BulkRequestNewParamsResourcesStatus] `json:"status"`
// An additional layer of classification for the type of payment order you are
// doing. This field is only used for `ach` payment orders currently. For `ach`
// payment orders, the `subtype` represents the SEC code. We currently support
// `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`.
Subtype param.Field[PaymentOrderSubtype] `json:"subtype"`
// A flag that determines whether a payment order should go through transaction
// monitoring.
TransactionMonitoringEnabled param.Field[bool] `json:"transaction_monitoring_enabled"`
// One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`,
// `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`,
// `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`.
Type param.Field[PaymentOrderType] `json:"type"`
// Identifier of the ultimate originator of the payment order.
UltimateOriginatingPartyIdentifier param.Field[string] `json:"ultimate_originating_party_identifier"`
// Name of the ultimate originator of the payment order.
UltimateOriginatingPartyName param.Field[string] `json:"ultimate_originating_party_name"`
// Identifier of the ultimate funds recipient.
UltimateReceivingPartyIdentifier param.Field[string] `json:"ultimate_receiving_party_identifier"`
// Name of the ultimate funds recipient.
UltimateReceivingPartyName param.Field[string] `json:"ultimate_receiving_party_name"`
// When applicable, the bank-given code that determines the transaction's category.
// For most banks this is the BAI2/BTRS transaction code.
VendorCode param.Field[string] `json:"vendor_code"`
// The type of `vendor_code` being reported. Can be one of `bai2`, `bankprov`,
// `bnk_dev`, `cleartouch`, `currencycloud`, `cross_river`, `dc_bank`, `dwolla`,
// `evolve`, `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `signet`, `silvergate`,
// `swift`, `us_bank`, or others.
VendorCodeType param.Field[string] `json:"vendor_code_type"`
// The transaction detail text that often appears in on your bank statement and in
// your banking portal.
VendorDescription param.Field[string] `json:"vendor_description"`
}
func (r BulkRequestNewParamsResource) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BulkRequestNewParamsResource) implementsBulkRequestNewParamsResourceUnion() {}
// Satisfied by [BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequest],
// [BulkRequestNewParamsResourcesExpectedPaymentCreateRequest],
// [BulkRequestNewParamsResourcesLedgerTransactionCreateRequest],
// [BulkRequestNewParamsResourcesTransactionCreateRequest],
// [BulkRequestNewParamsResourcesID],
// [BulkRequestNewParamsResourcesPaymentOrderUpdateRequestWithID],
// [BulkRequestNewParamsResourcesExpectedPaymentUpdateRequestWithID],
// [BulkRequestNewParamsResourcesTransactionUpdateRequestWithID],
// [BulkRequestNewParamsResourcesLedgerTransactionUpdateRequestWithID],
// [BulkRequestNewParamsResource].
type BulkRequestNewParamsResourceUnion interface {
implementsBulkRequestNewParamsResourceUnion()
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequest struct {
// Value in specified currency's smallest unit. e.g. $10 would be represented as
// 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000.
Amount param.Field[int64] `json:"amount,required"`
// One of `credit`, `debit`. Describes the direction money is flowing in the
// transaction. A `credit` moves money from your account to someone else's. A
// `debit` pulls money from someone else's account to your own. Note that wire,
// rtp, and check payments will always be `credit`.
Direction param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirection] `json:"direction,required"`
// The ID of one of your organization's internal accounts.
OriginatingAccountID param.Field[string] `json:"originating_account_id,required" format:"uuid"`
// One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`,
// `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`,
// `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`.
Type param.Field[PaymentOrderType] `json:"type,required"`
Accounting param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestAccounting] `json:"accounting"`
// The ID of one of your accounting categories. Note that these will only be
// accessible if your accounting system has been connected.
AccountingCategoryID param.Field[string] `json:"accounting_category_id" format:"uuid"`
// The ID of one of your accounting ledger classes. Note that these will only be
// accessible if your accounting system has been connected.
AccountingLedgerClassID param.Field[string] `json:"accounting_ledger_class_id" format:"uuid"`
// The party that will pay the fees for the payment order. Only applies to wire
// payment orders. Can be one of shared, sender, or receiver, which correspond
// respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`.
ChargeBearer param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearer] `json:"charge_bearer"`
// Defaults to the currency of the originating account.
Currency param.Field[shared.Currency] `json:"currency"`
// An optional description for internal use.
Description param.Field[string] `json:"description"`
// Date transactions are to be posted to the participants' account. Defaults to the
// current business day or the next business day if the current day is a bank
// holiday or weekend. Format: yyyy-mm-dd.
EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
// RFP payments require an expires_at. This value must be past the effective_date.
ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
// A payment type to fallback to if the original type is not valid for the
// receiving account. Currently, this only supports falling back from RTP to ACH
// (type=rtp and fallback_type=ach)
FallbackType param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestFallbackType] `json:"fallback_type"`
// If present, indicates a specific foreign exchange contract number that has been
// generated by your financial institution.
ForeignExchangeContract param.Field[string] `json:"foreign_exchange_contract"`
// Indicates the type of FX transfer to initiate, can be either
// `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order
// currency matches the originating account currency.
ForeignExchangeIndicator param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicator] `json:"foreign_exchange_indicator"`
// Specifies a ledger transaction object that will be created with the payment
// order. If the ledger transaction cannot be created, then the payment order
// creation will fail. The resulting ledger transaction will mirror the status of
// the payment order.
LedgerTransaction param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransaction] `json:"ledger_transaction"`
// Either ledger_transaction or ledger_transaction_id can be provided. Only a
// pending ledger transaction can be attached upon payment order creation. Once the
// payment order is created, the status of the ledger transaction tracks the
// payment order automatically.
LedgerTransactionID param.Field[string] `json:"ledger_transaction_id" format:"uuid"`
// An array of line items that must sum up to the amount of the payment order.
LineItems param.Field[[]BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLineItem] `json:"line_items"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata param.Field[map[string]string] `json:"metadata"`
// A boolean to determine if NSF Protection is enabled for this payment order. Note
// that this setting must also be turned on in your organization settings page.
NsfProtected param.Field[bool] `json:"nsf_protected"`
// If present, this will replace your default company name on receiver's bank
// statement. This field can only be used for ACH payments currently. For ACH, only
// the first 16 characters of this string will be used. Any additional characters
// will be truncated.
OriginatingPartyName param.Field[string] `json:"originating_party_name"`
// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
// an overnight check rather than standard mail.
Priority param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriority] `json:"priority"`
// If present, Modern Treasury will not process the payment until after this time.
// If `process_after` is past the cutoff for `effective_date`, `process_after` will
// take precedence and `effective_date` will automatically update to reflect the
// earliest possible sending date after `process_after`. Format is ISO8601
// timestamp.
ProcessAfter param.Field[time.Time] `json:"process_after" format:"date-time"`
// For `wire`, this is usually the purpose which is transmitted via the
// "InstrForDbtrAgt" field in the ISO20022 file. For `eft`, this field is the 3
// digit CPA Code that will be attached to the payment.
Purpose param.Field[string] `json:"purpose"`
// Either `receiving_account` or `receiving_account_id` must be present. When using
// `receiving_account_id`, you may pass the id of an external account or an
// internal account.
ReceivingAccount param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccount] `json:"receiving_account"`
// Either `receiving_account` or `receiving_account_id` must be present. When using
// `receiving_account_id`, you may pass the id of an external account or an
// internal account.
ReceivingAccountID param.Field[string] `json:"receiving_account_id" format:"uuid"`
// For `ach`, this field will be passed through on an addenda record. For `wire`
// payments the field will be passed through as the "Originator to Beneficiary
// Information", also known as OBI or Fedwire tag 6000.
RemittanceInformation param.Field[string] `json:"remittance_information"`
// Send an email to the counterparty when the payment order is sent to the bank. If
// `null`, `send_remittance_advice` on the Counterparty is used.
SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
// An optional descriptor which will appear in the receiver's statement. For
// `check` payments this field will be used as the memo line. For `ach` the maximum
// length is 10 characters. Note that for ACH payments, the name on your bank
// account will be included automatically by the bank, so you can use the
// characters for other useful information. For `eft` the maximum length is 15
// characters.
StatementDescriptor param.Field[string] `json:"statement_descriptor"`
// An additional layer of classification for the type of payment order you are
// doing. This field is only used for `ach` payment orders currently. For `ach`
// payment orders, the `subtype` represents the SEC code. We currently support
// `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`.
Subtype param.Field[PaymentOrderSubtype] `json:"subtype"`
// A flag that determines whether a payment order should go through transaction
// monitoring.
TransactionMonitoringEnabled param.Field[bool] `json:"transaction_monitoring_enabled"`
// Identifier of the ultimate originator of the payment order.
UltimateOriginatingPartyIdentifier param.Field[string] `json:"ultimate_originating_party_identifier"`
// Name of the ultimate originator of the payment order.
UltimateOriginatingPartyName param.Field[string] `json:"ultimate_originating_party_name"`
// Identifier of the ultimate funds recipient.
UltimateReceivingPartyIdentifier param.Field[string] `json:"ultimate_receiving_party_identifier"`
// Name of the ultimate funds recipient.
UltimateReceivingPartyName param.Field[string] `json:"ultimate_receiving_party_name"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequest) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequest) implementsBulkRequestNewParamsResourceUnion() {
}
// One of `credit`, `debit`. Describes the direction money is flowing in the
// transaction. A `credit` moves money from your account to someone else's. A
// `debit` pulls money from someone else's account to your own. Note that wire,
// rtp, and check payments will always be `credit`.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirection string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirectionCredit BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirection = "credit"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirectionDebit BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirection = "debit"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirection) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirectionCredit, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestDirectionDebit:
return true
}
return false
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestAccounting struct {
// The ID of one of your accounting categories. Note that these will only be
// accessible if your accounting system has been connected.
AccountID param.Field[string] `json:"account_id" format:"uuid"`
// The ID of one of the class objects in your accounting system. Class objects
// track segments of your business independent of client or project. Note that
// these will only be accessible if your accounting system has been connected.
ClassID param.Field[string] `json:"class_id" format:"uuid"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestAccounting) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The party that will pay the fees for the payment order. Only applies to wire
// payment orders. Can be one of shared, sender, or receiver, which correspond
// respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearer string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearerShared BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearer = "shared"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearerSender BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearer = "sender"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearerReceiver BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearer = "receiver"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearer) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearerShared, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearerSender, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestChargeBearerReceiver:
return true
}
return false
}
// A payment type to fallback to if the original type is not valid for the
// receiving account. Currently, this only supports falling back from RTP to ACH
// (type=rtp and fallback_type=ach)
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestFallbackType string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestFallbackTypeACH BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestFallbackType = "ach"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestFallbackType) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestFallbackTypeACH:
return true
}
return false
}
// Indicates the type of FX transfer to initiate, can be either
// `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order
// currency matches the originating account currency.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicator string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicatorFixedToVariable BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicator = "fixed_to_variable"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicatorVariableToFixed BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicator = "variable_to_fixed"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicator) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicatorFixedToVariable, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestForeignExchangeIndicatorVariableToFixed:
return true
}
return false
}
// Specifies a ledger transaction object that will be created with the payment
// order. If the ledger transaction cannot be created, then the payment order
// creation will fail. The resulting ledger transaction will mirror the status of
// the payment order.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransaction struct {
// An array of ledger entry objects.
LedgerEntries param.Field[[]BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerEntry] `json:"ledger_entries,required"`
// An optional description for internal use.
Description param.Field[string] `json:"description"`
// The timestamp (ISO8601 format) at which the ledger transaction happened for
// reporting purposes.
EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date-time"`
// The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
// purposes.
EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
// A unique string to represent the ledger transaction. Only one pending or posted
// ledger transaction may have this ID in the ledger.
ExternalID param.Field[string] `json:"external_id"`
// If the ledger transaction can be reconciled 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 transaction can be reconciled to another object in Modern
// Treasury, the type will be populated here, otherwise null. This can be one of
// payment_order, incoming_payment_detail, expected_payment, return, paper_item, or
// reversal.
LedgerableType param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType] `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"`
// To post a ledger transaction at creation, use `posted`.
Status param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatus] `json:"status"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransaction) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerEntry struct {
// Value in specified currency's smallest unit. e.g. $10 would be represented
// as 1000. Can be any integer up to 36 digits.
Amount param.Field[int64] `json:"amount,required"`
// One of `credit`, `debit`. Describes the direction money is flowing in the
// transaction. A `credit` moves money from your account to someone else's. A
// `debit` pulls money from someone else's account to your own. Note that wire,
// rtp, and check payments will always be `credit`.
Direction param.Field[shared.TransactionDirection] `json:"direction,required"`
// The ledger account that this ledger entry is associated with.
LedgerAccountID param.Field[string] `json:"ledger_account_id,required" format:"uuid"`
// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
// account’s available balance. If any of these conditions would be false after the
// transaction is created, the entire call will fail with error code 422.
AvailableBalanceAmount param.Field[map[string]int64] `json:"available_balance_amount"`
// Lock version of the ledger account. This can be passed when creating a ledger
// transaction to only succeed if no ledger transactions have posted since the
// given version. See our post about Designing the Ledgers API with Optimistic
// Locking for more details.
LockVersion param.Field[int64] `json:"lock_version"`
// Additional data represented as key-value pairs. Both the key and value must be
// strings.
Metadata param.Field[map[string]string] `json:"metadata"`
// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
// account’s pending balance. If any of these conditions would be false after the
// transaction is created, the entire call will fail with error code 422.
PendingBalanceAmount param.Field[map[string]int64] `json:"pending_balance_amount"`
// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
// account’s posted balance. If any of these conditions would be false after the
// transaction is created, the entire call will fail with error code 422.
PostedBalanceAmount param.Field[map[string]int64] `json:"posted_balance_amount"`
// If true, response will include the balance of the associated ledger account for
// the entry.
ShowResultingLedgerAccountBalances param.Field[bool] `json:"show_resulting_ledger_account_balances"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerEntry) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// If the ledger transaction can be reconciled to another object in Modern
// Treasury, the type will be populated here, otherwise null. This can be one of
// payment_order, incoming_payment_detail, expected_payment, return, paper_item, or
// reversal.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeExpectedPayment BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType = "expected_payment"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeIncomingPaymentDetail BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType = "incoming_payment_detail"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypePaperItem BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType = "paper_item"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypePaymentOrder BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType = "payment_order"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeReturn BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType = "return"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeReversal BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType = "reversal"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableType) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeExpectedPayment, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeIncomingPaymentDetail, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypePaperItem, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypePaymentOrder, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeReturn, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionLedgerableTypeReversal:
return true
}
return false
}
// To post a ledger transaction at creation, use `posted`.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatus string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatusArchived BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatus = "archived"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatusPending BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatus = "pending"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatusPosted BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatus = "posted"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatus) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatusArchived, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatusPending, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLedgerTransactionStatusPosted:
return true
}
return false
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLineItem struct {
// Value in specified currency's smallest unit. e.g. $10 would be represented
// as 1000.
Amount param.Field[int64] `json:"amount,required"`
// The ID of one of your accounting categories. Note that these will only be
// accessible if your accounting system has been connected.
AccountingCategoryID param.Field[string] `json:"accounting_category_id"`
// A free-form description of the line item.
Description param.Field[string] `json:"description"`
// 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 BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestLineItem) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
// an overnight check rather than standard mail.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriority string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriorityHigh BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriority = "high"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriorityNormal BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriority = "normal"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriority) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriorityHigh, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestPriorityNormal:
return true
}
return false
}
// Either `receiving_account` or `receiving_account_id` must be present. When using
// `receiving_account_id`, you may pass the id of an external account or an
// internal account.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccount struct {
AccountDetails param.Field[[]BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetail] `json:"account_details"`
// Can be `checking`, `savings` or `other`.
AccountType param.Field[ExternalAccountType] `json:"account_type"`
ContactDetails param.Field[[]BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetail] `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[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccount] `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[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyAddress] `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[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyType] `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[[]BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetail] `json:"routing_details"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccount) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetail struct {
AccountNumber param.Field[string] `json:"account_number,required"`
AccountNumberType param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType] `json:"account_number_type"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeAuNumber BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "au_number"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeClabe BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "clabe"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeHkNumber BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "hk_number"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeIban BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "iban"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeIDNumber BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "id_number"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeNzNumber BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "nz_number"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeOther BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "other"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypePan BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "pan"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeSgNumber BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "sg_number"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeWalletAddress BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType = "wallet_address"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberType) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeAuNumber, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeClabe, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeHkNumber, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeIban, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeIDNumber, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeNzNumber, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeOther, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypePan, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeSgNumber, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountAccountDetailsAccountNumberTypeWalletAddress:
return true
}
return false
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetail struct {
ContactIdentifier param.Field[string] `json:"contact_identifier"`
ContactIdentifierType param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierType string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierTypeEmail BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierType = "email"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierTypePhoneNumber BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierType = "phone_number"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierTypeWebsite BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierType = "website"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierType) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierTypeEmail, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierTypePhoneNumber, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountContactDetailsContactIdentifierTypeWebsite:
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 BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccount 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[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableType] `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 BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccount) 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 BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableType string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeCounterparty BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableType = "counterparty"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeExternalAccount BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableType = "external_account"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeInternalAccount BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableType = "internal_account"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeVirtualAccount BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableType = "virtual_account"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableType) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeCounterparty, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeExternalAccount, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeInternalAccount, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountLedgerAccountLedgerableTypeVirtualAccount:
return true
}
return false
}
// Required if receiving wire payments.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyAddress 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 BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyAddress) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Either `individual` or `business`.
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyType string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyTypeBusiness BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyType = "business"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyTypeIndividual BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyType = "individual"
)
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyType) IsKnown() bool {
switch r {
case BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyTypeBusiness, BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountPartyTypeIndividual:
return true
}
return false
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetail struct {
RoutingNumber param.Field[string] `json:"routing_number,required"`
RoutingNumberType param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
PaymentType param.Field[BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsPaymentType] `json:"payment_type"`
}
func (r BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetail) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType string
const (
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberTypeAba BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType = "aba"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberTypeAuBsb BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType = "au_bsb"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberTypeBrCodigo BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType = "br_codigo"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberTypeCaCpa BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType = "ca_cpa"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberTypeChips BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType = "chips"
BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberTypeCnaps BulkRequestNewParamsResourcesPaymentOrderAsyncCreateRequestReceivingAccountRoutingDetailsRoutingNumberType = "cnaps"