-
Notifications
You must be signed in to change notification settings - Fork 1
/
financialaccount.go
540 lines (488 loc) · 24.5 KB
/
financialaccount.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package lithic
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/lithic-com/lithic-go/internal/apijson"
"github.com/lithic-com/lithic-go/internal/apiquery"
"github.com/lithic-com/lithic-go/internal/pagination"
"github.com/lithic-com/lithic-go/internal/param"
"github.com/lithic-com/lithic-go/internal/requestconfig"
"github.com/lithic-com/lithic-go/option"
)
// FinancialAccountService contains methods and other services that help with
// interacting with the lithic 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 [NewFinancialAccountService] method instead.
type FinancialAccountService struct {
Options []option.RequestOption
Balances *FinancialAccountBalanceService
FinancialTransactions *FinancialAccountFinancialTransactionService
}
// NewFinancialAccountService 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 NewFinancialAccountService(opts ...option.RequestOption) (r *FinancialAccountService) {
r = &FinancialAccountService{}
r.Options = opts
r.Balances = NewFinancialAccountBalanceService(opts...)
r.FinancialTransactions = NewFinancialAccountFinancialTransactionService(opts...)
return
}
// Create a new financial account
func (r *FinancialAccountService) New(ctx context.Context, params FinancialAccountNewParams, opts ...option.RequestOption) (res *FinancialAccount, err error) {
opts = append(r.Options[:], opts...)
path := "financial_accounts"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return
}
// Get a financial account
func (r *FinancialAccountService) Get(ctx context.Context, financialAccountToken string, opts ...option.RequestOption) (res *FinancialAccount, err error) {
opts = append(r.Options[:], opts...)
if financialAccountToken == "" {
err = errors.New("missing required financial_account_token parameter")
return
}
path := fmt.Sprintf("financial_accounts/%s", financialAccountToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Update a financial account
func (r *FinancialAccountService) Update(ctx context.Context, financialAccountToken string, body FinancialAccountUpdateParams, opts ...option.RequestOption) (res *FinancialAccount, err error) {
opts = append(r.Options[:], opts...)
if financialAccountToken == "" {
err = errors.New("missing required financial_account_token parameter")
return
}
path := fmt.Sprintf("financial_accounts/%s", financialAccountToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// Retrieve information on your financial accounts including routing and account
// number.
func (r *FinancialAccountService) List(ctx context.Context, query FinancialAccountListParams, opts ...option.RequestOption) (res *pagination.SinglePage[FinancialAccount], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "financial_accounts"
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
}
// Retrieve information on your financial accounts including routing and account
// number.
func (r *FinancialAccountService) ListAutoPaging(ctx context.Context, query FinancialAccountListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[FinancialAccount] {
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
}
// Financial Account
type FinancialAccount struct {
// Globally unique identifier for the financial account.
Token string `json:"token,required" format:"uuid"`
// Date and time for when the financial account was first created.
Created time.Time `json:"created,required" format:"date-time"`
// Type of financial account
Type FinancialAccountType `json:"type,required"`
// Date and time for when the financial account was last updated.
Updated time.Time `json:"updated,required" format:"date-time"`
// Account number for your Lithic-assigned bank account number, if applicable.
AccountNumber string `json:"account_number"`
// Account token of the financial account if applicable.
AccountToken string `json:"account_token" format:"uuid"`
// User-defined nickname for the financial account.
Nickname string `json:"nickname"`
// Routing number for your Lithic-assigned bank account number, if applicable.
RoutingNumber string `json:"routing_number"`
JSON financialAccountJSON `json:"-"`
}
// financialAccountJSON contains the JSON metadata for the struct
// [FinancialAccount]
type financialAccountJSON struct {
Token apijson.Field
Created apijson.Field
Type apijson.Field
Updated apijson.Field
AccountNumber apijson.Field
AccountToken apijson.Field
Nickname apijson.Field
RoutingNumber apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *FinancialAccount) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r financialAccountJSON) RawJSON() string {
return r.raw
}
// Type of financial account
type FinancialAccountType string
const (
FinancialAccountTypeIssuing FinancialAccountType = "ISSUING"
FinancialAccountTypeOperating FinancialAccountType = "OPERATING"
FinancialAccountTypeReserve FinancialAccountType = "RESERVE"
)
func (r FinancialAccountType) IsKnown() bool {
switch r {
case FinancialAccountTypeIssuing, FinancialAccountTypeOperating, FinancialAccountTypeReserve:
return true
}
return false
}
type FinancialTransaction struct {
// Globally unique identifier.
Token string `json:"token,required" format:"uuid"`
// Status types:
//
// - `CARD` - Issuing card transaction.
// - `ACH` - Transaction over ACH.
// - `TRANSFER` - Internal transfer of funds between financial accounts in your
// program.
Category FinancialTransactionCategory `json:"category,required"`
// Date and time when the financial transaction first occurred. UTC time zone.
Created time.Time `json:"created,required" format:"date-time"`
// 3-digit alphabetic ISO 4217 code for the settling currency of the transaction.
Currency string `json:"currency,required"`
// A string that provides a description of the financial transaction; may be useful
// to display to users.
Descriptor string `json:"descriptor,required"`
// A list of all financial events that have modified this financial transaction.
Events []FinancialTransactionEvent `json:"events,required"`
// Pending amount of the transaction in the currency's smallest unit (e.g., cents),
// including any acquirer fees. The value of this field will go to zero over time
// once the financial transaction is settled.
PendingAmount int64 `json:"pending_amount,required"`
// APPROVED transactions were successful while DECLINED transactions were declined
// by user, Lithic, or the network.
Result FinancialTransactionResult `json:"result,required"`
// Amount of the transaction that has been settled in the currency's smallest unit
// (e.g., cents), including any acquirer fees. This may change over time.
SettledAmount int64 `json:"settled_amount,required"`
// Status types:
//
// - `DECLINED` - The transaction was declined.
// - `EXPIRED` - The authorization as it has passed its expiration time. Card
// transaction only.
// - `PENDING` - The transaction is expected to settle.
// - `RETURNED` - The transaction has been returned.
// - `SETTLED` - The transaction is completed.
// - `VOIDED` - The transaction was voided. Card transaction only.
Status FinancialTransactionStatus `json:"status,required"`
// Date and time when the financial transaction was last updated. UTC time zone.
Updated time.Time `json:"updated,required" format:"date-time"`
JSON financialTransactionJSON `json:"-"`
}
// financialTransactionJSON contains the JSON metadata for the struct
// [FinancialTransaction]
type financialTransactionJSON struct {
Token apijson.Field
Category apijson.Field
Created apijson.Field
Currency apijson.Field
Descriptor apijson.Field
Events apijson.Field
PendingAmount apijson.Field
Result apijson.Field
SettledAmount apijson.Field
Status apijson.Field
Updated apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *FinancialTransaction) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r financialTransactionJSON) RawJSON() string {
return r.raw
}
// Status types:
//
// - `CARD` - Issuing card transaction.
// - `ACH` - Transaction over ACH.
// - `TRANSFER` - Internal transfer of funds between financial accounts in your
// program.
type FinancialTransactionCategory string
const (
FinancialTransactionCategoryACH FinancialTransactionCategory = "ACH"
FinancialTransactionCategoryCard FinancialTransactionCategory = "CARD"
FinancialTransactionCategoryTransfer FinancialTransactionCategory = "TRANSFER"
)
func (r FinancialTransactionCategory) IsKnown() bool {
switch r {
case FinancialTransactionCategoryACH, FinancialTransactionCategoryCard, FinancialTransactionCategoryTransfer:
return true
}
return false
}
type FinancialTransactionEvent struct {
// Globally unique identifier.
Token string `json:"token" format:"uuid"`
// Amount of the financial event that has been settled in the currency's smallest
// unit (e.g., cents).
Amount int64 `json:"amount"`
// Date and time when the financial event occurred. UTC time zone.
Created time.Time `json:"created" format:"date-time"`
// APPROVED financial events were successful while DECLINED financial events were
// declined by user, Lithic, or the network.
Result FinancialTransactionEventsResult `json:"result"`
// Event types:
//
// - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending
// approval/release from an ACH hold.
// - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process.
// - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled.
// - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to
// the fed.
// - `ACH_ORIGINATION_SETTLED` - ACH origination has settled.
// - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to
// available balance.
// - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository
// Financial Institution.
// - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder.
// - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt.
// - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled.
// - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available
// balance.
// - `AUTHORIZATION` - Authorize a card transaction.
// - `AUTHORIZATION_ADVICE` - Advice on a card transaction.
// - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by
// Lithic.
// - `AUTHORIZATION_REVERSAL` - Card Authorization was reversed by the merchant.
// - `BALANCE_INQUIRY` - A card balance inquiry (typically a $0 authorization) has
// occurred on a card.
// - `CLEARING` - Card Transaction is settled.
// - `CORRECTION_DEBIT` - Manual card transaction correction (Debit).
// - `CORRECTION_CREDIT` - Manual card transaction correction (Credit).
// - `CREDIT_AUTHORIZATION` - A refund or credit card authorization from a
// merchant.
// - `CREDIT_AUTHORIZATION_ADVICE` - A credit card authorization was approved on
// your behalf by the network.
// - `FINANCIAL_AUTHORIZATION` - A request from a merchant to debit card funds
// without additional clearing.
// - `FINANCIAL_CREDIT_AUTHORIZATION` - A request from a merchant to refund or
// credit card funds without additional clearing.
// - `RETURN` - A card refund has been processed on the transaction.
// - `RETURN_REVERSAL` - A card refund has been reversed (e.g., when a merchant
// reverses an incorrect refund).
// - `TRANSFER` - Successful internal transfer of funds between financial accounts.
// - `TRANSFER_INSUFFICIENT_FUNDS` - Declined internl transfer of funds due to
// insufficient balance of the sender.
Type FinancialTransactionEventsType `json:"type"`
JSON financialTransactionEventJSON `json:"-"`
}
// financialTransactionEventJSON contains the JSON metadata for the struct
// [FinancialTransactionEvent]
type financialTransactionEventJSON struct {
Token apijson.Field
Amount apijson.Field
Created apijson.Field
Result apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *FinancialTransactionEvent) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r financialTransactionEventJSON) RawJSON() string {
return r.raw
}
// APPROVED financial events were successful while DECLINED financial events were
// declined by user, Lithic, or the network.
type FinancialTransactionEventsResult string
const (
FinancialTransactionEventsResultApproved FinancialTransactionEventsResult = "APPROVED"
FinancialTransactionEventsResultDeclined FinancialTransactionEventsResult = "DECLINED"
)
func (r FinancialTransactionEventsResult) IsKnown() bool {
switch r {
case FinancialTransactionEventsResultApproved, FinancialTransactionEventsResultDeclined:
return true
}
return false
}
// Event types:
//
// - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending
// approval/release from an ACH hold.
// - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process.
// - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled.
// - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to
// the fed.
// - `ACH_ORIGINATION_SETTLED` - ACH origination has settled.
// - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to
// available balance.
// - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository
// Financial Institution.
// - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder.
// - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt.
// - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled.
// - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available
// balance.
// - `AUTHORIZATION` - Authorize a card transaction.
// - `AUTHORIZATION_ADVICE` - Advice on a card transaction.
// - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by
// Lithic.
// - `AUTHORIZATION_REVERSAL` - Card Authorization was reversed by the merchant.
// - `BALANCE_INQUIRY` - A card balance inquiry (typically a $0 authorization) has
// occurred on a card.
// - `CLEARING` - Card Transaction is settled.
// - `CORRECTION_DEBIT` - Manual card transaction correction (Debit).
// - `CORRECTION_CREDIT` - Manual card transaction correction (Credit).
// - `CREDIT_AUTHORIZATION` - A refund or credit card authorization from a
// merchant.
// - `CREDIT_AUTHORIZATION_ADVICE` - A credit card authorization was approved on
// your behalf by the network.
// - `FINANCIAL_AUTHORIZATION` - A request from a merchant to debit card funds
// without additional clearing.
// - `FINANCIAL_CREDIT_AUTHORIZATION` - A request from a merchant to refund or
// credit card funds without additional clearing.
// - `RETURN` - A card refund has been processed on the transaction.
// - `RETURN_REVERSAL` - A card refund has been reversed (e.g., when a merchant
// reverses an incorrect refund).
// - `TRANSFER` - Successful internal transfer of funds between financial accounts.
// - `TRANSFER_INSUFFICIENT_FUNDS` - Declined internl transfer of funds due to
// insufficient balance of the sender.
type FinancialTransactionEventsType string
const (
FinancialTransactionEventsTypeACHOriginationCancelled FinancialTransactionEventsType = "ACH_ORIGINATION_CANCELLED"
FinancialTransactionEventsTypeACHOriginationInitiated FinancialTransactionEventsType = "ACH_ORIGINATION_INITIATED"
FinancialTransactionEventsTypeACHOriginationProcessed FinancialTransactionEventsType = "ACH_ORIGINATION_PROCESSED"
FinancialTransactionEventsTypeACHOriginationSettled FinancialTransactionEventsType = "ACH_ORIGINATION_SETTLED"
FinancialTransactionEventsTypeACHOriginationReleased FinancialTransactionEventsType = "ACH_ORIGINATION_RELEASED"
FinancialTransactionEventsTypeACHOriginationReviewed FinancialTransactionEventsType = "ACH_ORIGINATION_REVIEWED"
FinancialTransactionEventsTypeACHReceiptProcessed FinancialTransactionEventsType = "ACH_RECEIPT_PROCESSED"
FinancialTransactionEventsTypeACHReceiptSettled FinancialTransactionEventsType = "ACH_RECEIPT_SETTLED"
FinancialTransactionEventsTypeACHReturnInitiated FinancialTransactionEventsType = "ACH_RETURN_INITIATED"
FinancialTransactionEventsTypeACHReturnProcessed FinancialTransactionEventsType = "ACH_RETURN_PROCESSED"
FinancialTransactionEventsTypeAuthorization FinancialTransactionEventsType = "AUTHORIZATION"
FinancialTransactionEventsTypeAuthorizationAdvice FinancialTransactionEventsType = "AUTHORIZATION_ADVICE"
FinancialTransactionEventsTypeAuthorizationExpiry FinancialTransactionEventsType = "AUTHORIZATION_EXPIRY"
FinancialTransactionEventsTypeAuthorizationReversal FinancialTransactionEventsType = "AUTHORIZATION_REVERSAL"
FinancialTransactionEventsTypeBalanceInquiry FinancialTransactionEventsType = "BALANCE_INQUIRY"
FinancialTransactionEventsTypeClearing FinancialTransactionEventsType = "CLEARING"
FinancialTransactionEventsTypeCorrectionCredit FinancialTransactionEventsType = "CORRECTION_CREDIT"
FinancialTransactionEventsTypeCorrectionDebit FinancialTransactionEventsType = "CORRECTION_DEBIT"
FinancialTransactionEventsTypeCreditAuthorization FinancialTransactionEventsType = "CREDIT_AUTHORIZATION"
FinancialTransactionEventsTypeCreditAuthorizationAdvice FinancialTransactionEventsType = "CREDIT_AUTHORIZATION_ADVICE"
FinancialTransactionEventsTypeFinancialAuthorization FinancialTransactionEventsType = "FINANCIAL_AUTHORIZATION"
FinancialTransactionEventsTypeFinancialCreditAuthorization FinancialTransactionEventsType = "FINANCIAL_CREDIT_AUTHORIZATION"
FinancialTransactionEventsTypeReturn FinancialTransactionEventsType = "RETURN"
FinancialTransactionEventsTypeReturnReversal FinancialTransactionEventsType = "RETURN_REVERSAL"
FinancialTransactionEventsTypeTransfer FinancialTransactionEventsType = "TRANSFER"
FinancialTransactionEventsTypeTransferInsufficientFunds FinancialTransactionEventsType = "TRANSFER_INSUFFICIENT_FUNDS"
)
func (r FinancialTransactionEventsType) IsKnown() bool {
switch r {
case FinancialTransactionEventsTypeACHOriginationCancelled, FinancialTransactionEventsTypeACHOriginationInitiated, FinancialTransactionEventsTypeACHOriginationProcessed, FinancialTransactionEventsTypeACHOriginationSettled, FinancialTransactionEventsTypeACHOriginationReleased, FinancialTransactionEventsTypeACHOriginationReviewed, FinancialTransactionEventsTypeACHReceiptProcessed, FinancialTransactionEventsTypeACHReceiptSettled, FinancialTransactionEventsTypeACHReturnInitiated, FinancialTransactionEventsTypeACHReturnProcessed, FinancialTransactionEventsTypeAuthorization, FinancialTransactionEventsTypeAuthorizationAdvice, FinancialTransactionEventsTypeAuthorizationExpiry, FinancialTransactionEventsTypeAuthorizationReversal, FinancialTransactionEventsTypeBalanceInquiry, FinancialTransactionEventsTypeClearing, FinancialTransactionEventsTypeCorrectionCredit, FinancialTransactionEventsTypeCorrectionDebit, FinancialTransactionEventsTypeCreditAuthorization, FinancialTransactionEventsTypeCreditAuthorizationAdvice, FinancialTransactionEventsTypeFinancialAuthorization, FinancialTransactionEventsTypeFinancialCreditAuthorization, FinancialTransactionEventsTypeReturn, FinancialTransactionEventsTypeReturnReversal, FinancialTransactionEventsTypeTransfer, FinancialTransactionEventsTypeTransferInsufficientFunds:
return true
}
return false
}
// APPROVED transactions were successful while DECLINED transactions were declined
// by user, Lithic, or the network.
type FinancialTransactionResult string
const (
FinancialTransactionResultApproved FinancialTransactionResult = "APPROVED"
FinancialTransactionResultDeclined FinancialTransactionResult = "DECLINED"
)
func (r FinancialTransactionResult) IsKnown() bool {
switch r {
case FinancialTransactionResultApproved, FinancialTransactionResultDeclined:
return true
}
return false
}
// Status types:
//
// - `DECLINED` - The transaction was declined.
// - `EXPIRED` - The authorization as it has passed its expiration time. Card
// transaction only.
// - `PENDING` - The transaction is expected to settle.
// - `RETURNED` - The transaction has been returned.
// - `SETTLED` - The transaction is completed.
// - `VOIDED` - The transaction was voided. Card transaction only.
type FinancialTransactionStatus string
const (
FinancialTransactionStatusDeclined FinancialTransactionStatus = "DECLINED"
FinancialTransactionStatusExpired FinancialTransactionStatus = "EXPIRED"
FinancialTransactionStatusPending FinancialTransactionStatus = "PENDING"
FinancialTransactionStatusReturned FinancialTransactionStatus = "RETURNED"
FinancialTransactionStatusSettled FinancialTransactionStatus = "SETTLED"
FinancialTransactionStatusVoided FinancialTransactionStatus = "VOIDED"
)
func (r FinancialTransactionStatus) IsKnown() bool {
switch r {
case FinancialTransactionStatusDeclined, FinancialTransactionStatusExpired, FinancialTransactionStatusPending, FinancialTransactionStatusReturned, FinancialTransactionStatusSettled, FinancialTransactionStatusVoided:
return true
}
return false
}
type FinancialAccountNewParams struct {
Nickname param.Field[string] `json:"nickname,required"`
Type param.Field[FinancialAccountNewParamsType] `json:"type,required"`
AccountToken param.Field[string] `json:"account_token" format:"uuid"`
IdempotencyKey param.Field[string] `header:"Idempotency-Key" format:"uuid"`
}
func (r FinancialAccountNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type FinancialAccountNewParamsType string
const (
FinancialAccountNewParamsTypeOperating FinancialAccountNewParamsType = "OPERATING"
)
func (r FinancialAccountNewParamsType) IsKnown() bool {
switch r {
case FinancialAccountNewParamsTypeOperating:
return true
}
return false
}
type FinancialAccountUpdateParams struct {
Nickname param.Field[string] `json:"nickname"`
}
func (r FinancialAccountUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type FinancialAccountListParams struct {
// List financial accounts for a given account_token or business_account_token
AccountToken param.Field[string] `query:"account_token" format:"uuid"`
// List financial accounts for a given business_account_token
BusinessAccountToken param.Field[string] `query:"business_account_token" format:"uuid"`
// List financial accounts of a given type
Type param.Field[FinancialAccountListParamsType] `query:"type"`
}
// URLQuery serializes [FinancialAccountListParams]'s query parameters as
// `url.Values`.
func (r FinancialAccountListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// List financial accounts of a given type
type FinancialAccountListParamsType string
const (
FinancialAccountListParamsTypeIssuing FinancialAccountListParamsType = "ISSUING"
FinancialAccountListParamsTypeOperating FinancialAccountListParamsType = "OPERATING"
FinancialAccountListParamsTypeReserve FinancialAccountListParamsType = "RESERVE"
)
func (r FinancialAccountListParamsType) IsKnown() bool {
switch r {
case FinancialAccountListParamsTypeIssuing, FinancialAccountListParamsTypeOperating, FinancialAccountListParamsTypeReserve:
return true
}
return false
}