-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpaymentorder.go
2921 lines (2658 loc) · 199 KB
/
paymentorder.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 (
"bytes"
"context"
"errors"
"fmt"
"io"
"mime/multipart"
"net/http"
"net/url"
"reflect"
"time"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apiform"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apijson"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apiquery"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/param"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/requestconfig"
"github.com/Modern-Treasury/modern-treasury-go/v2/option"
"github.com/Modern-Treasury/modern-treasury-go/v2/packages/pagination"
"github.com/Modern-Treasury/modern-treasury-go/v2/shared"
"github.com/tidwall/gjson"
)
// PaymentOrderService 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 [NewPaymentOrderService] method instead.
type PaymentOrderService struct {
Options []option.RequestOption
Reversals *PaymentOrderReversalService
}
// NewPaymentOrderService 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 NewPaymentOrderService(opts ...option.RequestOption) (r *PaymentOrderService) {
r = &PaymentOrderService{}
r.Options = opts
r.Reversals = NewPaymentOrderReversalService(opts...)
return
}
// Create a new Payment Order
func (r *PaymentOrderService) New(ctx context.Context, body PaymentOrderNewParams, opts ...option.RequestOption) (res *PaymentOrder, err error) {
opts = append(r.Options[:], opts...)
path := "api/payment_orders"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Get details on a single payment order
func (r *PaymentOrderService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentOrder, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/payment_orders/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Update a payment order
func (r *PaymentOrderService) Update(ctx context.Context, id string, body PaymentOrderUpdateParams, opts ...option.RequestOption) (res *PaymentOrder, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/payment_orders/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// Get a list of all payment orders
func (r *PaymentOrderService) List(ctx context.Context, query PaymentOrderListParams, opts ...option.RequestOption) (res *pagination.Page[PaymentOrder], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "api/payment_orders"
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 list of all payment orders
func (r *PaymentOrderService) ListAutoPaging(ctx context.Context, query PaymentOrderListParams, opts ...option.RequestOption) *pagination.PageAutoPager[PaymentOrder] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// Create a new payment order asynchronously
func (r *PaymentOrderService) NewAsync(ctx context.Context, body PaymentOrderNewAsyncParams, opts ...option.RequestOption) (res *shared.AsyncResponse, err error) {
opts = append(r.Options[:], opts...)
path := "api/payment_orders/create_async"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
type PaymentOrder struct {
ID string `json:"id,required" format:"uuid"`
Accounting PaymentOrderAccounting `json:"accounting,required"`
// The ID of one of your accounting categories. Note that these will only be
// accessible if your accounting system has been connected.
//
// Deprecated: deprecated
AccountingCategoryID string `json:"accounting_category_id,required,nullable" 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.
//
// Deprecated: deprecated
AccountingLedgerClassID string `json:"accounting_ledger_class_id,required,nullable" 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 int64 `json:"amount,required"`
// 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 PaymentOrderChargeBearer `json:"charge_bearer,required,nullable"`
// Custom key-value pair for usage in compliance rules. Please contact support
// before making changes to this field.
ComplianceRuleMetadata map[string]interface{} `json:"compliance_rule_metadata,required,nullable"`
// If the payment order is tied to a specific Counterparty, their id will appear,
// otherwise `null`.
CounterpartyID string `json:"counterparty_id,required,nullable" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Defaults to the currency of the originating account.
Currency shared.Currency `json:"currency,required"`
// If the payment order's status is `returned`, this will include the return
// object's data.
CurrentReturn ReturnObject `json:"current_return,required,nullable"`
// The ID of the compliance decision for the payment order, if transaction
// monitoring is enabled.
DecisionID string `json:"decision_id,required,nullable" format:"uuid"`
// An optional description for internal use.
Description string `json:"description,required,nullable"`
// 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 PaymentOrderDirection `json:"direction,required"`
// 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 time.Time `json:"effective_date,required" format:"date"`
// RFP payments require an expires_at. This value must be past the effective_date.
ExpiresAt time.Time `json:"expires_at,required,nullable" format:"date-time"`
// If present, indicates a specific foreign exchange contract number that has been
// generated by your financial institution.
ForeignExchangeContract string `json:"foreign_exchange_contract,required,nullable"`
// 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 PaymentOrderForeignExchangeIndicator `json:"foreign_exchange_indicator,required,nullable"`
// Associated serialized foreign exchange rate information.
ForeignExchangeRate PaymentOrderForeignExchangeRate `json:"foreign_exchange_rate,required,nullable"`
// The ID of the ledger transaction linked to the payment order.
LedgerTransactionID string `json:"ledger_transaction_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 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 bool `json:"nsf_protected,required"`
Object string `json:"object,required"`
// The ID of one of your organization's internal accounts.
OriginatingAccountID string `json:"originating_account_id,required" 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 string `json:"originating_party_name,required,nullable"`
// 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 PaymentOrderPriority `json:"priority,required"`
// 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 time.Time `json:"process_after,required,nullable" 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 string `json:"purpose,required,nullable"`
// The receiving account ID. Can be an `external_account` or `internal_account`.
ReceivingAccountID string `json:"receiving_account_id,required" format:"uuid"`
ReceivingAccountType PaymentOrderReceivingAccountType `json:"receiving_account_type,required"`
ReferenceNumbers []PaymentOrderReferenceNumber `json:"reference_numbers,required"`
// 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 string `json:"remittance_information,required,nullable"`
// 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 bool `json:"send_remittance_advice,required,nullable"`
// 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 string `json:"statement_descriptor,required,nullable"`
// The current status of the payment order.
Status PaymentOrderStatus `json:"status,required"`
// 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 PaymentOrderSubtype `json:"subtype,required,nullable"`
// The IDs of all the transactions associated to this payment order. Usually, you
// will only have a single transaction ID. However, if a payment order initially
// results in a Return, but gets redrafted and is later successfully completed, it
// can have many transactions.
TransactionIDs []string `json:"transaction_ids,required" format:"uuid"`
// A flag that determines whether a payment order should go through transaction
// monitoring.
TransactionMonitoringEnabled bool `json:"transaction_monitoring_enabled,required"`
// 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 PaymentOrderType `json:"type,required"`
// The account to which the originating of this payment should be attributed to.
// Can be a `virtual_account` or `internal_account`.
UltimateOriginatingAccount PaymentOrderUltimateOriginatingAccount `json:"ultimate_originating_account,required,nullable"`
// The ultimate originating account ID. Can be a `virtual_account` or
// `internal_account`.
UltimateOriginatingAccountID string `json:"ultimate_originating_account_id,required,nullable" format:"uuid"`
UltimateOriginatingAccountType PaymentOrderUltimateOriginatingAccountType `json:"ultimate_originating_account_type,required,nullable"`
// Identifier of the ultimate originator of the payment order.
UltimateOriginatingPartyIdentifier string `json:"ultimate_originating_party_identifier,required,nullable"`
// Name of the ultimate originator of the payment order.
UltimateOriginatingPartyName string `json:"ultimate_originating_party_name,required,nullable"`
UltimateReceivingPartyIdentifier string `json:"ultimate_receiving_party_identifier,required,nullable"`
UltimateReceivingPartyName string `json:"ultimate_receiving_party_name,required,nullable"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
// Additional vendor specific fields for this payment. Data must be represented as
// key-value pairs.
VendorAttributes interface{} `json:"vendor_attributes,required,nullable"`
// This field will be populated if a vendor failure occurs. Logic shouldn't be
// built on its value as it is free-form.
VendorFailureReason string `json:"vendor_failure_reason,required,nullable"`
JSON paymentOrderJSON `json:"-"`
}
// paymentOrderJSON contains the JSON metadata for the struct [PaymentOrder]
type paymentOrderJSON struct {
ID apijson.Field
Accounting apijson.Field
AccountingCategoryID apijson.Field
AccountingLedgerClassID apijson.Field
Amount apijson.Field
ChargeBearer apijson.Field
ComplianceRuleMetadata apijson.Field
CounterpartyID apijson.Field
CreatedAt apijson.Field
Currency apijson.Field
CurrentReturn apijson.Field
DecisionID apijson.Field
Description apijson.Field
Direction apijson.Field
EffectiveDate apijson.Field
ExpiresAt apijson.Field
ForeignExchangeContract apijson.Field
ForeignExchangeIndicator apijson.Field
ForeignExchangeRate apijson.Field
LedgerTransactionID apijson.Field
LiveMode apijson.Field
Metadata apijson.Field
NsfProtected apijson.Field
Object apijson.Field
OriginatingAccountID apijson.Field
OriginatingPartyName apijson.Field
Priority apijson.Field
ProcessAfter apijson.Field
Purpose apijson.Field
ReceivingAccountID apijson.Field
ReceivingAccountType apijson.Field
ReferenceNumbers apijson.Field
RemittanceInformation apijson.Field
SendRemittanceAdvice apijson.Field
StatementDescriptor apijson.Field
Status apijson.Field
Subtype apijson.Field
TransactionIDs apijson.Field
TransactionMonitoringEnabled apijson.Field
Type apijson.Field
UltimateOriginatingAccount apijson.Field
UltimateOriginatingAccountID apijson.Field
UltimateOriginatingAccountType apijson.Field
UltimateOriginatingPartyIdentifier apijson.Field
UltimateOriginatingPartyName apijson.Field
UltimateReceivingPartyIdentifier apijson.Field
UltimateReceivingPartyName apijson.Field
UpdatedAt apijson.Field
VendorAttributes apijson.Field
VendorFailureReason apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *PaymentOrder) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r paymentOrderJSON) RawJSON() string {
return r.raw
}
func (r PaymentOrder) implementsBulkResultEntity() {}
type PaymentOrderAccounting struct {
// The ID of one of your accounting categories. Note that these will only be
// accessible if your accounting system has been connected.
AccountID string `json:"account_id,nullable" 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 string `json:"class_id,nullable" format:"uuid"`
JSON paymentOrderAccountingJSON `json:"-"`
}
// paymentOrderAccountingJSON contains the JSON metadata for the struct
// [PaymentOrderAccounting]
type paymentOrderAccountingJSON struct {
AccountID apijson.Field
ClassID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *PaymentOrderAccounting) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r paymentOrderAccountingJSON) RawJSON() string {
return r.raw
}
// 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 PaymentOrderChargeBearer string
const (
PaymentOrderChargeBearerShared PaymentOrderChargeBearer = "shared"
PaymentOrderChargeBearerSender PaymentOrderChargeBearer = "sender"
PaymentOrderChargeBearerReceiver PaymentOrderChargeBearer = "receiver"
)
func (r PaymentOrderChargeBearer) IsKnown() bool {
switch r {
case PaymentOrderChargeBearerShared, PaymentOrderChargeBearerSender, PaymentOrderChargeBearerReceiver:
return true
}
return false
}
// 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 PaymentOrderDirection string
const (
PaymentOrderDirectionCredit PaymentOrderDirection = "credit"
PaymentOrderDirectionDebit PaymentOrderDirection = "debit"
)
func (r PaymentOrderDirection) IsKnown() bool {
switch r {
case PaymentOrderDirectionCredit, PaymentOrderDirectionDebit:
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 PaymentOrderForeignExchangeIndicator string
const (
PaymentOrderForeignExchangeIndicatorFixedToVariable PaymentOrderForeignExchangeIndicator = "fixed_to_variable"
PaymentOrderForeignExchangeIndicatorVariableToFixed PaymentOrderForeignExchangeIndicator = "variable_to_fixed"
)
func (r PaymentOrderForeignExchangeIndicator) IsKnown() bool {
switch r {
case PaymentOrderForeignExchangeIndicatorFixedToVariable, PaymentOrderForeignExchangeIndicatorVariableToFixed:
return true
}
return false
}
// Associated serialized foreign exchange rate information.
type PaymentOrderForeignExchangeRate struct {
// Amount in the lowest denomination of the `base_currency` to convert, often
// called the "sell" amount.
BaseAmount int64 `json:"base_amount,required"`
// Currency to convert, often called the "sell" currency.
BaseCurrency shared.Currency `json:"base_currency,required"`
// The exponent component of the rate. The decimal is calculated as `value` / (10 ^
// `exponent`).
Exponent int64 `json:"exponent,required"`
// A string representation of the rate.
RateString string `json:"rate_string,required"`
// Amount in the lowest denomination of the `target_currency`, often called the
// "buy" amount.
TargetAmount int64 `json:"target_amount,required"`
// Currency to convert the `base_currency` to, often called the "buy" currency.
TargetCurrency shared.Currency `json:"target_currency,required"`
// The whole number component of the rate. The decimal is calculated as `value` /
// (10 ^ `exponent`).
Value int64 `json:"value,required"`
JSON paymentOrderForeignExchangeRateJSON `json:"-"`
}
// paymentOrderForeignExchangeRateJSON contains the JSON metadata for the struct
// [PaymentOrderForeignExchangeRate]
type paymentOrderForeignExchangeRateJSON struct {
BaseAmount apijson.Field
BaseCurrency apijson.Field
Exponent apijson.Field
RateString apijson.Field
TargetAmount apijson.Field
TargetCurrency apijson.Field
Value apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *PaymentOrderForeignExchangeRate) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r paymentOrderForeignExchangeRateJSON) RawJSON() string {
return r.raw
}
// 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 PaymentOrderPriority string
const (
PaymentOrderPriorityHigh PaymentOrderPriority = "high"
PaymentOrderPriorityNormal PaymentOrderPriority = "normal"
)
func (r PaymentOrderPriority) IsKnown() bool {
switch r {
case PaymentOrderPriorityHigh, PaymentOrderPriorityNormal:
return true
}
return false
}
type PaymentOrderReceivingAccountType string
const (
PaymentOrderReceivingAccountTypeInternalAccount PaymentOrderReceivingAccountType = "internal_account"
PaymentOrderReceivingAccountTypeExternalAccount PaymentOrderReceivingAccountType = "external_account"
)
func (r PaymentOrderReceivingAccountType) IsKnown() bool {
switch r {
case PaymentOrderReceivingAccountTypeInternalAccount, PaymentOrderReceivingAccountTypeExternalAccount:
return true
}
return false
}
type PaymentOrderReferenceNumber struct {
ID string `json:"id,required" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" 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"`
// The vendor reference number.
ReferenceNumber string `json:"reference_number,required"`
// The type of the reference number. Referring to the vendor payment id.
ReferenceNumberType PaymentOrderReferenceNumbersReferenceNumberType `json:"reference_number_type,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON paymentOrderReferenceNumberJSON `json:"-"`
}
// paymentOrderReferenceNumberJSON contains the JSON metadata for the struct
// [PaymentOrderReferenceNumber]
type paymentOrderReferenceNumberJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LiveMode apijson.Field
Object apijson.Field
ReferenceNumber apijson.Field
ReferenceNumberType apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *PaymentOrderReferenceNumber) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r paymentOrderReferenceNumberJSON) RawJSON() string {
return r.raw
}
// The type of the reference number. Referring to the vendor payment id.
type PaymentOrderReferenceNumbersReferenceNumberType string
const (
PaymentOrderReferenceNumbersReferenceNumberTypeACHOriginalTraceNumber PaymentOrderReferenceNumbersReferenceNumberType = "ach_original_trace_number"
PaymentOrderReferenceNumbersReferenceNumberTypeACHTraceNumber PaymentOrderReferenceNumbersReferenceNumberType = "ach_trace_number"
PaymentOrderReferenceNumbersReferenceNumberTypeBankprovPaymentActivityDate PaymentOrderReferenceNumbersReferenceNumberType = "bankprov_payment_activity_date"
PaymentOrderReferenceNumbersReferenceNumberTypeBankprovPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "bankprov_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeBnkDevPrenotificationID PaymentOrderReferenceNumbersReferenceNumberType = "bnk_dev_prenotification_id"
PaymentOrderReferenceNumbersReferenceNumberTypeBnkDevTransferID PaymentOrderReferenceNumbersReferenceNumberType = "bnk_dev_transfer_id"
PaymentOrderReferenceNumbersReferenceNumberTypeBofaEndToEndID PaymentOrderReferenceNumbersReferenceNumberType = "bofa_end_to_end_id"
PaymentOrderReferenceNumbersReferenceNumberTypeBofaTransactionID PaymentOrderReferenceNumbersReferenceNumberType = "bofa_transaction_id"
PaymentOrderReferenceNumbersReferenceNumberTypeCheckNumber PaymentOrderReferenceNumbersReferenceNumberType = "check_number"
PaymentOrderReferenceNumbersReferenceNumberTypeCitibankReferenceNumber PaymentOrderReferenceNumbersReferenceNumberType = "citibank_reference_number"
PaymentOrderReferenceNumbersReferenceNumberTypeCitibankWorldlinkClearingSystemReferenceNumber PaymentOrderReferenceNumbersReferenceNumberType = "citibank_worldlink_clearing_system_reference_number"
PaymentOrderReferenceNumbersReferenceNumberTypeColumnFxQuoteID PaymentOrderReferenceNumbersReferenceNumberType = "column_fx_quote_id"
PaymentOrderReferenceNumbersReferenceNumberTypeColumnReversalPairTransferID PaymentOrderReferenceNumbersReferenceNumberType = "column_reversal_pair_transfer_id"
PaymentOrderReferenceNumbersReferenceNumberTypeColumnTransferID PaymentOrderReferenceNumbersReferenceNumberType = "column_transfer_id"
PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "cross_river_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverServiceMessage PaymentOrderReferenceNumbersReferenceNumberType = "cross_river_service_message"
PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverTransactionID PaymentOrderReferenceNumbersReferenceNumberType = "cross_river_transaction_id"
PaymentOrderReferenceNumbersReferenceNumberTypeCurrencycloudConversionID PaymentOrderReferenceNumbersReferenceNumberType = "currencycloud_conversion_id"
PaymentOrderReferenceNumbersReferenceNumberTypeCurrencycloudPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "currencycloud_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeDcBankTransactionID PaymentOrderReferenceNumbersReferenceNumberType = "dc_bank_transaction_id"
PaymentOrderReferenceNumbersReferenceNumberTypeDwollaTransactionID PaymentOrderReferenceNumbersReferenceNumberType = "dwolla_transaction_id"
PaymentOrderReferenceNumbersReferenceNumberTypeEftTraceNumber PaymentOrderReferenceNumbersReferenceNumberType = "eft_trace_number"
PaymentOrderReferenceNumbersReferenceNumberTypeEvolveTransactionID PaymentOrderReferenceNumbersReferenceNumberType = "evolve_transaction_id"
PaymentOrderReferenceNumbersReferenceNumberTypeFedwireImad PaymentOrderReferenceNumbersReferenceNumberType = "fedwire_imad"
PaymentOrderReferenceNumbersReferenceNumberTypeFedwireOmad PaymentOrderReferenceNumbersReferenceNumberType = "fedwire_omad"
PaymentOrderReferenceNumbersReferenceNumberTypeFirstRepublicInternalID PaymentOrderReferenceNumbersReferenceNumberType = "first_republic_internal_id"
PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsCollectionRequestID PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_collection_request_id"
PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsEndToEndID PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_end_to_end_id"
PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsPaymentRequestID PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_payment_request_id"
PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsRequestID PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_request_id"
PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsUniquePaymentID PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_unique_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeInteracMessageID PaymentOrderReferenceNumbersReferenceNumberType = "interac_message_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcCcn PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_ccn"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcClearingSystemReference PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_clearing_system_reference"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcCustomerReferenceID PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_customer_reference_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcEndToEndID PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_end_to_end_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcFirmRootID PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_firm_root_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcFxTrnID PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_fx_trn_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcP3ID PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_p3_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentBatchID PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_payment_batch_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentInformationID PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_payment_information_id"
PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentReturnedDatetime PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_payment_returned_datetime"
PaymentOrderReferenceNumbersReferenceNumberTypeLobCheckID PaymentOrderReferenceNumbersReferenceNumberType = "lob_check_id"
PaymentOrderReferenceNumbersReferenceNumberTypeOther PaymentOrderReferenceNumbersReferenceNumberType = "other"
PaymentOrderReferenceNumbersReferenceNumberTypePartialSwiftMir PaymentOrderReferenceNumbersReferenceNumberType = "partial_swift_mir"
PaymentOrderReferenceNumbersReferenceNumberTypePncClearingReference PaymentOrderReferenceNumbersReferenceNumberType = "pnc_clearing_reference"
PaymentOrderReferenceNumbersReferenceNumberTypePncInstructionID PaymentOrderReferenceNumbersReferenceNumberType = "pnc_instruction_id"
PaymentOrderReferenceNumbersReferenceNumberTypePncMultipaymentID PaymentOrderReferenceNumbersReferenceNumberType = "pnc_multipayment_id"
PaymentOrderReferenceNumbersReferenceNumberTypePncPaymentTraceID PaymentOrderReferenceNumbersReferenceNumberType = "pnc_payment_trace_id"
PaymentOrderReferenceNumbersReferenceNumberTypePncTransactionReferenceNumber PaymentOrderReferenceNumbersReferenceNumberType = "pnc_transaction_reference_number"
PaymentOrderReferenceNumbersReferenceNumberTypeRspecVendorPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "rspec_vendor_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeRtpInstructionID PaymentOrderReferenceNumbersReferenceNumberType = "rtp_instruction_id"
PaymentOrderReferenceNumbersReferenceNumberTypeSignetAPIReferenceID PaymentOrderReferenceNumbersReferenceNumberType = "signet_api_reference_id"
PaymentOrderReferenceNumbersReferenceNumberTypeSignetConfirmationID PaymentOrderReferenceNumbersReferenceNumberType = "signet_confirmation_id"
PaymentOrderReferenceNumbersReferenceNumberTypeSignetRequestID PaymentOrderReferenceNumbersReferenceNumberType = "signet_request_id"
PaymentOrderReferenceNumbersReferenceNumberTypeSilvergatePaymentID PaymentOrderReferenceNumbersReferenceNumberType = "silvergate_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeSvbEndToEndID PaymentOrderReferenceNumbersReferenceNumberType = "svb_end_to_end_id"
PaymentOrderReferenceNumbersReferenceNumberTypeSvbPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "svb_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeSvbTransactionClearedForSanctionsReview PaymentOrderReferenceNumbersReferenceNumberType = "svb_transaction_cleared_for_sanctions_review"
PaymentOrderReferenceNumbersReferenceNumberTypeSvbTransactionHeldForSanctionsReview PaymentOrderReferenceNumbersReferenceNumberType = "svb_transaction_held_for_sanctions_review"
PaymentOrderReferenceNumbersReferenceNumberTypeSwiftMir PaymentOrderReferenceNumbersReferenceNumberType = "swift_mir"
PaymentOrderReferenceNumbersReferenceNumberTypeSwiftUetr PaymentOrderReferenceNumbersReferenceNumberType = "swift_uetr"
PaymentOrderReferenceNumbersReferenceNumberTypeUmbProductPartnerAccountNumber PaymentOrderReferenceNumbersReferenceNumberType = "umb_product_partner_account_number"
PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPaymentApplicationReferenceID PaymentOrderReferenceNumbersReferenceNumberType = "usbank_payment_application_reference_id"
PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "usbank_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPendingRtpPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "usbank_pending_rtp_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPostedRtpPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "usbank_posted_rtp_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoEndToEndID PaymentOrderReferenceNumbersReferenceNumberType = "wells_fargo_end_to_end_id"
PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoPaymentID PaymentOrderReferenceNumbersReferenceNumberType = "wells_fargo_payment_id"
PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoTraceNumber PaymentOrderReferenceNumbersReferenceNumberType = "wells_fargo_trace_number"
PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoUetr PaymentOrderReferenceNumbersReferenceNumberType = "wells_fargo_uetr"
)
func (r PaymentOrderReferenceNumbersReferenceNumberType) IsKnown() bool {
switch r {
case PaymentOrderReferenceNumbersReferenceNumberTypeACHOriginalTraceNumber, PaymentOrderReferenceNumbersReferenceNumberTypeACHTraceNumber, PaymentOrderReferenceNumbersReferenceNumberTypeBankprovPaymentActivityDate, PaymentOrderReferenceNumbersReferenceNumberTypeBankprovPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeBnkDevPrenotificationID, PaymentOrderReferenceNumbersReferenceNumberTypeBnkDevTransferID, PaymentOrderReferenceNumbersReferenceNumberTypeBofaEndToEndID, PaymentOrderReferenceNumbersReferenceNumberTypeBofaTransactionID, PaymentOrderReferenceNumbersReferenceNumberTypeCheckNumber, PaymentOrderReferenceNumbersReferenceNumberTypeCitibankReferenceNumber, PaymentOrderReferenceNumbersReferenceNumberTypeCitibankWorldlinkClearingSystemReferenceNumber, PaymentOrderReferenceNumbersReferenceNumberTypeColumnFxQuoteID, PaymentOrderReferenceNumbersReferenceNumberTypeColumnReversalPairTransferID, PaymentOrderReferenceNumbersReferenceNumberTypeColumnTransferID, PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverServiceMessage, PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverTransactionID, PaymentOrderReferenceNumbersReferenceNumberTypeCurrencycloudConversionID, PaymentOrderReferenceNumbersReferenceNumberTypeCurrencycloudPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeDcBankTransactionID, PaymentOrderReferenceNumbersReferenceNumberTypeDwollaTransactionID, PaymentOrderReferenceNumbersReferenceNumberTypeEftTraceNumber, PaymentOrderReferenceNumbersReferenceNumberTypeEvolveTransactionID, PaymentOrderReferenceNumbersReferenceNumberTypeFedwireImad, PaymentOrderReferenceNumbersReferenceNumberTypeFedwireOmad, PaymentOrderReferenceNumbersReferenceNumberTypeFirstRepublicInternalID, PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsCollectionRequestID, PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsEndToEndID, PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsPaymentRequestID, PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsRequestID, PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsUniquePaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeInteracMessageID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcCcn, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcClearingSystemReference, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcCustomerReferenceID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcEndToEndID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcFirmRootID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcFxTrnID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcP3ID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentBatchID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentInformationID, PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentReturnedDatetime, PaymentOrderReferenceNumbersReferenceNumberTypeLobCheckID, PaymentOrderReferenceNumbersReferenceNumberTypeOther, PaymentOrderReferenceNumbersReferenceNumberTypePartialSwiftMir, PaymentOrderReferenceNumbersReferenceNumberTypePncClearingReference, PaymentOrderReferenceNumbersReferenceNumberTypePncInstructionID, PaymentOrderReferenceNumbersReferenceNumberTypePncMultipaymentID, PaymentOrderReferenceNumbersReferenceNumberTypePncPaymentTraceID, PaymentOrderReferenceNumbersReferenceNumberTypePncTransactionReferenceNumber, PaymentOrderReferenceNumbersReferenceNumberTypeRspecVendorPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeRtpInstructionID, PaymentOrderReferenceNumbersReferenceNumberTypeSignetAPIReferenceID, PaymentOrderReferenceNumbersReferenceNumberTypeSignetConfirmationID, PaymentOrderReferenceNumbersReferenceNumberTypeSignetRequestID, PaymentOrderReferenceNumbersReferenceNumberTypeSilvergatePaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeSvbEndToEndID, PaymentOrderReferenceNumbersReferenceNumberTypeSvbPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeSvbTransactionClearedForSanctionsReview, PaymentOrderReferenceNumbersReferenceNumberTypeSvbTransactionHeldForSanctionsReview, PaymentOrderReferenceNumbersReferenceNumberTypeSwiftMir, PaymentOrderReferenceNumbersReferenceNumberTypeSwiftUetr, PaymentOrderReferenceNumbersReferenceNumberTypeUmbProductPartnerAccountNumber, PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPaymentApplicationReferenceID, PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPendingRtpPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPostedRtpPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoEndToEndID, PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoPaymentID, PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoTraceNumber, PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoUetr:
return true
}
return false
}
// The current status of the payment order.
type PaymentOrderStatus string
const (
PaymentOrderStatusApproved PaymentOrderStatus = "approved"
PaymentOrderStatusCancelled PaymentOrderStatus = "cancelled"
PaymentOrderStatusCompleted PaymentOrderStatus = "completed"
PaymentOrderStatusDenied PaymentOrderStatus = "denied"
PaymentOrderStatusFailed PaymentOrderStatus = "failed"
PaymentOrderStatusNeedsApproval PaymentOrderStatus = "needs_approval"
PaymentOrderStatusPending PaymentOrderStatus = "pending"
PaymentOrderStatusProcessing PaymentOrderStatus = "processing"
PaymentOrderStatusReturned PaymentOrderStatus = "returned"
PaymentOrderStatusReversed PaymentOrderStatus = "reversed"
PaymentOrderStatusSent PaymentOrderStatus = "sent"
)
func (r PaymentOrderStatus) IsKnown() bool {
switch r {
case PaymentOrderStatusApproved, PaymentOrderStatusCancelled, PaymentOrderStatusCompleted, PaymentOrderStatusDenied, PaymentOrderStatusFailed, PaymentOrderStatusNeedsApproval, PaymentOrderStatusPending, PaymentOrderStatusProcessing, PaymentOrderStatusReturned, PaymentOrderStatusReversed, PaymentOrderStatusSent:
return true
}
return false
}
// The account to which the originating of this payment should be attributed to.
// Can be a `virtual_account` or `internal_account`.
type PaymentOrderUltimateOriginatingAccount struct {
ID string `json:"id,required" format:"uuid"`
// This field can have the runtime type of [[]AccountDetail].
AccountDetails interface{} `json:"account_details,required"`
// The ID of a counterparty that the virtual account belongs to. Optional.
CounterpartyID string `json:"counterparty_id,required,nullable" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// If the virtual account links to a ledger account in Modern Treasury, the id of
// the ledger account will be populated here.
LedgerAccountID string `json:"ledger_account_id,required,nullable" format:"uuid"`
// This field will be true if this object exists in the live environment or false
// if it exists in the test environment.
LiveMode bool `json:"live_mode,required"`
// This field can have the runtime type of [map[string]string].
Metadata interface{} `json:"metadata,required"`
// The name of the virtual account.
Name string `json:"name,required"`
Object string `json:"object,required"`
// This field can have the runtime type of [[]RoutingDetail].
RoutingDetails interface{} `json:"routing_details,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
// Can be checking, savings or other.
AccountType PaymentOrderUltimateOriginatingAccountAccountType `json:"account_type,nullable"`
// Specifies which financial institution the accounts belong to.
Connection Connection `json:"connection"`
// The ID of a credit normal ledger account. When money enters the virtual account,
// this ledger account will be credited. Must be accompanied by a
// debit_ledger_account_id if present.
CreditLedgerAccountID string `json:"credit_ledger_account_id,nullable" format:"uuid"`
// The currency of the account.
Currency shared.Currency `json:"currency"`
// The ID of a debit normal ledger account. When money enters the virtual account,
// this ledger account will be debited. Must be accompanied by a
// credit_ledger_account_id if present.
DebitLedgerAccountID string `json:"debit_ledger_account_id,nullable" format:"uuid"`
// An optional free-form description for internal use.
Description string `json:"description,nullable"`
DiscardedAt time.Time `json:"discarded_at,nullable" format:"date-time"`
// The ID of the internal account that the virtual account is in.
InternalAccountID string `json:"internal_account_id" format:"uuid"`
// The Legal Entity associated to this account
LegalEntityID string `json:"legal_entity_id,nullable" format:"uuid"`
// The parent InternalAccount of this account.
ParentAccountID string `json:"parent_account_id,nullable" format:"uuid"`
// This field can have the runtime type of [InternalAccountPartyAddress].
PartyAddress interface{} `json:"party_address"`
// The legal name of the entity which owns the account.
PartyName string `json:"party_name"`
// Either individual or business.
PartyType PaymentOrderUltimateOriginatingAccountPartyType `json:"party_type,nullable"`
JSON paymentOrderUltimateOriginatingAccountJSON `json:"-"`
union PaymentOrderUltimateOriginatingAccountUnion
}
// paymentOrderUltimateOriginatingAccountJSON contains the JSON metadata for the
// struct [PaymentOrderUltimateOriginatingAccount]
type paymentOrderUltimateOriginatingAccountJSON struct {
ID apijson.Field
AccountDetails apijson.Field
CounterpartyID apijson.Field
CreatedAt apijson.Field
LedgerAccountID apijson.Field
LiveMode apijson.Field
Metadata apijson.Field
Name apijson.Field
Object apijson.Field
RoutingDetails apijson.Field
UpdatedAt apijson.Field
AccountType apijson.Field
Connection apijson.Field
CreditLedgerAccountID apijson.Field
Currency apijson.Field
DebitLedgerAccountID apijson.Field
Description apijson.Field
DiscardedAt apijson.Field
InternalAccountID apijson.Field
LegalEntityID apijson.Field
ParentAccountID apijson.Field
PartyAddress apijson.Field
PartyName apijson.Field
PartyType apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r paymentOrderUltimateOriginatingAccountJSON) RawJSON() string {
return r.raw
}
func (r *PaymentOrderUltimateOriginatingAccount) UnmarshalJSON(data []byte) (err error) {
*r = PaymentOrderUltimateOriginatingAccount{}
err = apijson.UnmarshalRoot(data, &r.union)
if err != nil {
return err
}
return apijson.Port(r.union, &r)
}
// AsUnion returns a [PaymentOrderUltimateOriginatingAccountUnion] interface which
// you can cast to the specific types for more type safety.
//
// Possible runtime types of the union are [VirtualAccount], [InternalAccount].
func (r PaymentOrderUltimateOriginatingAccount) AsUnion() PaymentOrderUltimateOriginatingAccountUnion {
return r.union
}
// The account to which the originating of this payment should be attributed to.
// Can be a `virtual_account` or `internal_account`.
//
// Union satisfied by [VirtualAccount] or [InternalAccount].
type PaymentOrderUltimateOriginatingAccountUnion interface {
implementsPaymentOrderUltimateOriginatingAccount()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*PaymentOrderUltimateOriginatingAccountUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(VirtualAccount{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(InternalAccount{}),
},
)
}
// Can be checking, savings or other.
type PaymentOrderUltimateOriginatingAccountAccountType string
const (
PaymentOrderUltimateOriginatingAccountAccountTypeCash PaymentOrderUltimateOriginatingAccountAccountType = "cash"
PaymentOrderUltimateOriginatingAccountAccountTypeChecking PaymentOrderUltimateOriginatingAccountAccountType = "checking"
PaymentOrderUltimateOriginatingAccountAccountTypeGeneralLedger PaymentOrderUltimateOriginatingAccountAccountType = "general_ledger"
PaymentOrderUltimateOriginatingAccountAccountTypeLoan PaymentOrderUltimateOriginatingAccountAccountType = "loan"
PaymentOrderUltimateOriginatingAccountAccountTypeNonResident PaymentOrderUltimateOriginatingAccountAccountType = "non_resident"
PaymentOrderUltimateOriginatingAccountAccountTypeOther PaymentOrderUltimateOriginatingAccountAccountType = "other"
PaymentOrderUltimateOriginatingAccountAccountTypeOverdraft PaymentOrderUltimateOriginatingAccountAccountType = "overdraft"
PaymentOrderUltimateOriginatingAccountAccountTypeSavings PaymentOrderUltimateOriginatingAccountAccountType = "savings"
)
func (r PaymentOrderUltimateOriginatingAccountAccountType) IsKnown() bool {
switch r {
case PaymentOrderUltimateOriginatingAccountAccountTypeCash, PaymentOrderUltimateOriginatingAccountAccountTypeChecking, PaymentOrderUltimateOriginatingAccountAccountTypeGeneralLedger, PaymentOrderUltimateOriginatingAccountAccountTypeLoan, PaymentOrderUltimateOriginatingAccountAccountTypeNonResident, PaymentOrderUltimateOriginatingAccountAccountTypeOther, PaymentOrderUltimateOriginatingAccountAccountTypeOverdraft, PaymentOrderUltimateOriginatingAccountAccountTypeSavings:
return true
}
return false
}
// Either individual or business.
type PaymentOrderUltimateOriginatingAccountPartyType string
const (
PaymentOrderUltimateOriginatingAccountPartyTypeBusiness PaymentOrderUltimateOriginatingAccountPartyType = "business"
PaymentOrderUltimateOriginatingAccountPartyTypeIndividual PaymentOrderUltimateOriginatingAccountPartyType = "individual"
)
func (r PaymentOrderUltimateOriginatingAccountPartyType) IsKnown() bool {
switch r {
case PaymentOrderUltimateOriginatingAccountPartyTypeBusiness, PaymentOrderUltimateOriginatingAccountPartyTypeIndividual:
return true
}
return false
}
type PaymentOrderUltimateOriginatingAccountType string
const (
PaymentOrderUltimateOriginatingAccountTypeInternalAccount PaymentOrderUltimateOriginatingAccountType = "internal_account"
PaymentOrderUltimateOriginatingAccountTypeVirtualAccount PaymentOrderUltimateOriginatingAccountType = "virtual_account"
)
func (r PaymentOrderUltimateOriginatingAccountType) IsKnown() bool {
switch r {
case PaymentOrderUltimateOriginatingAccountTypeInternalAccount, PaymentOrderUltimateOriginatingAccountTypeVirtualAccount:
return true
}
return false
}
// 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`.
type PaymentOrderSubtype string
const (
PaymentOrderSubtypeBacsNewInstruction PaymentOrderSubtype = "0C"
PaymentOrderSubtypeBacsCancellationInstruction PaymentOrderSubtype = "0N"
PaymentOrderSubtypeBacsConversionInstruction PaymentOrderSubtype = "0S"
PaymentOrderSubtypeCcd PaymentOrderSubtype = "CCD"
PaymentOrderSubtypeCie PaymentOrderSubtype = "CIE"
PaymentOrderSubtypeCtx PaymentOrderSubtype = "CTX"
PaymentOrderSubtypeIat PaymentOrderSubtype = "IAT"
PaymentOrderSubtypePpd PaymentOrderSubtype = "PPD"
PaymentOrderSubtypeTel PaymentOrderSubtype = "TEL"
PaymentOrderSubtypeWeb PaymentOrderSubtype = "WEB"
PaymentOrderSubtypeAuBecs PaymentOrderSubtype = "au_becs"
PaymentOrderSubtypeBacs PaymentOrderSubtype = "bacs"
PaymentOrderSubtypeChats PaymentOrderSubtype = "chats"
PaymentOrderSubtypeDkNets PaymentOrderSubtype = "dk_nets"
PaymentOrderSubtypeEft PaymentOrderSubtype = "eft"
PaymentOrderSubtypeHuIcs PaymentOrderSubtype = "hu_ics"
PaymentOrderSubtypeMasav PaymentOrderSubtype = "masav"
PaymentOrderSubtypeMxCcen PaymentOrderSubtype = "mx_ccen"
PaymentOrderSubtypeNeft PaymentOrderSubtype = "neft"
PaymentOrderSubtypeNics PaymentOrderSubtype = "nics"
PaymentOrderSubtypeNzBecs PaymentOrderSubtype = "nz_becs"
PaymentOrderSubtypePlElixir PaymentOrderSubtype = "pl_elixir"
PaymentOrderSubtypeRoSent PaymentOrderSubtype = "ro_sent"
PaymentOrderSubtypeSeBankgirot PaymentOrderSubtype = "se_bankgirot"
PaymentOrderSubtypeSepa PaymentOrderSubtype = "sepa"
PaymentOrderSubtypeSgGiro PaymentOrderSubtype = "sg_giro"
PaymentOrderSubtypeSic PaymentOrderSubtype = "sic"
PaymentOrderSubtypeSknbi PaymentOrderSubtype = "sknbi"
PaymentOrderSubtypeZengin PaymentOrderSubtype = "zengin"
)
func (r PaymentOrderSubtype) IsKnown() bool {
switch r {
case PaymentOrderSubtypeBacsNewInstruction, PaymentOrderSubtypeBacsCancellationInstruction, PaymentOrderSubtypeBacsConversionInstruction, PaymentOrderSubtypeCcd, PaymentOrderSubtypeCie, PaymentOrderSubtypeCtx, PaymentOrderSubtypeIat, PaymentOrderSubtypePpd, PaymentOrderSubtypeTel, PaymentOrderSubtypeWeb, PaymentOrderSubtypeAuBecs, PaymentOrderSubtypeBacs, PaymentOrderSubtypeChats, PaymentOrderSubtypeDkNets, PaymentOrderSubtypeEft, PaymentOrderSubtypeHuIcs, PaymentOrderSubtypeMasav, PaymentOrderSubtypeMxCcen, PaymentOrderSubtypeNeft, PaymentOrderSubtypeNics, PaymentOrderSubtypeNzBecs, PaymentOrderSubtypePlElixir, PaymentOrderSubtypeRoSent, PaymentOrderSubtypeSeBankgirot, PaymentOrderSubtypeSepa, PaymentOrderSubtypeSgGiro, PaymentOrderSubtypeSic, PaymentOrderSubtypeSknbi, PaymentOrderSubtypeZengin:
return true
}
return false
}
// 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 PaymentOrderType string
const (
PaymentOrderTypeACH PaymentOrderType = "ach"
PaymentOrderTypeAuBecs PaymentOrderType = "au_becs"
PaymentOrderTypeBacs PaymentOrderType = "bacs"
PaymentOrderTypeBook PaymentOrderType = "book"
PaymentOrderTypeCard PaymentOrderType = "card"
PaymentOrderTypeChats PaymentOrderType = "chats"
PaymentOrderTypeCheck PaymentOrderType = "check"
PaymentOrderTypeCrossBorder PaymentOrderType = "cross_border"
PaymentOrderTypeDkNets PaymentOrderType = "dk_nets"
PaymentOrderTypeEft PaymentOrderType = "eft"
PaymentOrderTypeHuIcs PaymentOrderType = "hu_ics"
PaymentOrderTypeInterac PaymentOrderType = "interac"
PaymentOrderTypeMasav PaymentOrderType = "masav"
PaymentOrderTypeMxCcen PaymentOrderType = "mx_ccen"
PaymentOrderTypeNeft PaymentOrderType = "neft"
PaymentOrderTypeNics PaymentOrderType = "nics"
PaymentOrderTypeNzBecs PaymentOrderType = "nz_becs"
PaymentOrderTypePlElixir PaymentOrderType = "pl_elixir"
PaymentOrderTypeProvxchange PaymentOrderType = "provxchange"
PaymentOrderTypeRoSent PaymentOrderType = "ro_sent"
PaymentOrderTypeRtp PaymentOrderType = "rtp"
PaymentOrderTypeSeBankgirot PaymentOrderType = "se_bankgirot"
PaymentOrderTypeSen PaymentOrderType = "sen"
PaymentOrderTypeSepa PaymentOrderType = "sepa"
PaymentOrderTypeSgGiro PaymentOrderType = "sg_giro"
PaymentOrderTypeSic PaymentOrderType = "sic"
PaymentOrderTypeSignet PaymentOrderType = "signet"
PaymentOrderTypeSknbi PaymentOrderType = "sknbi"
PaymentOrderTypeWire PaymentOrderType = "wire"
PaymentOrderTypeZengin PaymentOrderType = "zengin"
)
func (r PaymentOrderType) IsKnown() bool {
switch r {
case PaymentOrderTypeACH, PaymentOrderTypeAuBecs, PaymentOrderTypeBacs, PaymentOrderTypeBook, PaymentOrderTypeCard, PaymentOrderTypeChats, PaymentOrderTypeCheck, PaymentOrderTypeCrossBorder, PaymentOrderTypeDkNets, PaymentOrderTypeEft, PaymentOrderTypeHuIcs, PaymentOrderTypeInterac, PaymentOrderTypeMasav, PaymentOrderTypeMxCcen, PaymentOrderTypeNeft, PaymentOrderTypeNics, PaymentOrderTypeNzBecs, PaymentOrderTypePlElixir, PaymentOrderTypeProvxchange, PaymentOrderTypeRoSent, PaymentOrderTypeRtp, PaymentOrderTypeSeBankgirot, PaymentOrderTypeSen, PaymentOrderTypeSepa, PaymentOrderTypeSgGiro, PaymentOrderTypeSic, PaymentOrderTypeSignet, PaymentOrderTypeSknbi, PaymentOrderTypeWire, PaymentOrderTypeZengin:
return true
}
return false
}
type PaymentOrderNewParams 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[PaymentOrderNewParamsDirection] `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[PaymentOrderNewParamsAccounting] `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[PaymentOrderNewParamsChargeBearer] `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"`
// An array of documents to be attached to the payment order. Note that if you
// attach documents, the request's content type must be `multipart/form-data`.
Documents param.Field[[]PaymentOrderNewParamsDocument] `json:"documents"`
// 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[PaymentOrderNewParamsFallbackType] `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[PaymentOrderNewParamsForeignExchangeIndicator] `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[PaymentOrderNewParamsLedgerTransaction] `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[[]PaymentOrderNewParamsLineItem] `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[PaymentOrderNewParamsPriority] `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