-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpaymentorder_test.go
533 lines (525 loc) · 26.5 KB
/
paymentorder_test.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package moderntreasury_test
import (
"bytes"
"context"
"errors"
"io"
"os"
"testing"
"time"
"github.com/Modern-Treasury/modern-treasury-go/v2"
"github.com/Modern-Treasury/modern-treasury-go/v2/internal/testutil"
"github.com/Modern-Treasury/modern-treasury-go/v2/option"
"github.com/Modern-Treasury/modern-treasury-go/v2/shared"
)
func TestPaymentOrderNewWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := moderntreasury.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
option.WithOrganizationID("my-organization-ID"),
)
_, err := client.PaymentOrders.New(context.TODO(), moderntreasury.PaymentOrderNewParams{
Amount: moderntreasury.F(int64(0)),
Direction: moderntreasury.F(moderntreasury.PaymentOrderNewParamsDirectionCredit),
OriginatingAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Type: moderntreasury.F(moderntreasury.PaymentOrderTypeACH),
Accounting: moderntreasury.F(moderntreasury.PaymentOrderNewParamsAccounting{
AccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
ClassID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
AccountingCategoryID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
AccountingLedgerClassID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
ChargeBearer: moderntreasury.F(moderntreasury.PaymentOrderNewParamsChargeBearerShared),
Currency: moderntreasury.F(shared.CurrencyAed),
Description: moderntreasury.F("description"),
Documents: moderntreasury.F([]moderntreasury.PaymentOrderNewParamsDocument{{
DocumentableID: moderntreasury.F("documentable_id"),
DocumentableType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsDocumentsDocumentableTypeCases),
File: moderntreasury.F(io.Reader(bytes.NewBuffer([]byte("some file contents")))),
DocumentType: moderntreasury.F("document_type"),
}}),
EffectiveDate: moderntreasury.F(time.Now()),
ExpiresAt: moderntreasury.F(time.Now()),
FallbackType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsFallbackTypeACH),
ForeignExchangeContract: moderntreasury.F("foreign_exchange_contract"),
ForeignExchangeIndicator: moderntreasury.F(moderntreasury.PaymentOrderNewParamsForeignExchangeIndicatorFixedToVariable),
LedgerTransaction: moderntreasury.F(moderntreasury.PaymentOrderNewParamsLedgerTransaction{
LedgerEntries: moderntreasury.F([]moderntreasury.PaymentOrderNewParamsLedgerTransactionLedgerEntry{{
Amount: moderntreasury.F(int64(0)),
Direction: moderntreasury.F(shared.TransactionDirectionCredit),
LedgerAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
AvailableBalanceAmount: moderntreasury.F(map[string]int64{
"foo": int64(0),
}),
LockVersion: moderntreasury.F(int64(0)),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
PendingBalanceAmount: moderntreasury.F(map[string]int64{
"foo": int64(0),
}),
PostedBalanceAmount: moderntreasury.F(map[string]int64{
"foo": int64(0),
}),
ShowResultingLedgerAccountBalances: moderntreasury.F(true),
}}),
Description: moderntreasury.F("description"),
EffectiveAt: moderntreasury.F(time.Now()),
EffectiveDate: moderntreasury.F(time.Now()),
ExternalID: moderntreasury.F("external_id"),
LedgerableID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
LedgerableType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsLedgerTransactionLedgerableTypeExpectedPayment),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
Status: moderntreasury.F(moderntreasury.PaymentOrderNewParamsLedgerTransactionStatusArchived),
}),
LedgerTransactionID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
LineItems: moderntreasury.F([]moderntreasury.PaymentOrderNewParamsLineItem{{
Amount: moderntreasury.F(int64(0)),
AccountingCategoryID: moderntreasury.F("accounting_category_id"),
Description: moderntreasury.F("description"),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
}}),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
NsfProtected: moderntreasury.F(true),
OriginatingPartyName: moderntreasury.F("originating_party_name"),
Priority: moderntreasury.F(moderntreasury.PaymentOrderNewParamsPriorityHigh),
ProcessAfter: moderntreasury.F(time.Now()),
Purpose: moderntreasury.F("purpose"),
ReceivingAccount: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccount{
AccountDetails: moderntreasury.F([]moderntreasury.PaymentOrderNewParamsReceivingAccountAccountDetail{{
AccountNumber: moderntreasury.F("account_number"),
AccountNumberType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberTypeAuNumber),
}}),
AccountType: moderntreasury.F(moderntreasury.ExternalAccountTypeCash),
ContactDetails: moderntreasury.F([]moderntreasury.PaymentOrderNewParamsReceivingAccountContactDetail{{
ContactIdentifier: moderntreasury.F("contact_identifier"),
ContactIdentifierType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierTypeEmail),
}}),
LedgerAccount: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountLedgerAccount{
Currency: moderntreasury.F("currency"),
LedgerID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Name: moderntreasury.F("name"),
NormalBalance: moderntreasury.F(shared.TransactionDirectionCredit),
CurrencyExponent: moderntreasury.F(int64(0)),
Description: moderntreasury.F("description"),
LedgerAccountCategoryIDs: moderntreasury.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
LedgerableID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
LedgerableType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableTypeCounterparty),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
}),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
Name: moderntreasury.F("name"),
PartyAddress: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountPartyAddress{
Country: moderntreasury.F("country"),
Line1: moderntreasury.F("line1"),
Line2: moderntreasury.F("line2"),
Locality: moderntreasury.F("locality"),
PostalCode: moderntreasury.F("postal_code"),
Region: moderntreasury.F("region"),
}),
PartyIdentifier: moderntreasury.F("party_identifier"),
PartyName: moderntreasury.F("party_name"),
PartyType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountPartyTypeBusiness),
PlaidProcessorToken: moderntreasury.F("plaid_processor_token"),
RoutingDetails: moderntreasury.F([]moderntreasury.PaymentOrderNewParamsReceivingAccountRoutingDetail{{
RoutingNumber: moderntreasury.F("routing_number"),
RoutingNumberType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeAba),
PaymentType: moderntreasury.F(moderntreasury.PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeACH),
}}),
}),
ReceivingAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
RemittanceInformation: moderntreasury.F("remittance_information"),
SendRemittanceAdvice: moderntreasury.F(true),
StatementDescriptor: moderntreasury.F("statement_descriptor"),
Subtype: moderntreasury.F(moderntreasury.PaymentOrderSubtypeBacsNewInstruction),
TransactionMonitoringEnabled: moderntreasury.F(true),
UltimateOriginatingPartyIdentifier: moderntreasury.F("ultimate_originating_party_identifier"),
UltimateOriginatingPartyName: moderntreasury.F("ultimate_originating_party_name"),
UltimateReceivingPartyIdentifier: moderntreasury.F("ultimate_receiving_party_identifier"),
UltimateReceivingPartyName: moderntreasury.F("ultimate_receiving_party_name"),
})
if err != nil {
var apierr *moderntreasury.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}
func TestPaymentOrderGet(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := moderntreasury.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
option.WithOrganizationID("my-organization-ID"),
)
_, err := client.PaymentOrders.Get(context.TODO(), "id")
if err != nil {
var apierr *moderntreasury.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}
func TestPaymentOrderUpdateWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := moderntreasury.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
option.WithOrganizationID("my-organization-ID"),
)
_, err := client.PaymentOrders.Update(
context.TODO(),
"id",
moderntreasury.PaymentOrderUpdateParams{
Accounting: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsAccounting{
AccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
ClassID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
AccountingCategoryID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
AccountingLedgerClassID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Amount: moderntreasury.F(int64(0)),
ChargeBearer: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsChargeBearerShared),
CounterpartyID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Currency: moderntreasury.F(shared.CurrencyAed),
Description: moderntreasury.F("description"),
Direction: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsDirectionCredit),
EffectiveDate: moderntreasury.F(time.Now()),
ExpiresAt: moderntreasury.F(time.Now()),
FallbackType: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsFallbackTypeACH),
ForeignExchangeContract: moderntreasury.F("foreign_exchange_contract"),
ForeignExchangeIndicator: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsForeignExchangeIndicatorFixedToVariable),
LineItems: moderntreasury.F([]moderntreasury.PaymentOrderUpdateParamsLineItem{{
Amount: moderntreasury.F(int64(0)),
AccountingCategoryID: moderntreasury.F("accounting_category_id"),
Description: moderntreasury.F("description"),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
}}),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
NsfProtected: moderntreasury.F(true),
OriginatingAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
OriginatingPartyName: moderntreasury.F("originating_party_name"),
Priority: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsPriorityHigh),
ProcessAfter: moderntreasury.F(time.Now()),
Purpose: moderntreasury.F("purpose"),
ReceivingAccount: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccount{
AccountDetails: moderntreasury.F([]moderntreasury.PaymentOrderUpdateParamsReceivingAccountAccountDetail{{
AccountNumber: moderntreasury.F("account_number"),
AccountNumberType: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberTypeAuNumber),
}}),
AccountType: moderntreasury.F(moderntreasury.ExternalAccountTypeCash),
ContactDetails: moderntreasury.F([]moderntreasury.PaymentOrderUpdateParamsReceivingAccountContactDetail{{
ContactIdentifier: moderntreasury.F("contact_identifier"),
ContactIdentifierType: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierTypeEmail),
}}),
LedgerAccount: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountLedgerAccount{
Currency: moderntreasury.F("currency"),
LedgerID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Name: moderntreasury.F("name"),
NormalBalance: moderntreasury.F(shared.TransactionDirectionCredit),
CurrencyExponent: moderntreasury.F(int64(0)),
Description: moderntreasury.F("description"),
LedgerAccountCategoryIDs: moderntreasury.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
LedgerableID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
LedgerableType: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableTypeCounterparty),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
}),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
Name: moderntreasury.F("name"),
PartyAddress: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountPartyAddress{
Country: moderntreasury.F("country"),
Line1: moderntreasury.F("line1"),
Line2: moderntreasury.F("line2"),
Locality: moderntreasury.F("locality"),
PostalCode: moderntreasury.F("postal_code"),
Region: moderntreasury.F("region"),
}),
PartyIdentifier: moderntreasury.F("party_identifier"),
PartyName: moderntreasury.F("party_name"),
PartyType: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountPartyTypeBusiness),
PlaidProcessorToken: moderntreasury.F("plaid_processor_token"),
RoutingDetails: moderntreasury.F([]moderntreasury.PaymentOrderUpdateParamsReceivingAccountRoutingDetail{{
RoutingNumber: moderntreasury.F("routing_number"),
RoutingNumberType: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeAba),
PaymentType: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeACH),
}}),
}),
ReceivingAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
RemittanceInformation: moderntreasury.F("remittance_information"),
SendRemittanceAdvice: moderntreasury.F(true),
StatementDescriptor: moderntreasury.F("statement_descriptor"),
Status: moderntreasury.F(moderntreasury.PaymentOrderUpdateParamsStatusApproved),
Subtype: moderntreasury.F(moderntreasury.PaymentOrderSubtypeBacsNewInstruction),
Type: moderntreasury.F(moderntreasury.PaymentOrderTypeACH),
UltimateOriginatingPartyIdentifier: moderntreasury.F("ultimate_originating_party_identifier"),
UltimateOriginatingPartyName: moderntreasury.F("ultimate_originating_party_name"),
UltimateReceivingPartyIdentifier: moderntreasury.F("ultimate_receiving_party_identifier"),
UltimateReceivingPartyName: moderntreasury.F("ultimate_receiving_party_name"),
},
)
if err != nil {
var apierr *moderntreasury.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}
func TestPaymentOrderListWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := moderntreasury.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
option.WithOrganizationID("my-organization-ID"),
)
_, err := client.PaymentOrders.List(context.TODO(), moderntreasury.PaymentOrderListParams{
AfterCursor: moderntreasury.F("after_cursor"),
CounterpartyID: moderntreasury.F("counterparty_id"),
CreatedAtEnd: moderntreasury.F(time.Now()),
CreatedAtStart: moderntreasury.F(time.Now()),
Direction: moderntreasury.F(shared.TransactionDirectionCredit),
EffectiveDateEnd: moderntreasury.F(time.Now()),
EffectiveDateStart: moderntreasury.F(time.Now()),
Metadata: moderntreasury.F(map[string]string{
"foo": "string",
}),
OriginatingAccountID: moderntreasury.F("originating_account_id"),
PerPage: moderntreasury.F(int64(0)),
Priority: moderntreasury.F(moderntreasury.PaymentOrderListParamsPriorityHigh),
ProcessAfterEnd: moderntreasury.F(time.Now()),
ProcessAfterStart: moderntreasury.F(time.Now()),
ReferenceNumber: moderntreasury.F("reference_number"),
Status: moderntreasury.F(moderntreasury.PaymentOrderListParamsStatusApproved),
TransactionID: moderntreasury.F("transaction_id"),
Type: moderntreasury.F(moderntreasury.PaymentOrderListParamsTypeACH),
})
if err != nil {
var apierr *moderntreasury.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}
func TestPaymentOrderNewAsyncWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := moderntreasury.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
option.WithOrganizationID("my-organization-ID"),
)
_, err := client.PaymentOrders.NewAsync(context.TODO(), moderntreasury.PaymentOrderNewAsyncParams{
Amount: moderntreasury.F(int64(0)),
Direction: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsDirectionCredit),
OriginatingAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Type: moderntreasury.F(moderntreasury.PaymentOrderTypeACH),
Accounting: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsAccounting{
AccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
ClassID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
AccountingCategoryID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
AccountingLedgerClassID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
ChargeBearer: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsChargeBearerShared),
Currency: moderntreasury.F(shared.CurrencyAed),
Description: moderntreasury.F("description"),
EffectiveDate: moderntreasury.F(time.Now()),
ExpiresAt: moderntreasury.F(time.Now()),
FallbackType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsFallbackTypeACH),
ForeignExchangeContract: moderntreasury.F("foreign_exchange_contract"),
ForeignExchangeIndicator: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsForeignExchangeIndicatorFixedToVariable),
LedgerTransaction: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsLedgerTransaction{
LedgerEntries: moderntreasury.F([]moderntreasury.PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntry{{
Amount: moderntreasury.F(int64(0)),
Direction: moderntreasury.F(shared.TransactionDirectionCredit),
LedgerAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
AvailableBalanceAmount: moderntreasury.F(map[string]int64{
"foo": int64(0),
}),
LockVersion: moderntreasury.F(int64(0)),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
PendingBalanceAmount: moderntreasury.F(map[string]int64{
"foo": int64(0),
}),
PostedBalanceAmount: moderntreasury.F(map[string]int64{
"foo": int64(0),
}),
ShowResultingLedgerAccountBalances: moderntreasury.F(true),
}}),
Description: moderntreasury.F("description"),
EffectiveAt: moderntreasury.F(time.Now()),
EffectiveDate: moderntreasury.F(time.Now()),
ExternalID: moderntreasury.F("external_id"),
LedgerableID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
LedgerableType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeExpectedPayment),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
Status: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsLedgerTransactionStatusArchived),
}),
LedgerTransactionID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
LineItems: moderntreasury.F([]moderntreasury.PaymentOrderNewAsyncParamsLineItem{{
Amount: moderntreasury.F(int64(0)),
AccountingCategoryID: moderntreasury.F("accounting_category_id"),
Description: moderntreasury.F("description"),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
}}),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
NsfProtected: moderntreasury.F(true),
OriginatingPartyName: moderntreasury.F("originating_party_name"),
Priority: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsPriorityHigh),
ProcessAfter: moderntreasury.F(time.Now()),
Purpose: moderntreasury.F("purpose"),
ReceivingAccount: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccount{
AccountDetails: moderntreasury.F([]moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountAccountDetail{{
AccountNumber: moderntreasury.F("account_number"),
AccountNumberType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberTypeAuNumber),
}}),
AccountType: moderntreasury.F(moderntreasury.ExternalAccountTypeCash),
ContactDetails: moderntreasury.F([]moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountContactDetail{{
ContactIdentifier: moderntreasury.F("contact_identifier"),
ContactIdentifierType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierTypeEmail),
}}),
LedgerAccount: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountLedgerAccount{
Currency: moderntreasury.F("currency"),
LedgerID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Name: moderntreasury.F("name"),
NormalBalance: moderntreasury.F(shared.TransactionDirectionCredit),
CurrencyExponent: moderntreasury.F(int64(0)),
Description: moderntreasury.F("description"),
LedgerAccountCategoryIDs: moderntreasury.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
LedgerableID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
LedgerableType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableTypeCounterparty),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
}),
Metadata: moderntreasury.F(map[string]string{
"key": "value",
"foo": "bar",
"modern": "treasury",
}),
Name: moderntreasury.F("name"),
PartyAddress: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountPartyAddress{
Country: moderntreasury.F("country"),
Line1: moderntreasury.F("line1"),
Line2: moderntreasury.F("line2"),
Locality: moderntreasury.F("locality"),
PostalCode: moderntreasury.F("postal_code"),
Region: moderntreasury.F("region"),
}),
PartyIdentifier: moderntreasury.F("party_identifier"),
PartyName: moderntreasury.F("party_name"),
PartyType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountPartyTypeBusiness),
PlaidProcessorToken: moderntreasury.F("plaid_processor_token"),
RoutingDetails: moderntreasury.F([]moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountRoutingDetail{{
RoutingNumber: moderntreasury.F("routing_number"),
RoutingNumberType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeAba),
PaymentType: moderntreasury.F(moderntreasury.PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeACH),
}}),
}),
ReceivingAccountID: moderntreasury.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
RemittanceInformation: moderntreasury.F("remittance_information"),
SendRemittanceAdvice: moderntreasury.F(true),
StatementDescriptor: moderntreasury.F("statement_descriptor"),
Subtype: moderntreasury.F(moderntreasury.PaymentOrderSubtypeBacsNewInstruction),
TransactionMonitoringEnabled: moderntreasury.F(true),
UltimateOriginatingPartyIdentifier: moderntreasury.F("ultimate_originating_party_identifier"),
UltimateOriginatingPartyName: moderntreasury.F("ultimate_originating_party_name"),
UltimateReceivingPartyIdentifier: moderntreasury.F("ultimate_receiving_party_identifier"),
UltimateReceivingPartyName: moderntreasury.F("ultimate_receiving_party_name"),
})
if err != nil {
var apierr *moderntreasury.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}