-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbulkresult.go
908 lines (833 loc) · 43 KB
/
bulkresult.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package moderntreasury
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"reflect"
"time"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apijson"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/apiquery"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/param"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/requestconfig"
"github.com/Modern-Treasury/modern-treasury-go/v2/option"
"github.com/Modern-Treasury/modern-treasury-go/v2/packages/pagination"
"github.com/Modern-Treasury/modern-treasury-go/v2/shared"
"github.com/tidwall/gjson"
)
// BulkResultService 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 [NewBulkResultService] method instead.
type BulkResultService struct {
Options []option.RequestOption
}
// NewBulkResultService 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 NewBulkResultService(opts ...option.RequestOption) (r *BulkResultService) {
r = &BulkResultService{}
r.Options = opts
return
}
// get bulk_result
func (r *BulkResultService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *BulkResult, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("api/bulk_results/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// list bulk_results
func (r *BulkResultService) List(ctx context.Context, query BulkResultListParams, opts ...option.RequestOption) (res *pagination.Page[BulkResult], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "api/bulk_results"
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_results
func (r *BulkResultService) ListAutoPaging(ctx context.Context, query BulkResultListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BulkResult] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
type BulkResult struct {
ID string `json:"id,required" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// An object with type as indicated by `entity_type`. This is the result object
// that is generated by performing the requested action on the provided input
// `request_params`.
Entity BulkResultEntity `json:"entity,required"`
// Unique identifier for the result entity object.
EntityID string `json:"entity_id,required" format:"uuid"`
// The type of the result entity object. For a successful bulk result, this is the
// same as the `resource_type` of the bulk request. For a failed bulk result, this
// is always bulk_error
EntityType BulkResultEntityType `json:"entity_type,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"`
Object string `json:"object,required"`
// Unique identifier for the request that created this bulk result. This is the ID
// of the bulk request when `request_type` is bulk_request
RequestID string `json:"request_id,required" format:"uuid"`
// An optional object that contains the provided input params for the request that
// created this result. This is an item in the `resources` array for the
// bulk_request
RequestParams map[string]string `json:"request_params,required,nullable"`
// The type of the request that created this result. bulk_request is the only
// supported `request_type`
RequestType BulkResultRequestType `json:"request_type,required"`
// One of successful or failed.
Status BulkResultStatus `json:"status,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON bulkResultJSON `json:"-"`
}
// bulkResultJSON contains the JSON metadata for the struct [BulkResult]
type bulkResultJSON struct {
ID apijson.Field
CreatedAt apijson.Field
Entity apijson.Field
EntityID apijson.Field
EntityType apijson.Field
LiveMode apijson.Field
Object apijson.Field
RequestID apijson.Field
RequestParams apijson.Field
RequestType apijson.Field
Status apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BulkResult) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bulkResultJSON) RawJSON() string {
return r.raw
}
// An object with type as indicated by `entity_type`. This is the result object
// that is generated by performing the requested action on the provided input
// `request_params`.
type BulkResultEntity 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"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
// This field can have the runtime type of [PaymentOrderAccounting].
Accounting 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 string `json:"accounting_category_id,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.
AccountingLedgerClassID string `json:"accounting_ledger_class_id,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"`
// 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 int64 `json:"amount_lower_bound,nullable"`
// 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 int64 `json:"amount_upper_bound,nullable"`
// The date on which the transaction occurred.
AsOfDate time.Time `json:"as_of_date,nullable" format:"date"`
// The time on which the transaction occurred. Depending on the granularity of the
// timestamp information received from the bank, it may be `null`.
AsOfTime string `json:"as_of_time,nullable" format:"time"`
// The timezone in which the `as_of_time` is represented. Can be `null` if the bank
// does not provide timezone info.
AsOfTimezone string `json:"as_of_timezone,nullable"`
// 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 BulkResultEntityChargeBearer `json:"charge_bearer,nullable"`
// This field can have the runtime type of [map[string]interface{}].
ComplianceRuleMetadata interface{} `json:"compliance_rule_metadata"`
// If the payment order is tied to a specific Counterparty, their id will appear,
// otherwise `null`.
CounterpartyID string `json:"counterparty_id,nullable" format:"uuid"`
// Defaults to the currency of the originating account.
Currency shared.Currency `json:"currency,nullable"`
// If the payment order's status is `returned`, this will include the return
// object's data.
CurrentReturn ReturnObject `json:"current_return,nullable"`
// This field can have the runtime type of [map[string]string].
CustomIdentifiers interface{} `json:"custom_identifiers"`
// The earliest date the payment may come in. Format: yyyy-mm-dd
DateLowerBound time.Time `json:"date_lower_bound,nullable" format:"date"`
// The latest date the payment may come in. Format: yyyy-mm-dd
DateUpperBound time.Time `json:"date_upper_bound,nullable" format:"date"`
// The ID of the compliance decision for the payment order, if transaction
// monitoring is enabled.
DecisionID string `json:"decision_id,nullable" format:"uuid"`
// An optional description for internal use.
Description string `json:"description,nullable"`
// This field can have the runtime type of [map[string]string].
Details interface{} `json:"details"`
// 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 string `json:"direction"`
DiscardedAt time.Time `json:"discarded_at,nullable" format:"date-time"`
// The timestamp (ISO8601 format) at which the ledger transaction happened for
// reporting purposes.
EffectiveAt 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 time.Time `json:"effective_date" format:"date"`
// RFP payments require an expires_at. This value must be past the effective_date.
ExpiresAt time.Time `json:"expires_at,nullable" 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 string `json:"external_id,nullable"`
// If present, indicates a specific foreign exchange contract number that has been
// generated by your financial institution.
ForeignExchangeContract string `json:"foreign_exchange_contract,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 BulkResultEntityForeignExchangeIndicator `json:"foreign_exchange_indicator,nullable"`
// This field can have the runtime type of [PaymentOrderForeignExchangeRate],
// [TransactionForeignExchangeRate].
ForeignExchangeRate interface{} `json:"foreign_exchange_rate"`
// The ID of the Internal Account for the expected payment.
InternalAccountID string `json:"internal_account_id,nullable" format:"uuid"`
// This field can have the runtime type of [[]LedgerEntry].
LedgerEntries interface{} `json:"ledger_entries"`
// The ID of the ledger this ledger transaction belongs to.
LedgerID string `json:"ledger_id" format:"uuid"`
// The ID of the ledger transaction linked to the payment order.
LedgerTransactionID string `json:"ledger_transaction_id,nullable" format:"uuid"`
// If the ledger transaction can be reconciled to another object in Modern
// Treasury, the id will be populated here, otherwise null.
LedgerableID string `json:"ledgerable_id,nullable" 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 BulkResultEntityLedgerableType `json:"ledgerable_type,nullable"`
// This field can have the runtime type of [map[string]string].
Metadata 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 bool `json:"nsf_protected"`
// The ID of one of your organization's internal accounts.
OriginatingAccountID 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 string `json:"originating_party_name,nullable"`
// This field will be `true` if the transaction has posted to the account.
Posted bool `json:"posted"`
// The time on which the ledger transaction posted. This is null if the ledger
// transaction is pending.
PostedAt time.Time `json:"posted_at,nullable" format:"date-time"`
// 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 BulkResultEntityPriority `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 time.Time `json:"process_after,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,nullable"`
// The receiving account ID. Can be an `external_account` or `internal_account`.
ReceivingAccountID string `json:"receiving_account_id" format:"uuid"`
ReceivingAccountType BulkResultEntityReceivingAccountType `json:"receiving_account_type"`
// This field will be `true` if a transaction is reconciled by the Modern Treasury
// system. This means that it has transaction line items that sum up to the
// transaction's amount.
Reconciled bool `json:"reconciled"`
// This field can have the runtime type of [interface{}].
ReconciliationFilters interface{} `json:"reconciliation_filters"`
// This field can have the runtime type of [interface{}].
ReconciliationGroups interface{} `json:"reconciliation_groups"`
// One of manual if this expected payment was manually reconciled in the dashboard,
// automatic if it was automatically reconciled by Modern Treasury, or null if it
// is unreconciled.
ReconciliationMethod BulkResultEntityReconciliationMethod `json:"reconciliation_method,nullable"`
// This field can have the runtime type of [[]ReconciliationRule].
ReconciliationRuleVariables interface{} `json:"reconciliation_rule_variables"`
// This field can have the runtime type of [[]PaymentOrderReferenceNumber].
ReferenceNumbers interface{} `json:"reference_numbers"`
// 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,nullable"`
// This field can have the runtime type of
// [[]BulkResultEntityBulkErrorRequestError].
RequestErrors interface{} `json:"request_errors"`
// The ID of the ledger transaction that reversed this ledger transaction.
ReversedByLedgerTransactionID string `json:"reversed_by_ledger_transaction_id,nullable"`
// The ID of the original ledger transaction that this ledger transaction reverses.
ReversesLedgerTransactionID string `json:"reverses_ledger_transaction_id,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,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,nullable"`
// The current status of the payment order.
Status BulkResultEntityStatus `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 PaymentOrderSubtype `json:"subtype,nullable"`
// The ID of the Transaction this expected payment object has been matched to.
TransactionID string `json:"transaction_id,nullable" format:"uuid"`
// This field can have the runtime type of [[]string].
TransactionIDs interface{} `json:"transaction_ids"`
// The ID of the Transaction Line Item this expected payment has been matched to.
TransactionLineItemID string `json:"transaction_line_item_id,nullable" format:"uuid"`
// A flag that determines whether a payment order should go through transaction
// monitoring.
TransactionMonitoringEnabled 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 PaymentOrderType `json:"type,nullable"`
// This field can have the runtime type of
// [PaymentOrderUltimateOriginatingAccount].
UltimateOriginatingAccount interface{} `json:"ultimate_originating_account"`
// The ultimate originating account ID. Can be a `virtual_account` or
// `internal_account`.
UltimateOriginatingAccountID string `json:"ultimate_originating_account_id,nullable" format:"uuid"`
UltimateOriginatingAccountType BulkResultEntityUltimateOriginatingAccountType `json:"ultimate_originating_account_type,nullable"`
// Identifier of the ultimate originator of the payment order.
UltimateOriginatingPartyIdentifier string `json:"ultimate_originating_party_identifier,nullable"`
// Name of the ultimate originator of the payment order.
UltimateOriginatingPartyName string `json:"ultimate_originating_party_name,nullable"`
UltimateReceivingPartyIdentifier string `json:"ultimate_receiving_party_identifier,nullable"`
UltimateReceivingPartyName string `json:"ultimate_receiving_party_name,nullable"`
// This field can have the runtime type of [interface{}].
VendorAttributes interface{} `json:"vendor_attributes"`
// When applicable, the bank-given code that determines the transaction's category.
// For most banks this is the BAI2/BTRS transaction code.
VendorCode string `json:"vendor_code,nullable"`
// 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 BulkResultEntityVendorCodeType `json:"vendor_code_type,nullable"`
// An identifier given to this transaction by the bank, often `null`.
VendorCustomerID string `json:"vendor_customer_id,nullable"`
// The transaction detail text that often appears in on your bank statement and in
// your banking portal.
VendorDescription string `json:"vendor_description,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,nullable"`
// An identifier given to this transaction by the bank.
VendorID string `json:"vendor_id,nullable"`
JSON bulkResultEntityJSON `json:"-"`
union BulkResultEntityUnion
}
// bulkResultEntityJSON contains the JSON metadata for the struct
// [BulkResultEntity]
type bulkResultEntityJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LiveMode apijson.Field
Object apijson.Field
UpdatedAt apijson.Field
Accounting apijson.Field
AccountingCategoryID apijson.Field
AccountingLedgerClassID apijson.Field
Amount apijson.Field
AmountLowerBound apijson.Field
AmountUpperBound apijson.Field
AsOfDate apijson.Field
AsOfTime apijson.Field
AsOfTimezone apijson.Field
ChargeBearer apijson.Field
ComplianceRuleMetadata apijson.Field
CounterpartyID apijson.Field
Currency apijson.Field
CurrentReturn apijson.Field
CustomIdentifiers apijson.Field
DateLowerBound apijson.Field
DateUpperBound apijson.Field
DecisionID apijson.Field
Description apijson.Field
Details apijson.Field
Direction apijson.Field
DiscardedAt apijson.Field
EffectiveAt apijson.Field
EffectiveDate apijson.Field
ExpiresAt apijson.Field
ExternalID apijson.Field
ForeignExchangeContract apijson.Field
ForeignExchangeIndicator apijson.Field
ForeignExchangeRate apijson.Field
InternalAccountID apijson.Field
LedgerEntries apijson.Field
LedgerID apijson.Field
LedgerTransactionID apijson.Field
LedgerableID apijson.Field
LedgerableType apijson.Field
Metadata apijson.Field
NsfProtected apijson.Field
OriginatingAccountID apijson.Field
OriginatingPartyName apijson.Field
Posted apijson.Field
PostedAt apijson.Field
Priority apijson.Field
ProcessAfter apijson.Field
Purpose apijson.Field
ReceivingAccountID apijson.Field
ReceivingAccountType apijson.Field
Reconciled apijson.Field
ReconciliationFilters apijson.Field
ReconciliationGroups apijson.Field
ReconciliationMethod apijson.Field
ReconciliationRuleVariables apijson.Field
ReferenceNumbers apijson.Field
RemittanceInformation apijson.Field
RequestErrors apijson.Field
ReversedByLedgerTransactionID apijson.Field
ReversesLedgerTransactionID apijson.Field
SendRemittanceAdvice apijson.Field
StatementDescriptor apijson.Field
Status apijson.Field
Subtype apijson.Field
TransactionID apijson.Field
TransactionIDs apijson.Field
TransactionLineItemID 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
VendorAttributes apijson.Field
VendorCode apijson.Field
VendorCodeType apijson.Field
VendorCustomerID apijson.Field
VendorDescription apijson.Field
VendorFailureReason apijson.Field
VendorID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r bulkResultEntityJSON) RawJSON() string {
return r.raw
}
func (r *BulkResultEntity) UnmarshalJSON(data []byte) (err error) {
*r = BulkResultEntity{}
err = apijson.UnmarshalRoot(data, &r.union)
if err != nil {
return err
}
return apijson.Port(r.union, &r)
}
// AsUnion returns a [BulkResultEntityUnion] interface which you can cast to the
// specific types for more type safety.
//
// Possible runtime types of the union are [PaymentOrder], [ExpectedPayment],
// [LedgerTransaction], [Transaction], [BulkResultEntityBulkError].
func (r BulkResultEntity) AsUnion() BulkResultEntityUnion {
return r.union
}
// An object with type as indicated by `entity_type`. This is the result object
// that is generated by performing the requested action on the provided input
// `request_params`.
//
// Union satisfied by [PaymentOrder], [ExpectedPayment], [LedgerTransaction],
// [Transaction] or [BulkResultEntityBulkError].
type BulkResultEntityUnion interface {
implementsBulkResultEntity()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*BulkResultEntityUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(PaymentOrder{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(ExpectedPayment{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(LedgerTransaction{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(Transaction{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(BulkResultEntityBulkError{}),
},
)
}
type BulkResultEntityBulkError 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"`
RequestErrors []BulkResultEntityBulkErrorRequestError `json:"request_errors,required"`
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
JSON bulkResultEntityBulkErrorJSON `json:"-"`
}
// bulkResultEntityBulkErrorJSON contains the JSON metadata for the struct
// [BulkResultEntityBulkError]
type bulkResultEntityBulkErrorJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LiveMode apijson.Field
Object apijson.Field
RequestErrors apijson.Field
UpdatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BulkResultEntityBulkError) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bulkResultEntityBulkErrorJSON) RawJSON() string {
return r.raw
}
func (r BulkResultEntityBulkError) implementsBulkResultEntity() {}
type BulkResultEntityBulkErrorRequestError struct {
Code string `json:"code"`
Message string `json:"message"`
Parameter string `json:"parameter"`
JSON bulkResultEntityBulkErrorRequestErrorJSON `json:"-"`
}
// bulkResultEntityBulkErrorRequestErrorJSON contains the JSON metadata for the
// struct [BulkResultEntityBulkErrorRequestError]
type bulkResultEntityBulkErrorRequestErrorJSON struct {
Code apijson.Field
Message apijson.Field
Parameter apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *BulkResultEntityBulkErrorRequestError) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r bulkResultEntityBulkErrorRequestErrorJSON) 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 BulkResultEntityChargeBearer string
const (
BulkResultEntityChargeBearerShared BulkResultEntityChargeBearer = "shared"
BulkResultEntityChargeBearerSender BulkResultEntityChargeBearer = "sender"
BulkResultEntityChargeBearerReceiver BulkResultEntityChargeBearer = "receiver"
)
func (r BulkResultEntityChargeBearer) IsKnown() bool {
switch r {
case BulkResultEntityChargeBearerShared, BulkResultEntityChargeBearerSender, BulkResultEntityChargeBearerReceiver:
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 BulkResultEntityForeignExchangeIndicator string
const (
BulkResultEntityForeignExchangeIndicatorFixedToVariable BulkResultEntityForeignExchangeIndicator = "fixed_to_variable"
BulkResultEntityForeignExchangeIndicatorVariableToFixed BulkResultEntityForeignExchangeIndicator = "variable_to_fixed"
)
func (r BulkResultEntityForeignExchangeIndicator) IsKnown() bool {
switch r {
case BulkResultEntityForeignExchangeIndicatorFixedToVariable, BulkResultEntityForeignExchangeIndicatorVariableToFixed:
return true
}
return false
}
// 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 BulkResultEntityLedgerableType string
const (
BulkResultEntityLedgerableTypeExpectedPayment BulkResultEntityLedgerableType = "expected_payment"
BulkResultEntityLedgerableTypeIncomingPaymentDetail BulkResultEntityLedgerableType = "incoming_payment_detail"
BulkResultEntityLedgerableTypePaperItem BulkResultEntityLedgerableType = "paper_item"
BulkResultEntityLedgerableTypePaymentOrder BulkResultEntityLedgerableType = "payment_order"
BulkResultEntityLedgerableTypeReturn BulkResultEntityLedgerableType = "return"
BulkResultEntityLedgerableTypeReversal BulkResultEntityLedgerableType = "reversal"
)
func (r BulkResultEntityLedgerableType) IsKnown() bool {
switch r {
case BulkResultEntityLedgerableTypeExpectedPayment, BulkResultEntityLedgerableTypeIncomingPaymentDetail, BulkResultEntityLedgerableTypePaperItem, BulkResultEntityLedgerableTypePaymentOrder, BulkResultEntityLedgerableTypeReturn, BulkResultEntityLedgerableTypeReversal:
return true
}
return false
}
// 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 BulkResultEntityPriority string
const (
BulkResultEntityPriorityHigh BulkResultEntityPriority = "high"
BulkResultEntityPriorityNormal BulkResultEntityPriority = "normal"
)
func (r BulkResultEntityPriority) IsKnown() bool {
switch r {
case BulkResultEntityPriorityHigh, BulkResultEntityPriorityNormal:
return true
}
return false
}
type BulkResultEntityReceivingAccountType string
const (
BulkResultEntityReceivingAccountTypeInternalAccount BulkResultEntityReceivingAccountType = "internal_account"
BulkResultEntityReceivingAccountTypeExternalAccount BulkResultEntityReceivingAccountType = "external_account"
)
func (r BulkResultEntityReceivingAccountType) IsKnown() bool {
switch r {
case BulkResultEntityReceivingAccountTypeInternalAccount, BulkResultEntityReceivingAccountTypeExternalAccount:
return true
}
return false
}
// One of manual if this expected payment was manually reconciled in the dashboard,
// automatic if it was automatically reconciled by Modern Treasury, or null if it
// is unreconciled.
type BulkResultEntityReconciliationMethod string
const (
BulkResultEntityReconciliationMethodAutomatic BulkResultEntityReconciliationMethod = "automatic"
BulkResultEntityReconciliationMethodManual BulkResultEntityReconciliationMethod = "manual"
)
func (r BulkResultEntityReconciliationMethod) IsKnown() bool {
switch r {
case BulkResultEntityReconciliationMethodAutomatic, BulkResultEntityReconciliationMethodManual:
return true
}
return false
}
// The current status of the payment order.
type BulkResultEntityStatus string
const (
BulkResultEntityStatusApproved BulkResultEntityStatus = "approved"
BulkResultEntityStatusCancelled BulkResultEntityStatus = "cancelled"
BulkResultEntityStatusCompleted BulkResultEntityStatus = "completed"
BulkResultEntityStatusDenied BulkResultEntityStatus = "denied"
BulkResultEntityStatusFailed BulkResultEntityStatus = "failed"
BulkResultEntityStatusNeedsApproval BulkResultEntityStatus = "needs_approval"
BulkResultEntityStatusPending BulkResultEntityStatus = "pending"
BulkResultEntityStatusProcessing BulkResultEntityStatus = "processing"
BulkResultEntityStatusReturned BulkResultEntityStatus = "returned"
BulkResultEntityStatusReversed BulkResultEntityStatus = "reversed"
BulkResultEntityStatusSent BulkResultEntityStatus = "sent"
BulkResultEntityStatusArchived BulkResultEntityStatus = "archived"
BulkResultEntityStatusPartiallyReconciled BulkResultEntityStatus = "partially_reconciled"
BulkResultEntityStatusReconciled BulkResultEntityStatus = "reconciled"
BulkResultEntityStatusUnreconciled BulkResultEntityStatus = "unreconciled"
BulkResultEntityStatusPosted BulkResultEntityStatus = "posted"
)
func (r BulkResultEntityStatus) IsKnown() bool {
switch r {
case BulkResultEntityStatusApproved, BulkResultEntityStatusCancelled, BulkResultEntityStatusCompleted, BulkResultEntityStatusDenied, BulkResultEntityStatusFailed, BulkResultEntityStatusNeedsApproval, BulkResultEntityStatusPending, BulkResultEntityStatusProcessing, BulkResultEntityStatusReturned, BulkResultEntityStatusReversed, BulkResultEntityStatusSent, BulkResultEntityStatusArchived, BulkResultEntityStatusPartiallyReconciled, BulkResultEntityStatusReconciled, BulkResultEntityStatusUnreconciled, BulkResultEntityStatusPosted:
return true
}
return false
}
type BulkResultEntityUltimateOriginatingAccountType string
const (
BulkResultEntityUltimateOriginatingAccountTypeInternalAccount BulkResultEntityUltimateOriginatingAccountType = "internal_account"
BulkResultEntityUltimateOriginatingAccountTypeVirtualAccount BulkResultEntityUltimateOriginatingAccountType = "virtual_account"
)
func (r BulkResultEntityUltimateOriginatingAccountType) IsKnown() bool {
switch r {
case BulkResultEntityUltimateOriginatingAccountTypeInternalAccount, BulkResultEntityUltimateOriginatingAccountTypeVirtualAccount:
return true
}
return false
}
// 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.
type BulkResultEntityVendorCodeType string
const (
BulkResultEntityVendorCodeTypeBai2 BulkResultEntityVendorCodeType = "bai2"
BulkResultEntityVendorCodeTypeBankprov BulkResultEntityVendorCodeType = "bankprov"
BulkResultEntityVendorCodeTypeBnkDev BulkResultEntityVendorCodeType = "bnk_dev"
BulkResultEntityVendorCodeTypeCleartouch BulkResultEntityVendorCodeType = "cleartouch"
BulkResultEntityVendorCodeTypeColumn BulkResultEntityVendorCodeType = "column"
BulkResultEntityVendorCodeTypeCrossRiver BulkResultEntityVendorCodeType = "cross_river"
BulkResultEntityVendorCodeTypeCurrencycloud BulkResultEntityVendorCodeType = "currencycloud"
BulkResultEntityVendorCodeTypeDcBank BulkResultEntityVendorCodeType = "dc_bank"
BulkResultEntityVendorCodeTypeDwolla BulkResultEntityVendorCodeType = "dwolla"
BulkResultEntityVendorCodeTypeEvolve BulkResultEntityVendorCodeType = "evolve"
BulkResultEntityVendorCodeTypeGoldmanSachs BulkResultEntityVendorCodeType = "goldman_sachs"
BulkResultEntityVendorCodeTypeIso20022 BulkResultEntityVendorCodeType = "iso20022"
BulkResultEntityVendorCodeTypeJpmc BulkResultEntityVendorCodeType = "jpmc"
BulkResultEntityVendorCodeTypeMx BulkResultEntityVendorCodeType = "mx"
BulkResultEntityVendorCodeTypePlaid BulkResultEntityVendorCodeType = "plaid"
BulkResultEntityVendorCodeTypePnc BulkResultEntityVendorCodeType = "pnc"
BulkResultEntityVendorCodeTypeRspecVendor BulkResultEntityVendorCodeType = "rspec_vendor"
BulkResultEntityVendorCodeTypeSignet BulkResultEntityVendorCodeType = "signet"
BulkResultEntityVendorCodeTypeSilvergate BulkResultEntityVendorCodeType = "silvergate"
BulkResultEntityVendorCodeTypeSwift BulkResultEntityVendorCodeType = "swift"
BulkResultEntityVendorCodeTypeUsBank BulkResultEntityVendorCodeType = "us_bank"
BulkResultEntityVendorCodeTypeUser BulkResultEntityVendorCodeType = "user"
)
func (r BulkResultEntityVendorCodeType) IsKnown() bool {
switch r {
case BulkResultEntityVendorCodeTypeBai2, BulkResultEntityVendorCodeTypeBankprov, BulkResultEntityVendorCodeTypeBnkDev, BulkResultEntityVendorCodeTypeCleartouch, BulkResultEntityVendorCodeTypeColumn, BulkResultEntityVendorCodeTypeCrossRiver, BulkResultEntityVendorCodeTypeCurrencycloud, BulkResultEntityVendorCodeTypeDcBank, BulkResultEntityVendorCodeTypeDwolla, BulkResultEntityVendorCodeTypeEvolve, BulkResultEntityVendorCodeTypeGoldmanSachs, BulkResultEntityVendorCodeTypeIso20022, BulkResultEntityVendorCodeTypeJpmc, BulkResultEntityVendorCodeTypeMx, BulkResultEntityVendorCodeTypePlaid, BulkResultEntityVendorCodeTypePnc, BulkResultEntityVendorCodeTypeRspecVendor, BulkResultEntityVendorCodeTypeSignet, BulkResultEntityVendorCodeTypeSilvergate, BulkResultEntityVendorCodeTypeSwift, BulkResultEntityVendorCodeTypeUsBank, BulkResultEntityVendorCodeTypeUser:
return true
}
return false
}
// The type of the result entity object. For a successful bulk result, this is the
// same as the `resource_type` of the bulk request. For a failed bulk result, this
// is always bulk_error
type BulkResultEntityType string
const (
BulkResultEntityTypePaymentOrder BulkResultEntityType = "payment_order"
BulkResultEntityTypeLedgerTransaction BulkResultEntityType = "ledger_transaction"
BulkResultEntityTypeTransaction BulkResultEntityType = "transaction"
BulkResultEntityTypeExpectedPayment BulkResultEntityType = "expected_payment"
BulkResultEntityTypeBulkError BulkResultEntityType = "bulk_error"
)
func (r BulkResultEntityType) IsKnown() bool {
switch r {
case BulkResultEntityTypePaymentOrder, BulkResultEntityTypeLedgerTransaction, BulkResultEntityTypeTransaction, BulkResultEntityTypeExpectedPayment, BulkResultEntityTypeBulkError:
return true
}
return false
}
// The type of the request that created this result. bulk_request is the only
// supported `request_type`
type BulkResultRequestType string
const (
BulkResultRequestTypeBulkRequest BulkResultRequestType = "bulk_request"
)
func (r BulkResultRequestType) IsKnown() bool {
switch r {
case BulkResultRequestTypeBulkRequest:
return true
}
return false
}
// One of successful or failed.
type BulkResultStatus string
const (
BulkResultStatusPending BulkResultStatus = "pending"
BulkResultStatusSuccessful BulkResultStatus = "successful"
BulkResultStatusFailed BulkResultStatus = "failed"
)
func (r BulkResultStatus) IsKnown() bool {
switch r {
case BulkResultStatusPending, BulkResultStatusSuccessful, BulkResultStatusFailed:
return true
}
return false
}
type BulkResultListParams struct {
AfterCursor param.Field[string] `query:"after_cursor"`
// Unique identifier for the result entity object.
EntityID param.Field[string] `query:"entity_id"`
// The type of the request that created this result. bulk_request is the only
// supported `request_type`
EntityType param.Field[BulkResultListParamsEntityType] `query:"entity_type"`
PerPage param.Field[int64] `query:"per_page"`
// Unique identifier for the request that created this bulk result. This is the ID
// of the bulk request when `request_type` is bulk_request
RequestID param.Field[string] `query:"request_id"`
// The type of the request that created this result. bulk_request is the only
// supported `request_type`
RequestType param.Field[BulkResultListParamsRequestType] `query:"request_type"`
// One of successful or failed.
Status param.Field[BulkResultListParamsStatus] `query:"status"`
}
// URLQuery serializes [BulkResultListParams]'s query parameters as `url.Values`.
func (r BulkResultListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatBrackets,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// The type of the request that created this result. bulk_request is the only
// supported `request_type`
type BulkResultListParamsEntityType string
const (
BulkResultListParamsEntityTypePaymentOrder BulkResultListParamsEntityType = "payment_order"
BulkResultListParamsEntityTypeLedgerTransaction BulkResultListParamsEntityType = "ledger_transaction"
BulkResultListParamsEntityTypeTransaction BulkResultListParamsEntityType = "transaction"
BulkResultListParamsEntityTypeExpectedPayment BulkResultListParamsEntityType = "expected_payment"
BulkResultListParamsEntityTypeBulkError BulkResultListParamsEntityType = "bulk_error"
)
func (r BulkResultListParamsEntityType) IsKnown() bool {
switch r {
case BulkResultListParamsEntityTypePaymentOrder, BulkResultListParamsEntityTypeLedgerTransaction, BulkResultListParamsEntityTypeTransaction, BulkResultListParamsEntityTypeExpectedPayment, BulkResultListParamsEntityTypeBulkError:
return true
}
return false
}
// The type of the request that created this result. bulk_request is the only
// supported `request_type`
type BulkResultListParamsRequestType string
const (
BulkResultListParamsRequestTypeBulkRequest BulkResultListParamsRequestType = "bulk_request"
)
func (r BulkResultListParamsRequestType) IsKnown() bool {
switch r {
case BulkResultListParamsRequestTypeBulkRequest:
return true
}
return false
}
// One of successful or failed.
type BulkResultListParamsStatus string
const (
BulkResultListParamsStatusPending BulkResultListParamsStatus = "pending"
BulkResultListParamsStatusSuccessful BulkResultListParamsStatus = "successful"
BulkResultListParamsStatusFailed BulkResultListParamsStatus = "failed"
)
func (r BulkResultListParamsStatus) IsKnown() bool {
switch r {
case BulkResultListParamsStatusPending, BulkResultListParamsStatusSuccessful, BulkResultListParamsStatusFailed:
return true
}
return false
}