moderntreasury

package module
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 21 Imported by: 0

README

Modern Treasury Go API Library

Go Reference

The Modern Treasury Go library provides convenient access to the Modern Treasury REST API from applications written in Go.

Installation

import (
	"github.com/Modern-Treasury/modern-treasury-go/v1" // imported as moderntreasury
)

Or to pin the version:

go get -u 'github.com/Modern-Treasury/modern-treasury-go@v1.5.2'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"
	"github.com/Modern-Treasury/modern-treasury-go"
	"github.com/Modern-Treasury/modern-treasury-go/option"
)

func main() {
	client := moderntreasury.NewClient(
		option.WithAPIKey("my api key"),                 // defaults to os.LookupEnv("MODERN_TREASURY_API_KEY")
		option.WithOrganizationID("my-organization-ID"), // defaults to os.LookupEnv("MODERN_TREASURY_ORGANIZATION_ID")
	)
	externalAccount, err := client.ExternalAccounts.New(context.TODO(), moderntreasury.ExternalAccountNewParams{
		CounterpartyID: moderntreasury.F("9eba513a-53fd-4d6d-ad52-ccce122ab92a"),
		Name:           moderntreasury.F("my bank"),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", externalAccount.ID)
}

Request Fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: moderntreasury.F("hello"),

	// Explicitly send `"description": null`
	Description: moderntreasury.Null[string](),

	Point: moderntreasury.F(moderntreasury.Point{
		X: moderntreasury.Int(0),
		Y: moderntreasury.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: moderntreasury.Raw[int64](0.01), // sends a float
	}),
}
Response Objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the repsonse JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := moderntreasury.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.ExternalAccounts.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The full list of request options is here.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.ExternalAccounts.ListAutoPaging(context.TODO(), moderntreasury.ExternalAccountListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	externalAccount := iter.Current()
	fmt.Printf("%+v\n", externalAccount)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.ExternalAccounts.List(context.TODO(), moderntreasury.ExternalAccountListParams{})
for page != nil {
	for _, externalAccount := range page.Items {
		fmt.Printf("%+v\n", externalAccount)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *moderntreasury.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.ExternalAccounts.New(context.TODO(), moderntreasury.ExternalAccountNewParams{
	CounterpartyID: moderntreasury.F("missing"),
})
if err != nil {
	var apierr *moderntreasury.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/api/external_accounts": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.ExternalAccounts.List(
	ctx,
	moderntreasury.ExternalAccountListParams{
		PartyName: moderntreasury.F("my bank"),
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := moderntreasury.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.ExternalAccounts.List(
	context.TODO(),
	moderntreasury.ExternalAccountListParams{},
	option.WithMaxRetries(5),
)
Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := moderntreasury.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic Versioning

This package generally attempts to follow SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool added in v1.1.0

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explciitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type AccountCollectionFlow added in v1.1.0

type AccountCollectionFlow struct {
	// The ID of a counterparty. An external account created with this flow will be
	// associated with this counterparty.
	CounterpartyID string                             `json:"counterparty_id,required" format:"uuid"`
	PaymentTypes   []AccountCollectionFlowPaymentType `json:"payment_types,required"`
	ID             string                             `json:"id" format:"uuid"`
	// The client token of the account collection flow. This token can be used to embed
	// account collection in your client-side application.
	ClientToken string    `json:"client_token"`
	CreatedAt   time.Time `json:"created_at" format:"date-time"`
	// If present, the ID of the external account created using this flow.
	ExternalAccountID string `json:"external_account_id,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode           bool                                    `json:"live_mode"`
	Object             string                                  `json:"object"`
	ReceivingCountries []AccountCollectionFlowReceivingCountry `json:"receiving_countries"`
	// The current status of the account collection flow. One of `pending`,
	// `completed`, `expired`, or `cancelled`.
	Status    AccountCollectionFlowStatus `json:"status"`
	UpdatedAt time.Time                   `json:"updated_at" format:"date-time"`
	JSON      accountCollectionFlowJSON
}

func (*AccountCollectionFlow) UnmarshalJSON added in v1.1.0

func (r *AccountCollectionFlow) UnmarshalJSON(data []byte) (err error)

type AccountCollectionFlowListParams

type AccountCollectionFlowListParams struct {
	AfterCursor       param.Field[string] `query:"after_cursor"`
	ClientToken       param.Field[string] `query:"client_token"`
	CounterpartyID    param.Field[string] `query:"counterparty_id"`
	ExternalAccountID param.Field[string] `query:"external_account_id"`
	PerPage           param.Field[int64]  `query:"per_page"`
	Status            param.Field[string] `query:"status"`
}

func (AccountCollectionFlowListParams) URLQuery

func (r AccountCollectionFlowListParams) URLQuery() (v url.Values)

URLQuery serializes AccountCollectionFlowListParams's query parameters as `url.Values`.

type AccountCollectionFlowNewParams

type AccountCollectionFlowNewParams struct {
	// Required.
	CounterpartyID     param.Field[string]                                           `json:"counterparty_id,required" format:"uuid"`
	PaymentTypes       param.Field[[]string]                                         `json:"payment_types,required"`
	ReceivingCountries param.Field[[]AccountCollectionFlowNewParamsReceivingCountry] `json:"receiving_countries"`
}

func (AccountCollectionFlowNewParams) MarshalJSON

func (r AccountCollectionFlowNewParams) MarshalJSON() (data []byte, err error)

type AccountCollectionFlowNewParamsReceivingCountry added in v1.5.0

type AccountCollectionFlowNewParamsReceivingCountry string

Optional. Array of 3-digit ISO country codes.

const (
	AccountCollectionFlowNewParamsReceivingCountryUsa AccountCollectionFlowNewParamsReceivingCountry = "USA"
	AccountCollectionFlowNewParamsReceivingCountryAus AccountCollectionFlowNewParamsReceivingCountry = "AUS"
	AccountCollectionFlowNewParamsReceivingCountryBel AccountCollectionFlowNewParamsReceivingCountry = "BEL"
	AccountCollectionFlowNewParamsReceivingCountryCan AccountCollectionFlowNewParamsReceivingCountry = "CAN"
	AccountCollectionFlowNewParamsReceivingCountryChl AccountCollectionFlowNewParamsReceivingCountry = "CHL"
	AccountCollectionFlowNewParamsReceivingCountryChn AccountCollectionFlowNewParamsReceivingCountry = "CHN"
	AccountCollectionFlowNewParamsReceivingCountryCol AccountCollectionFlowNewParamsReceivingCountry = "COL"
	AccountCollectionFlowNewParamsReceivingCountryFra AccountCollectionFlowNewParamsReceivingCountry = "FRA"
	AccountCollectionFlowNewParamsReceivingCountryDeu AccountCollectionFlowNewParamsReceivingCountry = "DEU"
	AccountCollectionFlowNewParamsReceivingCountryHkg AccountCollectionFlowNewParamsReceivingCountry = "HKG"
	AccountCollectionFlowNewParamsReceivingCountryInd AccountCollectionFlowNewParamsReceivingCountry = "IND"
	AccountCollectionFlowNewParamsReceivingCountryIrl AccountCollectionFlowNewParamsReceivingCountry = "IRL"
	AccountCollectionFlowNewParamsReceivingCountryIta AccountCollectionFlowNewParamsReceivingCountry = "ITA"
	AccountCollectionFlowNewParamsReceivingCountryMex AccountCollectionFlowNewParamsReceivingCountry = "MEX"
	AccountCollectionFlowNewParamsReceivingCountryNld AccountCollectionFlowNewParamsReceivingCountry = "NLD"
	AccountCollectionFlowNewParamsReceivingCountryPer AccountCollectionFlowNewParamsReceivingCountry = "PER"
	AccountCollectionFlowNewParamsReceivingCountryEsp AccountCollectionFlowNewParamsReceivingCountry = "ESP"
)

type AccountCollectionFlowPaymentType added in v1.1.0

type AccountCollectionFlowPaymentType string

An account created with this flow will support payments of one of these types.

const (
	AccountCollectionFlowPaymentTypeACH  AccountCollectionFlowPaymentType = "ach"
	AccountCollectionFlowPaymentTypeWire AccountCollectionFlowPaymentType = "wire"
)

type AccountCollectionFlowReceivingCountry added in v1.5.0

type AccountCollectionFlowReceivingCountry string

An account created with this flow will support wires from the US to these countries.

const (
	AccountCollectionFlowReceivingCountryUsa AccountCollectionFlowReceivingCountry = "USA"
	AccountCollectionFlowReceivingCountryAus AccountCollectionFlowReceivingCountry = "AUS"
	AccountCollectionFlowReceivingCountryBel AccountCollectionFlowReceivingCountry = "BEL"
	AccountCollectionFlowReceivingCountryCan AccountCollectionFlowReceivingCountry = "CAN"
	AccountCollectionFlowReceivingCountryChl AccountCollectionFlowReceivingCountry = "CHL"
	AccountCollectionFlowReceivingCountryChn AccountCollectionFlowReceivingCountry = "CHN"
	AccountCollectionFlowReceivingCountryCol AccountCollectionFlowReceivingCountry = "COL"
	AccountCollectionFlowReceivingCountryFra AccountCollectionFlowReceivingCountry = "FRA"
	AccountCollectionFlowReceivingCountryDeu AccountCollectionFlowReceivingCountry = "DEU"
	AccountCollectionFlowReceivingCountryHkg AccountCollectionFlowReceivingCountry = "HKG"
	AccountCollectionFlowReceivingCountryInd AccountCollectionFlowReceivingCountry = "IND"
	AccountCollectionFlowReceivingCountryIrl AccountCollectionFlowReceivingCountry = "IRL"
	AccountCollectionFlowReceivingCountryIta AccountCollectionFlowReceivingCountry = "ITA"
	AccountCollectionFlowReceivingCountryMex AccountCollectionFlowReceivingCountry = "MEX"
	AccountCollectionFlowReceivingCountryNld AccountCollectionFlowReceivingCountry = "NLD"
	AccountCollectionFlowReceivingCountryPer AccountCollectionFlowReceivingCountry = "PER"
	AccountCollectionFlowReceivingCountryEsp AccountCollectionFlowReceivingCountry = "ESP"
)

type AccountCollectionFlowService

type AccountCollectionFlowService struct {
	Options []option.RequestOption
}

AccountCollectionFlowService 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 NewAccountCollectionFlowService method instead.

func NewAccountCollectionFlowService

func NewAccountCollectionFlowService(opts ...option.RequestOption) (r *AccountCollectionFlowService)

NewAccountCollectionFlowService 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 (*AccountCollectionFlowService) Get

get account_collection_flow

func (*AccountCollectionFlowService) List

list account_collection_flows

func (*AccountCollectionFlowService) ListAutoPaging

list account_collection_flows

func (*AccountCollectionFlowService) New

create account_collection_flow

func (*AccountCollectionFlowService) Update

update account_collection_flow

type AccountCollectionFlowStatus added in v1.1.0

type AccountCollectionFlowStatus string

The current status of the account collection flow. One of `pending`, `completed`, `expired`, or `cancelled`.

const (
	AccountCollectionFlowStatusCancelled AccountCollectionFlowStatus = "cancelled"
	AccountCollectionFlowStatusCompleted AccountCollectionFlowStatus = "completed"
	AccountCollectionFlowStatusExpired   AccountCollectionFlowStatus = "expired"
	AccountCollectionFlowStatusPending   AccountCollectionFlowStatus = "pending"
)

type AccountCollectionFlowUpdateParams

type AccountCollectionFlowUpdateParams struct {
	// Required. The updated status of the account collection flow. Can only be used to
	// mark a flow as `cancelled`.
	Status param.Field[AccountCollectionFlowUpdateParamsStatus] `json:"status,required"`
}

func (AccountCollectionFlowUpdateParams) MarshalJSON

func (r AccountCollectionFlowUpdateParams) MarshalJSON() (data []byte, err error)

type AccountCollectionFlowUpdateParamsStatus

type AccountCollectionFlowUpdateParamsStatus string

Required. The updated status of the account collection flow. Can only be used to mark a flow as `cancelled`.

const (
	AccountCollectionFlowUpdateParamsStatusCancelled AccountCollectionFlowUpdateParamsStatus = "cancelled"
)

type AccountDetail

type AccountDetail struct {
	ID string `json:"id,required" format:"uuid"`
	// The last 4 digits of the account_number.
	AccountNumberSafe string `json:"account_number_safe,required"`
	// One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank
	// account number is in a generic format.
	AccountNumberType AccountDetailAccountNumberType `json:"account_number_type,required"`
	CreatedAt         time.Time                      `json:"created_at,required" format:"date-time"`
	DiscardedAt       time.Time                      `json:"discarded_at,required,nullable" 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"`
	// The account number for the bank account.
	AccountNumber string `json:"account_number"`
	JSON          accountDetailJSON
}

func (*AccountDetail) UnmarshalJSON

func (r *AccountDetail) UnmarshalJSON(data []byte) (err error)

type AccountDetailAccountNumberType

type AccountDetailAccountNumberType string

One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank account number is in a generic format.

const (
	AccountDetailAccountNumberTypeClabe         AccountDetailAccountNumberType = "clabe"
	AccountDetailAccountNumberTypeIban          AccountDetailAccountNumberType = "iban"
	AccountDetailAccountNumberTypeOther         AccountDetailAccountNumberType = "other"
	AccountDetailAccountNumberTypePan           AccountDetailAccountNumberType = "pan"
	AccountDetailAccountNumberTypeWalletAddress AccountDetailAccountNumberType = "wallet_address"
)

type AccountDetailDeleteParamsAccountsType

type AccountDetailDeleteParamsAccountsType string
const (
	AccountDetailDeleteParamsAccountsTypeExternalAccounts AccountDetailDeleteParamsAccountsType = "external_accounts"
)

type AccountDetailListParams

type AccountDetailListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	PerPage     param.Field[int64]  `query:"per_page"`
}

func (AccountDetailListParams) URLQuery

func (r AccountDetailListParams) URLQuery() (v url.Values)

URLQuery serializes AccountDetailListParams's query parameters as `url.Values`.

type AccountDetailNewParams

type AccountDetailNewParams struct {
	// The account number for the bank account.
	AccountNumber param.Field[string] `json:"account_number,required"`
	// One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank
	// account number is in a generic format.
	AccountNumberType param.Field[AccountDetailNewParamsAccountNumberType] `json:"account_number_type"`
}

func (AccountDetailNewParams) MarshalJSON

func (r AccountDetailNewParams) MarshalJSON() (data []byte, err error)

type AccountDetailNewParamsAccountNumberType

type AccountDetailNewParamsAccountNumberType string

One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank account number is in a generic format.

const (
	AccountDetailNewParamsAccountNumberTypeClabe         AccountDetailNewParamsAccountNumberType = "clabe"
	AccountDetailNewParamsAccountNumberTypeIban          AccountDetailNewParamsAccountNumberType = "iban"
	AccountDetailNewParamsAccountNumberTypeOther         AccountDetailNewParamsAccountNumberType = "other"
	AccountDetailNewParamsAccountNumberTypePan           AccountDetailNewParamsAccountNumberType = "pan"
	AccountDetailNewParamsAccountNumberTypeWalletAddress AccountDetailNewParamsAccountNumberType = "wallet_address"
)

type AccountDetailNewParamsAccountsType

type AccountDetailNewParamsAccountsType string
const (
	AccountDetailNewParamsAccountsTypeExternalAccounts AccountDetailNewParamsAccountsType = "external_accounts"
)

type AccountDetailService

type AccountDetailService struct {
	Options []option.RequestOption
}

AccountDetailService 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 NewAccountDetailService method instead.

func NewAccountDetailService

func NewAccountDetailService(opts ...option.RequestOption) (r *AccountDetailService)

NewAccountDetailService 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 (*AccountDetailService) Delete

func (r *AccountDetailService) Delete(ctx context.Context, accountsType AccountDetailDeleteParamsAccountsType, accountID string, id string, opts ...option.RequestOption) (err error)

Delete a single account detail for an external account.

func (*AccountDetailService) Get

func (r *AccountDetailService) Get(ctx context.Context, accountsType shared.AccountsType, accountID string, id string, opts ...option.RequestOption) (res *AccountDetail, err error)

Get a single account detail for a single internal or external account.

func (*AccountDetailService) List

func (r *AccountDetailService) List(ctx context.Context, accountsType shared.AccountsType, accountID string, query AccountDetailListParams, opts ...option.RequestOption) (res *shared.Page[AccountDetail], err error)

Get a list of account details for a single internal or external account.

func (*AccountDetailService) ListAutoPaging

Get a list of account details for a single internal or external account.

func (*AccountDetailService) New

Create an account detail for an external account.

type AccountsType

type AccountsType = shared.AccountsType

This is an alias to an internal type.

type AsyncResponse

type AsyncResponse = shared.AsyncResponse

This is an alias to an internal type.

type BalanceReport

type BalanceReport struct {
	ID string `json:"id,required" format:"uuid"`
	// The date of the balance report in local time.
	AsOfDate time.Time `json:"as_of_date,required" format:"date"`
	// The time (24-hour clock) of the balance report in local time.
	AsOfTime string `json:"as_of_time,required,nullable" format:"time"`
	// The specific type of balance report. One of `intraday`, `previous_day`,
	// `real_time`, or `other`.
	BalanceReportType BalanceReportBalanceReportType `json:"balance_report_type,required"`
	// An array of `Balance` objects.
	Balances  []BalanceReportBalance `json:"balances,required"`
	CreatedAt time.Time              `json:"created_at,required" format:"date-time"`
	// The ID of one of your organization's Internal Accounts.
	InternalAccountID string `json:"internal_account_id,required" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode  bool      `json:"live_mode,required"`
	Object    string    `json:"object,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      balanceReportJSON
}

func (*BalanceReport) UnmarshalJSON

func (r *BalanceReport) UnmarshalJSON(data []byte) (err error)

type BalanceReportBalance

type BalanceReportBalance struct {
	ID string `json:"id,required" format:"uuid"`
	// The balance amount.
	Amount int64 `json:"amount,required"`
	// The specific type of balance reported. One of `opening_ledger`,
	// `closing_ledger`, `current_ledger`, `opening_available`,
	// `opening_available_next_business_day`, `closing_available`, `current_available`,
	// or `other`.
	BalanceType BalanceReportBalancesBalanceType `json:"balance_type,required"`
	CreatedAt   time.Time                        `json:"created_at,required" format:"date-time"`
	// The currency of the balance.
	Currency shared.Currency `json:"currency,required,nullable"`
	// 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"`
	// The code used by the bank when reporting this specific balance.
	VendorCode string `json:"vendor_code,required"`
	// The code used by the bank when reporting this specific balance.
	VendorCodeType BalanceReportBalancesVendorCodeType `json:"vendor_code_type,required,nullable"`
	JSON           balanceReportBalanceJSON
}

func (*BalanceReportBalance) UnmarshalJSON

func (r *BalanceReportBalance) UnmarshalJSON(data []byte) (err error)

type BalanceReportBalanceReportType

type BalanceReportBalanceReportType string

The specific type of balance report. One of `intraday`, `previous_day`, `real_time`, or `other`.

const (
	BalanceReportBalanceReportTypeIntraday    BalanceReportBalanceReportType = "intraday"
	BalanceReportBalanceReportTypeOther       BalanceReportBalanceReportType = "other"
	BalanceReportBalanceReportTypePreviousDay BalanceReportBalanceReportType = "previous_day"
	BalanceReportBalanceReportTypeRealTime    BalanceReportBalanceReportType = "real_time"
)

type BalanceReportBalancesBalanceType

type BalanceReportBalancesBalanceType string

The specific type of balance reported. One of `opening_ledger`, `closing_ledger`, `current_ledger`, `opening_available`, `opening_available_next_business_day`, `closing_available`, `current_available`, or `other`.

const (
	BalanceReportBalancesBalanceTypeClosingAvailable                BalanceReportBalancesBalanceType = "closing_available"
	BalanceReportBalancesBalanceTypeClosingLedger                   BalanceReportBalancesBalanceType = "closing_ledger"
	BalanceReportBalancesBalanceTypeCurrentAvailable                BalanceReportBalancesBalanceType = "current_available"
	BalanceReportBalancesBalanceTypeCurrentLedger                   BalanceReportBalancesBalanceType = "current_ledger"
	BalanceReportBalancesBalanceTypeOpeningAvailable                BalanceReportBalancesBalanceType = "opening_available"
	BalanceReportBalancesBalanceTypeOpeningAvailableNextBusinessDay BalanceReportBalancesBalanceType = "opening_available_next_business_day"
	BalanceReportBalancesBalanceTypeOpeningLedger                   BalanceReportBalancesBalanceType = "opening_ledger"
	BalanceReportBalancesBalanceTypeOther                           BalanceReportBalancesBalanceType = "other"
)

type BalanceReportBalancesVendorCodeType

type BalanceReportBalancesVendorCodeType string

The code used by the bank when reporting this specific balance.

const (
	BalanceReportBalancesVendorCodeTypeBai2          BalanceReportBalancesVendorCodeType = "bai2"
	BalanceReportBalancesVendorCodeTypeBankprov      BalanceReportBalancesVendorCodeType = "bankprov"
	BalanceReportBalancesVendorCodeTypeBnkDev        BalanceReportBalancesVendorCodeType = "bnk_dev"
	BalanceReportBalancesVendorCodeTypeCleartouch    BalanceReportBalancesVendorCodeType = "cleartouch"
	BalanceReportBalancesVendorCodeTypeColumn        BalanceReportBalancesVendorCodeType = "column"
	BalanceReportBalancesVendorCodeTypeCrossRiver    BalanceReportBalancesVendorCodeType = "cross_river"
	BalanceReportBalancesVendorCodeTypeCurrencycloud BalanceReportBalancesVendorCodeType = "currencycloud"
	BalanceReportBalancesVendorCodeTypeDcBank        BalanceReportBalancesVendorCodeType = "dc_bank"
	BalanceReportBalancesVendorCodeTypeDwolla        BalanceReportBalancesVendorCodeType = "dwolla"
	BalanceReportBalancesVendorCodeTypeEvolve        BalanceReportBalancesVendorCodeType = "evolve"
	BalanceReportBalancesVendorCodeTypeGoldmanSachs  BalanceReportBalancesVendorCodeType = "goldman_sachs"
	BalanceReportBalancesVendorCodeTypeIso20022      BalanceReportBalancesVendorCodeType = "iso20022"
	BalanceReportBalancesVendorCodeTypeJpmc          BalanceReportBalancesVendorCodeType = "jpmc"
	BalanceReportBalancesVendorCodeTypeMx            BalanceReportBalancesVendorCodeType = "mx"
	BalanceReportBalancesVendorCodeTypePlaid         BalanceReportBalancesVendorCodeType = "plaid"
	BalanceReportBalancesVendorCodeTypeRspecVendor   BalanceReportBalancesVendorCodeType = "rspec_vendor"
	BalanceReportBalancesVendorCodeTypeSignet        BalanceReportBalancesVendorCodeType = "signet"
	BalanceReportBalancesVendorCodeTypeSilvergate    BalanceReportBalancesVendorCodeType = "silvergate"
	BalanceReportBalancesVendorCodeTypeSwift         BalanceReportBalancesVendorCodeType = "swift"
	BalanceReportBalancesVendorCodeTypeUsBank        BalanceReportBalancesVendorCodeType = "us_bank"
)

type BalanceReportListParams

type BalanceReportListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// The date of the balance report in local time.
	AsOfDate param.Field[time.Time] `query:"as_of_date" format:"date"`
	// The specific type of balance report. One of `intraday`, `previous_day`,
	// `real_time`, or `other`.
	BalanceReportType param.Field[BalanceReportListParamsBalanceReportType] `query:"balance_report_type"`
	PerPage           param.Field[int64]                                    `query:"per_page"`
}

func (BalanceReportListParams) URLQuery

func (r BalanceReportListParams) URLQuery() (v url.Values)

URLQuery serializes BalanceReportListParams's query parameters as `url.Values`.

type BalanceReportListParamsBalanceReportType

type BalanceReportListParamsBalanceReportType string

The specific type of balance report. One of `intraday`, `previous_day`, `real_time`, or `other`.

const (
	BalanceReportListParamsBalanceReportTypeIntraday    BalanceReportListParamsBalanceReportType = "intraday"
	BalanceReportListParamsBalanceReportTypeOther       BalanceReportListParamsBalanceReportType = "other"
	BalanceReportListParamsBalanceReportTypePreviousDay BalanceReportListParamsBalanceReportType = "previous_day"
	BalanceReportListParamsBalanceReportTypeRealTime    BalanceReportListParamsBalanceReportType = "real_time"
)

type Client

type Client struct {
	Options                      []option.RequestOption
	Connections                  *ConnectionService
	Counterparties               *CounterpartyService
	Events                       *EventService
	ExpectedPayments             *ExpectedPaymentService
	ExternalAccounts             *ExternalAccountService
	IncomingPaymentDetails       *IncomingPaymentDetailService
	Invoices                     *InvoiceService
	Documents                    *DocumentService
	AccountCollectionFlows       *AccountCollectionFlowService
	AccountDetails               *AccountDetailService
	RoutingDetails               *RoutingDetailService
	InternalAccounts             *InternalAccountService
	Ledgers                      *LedgerService
	LedgerableEvents             *LedgerableEventService
	LedgerAccountCategories      *LedgerAccountCategoryService
	LedgerAccounts               *LedgerAccountService
	LedgerAccountBalanceMonitors *LedgerAccountBalanceMonitorService
	LedgerAccountPayouts         *LedgerAccountPayoutService
	LedgerAccountStatements      *LedgerAccountStatementService
	LedgerEntries                *LedgerEntryService
	LedgerEventHandlers          *LedgerEventHandlerService
	LedgerTransactions           *LedgerTransactionService
	LineItems                    *LineItemService
	PaymentFlows                 *PaymentFlowService
	PaymentOrders                *PaymentOrderService
	PaymentReferences            *PaymentReferenceService
	Returns                      *ReturnService
	Transactions                 *TransactionService
	Validations                  *ValidationService
	PaperItems                   *PaperItemService
	Webhooks                     *WebhookService
	VirtualAccounts              *VirtualAccountService
}

Client creates a struct with services and top level methods that help with interacting with the Modern Treasury API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (MODERN_TREASURY_API_KEY, MODERN_TREASURY_ORGANIZATION_ID, MODERN_TREASURY_WEBHOOK_KEY). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Ping

func (r *Client) Ping(ctx context.Context, opts ...option.RequestOption) (res *PingResponse, err error)

A test endpoint often used to confirm credentials and headers are being passed in correctly.

type Connection

type Connection struct {
	ID          string    `json:"id,required" format:"uuid"`
	CreatedAt   time.Time `json:"created_at,required" format:"date-time"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" 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"`
	// An identifier given to this connection by the bank.
	VendorCustomerID string `json:"vendor_customer_id,required,nullable" format:"uuid"`
	// Unique identifier for the bank or vendor.
	VendorID string `json:"vendor_id,required" format:"uuid"`
	// A human-friendly name for the bank or vendor.
	VendorName string `json:"vendor_name,required"`
	JSON       connectionJSON
}

func (*Connection) UnmarshalJSON

func (r *Connection) UnmarshalJSON(data []byte) (err error)

type ConnectionListParams

type ConnectionListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// A string code representing the vendor (i.e. bank).
	Entity  param.Field[string] `query:"entity"`
	PerPage param.Field[int64]  `query:"per_page"`
	// An identifier assigned by the vendor to your organization.
	VendorCustomerID param.Field[string] `query:"vendor_customer_id" format:"uuid"`
}

func (ConnectionListParams) URLQuery

func (r ConnectionListParams) URLQuery() (v url.Values)

URLQuery serializes ConnectionListParams's query parameters as `url.Values`.

type ConnectionService

type ConnectionService struct {
	Options []option.RequestOption
}

ConnectionService 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 NewConnectionService method instead.

func NewConnectionService

func NewConnectionService(opts ...option.RequestOption) (r *ConnectionService)

NewConnectionService 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 (*ConnectionService) List

Get a list of all connections.

func (*ConnectionService) ListAutoPaging

Get a list of all connections.

type Counterparty

type Counterparty struct {
	ID string `json:"id,required" format:"uuid"`
	// The accounts for this counterparty.
	Accounts    []CounterpartyAccount `json:"accounts,required"`
	CreatedAt   time.Time             `json:"created_at,required" format:"date-time"`
	DiscardedAt time.Time             `json:"discarded_at,required,nullable" format:"date-time"`
	// The counterparty's email.
	Email string `json:"email,required,nullable" format:"email"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// A human friendly name for this counterparty.
	Name   string `json:"name,required,nullable"`
	Object string `json:"object,required"`
	// Send an email to the counterparty whenever an associated payment order is sent
	// to the bank.
	SendRemittanceAdvice bool      `json:"send_remittance_advice,required"`
	UpdatedAt            time.Time `json:"updated_at,required" format:"date-time"`
	// The verification status of the counterparty.
	VerificationStatus CounterpartyVerificationStatus `json:"verification_status,required"`
	JSON               counterpartyJSON
}

func (*Counterparty) UnmarshalJSON

func (r *Counterparty) UnmarshalJSON(data []byte) (err error)

type CounterpartyAccount

type CounterpartyAccount struct {
	ID             string          `json:"id" format:"uuid"`
	AccountDetails []AccountDetail `json:"account_details"`
	// Can be `checking`, `savings` or `other`.
	AccountType    ExternalAccountType                 `json:"account_type"`
	ContactDetails []CounterpartyAccountsContactDetail `json:"contact_details"`
	CreatedAt      time.Time                           `json:"created_at" format:"date-time"`
	DiscardedAt    time.Time                           `json:"discarded_at,nullable" format:"date-time"`
	// If the external account links to a ledger account in Modern Treasury, the id of
	// the ledger account will be populated here.
	LedgerAccountID string `json:"ledger_account_id,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name   string `json:"name,nullable"`
	Object string `json:"object"`
	// The address associated with the owner or `null`.
	PartyAddress CounterpartyAccountsPartyAddress `json:"party_address,nullable"`
	// The legal name of the entity which owns the account.
	PartyName string `json:"party_name"`
	// Either `individual` or `business`.
	PartyType          CounterpartyAccountsPartyType          `json:"party_type,nullable"`
	RoutingDetails     []RoutingDetail                        `json:"routing_details"`
	UpdatedAt          time.Time                              `json:"updated_at" format:"date-time"`
	VerificationStatus CounterpartyAccountsVerificationStatus `json:"verification_status"`
	JSON               counterpartyAccountJSON
}

func (*CounterpartyAccount) UnmarshalJSON

func (r *CounterpartyAccount) UnmarshalJSON(data []byte) (err error)

type CounterpartyAccountsContactDetail

type CounterpartyAccountsContactDetail struct {
	ID                    string                                                  `json:"id,required" format:"uuid"`
	ContactIdentifier     string                                                  `json:"contact_identifier,required"`
	ContactIdentifierType CounterpartyAccountsContactDetailsContactIdentifierType `json:"contact_identifier_type,required"`
	CreatedAt             time.Time                                               `json:"created_at,required" format:"date-time"`
	DiscardedAt           time.Time                                               `json:"discarded_at,required,nullable" 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"`
	JSON      counterpartyAccountsContactDetailJSON
}

func (*CounterpartyAccountsContactDetail) UnmarshalJSON

func (r *CounterpartyAccountsContactDetail) UnmarshalJSON(data []byte) (err error)

type CounterpartyAccountsContactDetailsContactIdentifierType

type CounterpartyAccountsContactDetailsContactIdentifierType string
const (
	CounterpartyAccountsContactDetailsContactIdentifierTypeEmail       CounterpartyAccountsContactDetailsContactIdentifierType = "email"
	CounterpartyAccountsContactDetailsContactIdentifierTypePhoneNumber CounterpartyAccountsContactDetailsContactIdentifierType = "phone_number"
	CounterpartyAccountsContactDetailsContactIdentifierTypeWebsite     CounterpartyAccountsContactDetailsContactIdentifierType = "website"
)

type CounterpartyAccountsPartyAddress

type CounterpartyAccountsPartyAddress struct {
	ID string `json:"id,required" format:"uuid"`
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country   string    `json:"country,required,nullable"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	Line1     string    `json:"line1,required,nullable"`
	Line2     string    `json:"line2,required,nullable"`
	// 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"`
	// Locality or City.
	Locality string `json:"locality,required,nullable"`
	Object   string `json:"object,required"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,required,nullable"`
	// Region or State.
	Region    string    `json:"region,required,nullable"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      counterpartyAccountsPartyAddressJSON
}

The address associated with the owner or `null`.

func (*CounterpartyAccountsPartyAddress) UnmarshalJSON

func (r *CounterpartyAccountsPartyAddress) UnmarshalJSON(data []byte) (err error)

type CounterpartyAccountsPartyType

type CounterpartyAccountsPartyType string

Either `individual` or `business`.

const (
	CounterpartyAccountsPartyTypeBusiness   CounterpartyAccountsPartyType = "business"
	CounterpartyAccountsPartyTypeIndividual CounterpartyAccountsPartyType = "individual"
)

type CounterpartyAccountsVerificationStatus

type CounterpartyAccountsVerificationStatus string
const (
	CounterpartyAccountsVerificationStatusPendingVerification CounterpartyAccountsVerificationStatus = "pending_verification"
	CounterpartyAccountsVerificationStatusUnverified          CounterpartyAccountsVerificationStatus = "unverified"
	CounterpartyAccountsVerificationStatusVerified            CounterpartyAccountsVerificationStatus = "verified"
)

type CounterpartyCollectAccountParams

type CounterpartyCollectAccountParams struct {
	// One of `credit` or `debit`. Use `credit` when you want to pay a counterparty.
	// Use `debit` when you need to charge a counterparty. This field helps us send a
	// more tailored email to your counterparties."
	Direction param.Field[CounterpartyCollectAccountParamsDirection] `json:"direction,required"`
	// The URL you want your customer to visit upon filling out the form. By default,
	// they will be sent to a Modern Treasury landing page. This must be a valid HTTPS
	// URL if set.
	CustomRedirect param.Field[string] `json:"custom_redirect" format:"uri"`
	// The list of fields you want on the form. This field is optional and if it is not
	// set, will default to [\"nameOnAccount\", \"accountType\", \"accountNumber\",
	// \"routingNumber\", \"address\"]. The full list of options is [\"name\",
	// \"nameOnAccount\", \"taxpayerIdentifier\", \"accountType\", \"accountNumber\",
	// \"routingNumber\", \"address\", \"ibanNumber\", \"swiftCode\"].
	Fields param.Field[[]CounterpartyCollectAccountParamsField] `json:"fields"`
	// By default, Modern Treasury will send an email to your counterparty that
	// includes a link to the form they must fill out. However, if you would like to
	// send the counterparty the link, you can set this parameter to `false`. The JSON
	// body will include the link to the secure Modern Treasury form.
	SendEmail param.Field[bool] `json:"send_email"`
}

func (CounterpartyCollectAccountParams) MarshalJSON

func (r CounterpartyCollectAccountParams) MarshalJSON() (data []byte, err error)

type CounterpartyCollectAccountParamsDirection

type CounterpartyCollectAccountParamsDirection string

One of `credit` or `debit`. Use `credit` when you want to pay a counterparty. Use `debit` when you need to charge a counterparty. This field helps us send a more tailored email to your counterparties."

const (
	CounterpartyCollectAccountParamsDirectionCredit CounterpartyCollectAccountParamsDirection = "credit"
	CounterpartyCollectAccountParamsDirectionDebit  CounterpartyCollectAccountParamsDirection = "debit"
)

type CounterpartyCollectAccountParamsField

type CounterpartyCollectAccountParamsField string
const (
	CounterpartyCollectAccountParamsFieldName                 CounterpartyCollectAccountParamsField = "name"
	CounterpartyCollectAccountParamsFieldNameOnAccount        CounterpartyCollectAccountParamsField = "nameOnAccount"
	CounterpartyCollectAccountParamsFieldTaxpayerIdentifier   CounterpartyCollectAccountParamsField = "taxpayerIdentifier"
	CounterpartyCollectAccountParamsFieldAccountType          CounterpartyCollectAccountParamsField = "accountType"
	CounterpartyCollectAccountParamsFieldAccountNumber        CounterpartyCollectAccountParamsField = "accountNumber"
	CounterpartyCollectAccountParamsFieldIbanNumber           CounterpartyCollectAccountParamsField = "ibanNumber"
	CounterpartyCollectAccountParamsFieldClabeNumber          CounterpartyCollectAccountParamsField = "clabeNumber"
	CounterpartyCollectAccountParamsFieldWalletAddress        CounterpartyCollectAccountParamsField = "walletAddress"
	CounterpartyCollectAccountParamsFieldPanNumber            CounterpartyCollectAccountParamsField = "panNumber"
	CounterpartyCollectAccountParamsFieldRoutingNumber        CounterpartyCollectAccountParamsField = "routingNumber"
	CounterpartyCollectAccountParamsFieldAbaWireRoutingNumber CounterpartyCollectAccountParamsField = "abaWireRoutingNumber"
	CounterpartyCollectAccountParamsFieldSwiftCode            CounterpartyCollectAccountParamsField = "swiftCode"
	CounterpartyCollectAccountParamsFieldAuBsb                CounterpartyCollectAccountParamsField = "auBsb"
	CounterpartyCollectAccountParamsFieldCaCpa                CounterpartyCollectAccountParamsField = "caCpa"
	CounterpartyCollectAccountParamsFieldCnaps                CounterpartyCollectAccountParamsField = "cnaps"
	CounterpartyCollectAccountParamsFieldGBSortCode           CounterpartyCollectAccountParamsField = "gbSortCode"
	CounterpartyCollectAccountParamsFieldInIfsc               CounterpartyCollectAccountParamsField = "inIfsc"
	CounterpartyCollectAccountParamsFieldMyBranchCode         CounterpartyCollectAccountParamsField = "myBranchCode"
	CounterpartyCollectAccountParamsFieldBrCodigo             CounterpartyCollectAccountParamsField = "brCodigo"
	CounterpartyCollectAccountParamsFieldRoutingNumberType    CounterpartyCollectAccountParamsField = "routingNumberType"
	CounterpartyCollectAccountParamsFieldAddress              CounterpartyCollectAccountParamsField = "address"
	CounterpartyCollectAccountParamsFieldJpZenginCode         CounterpartyCollectAccountParamsField = "jp_zengin_code"
)

type CounterpartyCollectAccountResponse

type CounterpartyCollectAccountResponse struct {
	// The id of the existing counterparty.
	ID string `json:"id,required"`
	// This is the link to the secure Modern Treasury form. By default, Modern Treasury
	// will send an email to your counterparty that includes a link to this form.
	// However, if `send_email` is passed as `false` in the body then Modern Treasury
	// will not send the email and you can send it to the counterparty directly.
	FormLink string `json:"form_link,required" format:"uri"`
	// This field will be `true` if an email requesting account details has already
	// been sent to this counterparty.
	IsResend bool `json:"is_resend,required"`
	JSON     counterpartyCollectAccountResponseJSON
}

func (*CounterpartyCollectAccountResponse) UnmarshalJSON

func (r *CounterpartyCollectAccountResponse) UnmarshalJSON(data []byte) (err error)

type CounterpartyListParams

type CounterpartyListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Used to return counterparties created after some datetime.
	CreatedAtLowerBound param.Field[time.Time] `query:"created_at_lower_bound" format:"date-time"`
	// Used to return counterparties created before some datetime.
	CreatedAtUpperBound param.Field[time.Time] `query:"created_at_upper_bound" format:"date-time"`
	// Performs a partial string match of the email field. This is also case
	// insensitive.
	Email param.Field[string] `query:"email" format:"email"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	// Performs a partial string match of the name field. This is also case
	// insensitive.
	Name    param.Field[string] `query:"name"`
	PerPage param.Field[int64]  `query:"per_page"`
}

func (CounterpartyListParams) URLQuery

func (r CounterpartyListParams) URLQuery() (v url.Values)

URLQuery serializes CounterpartyListParams's query parameters as `url.Values`.

type CounterpartyNewParams

type CounterpartyNewParams struct {
	// A human friendly name for this counterparty.
	Name       param.Field[string]                          `json:"name,required"`
	Accounting param.Field[CounterpartyNewParamsAccounting] `json:"accounting"`
	// The accounts for this counterparty.
	Accounts param.Field[[]CounterpartyNewParamsAccount] `json:"accounts"`
	// The counterparty's email.
	Email param.Field[string] `json:"email" format:"email"`
	// An optional type to auto-sync the counterparty to your ledger. Either `customer`
	// or `vendor`.
	LedgerType param.Field[CounterpartyNewParamsLedgerType] `json:"ledger_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// Send an email to the counterparty whenever an associated payment order is sent
	// to the bank.
	SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
	// Either a valid SSN or EIN.
	TaxpayerIdentifier param.Field[string] `json:"taxpayer_identifier"`
	// The verification status of the counterparty.
	VerificationStatus param.Field[CounterpartyNewParamsVerificationStatus] `json:"verification_status"`
}

func (CounterpartyNewParams) MarshalJSON

func (r CounterpartyNewParams) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccount

type CounterpartyNewParamsAccount struct {
	AccountDetails param.Field[[]CounterpartyNewParamsAccountsAccountDetail] `json:"account_details"`
	// Can be `checking`, `savings` or `other`.
	AccountType    param.Field[ExternalAccountType]                          `json:"account_type"`
	ContactDetails param.Field[[]CounterpartyNewParamsAccountsContactDetail] `json:"contact_details"`
	// Specifies a ledger account object that will be created with the external
	// account. The resulting ledger account is linked to the external account for
	// auto-ledgering Payment objects. See
	// https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
	// for more details.
	LedgerAccount param.Field[CounterpartyNewParamsAccountsLedgerAccount] `json:"ledger_account"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name param.Field[string] `json:"name"`
	// Required if receiving wire payments.
	PartyAddress    param.Field[CounterpartyNewParamsAccountsPartyAddress] `json:"party_address"`
	PartyIdentifier param.Field[string]                                    `json:"party_identifier"`
	// If this value isn't provided, it will be inherited from the counterparty's name.
	PartyName param.Field[string] `json:"party_name"`
	// Either `individual` or `business`.
	PartyType param.Field[CounterpartyNewParamsAccountsPartyType] `json:"party_type"`
	// If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
	// you can pass the processor token in this field.
	PlaidProcessorToken param.Field[string]                                       `json:"plaid_processor_token"`
	RoutingDetails      param.Field[[]CounterpartyNewParamsAccountsRoutingDetail] `json:"routing_details"`
}

func (CounterpartyNewParamsAccount) MarshalJSON

func (r CounterpartyNewParamsAccount) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccounting

type CounterpartyNewParamsAccounting struct {
	// An optional type to auto-sync the counterparty to your ledger. Either `customer`
	// or `vendor`.
	Type param.Field[CounterpartyNewParamsAccountingType] `json:"type"`
}

func (CounterpartyNewParamsAccounting) MarshalJSON

func (r CounterpartyNewParamsAccounting) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccountingType

type CounterpartyNewParamsAccountingType string

An optional type to auto-sync the counterparty to your ledger. Either `customer` or `vendor`.

const (
	CounterpartyNewParamsAccountingTypeCustomer CounterpartyNewParamsAccountingType = "customer"
	CounterpartyNewParamsAccountingTypeVendor   CounterpartyNewParamsAccountingType = "vendor"
)

type CounterpartyNewParamsAccountsAccountDetail

type CounterpartyNewParamsAccountsAccountDetail struct {
	AccountNumber     param.Field[string]                                                       `json:"account_number,required"`
	AccountNumberType param.Field[CounterpartyNewParamsAccountsAccountDetailsAccountNumberType] `json:"account_number_type"`
}

func (CounterpartyNewParamsAccountsAccountDetail) MarshalJSON

func (r CounterpartyNewParamsAccountsAccountDetail) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccountsAccountDetailsAccountNumberType

type CounterpartyNewParamsAccountsAccountDetailsAccountNumberType string
const (
	CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeIban          CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "iban"
	CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeClabe         CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "clabe"
	CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeWalletAddress CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "wallet_address"
	CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypePan           CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "pan"
	CounterpartyNewParamsAccountsAccountDetailsAccountNumberTypeOther         CounterpartyNewParamsAccountsAccountDetailsAccountNumberType = "other"
)

type CounterpartyNewParamsAccountsContactDetail

type CounterpartyNewParamsAccountsContactDetail struct {
	ContactIdentifier     param.Field[string]                                                           `json:"contact_identifier"`
	ContactIdentifierType param.Field[CounterpartyNewParamsAccountsContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}

func (CounterpartyNewParamsAccountsContactDetail) MarshalJSON

func (r CounterpartyNewParamsAccountsContactDetail) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccountsContactDetailsContactIdentifierType

type CounterpartyNewParamsAccountsContactDetailsContactIdentifierType string
const (
	CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypeEmail       CounterpartyNewParamsAccountsContactDetailsContactIdentifierType = "email"
	CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypePhoneNumber CounterpartyNewParamsAccountsContactDetailsContactIdentifierType = "phone_number"
	CounterpartyNewParamsAccountsContactDetailsContactIdentifierTypeWebsite     CounterpartyNewParamsAccountsContactDetailsContactIdentifierType = "website"
)

type CounterpartyNewParamsAccountsLedgerAccount

type CounterpartyNewParamsAccountsLedgerAccount struct {
	// The currency of the ledger account.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the ledger that this account belongs to.
	LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
	// The name of the ledger account.
	Name param.Field[string] `json:"name,required"`
	// The normal balance of the ledger account.
	NormalBalance param.Field[CounterpartyNewParamsAccountsLedgerAccountNormalBalance] `json:"normal_balance,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// The description of the ledger account.
	Description param.Field[string] `json:"description"`
	// If the ledger account links to another object in Modern Treasury, the id will be
	// populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the type will
	// be populated here, otherwise null. The value is one of internal_account or
	// external_account.
	LedgerableType param.Field[CounterpartyNewParamsAccountsLedgerAccountLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

Specifies a ledger account object that will be created with the external account. The resulting ledger account is linked to the external account for auto-ledgering Payment objects. See https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects for more details.

func (CounterpartyNewParamsAccountsLedgerAccount) MarshalJSON

func (r CounterpartyNewParamsAccountsLedgerAccount) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccountsLedgerAccountLedgerableType

type CounterpartyNewParamsAccountsLedgerAccountLedgerableType string

If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.

const (
	CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeExternalAccount CounterpartyNewParamsAccountsLedgerAccountLedgerableType = "external_account"
	CounterpartyNewParamsAccountsLedgerAccountLedgerableTypeInternalAccount CounterpartyNewParamsAccountsLedgerAccountLedgerableType = "internal_account"
)

type CounterpartyNewParamsAccountsLedgerAccountNormalBalance

type CounterpartyNewParamsAccountsLedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	CounterpartyNewParamsAccountsLedgerAccountNormalBalanceCredit CounterpartyNewParamsAccountsLedgerAccountNormalBalance = "credit"
	CounterpartyNewParamsAccountsLedgerAccountNormalBalanceDebit  CounterpartyNewParamsAccountsLedgerAccountNormalBalance = "debit"
)

type CounterpartyNewParamsAccountsPartyAddress

type CounterpartyNewParamsAccountsPartyAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country"`
	Line1   param.Field[string] `json:"line1"`
	Line2   param.Field[string] `json:"line2"`
	// Locality or City.
	Locality param.Field[string] `json:"locality"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code"`
	// Region or State.
	Region param.Field[string] `json:"region"`
}

Required if receiving wire payments.

func (CounterpartyNewParamsAccountsPartyAddress) MarshalJSON

func (r CounterpartyNewParamsAccountsPartyAddress) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccountsPartyType

type CounterpartyNewParamsAccountsPartyType string

Either `individual` or `business`.

const (
	CounterpartyNewParamsAccountsPartyTypeBusiness   CounterpartyNewParamsAccountsPartyType = "business"
	CounterpartyNewParamsAccountsPartyTypeIndividual CounterpartyNewParamsAccountsPartyType = "individual"
)

type CounterpartyNewParamsAccountsRoutingDetail

type CounterpartyNewParamsAccountsRoutingDetail struct {
	RoutingNumber     param.Field[string]                                                       `json:"routing_number,required"`
	RoutingNumberType param.Field[CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
	PaymentType       param.Field[CounterpartyNewParamsAccountsRoutingDetailsPaymentType]       `json:"payment_type"`
}

func (CounterpartyNewParamsAccountsRoutingDetail) MarshalJSON

func (r CounterpartyNewParamsAccountsRoutingDetail) MarshalJSON() (data []byte, err error)

type CounterpartyNewParamsAccountsRoutingDetailsPaymentType

type CounterpartyNewParamsAccountsRoutingDetailsPaymentType string
const (
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeACH         CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "ach"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeAuBecs      CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "au_becs"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSeBankgirot CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "se_bankgirot"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeBacs        CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "bacs"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeBook        CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "book"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCard        CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "card"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCheck       CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "check"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeEft         CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "eft"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeCrossBorder CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "cross_border"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeInterac     CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "interac"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeMasav       CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "masav"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNeft        CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "neft"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeNics        CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "nics"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeProvxchange CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "provxchange"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeRtp         CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "rtp"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSen         CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sen"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSic         CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sic"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSepa        CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "sepa"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeSignet      CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "signet"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeWire        CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "wire"
	CounterpartyNewParamsAccountsRoutingDetailsPaymentTypeZengin      CounterpartyNewParamsAccountsRoutingDetailsPaymentType = "zengin"
)

type CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType

type CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType string
const (
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeAba                    CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "aba"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeAuBsb                  CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "au_bsb"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeBrCodigo               CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "br_codigo"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeCaCpa                  CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "ca_cpa"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeChips                  CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "chips"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeCnaps                  CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "cnaps"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeGBSortCode             CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "gb_sort_code"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeInIfsc                 CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "in_ifsc"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeMyBranchCode           CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "my_branch_code"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeSwift                  CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "swift"
	CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberTypeJpZenginCode           CounterpartyNewParamsAccountsRoutingDetailsRoutingNumberType = "jp_zengin_code"
)

type CounterpartyNewParamsLedgerType

type CounterpartyNewParamsLedgerType string

An optional type to auto-sync the counterparty to your ledger. Either `customer` or `vendor`.

const (
	CounterpartyNewParamsLedgerTypeCustomer CounterpartyNewParamsLedgerType = "customer"
	CounterpartyNewParamsLedgerTypeVendor   CounterpartyNewParamsLedgerType = "vendor"
)

type CounterpartyNewParamsVerificationStatus

type CounterpartyNewParamsVerificationStatus string

The verification status of the counterparty.

const (
	CounterpartyNewParamsVerificationStatusDenied        CounterpartyNewParamsVerificationStatus = "denied"
	CounterpartyNewParamsVerificationStatusNeedsApproval CounterpartyNewParamsVerificationStatus = "needs_approval"
	CounterpartyNewParamsVerificationStatusUnverified    CounterpartyNewParamsVerificationStatus = "unverified"
	CounterpartyNewParamsVerificationStatusVerified      CounterpartyNewParamsVerificationStatus = "verified"
)

type CounterpartyService

type CounterpartyService struct {
	Options []option.RequestOption
}

CounterpartyService 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 NewCounterpartyService method instead.

func NewCounterpartyService

func NewCounterpartyService(opts ...option.RequestOption) (r *CounterpartyService)

NewCounterpartyService 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 (*CounterpartyService) CollectAccount

Send an email requesting account details.

func (*CounterpartyService) Delete

func (r *CounterpartyService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Deletes a given counterparty.

func (*CounterpartyService) Get

func (r *CounterpartyService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Counterparty, err error)

Get details on a single counterparty.

func (*CounterpartyService) List

Get a paginated list of all counterparties.

func (*CounterpartyService) ListAutoPaging

Get a paginated list of all counterparties.

func (*CounterpartyService) New

Create a new counterparty.

func (*CounterpartyService) Update

Updates a given counterparty with new information.

type CounterpartyUpdateParams

type CounterpartyUpdateParams struct {
	// A new email for the counterparty.
	Email param.Field[string] `json:"email" format:"email"`
	// Additional data in the form of key-value pairs. Pairs can be removed by passing
	// an empty string or `null` as the value.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A new name for the counterparty. Will only update if passed.
	Name param.Field[string] `json:"name"`
	// If this is `true`, Modern Treasury will send an email to the counterparty
	// whenever an associated payment order is sent to the bank.
	SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
	// Either a valid SSN or EIN.
	TaxpayerIdentifier param.Field[string] `json:"taxpayer_identifier"`
}

func (CounterpartyUpdateParams) MarshalJSON

func (r CounterpartyUpdateParams) MarshalJSON() (data []byte, err error)

type CounterpartyVerificationStatus

type CounterpartyVerificationStatus string

The verification status of the counterparty.

const (
	CounterpartyVerificationStatusDenied        CounterpartyVerificationStatus = "denied"
	CounterpartyVerificationStatusNeedsApproval CounterpartyVerificationStatus = "needs_approval"
	CounterpartyVerificationStatusUnverified    CounterpartyVerificationStatus = "unverified"
	CounterpartyVerificationStatusVerified      CounterpartyVerificationStatus = "verified"
)

type Currency

type Currency = shared.Currency

Three-letter ISO currency code.

This is an alias to an internal type.

type Document

type Document struct {
	ID              string                   `json:"id,required" format:"uuid"`
	CreatedAt       time.Time                `json:"created_at,required" format:"date-time"`
	DiscardedAt     time.Time                `json:"discarded_at,required,nullable" format:"date-time"`
	DocumentDetails []DocumentDocumentDetail `json:"document_details,required"`
	// A category given to the document, can be `null`.
	DocumentType string `json:"document_type,required,nullable"`
	// The unique identifier for the associated object.
	DocumentableID string `json:"documentable_id,required" format:"uuid"`
	// The type of the associated object. Currently can be one of `payment_order`,
	// `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`,
	// `case`, `internal_account`, `decision`, or `external_account`.
	DocumentableType DocumentDocumentableType `json:"documentable_type,required"`
	File             DocumentFile             `json:"file,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"`
	// The source of the document. Can be `vendor`, `customer`, or `modern_treasury`.
	Source    string    `json:"source,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      documentJSON
}

func (*Document) UnmarshalJSON

func (r *Document) UnmarshalJSON(data []byte) (err error)

type DocumentDocumentDetail

type DocumentDocumentDetail struct {
	ID                     string    `json:"id,required" format:"uuid"`
	CreatedAt              time.Time `json:"created_at,required" format:"date-time"`
	DiscardedAt            time.Time `json:"discarded_at,required,nullable" format:"date-time"`
	DocumentIdentifier     string    `json:"document_identifier,required"`
	DocumentIdentifierType string    `json:"document_identifier_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"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      documentDocumentDetailJSON
}

func (*DocumentDocumentDetail) UnmarshalJSON

func (r *DocumentDocumentDetail) UnmarshalJSON(data []byte) (err error)

type DocumentDocumentableType

type DocumentDocumentableType string

The type of the associated object. Currently can be one of `payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`.

const (
	DocumentDocumentableTypeCase            DocumentDocumentableType = "case"
	DocumentDocumentableTypeCounterparty    DocumentDocumentableType = "counterparty"
	DocumentDocumentableTypeExpectedPayment DocumentDocumentableType = "expected_payment"
	DocumentDocumentableTypeExternalAccount DocumentDocumentableType = "external_account"
	DocumentDocumentableTypeInternalAccount DocumentDocumentableType = "internal_account"
	DocumentDocumentableTypeOrganization    DocumentDocumentableType = "organization"
	DocumentDocumentableTypePaperItem       DocumentDocumentableType = "paper_item"
	DocumentDocumentableTypePaymentOrder    DocumentDocumentableType = "payment_order"
	DocumentDocumentableTypeTransaction     DocumentDocumentableType = "transaction"
	DocumentDocumentableTypeDecision        DocumentDocumentableType = "decision"
	DocumentDocumentableTypeConnection      DocumentDocumentableType = "connection"
)

type DocumentFile

type DocumentFile struct {
	// The MIME content type of the document.
	ContentType string `json:"content_type"`
	// The original filename of the document.
	Filename string `json:"filename"`
	// The size of the document in bytes.
	Size int64 `json:"size"`
	JSON documentFileJSON
}

func (*DocumentFile) UnmarshalJSON

func (r *DocumentFile) UnmarshalJSON(data []byte) (err error)

type DocumentListParams

type DocumentListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// The unique identifier for the associated object.
	DocumentableID param.Field[string] `query:"documentable_id"`
	// The type of the associated object. Currently can be one of `payment_order`,
	// `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`,
	// `case`, `internal_account`, `decision`, or `external_account`.
	DocumentableType param.Field[DocumentListParamsDocumentableType] `query:"documentable_type"`
	PerPage          param.Field[int64]                              `query:"per_page"`
}

func (DocumentListParams) URLQuery

func (r DocumentListParams) URLQuery() (v url.Values)

URLQuery serializes DocumentListParams's query parameters as `url.Values`.

type DocumentListParamsDocumentableType

type DocumentListParamsDocumentableType string

The type of the associated object. Currently can be one of `payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`.

const (
	DocumentListParamsDocumentableTypeCases            DocumentListParamsDocumentableType = "cases"
	DocumentListParamsDocumentableTypeCounterparties   DocumentListParamsDocumentableType = "counterparties"
	DocumentListParamsDocumentableTypeExpectedPayments DocumentListParamsDocumentableType = "expected_payments"
	DocumentListParamsDocumentableTypeExternalAccounts DocumentListParamsDocumentableType = "external_accounts"
	DocumentListParamsDocumentableTypeInternalAccounts DocumentListParamsDocumentableType = "internal_accounts"
	DocumentListParamsDocumentableTypeOrganizations    DocumentListParamsDocumentableType = "organizations"
	DocumentListParamsDocumentableTypePaperItems       DocumentListParamsDocumentableType = "paper_items"
	DocumentListParamsDocumentableTypePaymentOrders    DocumentListParamsDocumentableType = "payment_orders"
	DocumentListParamsDocumentableTypeTransactions     DocumentListParamsDocumentableType = "transactions"
	DocumentListParamsDocumentableTypeDecisions        DocumentListParamsDocumentableType = "decisions"
	DocumentListParamsDocumentableTypeConnections      DocumentListParamsDocumentableType = "connections"
)

type DocumentNewParams

type DocumentNewParams struct {
	// The unique identifier for the associated object.
	DocumentableID   param.Field[string]                            `json:"documentable_id,required"`
	DocumentableType param.Field[DocumentNewParamsDocumentableType] `json:"documentable_type,required"`
	File             param.Field[io.Reader]                         `json:"file,required" format:"binary"`
	// A category given to the document, can be `null`.
	DocumentType param.Field[string] `json:"document_type"`
}

func (DocumentNewParams) MarshalMultipart

func (r DocumentNewParams) MarshalMultipart() (data []byte, contentType string, err error)

type DocumentNewParamsDocumentableType

type DocumentNewParamsDocumentableType string
const (
	DocumentNewParamsDocumentableTypeCases            DocumentNewParamsDocumentableType = "cases"
	DocumentNewParamsDocumentableTypeCounterparties   DocumentNewParamsDocumentableType = "counterparties"
	DocumentNewParamsDocumentableTypeExpectedPayments DocumentNewParamsDocumentableType = "expected_payments"
	DocumentNewParamsDocumentableTypeExternalAccounts DocumentNewParamsDocumentableType = "external_accounts"
	DocumentNewParamsDocumentableTypeInternalAccounts DocumentNewParamsDocumentableType = "internal_accounts"
	DocumentNewParamsDocumentableTypeOrganizations    DocumentNewParamsDocumentableType = "organizations"
	DocumentNewParamsDocumentableTypePaperItems       DocumentNewParamsDocumentableType = "paper_items"
	DocumentNewParamsDocumentableTypePaymentOrders    DocumentNewParamsDocumentableType = "payment_orders"
	DocumentNewParamsDocumentableTypeTransactions     DocumentNewParamsDocumentableType = "transactions"
	DocumentNewParamsDocumentableTypeDecisions        DocumentNewParamsDocumentableType = "decisions"
	DocumentNewParamsDocumentableTypeConnections      DocumentNewParamsDocumentableType = "connections"
)

type DocumentService

type DocumentService struct {
	Options []option.RequestOption
}

DocumentService 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 NewDocumentService method instead.

func NewDocumentService

func NewDocumentService(opts ...option.RequestOption) (r *DocumentService)

NewDocumentService 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 (*DocumentService) Get

func (r *DocumentService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Document, err error)

Get an existing document.

func (*DocumentService) List

func (r *DocumentService) List(ctx context.Context, query DocumentListParams, opts ...option.RequestOption) (res *shared.Page[Document], err error)

Get a list of documents.

func (*DocumentService) ListAutoPaging

Get a list of documents.

func (*DocumentService) New

func (r *DocumentService) New(ctx context.Context, body DocumentNewParams, opts ...option.RequestOption) (res *Document, err error)

Create a document.

type Error

type Error = apierror.Error

type Event

type Event struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The body of the event.
	Data map[string]interface{} `json:"data,required"`
	// The ID of the entity for the event.
	EntityID string `json:"entity_id,required"`
	// The name of the event.
	EventName string `json:"event_name,required"`
	// The time of the event.
	EventTime time.Time `json:"event_time,required" format:"date-time"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool   `json:"live_mode,required"`
	Object   string `json:"object,required"`
	// The type of resource for the event.
	Resource  string    `json:"resource,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      eventJSON
}

func (*Event) UnmarshalJSON

func (r *Event) UnmarshalJSON(data []byte) (err error)

type EventListParams

type EventListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	EntityID    param.Field[string] `query:"entity_id"`
	EventName   param.Field[string] `query:"event_name"`
	// An inclusive upper bound for when the event occurred
	EventTimeEnd param.Field[time.Time] `query:"event_time_end" format:"date-time"`
	// An inclusive lower bound for when the event occurred
	EventTimeStart param.Field[time.Time] `query:"event_time_start" format:"date-time"`
	PerPage        param.Field[int64]     `query:"per_page"`
	Resource       param.Field[string]    `query:"resource"`
}

func (EventListParams) URLQuery

func (r EventListParams) URLQuery() (v url.Values)

URLQuery serializes EventListParams's query parameters as `url.Values`.

type EventService

type EventService struct {
	Options []option.RequestOption
}

EventService 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 NewEventService method instead.

func NewEventService

func NewEventService(opts ...option.RequestOption) (r *EventService)

NewEventService 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 (*EventService) Get

func (r *EventService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Event, err error)

get event

func (*EventService) List

func (r *EventService) List(ctx context.Context, query EventListParams, opts ...option.RequestOption) (res *shared.Page[Event], err error)

list events

func (*EventService) ListAutoPaging

func (r *EventService) ListAutoPaging(ctx context.Context, query EventListParams, opts ...option.RequestOption) *shared.PageAutoPager[Event]

list events

type ExpectedPayment

type ExpectedPayment struct {
	ID string `json:"id,required" format:"uuid"`
	// 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,required"`
	// 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,required"`
	// The ID of the counterparty you expect for this payment.
	CounterpartyID string    `json:"counterparty_id,required,nullable" format:"uuid"`
	CreatedAt      time.Time `json:"created_at,required" format:"date-time"`
	// Must conform to ISO 4217. Defaults to the currency of the internal account.
	Currency shared.Currency `json:"currency,required,nullable"`
	// The earliest date the payment may come in. Format: yyyy-mm-dd
	DateLowerBound time.Time `json:"date_lower_bound,required,nullable" format:"date"`
	// The latest date the payment may come in. Format: yyyy-mm-dd
	DateUpperBound time.Time `json:"date_upper_bound,required,nullable" format:"date"`
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// One of credit or debit. When you are receiving money, use credit. When you are
	// being charged, use debit.
	Direction ExpectedPaymentDirection `json:"direction,required"`
	// The ID of the Internal Account for the expected payment.
	InternalAccountID string `json:"internal_account_id,required" format:"uuid"`
	// The ID of the ledger transaction linked to the expected payment.
	LedgerTransactionID string `json:"ledger_transaction_id,required,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The reconciliation filters you have for this payment.
	ReconciliationFilters interface{} `json:"reconciliation_filters,required,nullable"`
	// The reconciliation groups you have for this payment.
	ReconciliationGroups interface{} `json:"reconciliation_groups,required,nullable"`
	// 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 ExpectedPaymentReconciliationMethod `json:"reconciliation_method,required,nullable"`
	// For `ach`, this field will be passed through on an addenda record. For `wire`
	// payments the field will be passed through as the "Originator to Beneficiary
	// Information", also known as OBI or Fedwire tag 6000.
	RemittanceInformation string `json:"remittance_information,required,nullable"`
	// The statement description you expect to see on the transaction. For ACH
	// payments, this will be the full line item passed from the bank. For wire
	// payments, this will be the OBI field on the wire. For check payments, this will
	// be the memo field.
	StatementDescriptor string `json:"statement_descriptor,required,nullable"`
	// One of unreconciled, reconciled, or archived.
	Status ExpectedPaymentStatus `json:"status,required"`
	// The ID of the Transaction this expected payment object has been matched to.
	TransactionID string `json:"transaction_id,required,nullable" format:"uuid"`
	// The ID of the Transaction Line Item this expected payment has been matched to.
	TransactionLineItemID string `json:"transaction_line_item_id,required,nullable" format:"uuid"`
	// One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen,
	// sepa, signet, wire.
	Type      ExpectedPaymentType `json:"type,required,nullable"`
	UpdatedAt time.Time           `json:"updated_at,required" format:"date-time"`
	JSON      expectedPaymentJSON
}

func (*ExpectedPayment) UnmarshalJSON

func (r *ExpectedPayment) UnmarshalJSON(data []byte) (err error)

type ExpectedPaymentDirection

type ExpectedPaymentDirection string

One of credit or debit. When you are receiving money, use credit. When you are being charged, use debit.

const (
	ExpectedPaymentDirectionCredit ExpectedPaymentDirection = "credit"
	ExpectedPaymentDirectionDebit  ExpectedPaymentDirection = "debit"
)

type ExpectedPaymentListParams

type ExpectedPaymentListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Specify counterparty_id to see expected_payments for a specific account.
	CounterpartyID param.Field[string] `query:"counterparty_id"`
	// Used to return expected payments created after some datetime
	CreatedAtLowerBound param.Field[time.Time] `query:"created_at_lower_bound" format:"date-time"`
	// Used to return expected payments created before some datetime
	CreatedAtUpperBound param.Field[time.Time] `query:"created_at_upper_bound" format:"date-time"`
	// One of credit, debit
	Direction param.Field[ExpectedPaymentListParamsDirection] `query:"direction"`
	// Specify internal_account_id to see expected_payments for a specific account.
	InternalAccountID param.Field[string] `query:"internal_account_id"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	PerPage  param.Field[int64]             `query:"per_page"`
	// One of unreconciled, reconciled, or archived.
	Status param.Field[ExpectedPaymentListParamsStatus] `query:"status"`
	// One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp,sen,
	// sepa, signet, wire
	Type param.Field[ExpectedPaymentListParamsType] `query:"type"`
}

func (ExpectedPaymentListParams) URLQuery

func (r ExpectedPaymentListParams) URLQuery() (v url.Values)

URLQuery serializes ExpectedPaymentListParams's query parameters as `url.Values`.

type ExpectedPaymentListParamsDirection

type ExpectedPaymentListParamsDirection string

One of credit, debit

const (
	ExpectedPaymentListParamsDirectionCredit ExpectedPaymentListParamsDirection = "credit"
	ExpectedPaymentListParamsDirectionDebit  ExpectedPaymentListParamsDirection = "debit"
)

type ExpectedPaymentListParamsStatus

type ExpectedPaymentListParamsStatus string

One of unreconciled, reconciled, or archived.

const (
	ExpectedPaymentListParamsStatusArchived            ExpectedPaymentListParamsStatus = "archived"
	ExpectedPaymentListParamsStatusPartiallyReconciled ExpectedPaymentListParamsStatus = "partially_reconciled"
	ExpectedPaymentListParamsStatusReconciled          ExpectedPaymentListParamsStatus = "reconciled"
	ExpectedPaymentListParamsStatusUnreconciled        ExpectedPaymentListParamsStatus = "unreconciled"
)

type ExpectedPaymentListParamsType

type ExpectedPaymentListParamsType string

One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp,sen, sepa, signet, wire

const (
	ExpectedPaymentListParamsTypeACH         ExpectedPaymentListParamsType = "ach"
	ExpectedPaymentListParamsTypeAuBecs      ExpectedPaymentListParamsType = "au_becs"
	ExpectedPaymentListParamsTypeBacs        ExpectedPaymentListParamsType = "bacs"
	ExpectedPaymentListParamsTypeBook        ExpectedPaymentListParamsType = "book"
	ExpectedPaymentListParamsTypeCard        ExpectedPaymentListParamsType = "card"
	ExpectedPaymentListParamsTypeCheck       ExpectedPaymentListParamsType = "check"
	ExpectedPaymentListParamsTypeCrossBorder ExpectedPaymentListParamsType = "cross_border"
	ExpectedPaymentListParamsTypeEft         ExpectedPaymentListParamsType = "eft"
	ExpectedPaymentListParamsTypeInterac     ExpectedPaymentListParamsType = "interac"
	ExpectedPaymentListParamsTypeMasav       ExpectedPaymentListParamsType = "masav"
	ExpectedPaymentListParamsTypeNeft        ExpectedPaymentListParamsType = "neft"
	ExpectedPaymentListParamsTypeNics        ExpectedPaymentListParamsType = "nics"
	ExpectedPaymentListParamsTypeProvxchange ExpectedPaymentListParamsType = "provxchange"
	ExpectedPaymentListParamsTypeRtp         ExpectedPaymentListParamsType = "rtp"
	ExpectedPaymentListParamsTypeSeBankgirot ExpectedPaymentListParamsType = "se_bankgirot"
	ExpectedPaymentListParamsTypeSen         ExpectedPaymentListParamsType = "sen"
	ExpectedPaymentListParamsTypeSepa        ExpectedPaymentListParamsType = "sepa"
	ExpectedPaymentListParamsTypeSic         ExpectedPaymentListParamsType = "sic"
	ExpectedPaymentListParamsTypeSignet      ExpectedPaymentListParamsType = "signet"
	ExpectedPaymentListParamsTypeWire        ExpectedPaymentListParamsType = "wire"
	ExpectedPaymentListParamsTypeZengin      ExpectedPaymentListParamsType = "zengin"
)

type ExpectedPaymentNewParams

type ExpectedPaymentNewParams struct {
	// The lowest amount this expected payment may be equal to. Value in specified
	// currency's smallest unit. e.g. $10 would be represented as 1000.
	AmountLowerBound param.Field[int64] `json:"amount_lower_bound,required"`
	// The highest amount this expected payment may be equal to. Value in specified
	// currency's smallest unit. e.g. $10 would be represented as 1000.
	AmountUpperBound param.Field[int64] `json:"amount_upper_bound,required"`
	// One of credit or debit. When you are receiving money, use credit. When you are
	// being charged, use debit.
	Direction param.Field[ExpectedPaymentNewParamsDirection] `json:"direction,required"`
	// The ID of the Internal Account for the expected payment.
	InternalAccountID param.Field[string] `json:"internal_account_id,required" format:"uuid"`
	// The ID of the counterparty you expect for this payment.
	CounterpartyID param.Field[string] `json:"counterparty_id" format:"uuid"`
	// Must conform to ISO 4217. Defaults to the currency of the internal account.
	Currency param.Field[shared.Currency] `json:"currency"`
	// The earliest date the payment may come in. Format: yyyy-mm-dd
	DateLowerBound param.Field[time.Time] `json:"date_lower_bound" format:"date"`
	// The latest date the payment may come in. Format: yyyy-mm-dd
	DateUpperBound param.Field[time.Time] `json:"date_upper_bound" format:"date"`
	// An optional description for internal use.
	Description param.Field[string]                             `json:"description"`
	LineItems   param.Field[[]ExpectedPaymentNewParamsLineItem] `json:"line_items"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// The reconciliation filters you have for this payment.
	ReconciliationFilters param.Field[interface{}] `json:"reconciliation_filters"`
	// The reconciliation groups you have for this payment.
	ReconciliationGroups param.Field[interface{}] `json:"reconciliation_groups"`
	// For `ach`, this field will be passed through on an addenda record. For `wire`
	// payments the field will be passed through as the "Originator to Beneficiary
	// Information", also known as OBI or Fedwire tag 6000.
	RemittanceInformation param.Field[string] `json:"remittance_information"`
	// The statement description you expect to see on the transaction. For ACH
	// payments, this will be the full line item passed from the bank. For wire
	// payments, this will be the OBI field on the wire. For check payments, this will
	// be the memo field.
	StatementDescriptor param.Field[string] `json:"statement_descriptor"`
	// One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen,
	// sepa, signet, wire.
	Type param.Field[ExpectedPaymentType] `json:"type"`
}

func (ExpectedPaymentNewParams) MarshalJSON

func (r ExpectedPaymentNewParams) MarshalJSON() (data []byte, err error)

type ExpectedPaymentNewParamsDirection

type ExpectedPaymentNewParamsDirection string

One of credit or debit. When you are receiving money, use credit. When you are being charged, use debit.

const (
	ExpectedPaymentNewParamsDirectionCredit ExpectedPaymentNewParamsDirection = "credit"
	ExpectedPaymentNewParamsDirectionDebit  ExpectedPaymentNewParamsDirection = "debit"
)

type ExpectedPaymentNewParamsLineItem

type ExpectedPaymentNewParamsLineItem struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount param.Field[int64] `json:"amount,required"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID param.Field[string] `json:"accounting_category_id"`
	// A free-form description of the line item.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (ExpectedPaymentNewParamsLineItem) MarshalJSON

func (r ExpectedPaymentNewParamsLineItem) MarshalJSON() (data []byte, err error)

type ExpectedPaymentReconciliationMethod

type ExpectedPaymentReconciliationMethod string

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.

const (
	ExpectedPaymentReconciliationMethodAutomatic ExpectedPaymentReconciliationMethod = "automatic"
	ExpectedPaymentReconciliationMethodManual    ExpectedPaymentReconciliationMethod = "manual"
)

type ExpectedPaymentService

type ExpectedPaymentService struct {
	Options []option.RequestOption
}

ExpectedPaymentService 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 NewExpectedPaymentService method instead.

func NewExpectedPaymentService

func NewExpectedPaymentService(opts ...option.RequestOption) (r *ExpectedPaymentService)

NewExpectedPaymentService 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 (*ExpectedPaymentService) Delete

func (r *ExpectedPaymentService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *ExpectedPayment, err error)

delete expected payment

func (*ExpectedPaymentService) Get

get expected payment

func (*ExpectedPaymentService) List

list expected_payments

func (*ExpectedPaymentService) ListAutoPaging

list expected_payments

func (*ExpectedPaymentService) New

create expected payment

func (*ExpectedPaymentService) Update

update expected payment

type ExpectedPaymentStatus

type ExpectedPaymentStatus string

One of unreconciled, reconciled, or archived.

const (
	ExpectedPaymentStatusArchived            ExpectedPaymentStatus = "archived"
	ExpectedPaymentStatusPartiallyReconciled ExpectedPaymentStatus = "partially_reconciled"
	ExpectedPaymentStatusReconciled          ExpectedPaymentStatus = "reconciled"
	ExpectedPaymentStatusUnreconciled        ExpectedPaymentStatus = "unreconciled"
)

type ExpectedPaymentType

type ExpectedPaymentType string

One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet, wire.

const (
	ExpectedPaymentTypeACH         ExpectedPaymentType = "ach"
	ExpectedPaymentTypeAuBecs      ExpectedPaymentType = "au_becs"
	ExpectedPaymentTypeBacs        ExpectedPaymentType = "bacs"
	ExpectedPaymentTypeBook        ExpectedPaymentType = "book"
	ExpectedPaymentTypeCard        ExpectedPaymentType = "card"
	ExpectedPaymentTypeCheck       ExpectedPaymentType = "check"
	ExpectedPaymentTypeCrossBorder ExpectedPaymentType = "cross_border"
	ExpectedPaymentTypeEft         ExpectedPaymentType = "eft"
	ExpectedPaymentTypeInterac     ExpectedPaymentType = "interac"
	ExpectedPaymentTypeMasav       ExpectedPaymentType = "masav"
	ExpectedPaymentTypeNeft        ExpectedPaymentType = "neft"
	ExpectedPaymentTypeNics        ExpectedPaymentType = "nics"
	ExpectedPaymentTypeProvxchange ExpectedPaymentType = "provxchange"
	ExpectedPaymentTypeRtp         ExpectedPaymentType = "rtp"
	ExpectedPaymentTypeSeBankgirot ExpectedPaymentType = "se_bankgirot"
	ExpectedPaymentTypeSen         ExpectedPaymentType = "sen"
	ExpectedPaymentTypeSepa        ExpectedPaymentType = "sepa"
	ExpectedPaymentTypeSic         ExpectedPaymentType = "sic"
	ExpectedPaymentTypeSignet      ExpectedPaymentType = "signet"
	ExpectedPaymentTypeWire        ExpectedPaymentType = "wire"
	ExpectedPaymentTypeZengin      ExpectedPaymentType = "zengin"
)

type ExpectedPaymentUpdateParams

type ExpectedPaymentUpdateParams struct {
	// The lowest amount this expected payment may be equal to. Value in specified
	// currency's smallest unit. e.g. $10 would be represented as 1000.
	AmountLowerBound param.Field[int64] `json:"amount_lower_bound"`
	// The highest amount this expected payment may be equal to. Value in specified
	// currency's smallest unit. e.g. $10 would be represented as 1000.
	AmountUpperBound param.Field[int64] `json:"amount_upper_bound"`
	// The ID of the counterparty you expect for this payment.
	CounterpartyID param.Field[string] `json:"counterparty_id" format:"uuid"`
	// Must conform to ISO 4217. Defaults to the currency of the internal account.
	Currency param.Field[shared.Currency] `json:"currency"`
	// The earliest date the payment may come in. Format: yyyy-mm-dd
	DateLowerBound param.Field[time.Time] `json:"date_lower_bound" format:"date"`
	// The latest date the payment may come in. Format: yyyy-mm-dd
	DateUpperBound param.Field[time.Time] `json:"date_upper_bound" format:"date"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// One of credit or debit. When you are receiving money, use credit. When you are
	// being charged, use debit.
	Direction param.Field[ExpectedPaymentUpdateParamsDirection] `json:"direction"`
	// The ID of the Internal Account for the expected payment.
	InternalAccountID param.Field[string] `json:"internal_account_id" format:"uuid"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// The reconciliation filters you have for this payment.
	ReconciliationFilters param.Field[interface{}] `json:"reconciliation_filters"`
	// The reconciliation groups you have for this payment.
	ReconciliationGroups param.Field[interface{}] `json:"reconciliation_groups"`
	// For `ach`, this field will be passed through on an addenda record. For `wire`
	// payments the field will be passed through as the "Originator to Beneficiary
	// Information", also known as OBI or Fedwire tag 6000.
	RemittanceInformation param.Field[string] `json:"remittance_information"`
	// The statement description you expect to see on the transaction. For ACH
	// payments, this will be the full line item passed from the bank. For wire
	// payments, this will be the OBI field on the wire. For check payments, this will
	// be the memo field.
	StatementDescriptor param.Field[string] `json:"statement_descriptor"`
	// One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen,
	// sepa, signet, wire.
	Type param.Field[ExpectedPaymentType] `json:"type"`
}

func (ExpectedPaymentUpdateParams) MarshalJSON

func (r ExpectedPaymentUpdateParams) MarshalJSON() (data []byte, err error)

type ExpectedPaymentUpdateParamsDirection

type ExpectedPaymentUpdateParamsDirection string

One of credit or debit. When you are receiving money, use credit. When you are being charged, use debit.

const (
	ExpectedPaymentUpdateParamsDirectionCredit ExpectedPaymentUpdateParamsDirection = "credit"
	ExpectedPaymentUpdateParamsDirectionDebit  ExpectedPaymentUpdateParamsDirection = "debit"
)

type ExternalAccount

type ExternalAccount struct {
	ID             string          `json:"id,required" format:"uuid"`
	AccountDetails []AccountDetail `json:"account_details,required"`
	// Can be `checking`, `savings` or `other`.
	AccountType    ExternalAccountType            `json:"account_type,required"`
	ContactDetails []ExternalAccountContactDetail `json:"contact_details,required"`
	CounterpartyID string                         `json:"counterparty_id,required,nullable" format:"uuid"`
	CreatedAt      time.Time                      `json:"created_at,required" format:"date-time"`
	DiscardedAt    time.Time                      `json:"discarded_at,required,nullable" format:"date-time"`
	// If the external account links to a ledger account in Modern Treasury, the id of
	// the ledger account will be populated here.
	LedgerAccountID string `json:"ledger_account_id,required,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name   string `json:"name,required,nullable"`
	Object string `json:"object,required"`
	// The address associated with the owner or `null`.
	PartyAddress ExternalAccountPartyAddress `json:"party_address,required,nullable"`
	// The legal name of the entity which owns the account.
	PartyName string `json:"party_name,required"`
	// Either `individual` or `business`.
	PartyType          ExternalAccountPartyType          `json:"party_type,required,nullable"`
	RoutingDetails     []RoutingDetail                   `json:"routing_details,required"`
	UpdatedAt          time.Time                         `json:"updated_at,required" format:"date-time"`
	VerificationStatus ExternalAccountVerificationStatus `json:"verification_status,required"`
	JSON               externalAccountJSON
}

func (*ExternalAccount) UnmarshalJSON

func (r *ExternalAccount) UnmarshalJSON(data []byte) (err error)

type ExternalAccountCompleteVerificationParams

type ExternalAccountCompleteVerificationParams struct {
	Amounts param.Field[[]int64] `json:"amounts"`
}

func (ExternalAccountCompleteVerificationParams) MarshalJSON

func (r ExternalAccountCompleteVerificationParams) MarshalJSON() (data []byte, err error)

type ExternalAccountContactDetail

type ExternalAccountContactDetail struct {
	ID                    string                                             `json:"id,required" format:"uuid"`
	ContactIdentifier     string                                             `json:"contact_identifier,required"`
	ContactIdentifierType ExternalAccountContactDetailsContactIdentifierType `json:"contact_identifier_type,required"`
	CreatedAt             time.Time                                          `json:"created_at,required" format:"date-time"`
	DiscardedAt           time.Time                                          `json:"discarded_at,required,nullable" 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"`
	JSON      externalAccountContactDetailJSON
}

func (*ExternalAccountContactDetail) UnmarshalJSON

func (r *ExternalAccountContactDetail) UnmarshalJSON(data []byte) (err error)

type ExternalAccountContactDetailsContactIdentifierType

type ExternalAccountContactDetailsContactIdentifierType string
const (
	ExternalAccountContactDetailsContactIdentifierTypeEmail       ExternalAccountContactDetailsContactIdentifierType = "email"
	ExternalAccountContactDetailsContactIdentifierTypePhoneNumber ExternalAccountContactDetailsContactIdentifierType = "phone_number"
	ExternalAccountContactDetailsContactIdentifierTypeWebsite     ExternalAccountContactDetailsContactIdentifierType = "website"
)

type ExternalAccountListParams

type ExternalAccountListParams struct {
	AfterCursor    param.Field[string] `query:"after_cursor"`
	CounterpartyID param.Field[string] `query:"counterparty_id"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	// Searches the ExternalAccount's party_name AND the Counterparty's party_name
	PartyName param.Field[string] `query:"party_name"`
	PerPage   param.Field[int64]  `query:"per_page"`
}

func (ExternalAccountListParams) URLQuery

func (r ExternalAccountListParams) URLQuery() (v url.Values)

URLQuery serializes ExternalAccountListParams's query parameters as `url.Values`.

type ExternalAccountNewParams

type ExternalAccountNewParams struct {
	CounterpartyID param.Field[string]                                  `json:"counterparty_id,required" format:"uuid"`
	AccountDetails param.Field[[]ExternalAccountNewParamsAccountDetail] `json:"account_details"`
	// Can be `checking`, `savings` or `other`.
	AccountType    param.Field[ExternalAccountType]                     `json:"account_type"`
	ContactDetails param.Field[[]ExternalAccountNewParamsContactDetail] `json:"contact_details"`
	// Specifies a ledger account object that will be created with the external
	// account. The resulting ledger account is linked to the external account for
	// auto-ledgering Payment objects. See
	// https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
	// for more details.
	LedgerAccount param.Field[ExternalAccountNewParamsLedgerAccount] `json:"ledger_account"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name param.Field[string] `json:"name"`
	// Required if receiving wire payments.
	PartyAddress    param.Field[ExternalAccountNewParamsPartyAddress] `json:"party_address"`
	PartyIdentifier param.Field[string]                               `json:"party_identifier"`
	// If this value isn't provided, it will be inherited from the counterparty's name.
	PartyName param.Field[string] `json:"party_name"`
	// Either `individual` or `business`.
	PartyType param.Field[ExternalAccountNewParamsPartyType] `json:"party_type"`
	// If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
	// you can pass the processor token in this field.
	PlaidProcessorToken param.Field[string]                                  `json:"plaid_processor_token"`
	RoutingDetails      param.Field[[]ExternalAccountNewParamsRoutingDetail] `json:"routing_details"`
}

func (ExternalAccountNewParams) MarshalJSON

func (r ExternalAccountNewParams) MarshalJSON() (data []byte, err error)

type ExternalAccountNewParamsAccountDetail

type ExternalAccountNewParamsAccountDetail struct {
	AccountNumber     param.Field[string]                                                  `json:"account_number,required"`
	AccountNumberType param.Field[ExternalAccountNewParamsAccountDetailsAccountNumberType] `json:"account_number_type"`
}

func (ExternalAccountNewParamsAccountDetail) MarshalJSON

func (r ExternalAccountNewParamsAccountDetail) MarshalJSON() (data []byte, err error)

type ExternalAccountNewParamsAccountDetailsAccountNumberType

type ExternalAccountNewParamsAccountDetailsAccountNumberType string
const (
	ExternalAccountNewParamsAccountDetailsAccountNumberTypeIban          ExternalAccountNewParamsAccountDetailsAccountNumberType = "iban"
	ExternalAccountNewParamsAccountDetailsAccountNumberTypeClabe         ExternalAccountNewParamsAccountDetailsAccountNumberType = "clabe"
	ExternalAccountNewParamsAccountDetailsAccountNumberTypeWalletAddress ExternalAccountNewParamsAccountDetailsAccountNumberType = "wallet_address"
	ExternalAccountNewParamsAccountDetailsAccountNumberTypePan           ExternalAccountNewParamsAccountDetailsAccountNumberType = "pan"
	ExternalAccountNewParamsAccountDetailsAccountNumberTypeOther         ExternalAccountNewParamsAccountDetailsAccountNumberType = "other"
)

type ExternalAccountNewParamsContactDetail

type ExternalAccountNewParamsContactDetail struct {
	ContactIdentifier     param.Field[string]                                                      `json:"contact_identifier"`
	ContactIdentifierType param.Field[ExternalAccountNewParamsContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}

func (ExternalAccountNewParamsContactDetail) MarshalJSON

func (r ExternalAccountNewParamsContactDetail) MarshalJSON() (data []byte, err error)

type ExternalAccountNewParamsContactDetailsContactIdentifierType

type ExternalAccountNewParamsContactDetailsContactIdentifierType string
const (
	ExternalAccountNewParamsContactDetailsContactIdentifierTypeEmail       ExternalAccountNewParamsContactDetailsContactIdentifierType = "email"
	ExternalAccountNewParamsContactDetailsContactIdentifierTypePhoneNumber ExternalAccountNewParamsContactDetailsContactIdentifierType = "phone_number"
	ExternalAccountNewParamsContactDetailsContactIdentifierTypeWebsite     ExternalAccountNewParamsContactDetailsContactIdentifierType = "website"
)

type ExternalAccountNewParamsLedgerAccount

type ExternalAccountNewParamsLedgerAccount struct {
	// The currency of the ledger account.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the ledger that this account belongs to.
	LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
	// The name of the ledger account.
	Name param.Field[string] `json:"name,required"`
	// The normal balance of the ledger account.
	NormalBalance param.Field[ExternalAccountNewParamsLedgerAccountNormalBalance] `json:"normal_balance,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// The description of the ledger account.
	Description param.Field[string] `json:"description"`
	// If the ledger account links to another object in Modern Treasury, the id will be
	// populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the type will
	// be populated here, otherwise null. The value is one of internal_account or
	// external_account.
	LedgerableType param.Field[ExternalAccountNewParamsLedgerAccountLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

Specifies a ledger account object that will be created with the external account. The resulting ledger account is linked to the external account for auto-ledgering Payment objects. See https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects for more details.

func (ExternalAccountNewParamsLedgerAccount) MarshalJSON

func (r ExternalAccountNewParamsLedgerAccount) MarshalJSON() (data []byte, err error)

type ExternalAccountNewParamsLedgerAccountLedgerableType

type ExternalAccountNewParamsLedgerAccountLedgerableType string

If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.

const (
	ExternalAccountNewParamsLedgerAccountLedgerableTypeExternalAccount ExternalAccountNewParamsLedgerAccountLedgerableType = "external_account"
	ExternalAccountNewParamsLedgerAccountLedgerableTypeInternalAccount ExternalAccountNewParamsLedgerAccountLedgerableType = "internal_account"
)

type ExternalAccountNewParamsLedgerAccountNormalBalance

type ExternalAccountNewParamsLedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	ExternalAccountNewParamsLedgerAccountNormalBalanceCredit ExternalAccountNewParamsLedgerAccountNormalBalance = "credit"
	ExternalAccountNewParamsLedgerAccountNormalBalanceDebit  ExternalAccountNewParamsLedgerAccountNormalBalance = "debit"
)

type ExternalAccountNewParamsPartyAddress

type ExternalAccountNewParamsPartyAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country"`
	Line1   param.Field[string] `json:"line1"`
	Line2   param.Field[string] `json:"line2"`
	// Locality or City.
	Locality param.Field[string] `json:"locality"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code"`
	// Region or State.
	Region param.Field[string] `json:"region"`
}

Required if receiving wire payments.

func (ExternalAccountNewParamsPartyAddress) MarshalJSON

func (r ExternalAccountNewParamsPartyAddress) MarshalJSON() (data []byte, err error)

type ExternalAccountNewParamsPartyType

type ExternalAccountNewParamsPartyType string

Either `individual` or `business`.

const (
	ExternalAccountNewParamsPartyTypeBusiness   ExternalAccountNewParamsPartyType = "business"
	ExternalAccountNewParamsPartyTypeIndividual ExternalAccountNewParamsPartyType = "individual"
)

type ExternalAccountNewParamsRoutingDetail

type ExternalAccountNewParamsRoutingDetail struct {
	RoutingNumber     param.Field[string]                                                  `json:"routing_number,required"`
	RoutingNumberType param.Field[ExternalAccountNewParamsRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
	PaymentType       param.Field[ExternalAccountNewParamsRoutingDetailsPaymentType]       `json:"payment_type"`
}

func (ExternalAccountNewParamsRoutingDetail) MarshalJSON

func (r ExternalAccountNewParamsRoutingDetail) MarshalJSON() (data []byte, err error)

type ExternalAccountNewParamsRoutingDetailsPaymentType

type ExternalAccountNewParamsRoutingDetailsPaymentType string
const (
	ExternalAccountNewParamsRoutingDetailsPaymentTypeACH         ExternalAccountNewParamsRoutingDetailsPaymentType = "ach"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeAuBecs      ExternalAccountNewParamsRoutingDetailsPaymentType = "au_becs"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeSeBankgirot ExternalAccountNewParamsRoutingDetailsPaymentType = "se_bankgirot"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeBacs        ExternalAccountNewParamsRoutingDetailsPaymentType = "bacs"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeBook        ExternalAccountNewParamsRoutingDetailsPaymentType = "book"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeCard        ExternalAccountNewParamsRoutingDetailsPaymentType = "card"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeCheck       ExternalAccountNewParamsRoutingDetailsPaymentType = "check"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeEft         ExternalAccountNewParamsRoutingDetailsPaymentType = "eft"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeCrossBorder ExternalAccountNewParamsRoutingDetailsPaymentType = "cross_border"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeInterac     ExternalAccountNewParamsRoutingDetailsPaymentType = "interac"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeMasav       ExternalAccountNewParamsRoutingDetailsPaymentType = "masav"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeNeft        ExternalAccountNewParamsRoutingDetailsPaymentType = "neft"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeNics        ExternalAccountNewParamsRoutingDetailsPaymentType = "nics"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeProvxchange ExternalAccountNewParamsRoutingDetailsPaymentType = "provxchange"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeRtp         ExternalAccountNewParamsRoutingDetailsPaymentType = "rtp"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeSen         ExternalAccountNewParamsRoutingDetailsPaymentType = "sen"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeSic         ExternalAccountNewParamsRoutingDetailsPaymentType = "sic"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeSepa        ExternalAccountNewParamsRoutingDetailsPaymentType = "sepa"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeSignet      ExternalAccountNewParamsRoutingDetailsPaymentType = "signet"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeWire        ExternalAccountNewParamsRoutingDetailsPaymentType = "wire"
	ExternalAccountNewParamsRoutingDetailsPaymentTypeZengin      ExternalAccountNewParamsRoutingDetailsPaymentType = "zengin"
)

type ExternalAccountNewParamsRoutingDetailsRoutingNumberType

type ExternalAccountNewParamsRoutingDetailsRoutingNumberType string
const (
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeAba                    ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "aba"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeAuBsb                  ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "au_bsb"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeBrCodigo               ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "br_codigo"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeCaCpa                  ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "ca_cpa"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeChips                  ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "chips"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeCnaps                  ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "cnaps"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeGBSortCode             ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "gb_sort_code"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeInIfsc                 ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "in_ifsc"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeMyBranchCode           ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "my_branch_code"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeSwift                  ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "swift"
	ExternalAccountNewParamsRoutingDetailsRoutingNumberTypeJpZenginCode           ExternalAccountNewParamsRoutingDetailsRoutingNumberType = "jp_zengin_code"
)

type ExternalAccountPartyAddress

type ExternalAccountPartyAddress struct {
	ID string `json:"id,required" format:"uuid"`
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country   string    `json:"country,required,nullable"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	Line1     string    `json:"line1,required,nullable"`
	Line2     string    `json:"line2,required,nullable"`
	// 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"`
	// Locality or City.
	Locality string `json:"locality,required,nullable"`
	Object   string `json:"object,required"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,required,nullable"`
	// Region or State.
	Region    string    `json:"region,required,nullable"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      externalAccountPartyAddressJSON
}

The address associated with the owner or `null`.

func (*ExternalAccountPartyAddress) UnmarshalJSON

func (r *ExternalAccountPartyAddress) UnmarshalJSON(data []byte) (err error)

type ExternalAccountPartyType

type ExternalAccountPartyType string

Either `individual` or `business`.

const (
	ExternalAccountPartyTypeBusiness   ExternalAccountPartyType = "business"
	ExternalAccountPartyTypeIndividual ExternalAccountPartyType = "individual"
)

type ExternalAccountService

type ExternalAccountService struct {
	Options []option.RequestOption
}

ExternalAccountService 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 NewExternalAccountService method instead.

func NewExternalAccountService

func NewExternalAccountService(opts ...option.RequestOption) (r *ExternalAccountService)

NewExternalAccountService 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 (*ExternalAccountService) CompleteVerification

complete verification of external account

func (*ExternalAccountService) Delete

func (r *ExternalAccountService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

delete external account

func (*ExternalAccountService) Get

show external account

func (*ExternalAccountService) List

list external accounts

func (*ExternalAccountService) ListAutoPaging

list external accounts

func (*ExternalAccountService) New

create external account

func (*ExternalAccountService) Update

update external account

func (*ExternalAccountService) Verify

verify external account

type ExternalAccountType

type ExternalAccountType string

Can be `checking`, `savings` or `other`.

const (
	ExternalAccountTypeCash        ExternalAccountType = "cash"
	ExternalAccountTypeChecking    ExternalAccountType = "checking"
	ExternalAccountTypeLoan        ExternalAccountType = "loan"
	ExternalAccountTypeNonResident ExternalAccountType = "non_resident"
	ExternalAccountTypeOther       ExternalAccountType = "other"
	ExternalAccountTypeOverdraft   ExternalAccountType = "overdraft"
	ExternalAccountTypeSavings     ExternalAccountType = "savings"
)

type ExternalAccountUpdateParams

type ExternalAccountUpdateParams struct {
	// Can be `checking`, `savings` or `other`.
	AccountType    param.Field[ExternalAccountType] `json:"account_type"`
	CounterpartyID param.Field[string]              `json:"counterparty_id" format:"uuid"`
	// Additional data in the form of key-value pairs. Pairs can be removed by passing
	// an empty string or `null` as the value.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name         param.Field[string]                                  `json:"name"`
	PartyAddress param.Field[ExternalAccountUpdateParamsPartyAddress] `json:"party_address"`
	// If this value isn't provided, it will be inherited from the counterparty's name.
	PartyName param.Field[string] `json:"party_name"`
	// Either `individual` or `business`.
	PartyType param.Field[ExternalAccountUpdateParamsPartyType] `json:"party_type"`
}

func (ExternalAccountUpdateParams) MarshalJSON

func (r ExternalAccountUpdateParams) MarshalJSON() (data []byte, err error)

type ExternalAccountUpdateParamsPartyAddress

type ExternalAccountUpdateParamsPartyAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country"`
	Line1   param.Field[string] `json:"line1"`
	Line2   param.Field[string] `json:"line2"`
	// Locality or City.
	Locality param.Field[string] `json:"locality"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code"`
	// Region or State.
	Region param.Field[string] `json:"region"`
}

func (ExternalAccountUpdateParamsPartyAddress) MarshalJSON

func (r ExternalAccountUpdateParamsPartyAddress) MarshalJSON() (data []byte, err error)

type ExternalAccountUpdateParamsPartyType

type ExternalAccountUpdateParamsPartyType string

Either `individual` or `business`.

const (
	ExternalAccountUpdateParamsPartyTypeBusiness   ExternalAccountUpdateParamsPartyType = "business"
	ExternalAccountUpdateParamsPartyTypeIndividual ExternalAccountUpdateParamsPartyType = "individual"
)

type ExternalAccountVerificationStatus

type ExternalAccountVerificationStatus string
const (
	ExternalAccountVerificationStatusPendingVerification ExternalAccountVerificationStatus = "pending_verification"
	ExternalAccountVerificationStatusUnverified          ExternalAccountVerificationStatus = "unverified"
	ExternalAccountVerificationStatusVerified            ExternalAccountVerificationStatus = "verified"
)

type ExternalAccountVerifyParams

type ExternalAccountVerifyParams struct {
	// The ID of the internal account where the micro-deposits originate from. Both
	// credit and debit capabilities must be enabled.
	OriginatingAccountID param.Field[string] `json:"originating_account_id,required" format:"uuid"`
	// Both ach and eft are supported payment types.
	PaymentType param.Field[ExternalAccountVerifyParamsPaymentType] `json:"payment_type,required"`
	// Defaults to the currency of the originating account.
	Currency param.Field[shared.Currency] `json:"currency"`
}

func (ExternalAccountVerifyParams) MarshalJSON

func (r ExternalAccountVerifyParams) MarshalJSON() (data []byte, err error)

type ExternalAccountVerifyParamsPaymentType

type ExternalAccountVerifyParamsPaymentType string

Both ach and eft are supported payment types.

const (
	ExternalAccountVerifyParamsPaymentTypeACH         ExternalAccountVerifyParamsPaymentType = "ach"
	ExternalAccountVerifyParamsPaymentTypeAuBecs      ExternalAccountVerifyParamsPaymentType = "au_becs"
	ExternalAccountVerifyParamsPaymentTypeBacs        ExternalAccountVerifyParamsPaymentType = "bacs"
	ExternalAccountVerifyParamsPaymentTypeBook        ExternalAccountVerifyParamsPaymentType = "book"
	ExternalAccountVerifyParamsPaymentTypeCard        ExternalAccountVerifyParamsPaymentType = "card"
	ExternalAccountVerifyParamsPaymentTypeCheck       ExternalAccountVerifyParamsPaymentType = "check"
	ExternalAccountVerifyParamsPaymentTypeCrossBorder ExternalAccountVerifyParamsPaymentType = "cross_border"
	ExternalAccountVerifyParamsPaymentTypeEft         ExternalAccountVerifyParamsPaymentType = "eft"
	ExternalAccountVerifyParamsPaymentTypeInterac     ExternalAccountVerifyParamsPaymentType = "interac"
	ExternalAccountVerifyParamsPaymentTypeMasav       ExternalAccountVerifyParamsPaymentType = "masav"
	ExternalAccountVerifyParamsPaymentTypeNeft        ExternalAccountVerifyParamsPaymentType = "neft"
	ExternalAccountVerifyParamsPaymentTypeNics        ExternalAccountVerifyParamsPaymentType = "nics"
	ExternalAccountVerifyParamsPaymentTypeProvxchange ExternalAccountVerifyParamsPaymentType = "provxchange"
	ExternalAccountVerifyParamsPaymentTypeRtp         ExternalAccountVerifyParamsPaymentType = "rtp"
	ExternalAccountVerifyParamsPaymentTypeSeBankgirot ExternalAccountVerifyParamsPaymentType = "se_bankgirot"
	ExternalAccountVerifyParamsPaymentTypeSen         ExternalAccountVerifyParamsPaymentType = "sen"
	ExternalAccountVerifyParamsPaymentTypeSepa        ExternalAccountVerifyParamsPaymentType = "sepa"
	ExternalAccountVerifyParamsPaymentTypeSic         ExternalAccountVerifyParamsPaymentType = "sic"
	ExternalAccountVerifyParamsPaymentTypeSignet      ExternalAccountVerifyParamsPaymentType = "signet"
	ExternalAccountVerifyParamsPaymentTypeWire        ExternalAccountVerifyParamsPaymentType = "wire"
	ExternalAccountVerifyParamsPaymentTypeZengin      ExternalAccountVerifyParamsPaymentType = "zengin"
)

type IncomingPaymentDetail

type IncomingPaymentDetail struct {
	ID string `json:"id,required" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount int64 `json:"amount,required"`
	// The date on which the corresponding transaction will occur.
	AsOfDate  time.Time `json:"as_of_date,required" format:"date"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The currency of the incoming payment detail.
	Currency shared.Currency `json:"currency,required,nullable"`
	// The raw data from the payment pre-notification file that we get from the bank.
	Data map[string]interface{} `json:"data,required"`
	// One of `credit` or `debit`.
	Direction IncomingPaymentDetailDirection `json:"direction,required"`
	// The ID of the Internal Account for the incoming payment detail. This is always
	// present.
	InternalAccountID string `json:"internal_account_id,required" format:"uuid"`
	// The ID of the ledger transaction linked to the incoming payment detail or
	// `null`.
	LedgerTransactionID string `json:"ledger_transaction_id,required,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The last 4 digits of the originating account_number for the incoming payment
	// detail.
	OriginatingAccountNumberSafe string `json:"originating_account_number_safe,required,nullable"`
	// The type of the originating account number for the incoming payment detail.
	OriginatingAccountNumberType IncomingPaymentDetailOriginatingAccountNumberType `json:"originating_account_number_type,required,nullable"`
	// The routing number of the originating account for the incoming payment detail.
	OriginatingRoutingNumber string `json:"originating_routing_number,required,nullable"`
	// The type of the originating routing number for the incoming payment detail.
	OriginatingRoutingNumberType IncomingPaymentDetailOriginatingRoutingNumberType `json:"originating_routing_number_type,required,nullable"`
	// The current status of the incoming payment order. One of `pending`, `completed`,
	// or `returned`.
	Status IncomingPaymentDetailStatus `json:"status,required"`
	// The ID of the reconciled Transaction or `null`.
	TransactionID string `json:"transaction_id,required,nullable" format:"uuid"`
	// The ID of the reconciled Transaction Line Item or `null`.
	TransactionLineItemID string `json:"transaction_line_item_id,required,nullable" format:"uuid"`
	// One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or
	// `wire`.
	Type      IncomingPaymentDetailType `json:"type,required"`
	UpdatedAt time.Time                 `json:"updated_at,required" format:"date-time"`
	// The identifier of the vendor bank.
	VendorID string `json:"vendor_id,required,nullable" format:"uuid"`
	// If the incoming payment detail is in a virtual account, the serialized virtual
	// account object.
	VirtualAccount VirtualAccount `json:"virtual_account,required,nullable"`
	// If the incoming payment detail is in a virtual account, the ID of the Virtual
	// Account.
	VirtualAccountID string `json:"virtual_account_id,required,nullable" format:"uuid"`
	// The account number of the originating account for the incoming payment detail.
	OriginatingAccountNumber string `json:"originating_account_number,nullable"`
	JSON                     incomingPaymentDetailJSON
}

func (*IncomingPaymentDetail) UnmarshalJSON

func (r *IncomingPaymentDetail) UnmarshalJSON(data []byte) (err error)

type IncomingPaymentDetailDirection

type IncomingPaymentDetailDirection string

One of `credit` or `debit`.

const (
	IncomingPaymentDetailDirectionCredit IncomingPaymentDetailDirection = "credit"
	IncomingPaymentDetailDirectionDebit  IncomingPaymentDetailDirection = "debit"
)

type IncomingPaymentDetailListParams

type IncomingPaymentDetailListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Filters incoming payment details with an as_of_date starting on or before the
	// specified date (YYYY-MM-DD).
	AsOfDateEnd param.Field[time.Time] `query:"as_of_date_end" format:"date"`
	// Filters incoming payment details with an as_of_date starting on or after the
	// specified date (YYYY-MM-DD).
	AsOfDateStart param.Field[time.Time] `query:"as_of_date_start" format:"date"`
	// One of `credit` or `debit`.
	Direction param.Field[IncomingPaymentDetailListParamsDirection] `query:"direction"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	PerPage  param.Field[int64]             `query:"per_page"`
	// The current status of the incoming payment order. One of `pending`, `completed`,
	// or `returned`.
	Status param.Field[IncomingPaymentDetailListParamsStatus] `query:"status"`
	// One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or
	// `wire`.
	Type param.Field[IncomingPaymentDetailListParamsType] `query:"type"`
	// If the incoming payment detail is in a virtual account, the ID of the Virtual
	// Account.
	VirtualAccountID param.Field[string] `query:"virtual_account_id"`
}

func (IncomingPaymentDetailListParams) URLQuery

func (r IncomingPaymentDetailListParams) URLQuery() (v url.Values)

URLQuery serializes IncomingPaymentDetailListParams's query parameters as `url.Values`.

type IncomingPaymentDetailListParamsDirection

type IncomingPaymentDetailListParamsDirection string

One of `credit` or `debit`.

const (
	IncomingPaymentDetailListParamsDirectionCredit IncomingPaymentDetailListParamsDirection = "credit"
	IncomingPaymentDetailListParamsDirectionDebit  IncomingPaymentDetailListParamsDirection = "debit"
)

type IncomingPaymentDetailListParamsStatus

type IncomingPaymentDetailListParamsStatus string

The current status of the incoming payment order. One of `pending`, `completed`, or `returned`.

const (
	IncomingPaymentDetailListParamsStatusCompleted IncomingPaymentDetailListParamsStatus = "completed"
	IncomingPaymentDetailListParamsStatusPending   IncomingPaymentDetailListParamsStatus = "pending"
	IncomingPaymentDetailListParamsStatusReturned  IncomingPaymentDetailListParamsStatus = "returned"
)

type IncomingPaymentDetailListParamsType

type IncomingPaymentDetailListParamsType string

One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`.

const (
	IncomingPaymentDetailListParamsTypeACH     IncomingPaymentDetailListParamsType = "ach"
	IncomingPaymentDetailListParamsTypeBook    IncomingPaymentDetailListParamsType = "book"
	IncomingPaymentDetailListParamsTypeCheck   IncomingPaymentDetailListParamsType = "check"
	IncomingPaymentDetailListParamsTypeEft     IncomingPaymentDetailListParamsType = "eft"
	IncomingPaymentDetailListParamsTypeInterac IncomingPaymentDetailListParamsType = "interac"
	IncomingPaymentDetailListParamsTypeRtp     IncomingPaymentDetailListParamsType = "rtp"
	IncomingPaymentDetailListParamsTypeSepa    IncomingPaymentDetailListParamsType = "sepa"
	IncomingPaymentDetailListParamsTypeSignet  IncomingPaymentDetailListParamsType = "signet"
	IncomingPaymentDetailListParamsTypeWire    IncomingPaymentDetailListParamsType = "wire"
)

type IncomingPaymentDetailNewAsyncParams

type IncomingPaymentDetailNewAsyncParams struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount param.Field[int64] `json:"amount"`
	// Defaults to today.
	AsOfDate param.Field[time.Time] `json:"as_of_date" format:"date"`
	// Defaults to the currency of the originating account.
	Currency param.Field[shared.Currency] `json:"currency"`
	// Defaults to a random description.
	Description param.Field[string] `json:"description"`
	// One of `credit`, `debit`.
	Direction param.Field[IncomingPaymentDetailNewAsyncParamsDirection] `json:"direction"`
	// The ID of one of your internal accounts.
	InternalAccountID param.Field[string] `json:"internal_account_id" format:"uuid"`
	// One of `ach`, `wire`, `check`.
	Type param.Field[IncomingPaymentDetailNewAsyncParamsType] `json:"type"`
	// An optional parameter to associate the incoming payment detail to a virtual
	// account.
	VirtualAccountID param.Field[string] `json:"virtual_account_id" format:"uuid"`
}

func (IncomingPaymentDetailNewAsyncParams) MarshalJSON

func (r IncomingPaymentDetailNewAsyncParams) MarshalJSON() (data []byte, err error)

type IncomingPaymentDetailNewAsyncParamsDirection

type IncomingPaymentDetailNewAsyncParamsDirection string

One of `credit`, `debit`.

const (
	IncomingPaymentDetailNewAsyncParamsDirectionCredit IncomingPaymentDetailNewAsyncParamsDirection = "credit"
	IncomingPaymentDetailNewAsyncParamsDirectionDebit  IncomingPaymentDetailNewAsyncParamsDirection = "debit"
)

type IncomingPaymentDetailNewAsyncParamsType

type IncomingPaymentDetailNewAsyncParamsType string

One of `ach`, `wire`, `check`.

const (
	IncomingPaymentDetailNewAsyncParamsTypeACH     IncomingPaymentDetailNewAsyncParamsType = "ach"
	IncomingPaymentDetailNewAsyncParamsTypeBook    IncomingPaymentDetailNewAsyncParamsType = "book"
	IncomingPaymentDetailNewAsyncParamsTypeCheck   IncomingPaymentDetailNewAsyncParamsType = "check"
	IncomingPaymentDetailNewAsyncParamsTypeEft     IncomingPaymentDetailNewAsyncParamsType = "eft"
	IncomingPaymentDetailNewAsyncParamsTypeInterac IncomingPaymentDetailNewAsyncParamsType = "interac"
	IncomingPaymentDetailNewAsyncParamsTypeRtp     IncomingPaymentDetailNewAsyncParamsType = "rtp"
	IncomingPaymentDetailNewAsyncParamsTypeSepa    IncomingPaymentDetailNewAsyncParamsType = "sepa"
	IncomingPaymentDetailNewAsyncParamsTypeSignet  IncomingPaymentDetailNewAsyncParamsType = "signet"
	IncomingPaymentDetailNewAsyncParamsTypeWire    IncomingPaymentDetailNewAsyncParamsType = "wire"
)

type IncomingPaymentDetailOriginatingAccountNumberType

type IncomingPaymentDetailOriginatingAccountNumberType string

The type of the originating account number for the incoming payment detail.

const (
	IncomingPaymentDetailOriginatingAccountNumberTypeClabe         IncomingPaymentDetailOriginatingAccountNumberType = "clabe"
	IncomingPaymentDetailOriginatingAccountNumberTypeIban          IncomingPaymentDetailOriginatingAccountNumberType = "iban"
	IncomingPaymentDetailOriginatingAccountNumberTypeOther         IncomingPaymentDetailOriginatingAccountNumberType = "other"
	IncomingPaymentDetailOriginatingAccountNumberTypePan           IncomingPaymentDetailOriginatingAccountNumberType = "pan"
	IncomingPaymentDetailOriginatingAccountNumberTypeWalletAddress IncomingPaymentDetailOriginatingAccountNumberType = "wallet_address"
)

type IncomingPaymentDetailOriginatingRoutingNumberType

type IncomingPaymentDetailOriginatingRoutingNumberType string

The type of the originating routing number for the incoming payment detail.

const (
	IncomingPaymentDetailOriginatingRoutingNumberTypeAba                    IncomingPaymentDetailOriginatingRoutingNumberType = "aba"
	IncomingPaymentDetailOriginatingRoutingNumberTypeAuBsb                  IncomingPaymentDetailOriginatingRoutingNumberType = "au_bsb"
	IncomingPaymentDetailOriginatingRoutingNumberTypeBrCodigo               IncomingPaymentDetailOriginatingRoutingNumberType = "br_codigo"
	IncomingPaymentDetailOriginatingRoutingNumberTypeCaCpa                  IncomingPaymentDetailOriginatingRoutingNumberType = "ca_cpa"
	IncomingPaymentDetailOriginatingRoutingNumberTypeChips                  IncomingPaymentDetailOriginatingRoutingNumberType = "chips"
	IncomingPaymentDetailOriginatingRoutingNumberTypeCnaps                  IncomingPaymentDetailOriginatingRoutingNumberType = "cnaps"
	IncomingPaymentDetailOriginatingRoutingNumberTypeGBSortCode             IncomingPaymentDetailOriginatingRoutingNumberType = "gb_sort_code"
	IncomingPaymentDetailOriginatingRoutingNumberTypeInIfsc                 IncomingPaymentDetailOriginatingRoutingNumberType = "in_ifsc"
	IncomingPaymentDetailOriginatingRoutingNumberTypeJpZenginCode           IncomingPaymentDetailOriginatingRoutingNumberType = "jp_zengin_code"
	IncomingPaymentDetailOriginatingRoutingNumberTypeMyBranchCode           IncomingPaymentDetailOriginatingRoutingNumberType = "my_branch_code"
	IncomingPaymentDetailOriginatingRoutingNumberTypeSeBankgiroClearingCode IncomingPaymentDetailOriginatingRoutingNumberType = "se_bankgiro_clearing_code"
	IncomingPaymentDetailOriginatingRoutingNumberTypeSwift                  IncomingPaymentDetailOriginatingRoutingNumberType = "swift"
)

type IncomingPaymentDetailService

type IncomingPaymentDetailService struct {
	Options []option.RequestOption
}

IncomingPaymentDetailService 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 NewIncomingPaymentDetailService method instead.

func NewIncomingPaymentDetailService

func NewIncomingPaymentDetailService(opts ...option.RequestOption) (r *IncomingPaymentDetailService)

NewIncomingPaymentDetailService 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 (*IncomingPaymentDetailService) Get

Get an existing Incoming Payment Detail.

func (*IncomingPaymentDetailService) List

Get a list of Incoming Payment Details.

func (*IncomingPaymentDetailService) ListAutoPaging

Get a list of Incoming Payment Details.

func (*IncomingPaymentDetailService) NewAsync

Simulate Incoming Payment Detail

func (*IncomingPaymentDetailService) Update

Update an existing Incoming Payment Detail.

type IncomingPaymentDetailStatus

type IncomingPaymentDetailStatus string

The current status of the incoming payment order. One of `pending`, `completed`, or `returned`.

const (
	IncomingPaymentDetailStatusCompleted IncomingPaymentDetailStatus = "completed"
	IncomingPaymentDetailStatusPending   IncomingPaymentDetailStatus = "pending"
	IncomingPaymentDetailStatusReturned  IncomingPaymentDetailStatus = "returned"
)

type IncomingPaymentDetailType

type IncomingPaymentDetailType string

One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`.

const (
	IncomingPaymentDetailTypeACH     IncomingPaymentDetailType = "ach"
	IncomingPaymentDetailTypeBook    IncomingPaymentDetailType = "book"
	IncomingPaymentDetailTypeCheck   IncomingPaymentDetailType = "check"
	IncomingPaymentDetailTypeEft     IncomingPaymentDetailType = "eft"
	IncomingPaymentDetailTypeInterac IncomingPaymentDetailType = "interac"
	IncomingPaymentDetailTypeRtp     IncomingPaymentDetailType = "rtp"
	IncomingPaymentDetailTypeSepa    IncomingPaymentDetailType = "sepa"
	IncomingPaymentDetailTypeSignet  IncomingPaymentDetailType = "signet"
	IncomingPaymentDetailTypeWire    IncomingPaymentDetailType = "wire"
)

type IncomingPaymentDetailUpdateParams

type IncomingPaymentDetailUpdateParams struct {
	// Additional data in the form of key-value pairs. Pairs can be removed by passing
	// an empty string or `null` as the value.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (IncomingPaymentDetailUpdateParams) MarshalJSON

func (r IncomingPaymentDetailUpdateParams) MarshalJSON() (data []byte, err error)

type InternalAccount

type InternalAccount struct {
	ID string `json:"id,required" format:"uuid"`
	// An array of account detail objects.
	AccountDetails []AccountDetail `json:"account_details,required"`
	// Can be checking, savings or other.
	AccountType InternalAccountAccountType `json:"account_type,required,nullable"`
	// Specifies which financial institution the accounts belong to.
	Connection Connection `json:"connection,required"`
	// The Counterparty associated to this account.
	CounterpartyID string    `json:"counterparty_id,required,nullable" format:"uuid"`
	CreatedAt      time.Time `json:"created_at,required" format:"date-time"`
	// The currency of the account.
	Currency shared.Currency `json:"currency,required,nullable"`
	// If the internal account links to a ledger account in Modern Treasury, the id of
	// the ledger account will be populated here.
	LedgerAccountID string `json:"ledger_account_id,required,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// A nickname for the account.
	Name   string `json:"name,required,nullable"`
	Object string `json:"object,required"`
	// The parent InternalAccount of this account.
	ParentAccountID string `json:"parent_account_id,required,nullable" format:"uuid"`
	// The address associated with the owner or null.
	PartyAddress InternalAccountPartyAddress `json:"party_address,required,nullable"`
	// The legal name of the entity which owns the account.
	PartyName string `json:"party_name,required"`
	// Either individual or business.
	PartyType InternalAccountPartyType `json:"party_type,required,nullable"`
	// An array of routing detail objects.
	RoutingDetails []RoutingDetail `json:"routing_details,required"`
	UpdatedAt      time.Time       `json:"updated_at,required" format:"date-time"`
	JSON           internalAccountJSON
}

func (*InternalAccount) UnmarshalJSON

func (r *InternalAccount) UnmarshalJSON(data []byte) (err error)

type InternalAccountAccountType

type InternalAccountAccountType string

Can be checking, savings or other.

const (
	InternalAccountAccountTypeCash        InternalAccountAccountType = "cash"
	InternalAccountAccountTypeChecking    InternalAccountAccountType = "checking"
	InternalAccountAccountTypeLoan        InternalAccountAccountType = "loan"
	InternalAccountAccountTypeNonResident InternalAccountAccountType = "non_resident"
	InternalAccountAccountTypeOther       InternalAccountAccountType = "other"
	InternalAccountAccountTypeOverdraft   InternalAccountAccountType = "overdraft"
	InternalAccountAccountTypeSavings     InternalAccountAccountType = "savings"
)

type InternalAccountBalanceReportService

type InternalAccountBalanceReportService struct {
	Options []option.RequestOption
}

InternalAccountBalanceReportService 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 NewInternalAccountBalanceReportService method instead.

func NewInternalAccountBalanceReportService

func NewInternalAccountBalanceReportService(opts ...option.RequestOption) (r *InternalAccountBalanceReportService)

NewInternalAccountBalanceReportService 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 (*InternalAccountBalanceReportService) Get

func (r *InternalAccountBalanceReportService) Get(ctx context.Context, internalAccountID string, id string, opts ...option.RequestOption) (res *BalanceReport, err error)

Get a single balance report for a given internal account.

func (*InternalAccountBalanceReportService) List

Get all balance reports for a given internal account.

func (*InternalAccountBalanceReportService) ListAutoPaging

Get all balance reports for a given internal account.

type InternalAccountListParams

type InternalAccountListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// The counterparty associated with the internal account.
	CounterpartyID param.Field[string] `query:"counterparty_id"`
	// The currency associated with the internal account.
	Currency param.Field[shared.Currency] `query:"currency"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	// The direction of payments that can be made by internal account.
	PaymentDirection param.Field[InternalAccountListParamsPaymentDirection] `query:"payment_direction"`
	// The type of payment that can be made by the internal account.
	PaymentType param.Field[InternalAccountListParamsPaymentType] `query:"payment_type"`
	PerPage     param.Field[int64]                                `query:"per_page"`
}

func (InternalAccountListParams) URLQuery

func (r InternalAccountListParams) URLQuery() (v url.Values)

URLQuery serializes InternalAccountListParams's query parameters as `url.Values`.

type InternalAccountListParamsPaymentDirection

type InternalAccountListParamsPaymentDirection string

The direction of payments that can be made by internal account.

const (
	InternalAccountListParamsPaymentDirectionCredit InternalAccountListParamsPaymentDirection = "credit"
	InternalAccountListParamsPaymentDirectionDebit  InternalAccountListParamsPaymentDirection = "debit"
)

type InternalAccountListParamsPaymentType

type InternalAccountListParamsPaymentType string

The type of payment that can be made by the internal account.

const (
	InternalAccountListParamsPaymentTypeACH         InternalAccountListParamsPaymentType = "ach"
	InternalAccountListParamsPaymentTypeAuBecs      InternalAccountListParamsPaymentType = "au_becs"
	InternalAccountListParamsPaymentTypeBacs        InternalAccountListParamsPaymentType = "bacs"
	InternalAccountListParamsPaymentTypeBook        InternalAccountListParamsPaymentType = "book"
	InternalAccountListParamsPaymentTypeCard        InternalAccountListParamsPaymentType = "card"
	InternalAccountListParamsPaymentTypeCheck       InternalAccountListParamsPaymentType = "check"
	InternalAccountListParamsPaymentTypeCrossBorder InternalAccountListParamsPaymentType = "cross_border"
	InternalAccountListParamsPaymentTypeEft         InternalAccountListParamsPaymentType = "eft"
	InternalAccountListParamsPaymentTypeInterac     InternalAccountListParamsPaymentType = "interac"
	InternalAccountListParamsPaymentTypeMasav       InternalAccountListParamsPaymentType = "masav"
	InternalAccountListParamsPaymentTypeNeft        InternalAccountListParamsPaymentType = "neft"
	InternalAccountListParamsPaymentTypeNics        InternalAccountListParamsPaymentType = "nics"
	InternalAccountListParamsPaymentTypeProvxchange InternalAccountListParamsPaymentType = "provxchange"
	InternalAccountListParamsPaymentTypeRtp         InternalAccountListParamsPaymentType = "rtp"
	InternalAccountListParamsPaymentTypeSeBankgirot InternalAccountListParamsPaymentType = "se_bankgirot"
	InternalAccountListParamsPaymentTypeSen         InternalAccountListParamsPaymentType = "sen"
	InternalAccountListParamsPaymentTypeSepa        InternalAccountListParamsPaymentType = "sepa"
	InternalAccountListParamsPaymentTypeSic         InternalAccountListParamsPaymentType = "sic"
	InternalAccountListParamsPaymentTypeSignet      InternalAccountListParamsPaymentType = "signet"
	InternalAccountListParamsPaymentTypeWire        InternalAccountListParamsPaymentType = "wire"
	InternalAccountListParamsPaymentTypeZengin      InternalAccountListParamsPaymentType = "zengin"
)

type InternalAccountNewParams

type InternalAccountNewParams struct {
	// The identifier of the financial institution the account belongs to.
	ConnectionID param.Field[string] `json:"connection_id,required"`
	// Either "USD" or "CAD". Internal accounts created at Increase only supports
	// "USD".
	Currency param.Field[InternalAccountNewParamsCurrency] `json:"currency,required"`
	// The nickname of the account.
	Name param.Field[string] `json:"name,required"`
	// The legal name of the entity which owns the account.
	PartyName param.Field[string] `json:"party_name,required"`
	// The Counterparty associated to this account.
	CounterpartyID param.Field[string] `json:"counterparty_id"`
	// The parent internal account of this new account.
	ParentAccountID param.Field[string] `json:"parent_account_id"`
	// The address associated with the owner or null.
	PartyAddress param.Field[InternalAccountNewParamsPartyAddress] `json:"party_address"`
	// A hash of vendor specific attributes that will be used when creating the account
	// at the vendor specified by the given connection.
	VendorAttributes param.Field[map[string]string] `json:"vendor_attributes"`
}

func (InternalAccountNewParams) MarshalJSON

func (r InternalAccountNewParams) MarshalJSON() (data []byte, err error)

type InternalAccountNewParamsCurrency

type InternalAccountNewParamsCurrency string

Either "USD" or "CAD". Internal accounts created at Increase only supports "USD".

const (
	InternalAccountNewParamsCurrencyUsd InternalAccountNewParamsCurrency = "USD"
	InternalAccountNewParamsCurrencyCad InternalAccountNewParamsCurrency = "CAD"
)

type InternalAccountNewParamsPartyAddress

type InternalAccountNewParamsPartyAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country,required"`
	Line1   param.Field[string] `json:"line1,required"`
	// Locality or City.
	Locality param.Field[string] `json:"locality,required"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Region or State.
	Region param.Field[string] `json:"region,required"`
	Line2  param.Field[string] `json:"line2"`
}

The address associated with the owner or null.

func (InternalAccountNewParamsPartyAddress) MarshalJSON

func (r InternalAccountNewParamsPartyAddress) MarshalJSON() (data []byte, err error)

type InternalAccountPartyAddress

type InternalAccountPartyAddress struct {
	ID string `json:"id,required" format:"uuid"`
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country   string    `json:"country,required,nullable"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	Line1     string    `json:"line1,required,nullable"`
	Line2     string    `json:"line2,required,nullable"`
	// 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"`
	// Locality or City.
	Locality string `json:"locality,required,nullable"`
	Object   string `json:"object,required"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,required,nullable"`
	// Region or State.
	Region    string    `json:"region,required,nullable"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      internalAccountPartyAddressJSON
}

The address associated with the owner or null.

func (*InternalAccountPartyAddress) UnmarshalJSON

func (r *InternalAccountPartyAddress) UnmarshalJSON(data []byte) (err error)

type InternalAccountPartyType

type InternalAccountPartyType string

Either individual or business.

const (
	InternalAccountPartyTypeBusiness   InternalAccountPartyType = "business"
	InternalAccountPartyTypeIndividual InternalAccountPartyType = "individual"
)

type InternalAccountService

type InternalAccountService struct {
	Options        []option.RequestOption
	BalanceReports *InternalAccountBalanceReportService
}

InternalAccountService 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 NewInternalAccountService method instead.

func NewInternalAccountService

func NewInternalAccountService(opts ...option.RequestOption) (r *InternalAccountService)

NewInternalAccountService 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 (*InternalAccountService) Get

get internal account

func (*InternalAccountService) List

list internal accounts

func (*InternalAccountService) ListAutoPaging

list internal accounts

func (*InternalAccountService) New

create internal account

func (*InternalAccountService) Update

update internal account

type InternalAccountUpdateParams

type InternalAccountUpdateParams struct {
	// The Counterparty associated to this account.
	CounterpartyID param.Field[string] `json:"counterparty_id"`
	// Additional data in the form of key-value pairs. Pairs can be removed by passing
	// an empty string or `null` as the value.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// The nickname for the internal account.
	Name param.Field[string] `json:"name"`
	// The parent internal account for this account.
	ParentAccountID param.Field[string] `json:"parent_account_id"`
}

func (InternalAccountUpdateParams) MarshalJSON

func (r InternalAccountUpdateParams) MarshalJSON() (data []byte, err error)

type Invoice

type Invoice struct {
	ID string `json:"id,required" format:"uuid"`
	// The invoicer's contact details displayed at the top of the invoice.
	ContactDetails []InvoiceContactDetail `json:"contact_details,required"`
	// The counterparty's billing address.
	CounterpartyBillingAddress InvoiceCounterpartyBillingAddress `json:"counterparty_billing_address,required,nullable"`
	// The ID of the counterparty receiving the invoice.
	CounterpartyID string `json:"counterparty_id,required"`
	// The counterparty's shipping address where physical goods should be delivered.
	CounterpartyShippingAddress InvoiceCounterpartyShippingAddress `json:"counterparty_shipping_address,required,nullable"`
	CreatedAt                   time.Time                          `json:"created_at,required" format:"date-time"`
	// Currency that the invoice is denominated in. Defaults to `USD` if not provided.
	Currency shared.Currency `json:"currency,required,nullable"`
	// A free-form description of the invoice.
	Description string `json:"description,required"`
	// A future date by when the invoice needs to be paid.
	DueDate time.Time `json:"due_date,required" format:"date-time"`
	// The URL of the hosted web UI where the invoice can be viewed.
	HostedURL string `json:"hosted_url,required"`
	// The invoice issuer's business address.
	InvoicerAddress InvoiceInvoicerAddress `json:"invoicer_address,required,nullable"`
	// 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"`
	// Emails in addition to the counterparty email to send invoice status
	// notifications to. At least one email is required if notifications are enabled
	// and the counterparty doesn't have an email.
	NotificationEmailAddresses []string `json:"notification_email_addresses,required,nullable"`
	// If true, the invoice will send email notifications to the invoice recipients
	// about invoice status changes.
	NotificationsEnabled bool `json:"notifications_enabled,required"`
	// A unique record number assigned to each invoice that is issued.
	Number string `json:"number,required"`
	Object string `json:"object,required"`
	// The ID of the internal account the invoice should be paid to.
	OriginatingAccountID string `json:"originating_account_id,required"`
	// Date transactions are to be posted to the participants' account. Defaults to the
	// current business day or the next business day if the current day is a bank
	// holiday or weekend. Format: yyyy-mm-dd.
	PaymentEffectiveDate time.Time `json:"payment_effective_date,required,nullable" format:"date"`
	// When opening an invoice, whether to show the embedded payment UI , automatically
	// debit the recipient, or rely on manual payment from the recipient.
	PaymentMethod InvoicePaymentMethod `json:"payment_method,required,nullable"`
	// The payment orders created for paying the invoice through the invoice payment
	// UI.
	PaymentOrders []PaymentOrder `json:"payment_orders,required"`
	// One of `ach` or `eft`.
	PaymentType InvoicePaymentType `json:"payment_type,required,nullable"`
	// The URL where the invoice PDF can be downloaded.
	PdfURL string `json:"pdf_url,required,nullable"`
	// The receiving account ID. Can be an `internal_account`.
	ReceivingAccountID string `json:"receiving_account_id,required,nullable" format:"uuid"`
	// The email of the recipient of the invoice. Leaving this value as null will
	// fallback to using the counterparty's name.
	RecipientEmail string `json:"recipient_email,required,nullable"`
	// The name of the recipient of the invoice. Leaving this value as null will
	// fallback to using the counterparty's name.
	RecipientName string `json:"recipient_name,required,nullable"`
	// The status of the invoice.
	Status InvoiceStatus `json:"status,required"`
	// Total amount due in specified currency's smallest unit, e.g., $10 USD would be
	// represented as 1000.
	TotalAmount int64 `json:"total_amount,required"`
	// IDs of transaction line items associated with an invoice.
	TransactionLineItemIDs []string  `json:"transaction_line_item_ids,required" format:"uuid"`
	UpdatedAt              time.Time `json:"updated_at,required" format:"date-time"`
	// The ID of the virtual account the invoice should be paid to.
	VirtualAccountID string `json:"virtual_account_id,required,nullable"`
	JSON             invoiceJSON
}

func (*Invoice) UnmarshalJSON

func (r *Invoice) UnmarshalJSON(data []byte) (err error)

type InvoiceContactDetail

type InvoiceContactDetail struct {
	ID                    string                                     `json:"id,required" format:"uuid"`
	ContactIdentifier     string                                     `json:"contact_identifier,required"`
	ContactIdentifierType InvoiceContactDetailsContactIdentifierType `json:"contact_identifier_type,required"`
	CreatedAt             time.Time                                  `json:"created_at,required" format:"date-time"`
	DiscardedAt           time.Time                                  `json:"discarded_at,required,nullable" 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"`
	JSON      invoiceContactDetailJSON
}

func (*InvoiceContactDetail) UnmarshalJSON

func (r *InvoiceContactDetail) UnmarshalJSON(data []byte) (err error)

type InvoiceContactDetailsContactIdentifierType

type InvoiceContactDetailsContactIdentifierType string
const (
	InvoiceContactDetailsContactIdentifierTypeEmail       InvoiceContactDetailsContactIdentifierType = "email"
	InvoiceContactDetailsContactIdentifierTypePhoneNumber InvoiceContactDetailsContactIdentifierType = "phone_number"
	InvoiceContactDetailsContactIdentifierTypeWebsite     InvoiceContactDetailsContactIdentifierType = "website"
)

type InvoiceCounterpartyBillingAddress

type InvoiceCounterpartyBillingAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country string `json:"country,required"`
	Line1   string `json:"line1,required"`
	// Locality or City.
	Locality string `json:"locality,required"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,required"`
	// Region or State.
	Region string `json:"region,required"`
	Line2  string `json:"line2"`
	JSON   invoiceCounterpartyBillingAddressJSON
}

The counterparty's billing address.

func (*InvoiceCounterpartyBillingAddress) UnmarshalJSON

func (r *InvoiceCounterpartyBillingAddress) UnmarshalJSON(data []byte) (err error)

type InvoiceCounterpartyShippingAddress

type InvoiceCounterpartyShippingAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country string `json:"country,required"`
	Line1   string `json:"line1,required"`
	// Locality or City.
	Locality string `json:"locality,required"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,required"`
	// Region or State.
	Region string `json:"region,required"`
	Line2  string `json:"line2"`
	JSON   invoiceCounterpartyShippingAddressJSON
}

The counterparty's shipping address where physical goods should be delivered.

func (*InvoiceCounterpartyShippingAddress) UnmarshalJSON

func (r *InvoiceCounterpartyShippingAddress) UnmarshalJSON(data []byte) (err error)

type InvoiceInvoicerAddress

type InvoiceInvoicerAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country string `json:"country,required"`
	Line1   string `json:"line1,required"`
	// Locality or City.
	Locality string `json:"locality,required"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,required"`
	// Region or State.
	Region string `json:"region,required"`
	Line2  string `json:"line2"`
	JSON   invoiceInvoicerAddressJSON
}

The invoice issuer's business address.

func (*InvoiceInvoicerAddress) UnmarshalJSON

func (r *InvoiceInvoicerAddress) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItem

type InvoiceLineItem struct {
	ID string `json:"id,required" format:"uuid"`
	// The total amount for this line item specified in the invoice currency's smallest
	// unit.
	Amount    int64     `json:"amount,required"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// An optional free-form description of the line item.
	Description string `json:"description,required"`
	// Either `debit` or `credit`. `debit` indicates that a client owes the business
	// money and increases the invoice's `total_amount` due. `credit` has the opposite
	// intention and effect.
	Direction string `json:"direction,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"`
	// The name of the line item, typically a product or SKU name.
	Name   string `json:"name,required"`
	Object string `json:"object,required"`
	// The number of units of a product or service that this line item is for. Must be
	// a whole number. Defaults to 1 if not provided.
	Quantity int64 `json:"quantity,required"`
	// The cost per unit of the product or service that this line item is for,
	// specified in the invoice currency's smallest unit.
	UnitAmount int64     `json:"unit_amount,required"`
	UpdatedAt  time.Time `json:"updated_at,required" format:"date-time"`
	JSON       invoiceLineItemJSON
}

func (*InvoiceLineItem) UnmarshalJSON

func (r *InvoiceLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemListParams

type InvoiceLineItemListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	PerPage     param.Field[int64]  `query:"per_page"`
}

func (InvoiceLineItemListParams) URLQuery

func (r InvoiceLineItemListParams) URLQuery() (v url.Values)

URLQuery serializes InvoiceLineItemListParams's query parameters as `url.Values`.

type InvoiceLineItemNewParams

type InvoiceLineItemNewParams struct {
	// The name of the line item, typically a product or SKU name.
	Name param.Field[string] `json:"name,required"`
	// The cost per unit of the product or service that this line item is for,
	// specified in the invoice currency's smallest unit.
	UnitAmount param.Field[int64] `json:"unit_amount,required"`
	// An optional free-form description of the line item.
	Description param.Field[string] `json:"description"`
	// Either `debit` or `credit`. `debit` indicates that a client owes the business
	// money and increases the invoice's `total_amount` due. `credit` has the opposite
	// intention and effect.
	Direction param.Field[string] `json:"direction"`
	// The number of units of a product or service that this line item is for. Must be
	// a whole number. Defaults to 1 if not provided.
	Quantity param.Field[int64] `json:"quantity"`
}

func (InvoiceLineItemNewParams) MarshalJSON

func (r InvoiceLineItemNewParams) MarshalJSON() (data []byte, err error)

type InvoiceLineItemService

type InvoiceLineItemService struct {
	Options []option.RequestOption
}

InvoiceLineItemService 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 NewInvoiceLineItemService method instead.

func NewInvoiceLineItemService

func NewInvoiceLineItemService(opts ...option.RequestOption) (r *InvoiceLineItemService)

NewInvoiceLineItemService 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 (*InvoiceLineItemService) Delete

func (r *InvoiceLineItemService) Delete(ctx context.Context, invoiceID string, id string, opts ...option.RequestOption) (res *InvoiceLineItem, err error)

delete invoice_line_item

func (*InvoiceLineItemService) Get

func (r *InvoiceLineItemService) Get(ctx context.Context, invoiceID string, id string, opts ...option.RequestOption) (res *InvoiceLineItem, err error)

get invoice_line_item

func (*InvoiceLineItemService) List

list invoice_line_items

func (*InvoiceLineItemService) ListAutoPaging

list invoice_line_items

func (*InvoiceLineItemService) New

create invoice_line_item

func (*InvoiceLineItemService) Update

update invoice_line_item

type InvoiceLineItemUpdateParams

type InvoiceLineItemUpdateParams struct {
	// An optional free-form description of the line item.
	Description param.Field[string] `json:"description"`
	// Either `debit` or `credit`. `debit` indicates that a client owes the business
	// money and increases the invoice's `total_amount` due. `credit` has the opposite
	// intention and effect.
	Direction param.Field[string] `json:"direction"`
	// The name of the line item, typically a product or SKU name.
	Name param.Field[string] `json:"name"`
	// The number of units of a product or service that this line item is for. Must be
	// a whole number. Defaults to 1 if not provided.
	Quantity param.Field[int64] `json:"quantity"`
	// The cost per unit of the product or service that this line item is for,
	// specified in the invoice currency's smallest unit.
	UnitAmount param.Field[int64] `json:"unit_amount"`
}

func (InvoiceLineItemUpdateParams) MarshalJSON

func (r InvoiceLineItemUpdateParams) MarshalJSON() (data []byte, err error)

type InvoiceListParams

type InvoiceListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	PerPage     param.Field[int64]  `query:"per_page"`
}

func (InvoiceListParams) URLQuery

func (r InvoiceListParams) URLQuery() (v url.Values)

URLQuery serializes InvoiceListParams's query parameters as `url.Values`.

type InvoiceNewParams

type InvoiceNewParams struct {
	// The ID of the counterparty receiving the invoice.
	CounterpartyID param.Field[string] `json:"counterparty_id,required"`
	// A future date by when the invoice needs to be paid.
	DueDate param.Field[time.Time] `json:"due_date,required" format:"date-time"`
	// The ID of the internal account the invoice should be paid to.
	OriginatingAccountID param.Field[string] `json:"originating_account_id,required"`
	// The invoicer's contact details displayed at the top of the invoice.
	ContactDetails param.Field[[]InvoiceNewParamsContactDetail] `json:"contact_details"`
	// The counterparty's billing address.
	CounterpartyBillingAddress param.Field[InvoiceNewParamsCounterpartyBillingAddress] `json:"counterparty_billing_address"`
	// The counterparty's shipping address where physical goods should be delivered.
	CounterpartyShippingAddress param.Field[InvoiceNewParamsCounterpartyShippingAddress] `json:"counterparty_shipping_address"`
	// Currency that the invoice is denominated in. Defaults to `USD` if not provided.
	Currency param.Field[shared.Currency] `json:"currency"`
	// A free-form description of the invoice.
	Description param.Field[string] `json:"description"`
	// The invoice issuer's business address.
	InvoicerAddress param.Field[InvoiceNewParamsInvoicerAddress] `json:"invoicer_address"`
	// Emails in addition to the counterparty email to send invoice status
	// notifications to. At least one email is required if notifications are enabled
	// and the counterparty doesn't have an email.
	NotificationEmailAddresses param.Field[[]string] `json:"notification_email_addresses"`
	// If true, the invoice will send email notifications to the invoice recipients
	// about invoice status changes.
	NotificationsEnabled param.Field[bool] `json:"notifications_enabled"`
	// 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.
	PaymentEffectiveDate param.Field[time.Time] `json:"payment_effective_date" format:"date"`
	// The method by which the invoice can be paid. `ui` will show the embedded payment
	// collection flow. `automatic` will automatically initiate payment based upon the
	// account details of the receiving_account id.\nIf the invoice amount is positive,
	// the automatically initiated payment order's direction will be debit. If the
	// invoice amount is negative, the automatically initiated payment order's
	// direction will be credit. One of `manual`, `ui`, or `automatic`.
	PaymentMethod param.Field[InvoiceNewParamsPaymentMethod] `json:"payment_method"`
	// One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`,
	// `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`,
	// `zengin`.
	PaymentType param.Field[InvoiceNewParamsPaymentType] `json:"payment_type"`
	// The receiving account ID. Can be an `external_account`.
	ReceivingAccountID param.Field[string] `json:"receiving_account_id" format:"uuid"`
	// The email of the recipient of the invoice. Leaving this value as null will
	// fallback to using the counterparty's name.
	RecipientEmail param.Field[string] `json:"recipient_email"`
	// The name of the recipient of the invoice. Leaving this value as null will
	// fallback to using the counterparty's name.
	RecipientName param.Field[string] `json:"recipient_name"`
	// The ID of the virtual account the invoice should be paid to.
	VirtualAccountID param.Field[string] `json:"virtual_account_id"`
}

func (InvoiceNewParams) MarshalJSON

func (r InvoiceNewParams) MarshalJSON() (data []byte, err error)

type InvoiceNewParamsContactDetail

type InvoiceNewParamsContactDetail struct {
	ID                    param.Field[string]                                              `json:"id,required" format:"uuid"`
	ContactIdentifier     param.Field[string]                                              `json:"contact_identifier,required"`
	ContactIdentifierType param.Field[InvoiceNewParamsContactDetailsContactIdentifierType] `json:"contact_identifier_type,required"`
	CreatedAt             param.Field[time.Time]                                           `json:"created_at,required" format:"date-time"`
	DiscardedAt           param.Field[time.Time]                                           `json:"discarded_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  param.Field[bool]      `json:"live_mode,required"`
	Object    param.Field[string]    `json:"object,required"`
	UpdatedAt param.Field[time.Time] `json:"updated_at,required" format:"date-time"`
}

func (InvoiceNewParamsContactDetail) MarshalJSON

func (r InvoiceNewParamsContactDetail) MarshalJSON() (data []byte, err error)

type InvoiceNewParamsContactDetailsContactIdentifierType

type InvoiceNewParamsContactDetailsContactIdentifierType string
const (
	InvoiceNewParamsContactDetailsContactIdentifierTypeEmail       InvoiceNewParamsContactDetailsContactIdentifierType = "email"
	InvoiceNewParamsContactDetailsContactIdentifierTypePhoneNumber InvoiceNewParamsContactDetailsContactIdentifierType = "phone_number"
	InvoiceNewParamsContactDetailsContactIdentifierTypeWebsite     InvoiceNewParamsContactDetailsContactIdentifierType = "website"
)

type InvoiceNewParamsCounterpartyBillingAddress

type InvoiceNewParamsCounterpartyBillingAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country,required"`
	Line1   param.Field[string] `json:"line1,required"`
	// Locality or City.
	Locality param.Field[string] `json:"locality,required"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Region or State.
	Region param.Field[string] `json:"region,required"`
	Line2  param.Field[string] `json:"line2"`
}

The counterparty's billing address.

func (InvoiceNewParamsCounterpartyBillingAddress) MarshalJSON

func (r InvoiceNewParamsCounterpartyBillingAddress) MarshalJSON() (data []byte, err error)

type InvoiceNewParamsCounterpartyShippingAddress

type InvoiceNewParamsCounterpartyShippingAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country,required"`
	Line1   param.Field[string] `json:"line1,required"`
	// Locality or City.
	Locality param.Field[string] `json:"locality,required"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Region or State.
	Region param.Field[string] `json:"region,required"`
	Line2  param.Field[string] `json:"line2"`
}

The counterparty's shipping address where physical goods should be delivered.

func (InvoiceNewParamsCounterpartyShippingAddress) MarshalJSON

func (r InvoiceNewParamsCounterpartyShippingAddress) MarshalJSON() (data []byte, err error)

type InvoiceNewParamsInvoicerAddress

type InvoiceNewParamsInvoicerAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country,required"`
	Line1   param.Field[string] `json:"line1,required"`
	// Locality or City.
	Locality param.Field[string] `json:"locality,required"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Region or State.
	Region param.Field[string] `json:"region,required"`
	Line2  param.Field[string] `json:"line2"`
}

The invoice issuer's business address.

func (InvoiceNewParamsInvoicerAddress) MarshalJSON

func (r InvoiceNewParamsInvoicerAddress) MarshalJSON() (data []byte, err error)

type InvoiceNewParamsPaymentMethod added in v1.1.0

type InvoiceNewParamsPaymentMethod string

The method by which the invoice can be paid. `ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.\nIf the invoice amount is positive, the automatically initiated payment order's direction will be debit. If the invoice amount is negative, the automatically initiated payment order's direction will be credit. One of `manual`, `ui`, or `automatic`.

const (
	InvoiceNewParamsPaymentMethodUi        InvoiceNewParamsPaymentMethod = "ui"
	InvoiceNewParamsPaymentMethodManual    InvoiceNewParamsPaymentMethod = "manual"
	InvoiceNewParamsPaymentMethodAutomatic InvoiceNewParamsPaymentMethod = "automatic"
)

type InvoiceNewParamsPaymentType added in v1.1.0

type InvoiceNewParamsPaymentType string

One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`, `zengin`.

const (
	InvoiceNewParamsPaymentTypeACH         InvoiceNewParamsPaymentType = "ach"
	InvoiceNewParamsPaymentTypeAuBecs      InvoiceNewParamsPaymentType = "au_becs"
	InvoiceNewParamsPaymentTypeSeBankgirot InvoiceNewParamsPaymentType = "se_bankgirot"
	InvoiceNewParamsPaymentTypeBacs        InvoiceNewParamsPaymentType = "bacs"
	InvoiceNewParamsPaymentTypeBook        InvoiceNewParamsPaymentType = "book"
	InvoiceNewParamsPaymentTypeCard        InvoiceNewParamsPaymentType = "card"
	InvoiceNewParamsPaymentTypeCheck       InvoiceNewParamsPaymentType = "check"
	InvoiceNewParamsPaymentTypeEft         InvoiceNewParamsPaymentType = "eft"
	InvoiceNewParamsPaymentTypeCrossBorder InvoiceNewParamsPaymentType = "cross_border"
	InvoiceNewParamsPaymentTypeInterac     InvoiceNewParamsPaymentType = "interac"
	InvoiceNewParamsPaymentTypeMasav       InvoiceNewParamsPaymentType = "masav"
	InvoiceNewParamsPaymentTypeNeft        InvoiceNewParamsPaymentType = "neft"
	InvoiceNewParamsPaymentTypeNics        InvoiceNewParamsPaymentType = "nics"
	InvoiceNewParamsPaymentTypeProvxchange InvoiceNewParamsPaymentType = "provxchange"
	InvoiceNewParamsPaymentTypeRtp         InvoiceNewParamsPaymentType = "rtp"
	InvoiceNewParamsPaymentTypeSen         InvoiceNewParamsPaymentType = "sen"
	InvoiceNewParamsPaymentTypeSic         InvoiceNewParamsPaymentType = "sic"
	InvoiceNewParamsPaymentTypeSepa        InvoiceNewParamsPaymentType = "sepa"
	InvoiceNewParamsPaymentTypeSignet      InvoiceNewParamsPaymentType = "signet"
	InvoiceNewParamsPaymentTypeWire        InvoiceNewParamsPaymentType = "wire"
	InvoiceNewParamsPaymentTypeZengin      InvoiceNewParamsPaymentType = "zengin"
)

type InvoicePaymentMethod added in v1.1.0

type InvoicePaymentMethod string

When opening an invoice, whether to show the embedded payment UI , automatically debit the recipient, or rely on manual payment from the recipient.

const (
	InvoicePaymentMethodUi        InvoicePaymentMethod = "ui"
	InvoicePaymentMethodManual    InvoicePaymentMethod = "manual"
	InvoicePaymentMethodAutomatic InvoicePaymentMethod = "automatic"
)

type InvoicePaymentType added in v1.1.0

type InvoicePaymentType string

One of `ach` or `eft`.

const (
	InvoicePaymentTypeEft InvoicePaymentType = "eft"
	InvoicePaymentTypeACH InvoicePaymentType = "ach"
)

type InvoiceService

type InvoiceService struct {
	Options   []option.RequestOption
	LineItems *InvoiceLineItemService
}

InvoiceService 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 NewInvoiceService method instead.

func NewInvoiceService

func NewInvoiceService(opts ...option.RequestOption) (r *InvoiceService)

NewInvoiceService 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 (*InvoiceService) AddPaymentOrder added in v1.5.0

func (r *InvoiceService) AddPaymentOrder(ctx context.Context, id string, paymentOrderID string, opts ...option.RequestOption) (err error)

Add a payment order to an invoice.

func (*InvoiceService) Get

func (r *InvoiceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Invoice, err error)

get invoice

func (*InvoiceService) List

func (r *InvoiceService) List(ctx context.Context, query InvoiceListParams, opts ...option.RequestOption) (res *shared.Page[Invoice], err error)

list invoices

func (*InvoiceService) ListAutoPaging

list invoices

func (*InvoiceService) New

func (r *InvoiceService) New(ctx context.Context, body InvoiceNewParams, opts ...option.RequestOption) (res *Invoice, err error)

create invoice

func (*InvoiceService) Update

func (r *InvoiceService) Update(ctx context.Context, id string, body InvoiceUpdateParams, opts ...option.RequestOption) (res *Invoice, err error)

update invoice

type InvoiceStatus

type InvoiceStatus string

The status of the invoice.

const (
	InvoiceStatusDraft          InvoiceStatus = "draft"
	InvoiceStatusPaid           InvoiceStatus = "paid"
	InvoiceStatusPaymentPending InvoiceStatus = "payment_pending"
	InvoiceStatusUnpaid         InvoiceStatus = "unpaid"
	InvoiceStatusVoided         InvoiceStatus = "voided"
)

type InvoiceUpdateParams

type InvoiceUpdateParams struct {
	// The invoicer's contact details displayed at the top of the invoice.
	ContactDetails param.Field[[]InvoiceUpdateParamsContactDetail] `json:"contact_details"`
	// The counterparty's billing address.
	CounterpartyBillingAddress param.Field[InvoiceUpdateParamsCounterpartyBillingAddress] `json:"counterparty_billing_address"`
	// The ID of the counterparty receiving the invoice.
	CounterpartyID param.Field[string] `json:"counterparty_id"`
	// The counterparty's shipping address where physical goods should be delivered.
	CounterpartyShippingAddress param.Field[InvoiceUpdateParamsCounterpartyShippingAddress] `json:"counterparty_shipping_address"`
	// Currency that the invoice is denominated in. Defaults to `USD` if not provided.
	Currency param.Field[shared.Currency] `json:"currency"`
	// A free-form description of the invoice.
	Description param.Field[string] `json:"description"`
	// A future date by when the invoice needs to be paid.
	DueDate param.Field[time.Time] `json:"due_date" format:"date-time"`
	// The invoice issuer's business address.
	InvoicerAddress param.Field[InvoiceUpdateParamsInvoicerAddress] `json:"invoicer_address"`
	// Emails in addition to the counterparty email to send invoice status
	// notifications to. At least one email is required if notifications are enabled
	// and the counterparty doesn't have an email.
	NotificationEmailAddresses param.Field[[]string] `json:"notification_email_addresses"`
	// If true, the invoice will send email notifications to the invoice recipients
	// about invoice status changes.
	NotificationsEnabled param.Field[bool] `json:"notifications_enabled"`
	// The ID of the internal account the invoice should be paid to.
	OriginatingAccountID param.Field[string] `json:"originating_account_id"`
	// 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.
	PaymentEffectiveDate param.Field[time.Time] `json:"payment_effective_date" format:"date"`
	// The method by which the invoice can be paid. `ui` will show the embedded payment
	// collection flow. `automatic` will automatically initiate payment based upon the
	// account details of the receiving_account id.\nIf the invoice amount is positive,
	// the automatically initiated payment order's direction will be debit. If the
	// invoice amount is negative, the automatically initiated payment order's
	// direction will be credit. One of `manual`, `ui`, or `automatic`.
	PaymentMethod param.Field[InvoiceUpdateParamsPaymentMethod] `json:"payment_method"`
	// One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`,
	// `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`,
	// `zengin`.
	PaymentType param.Field[InvoiceUpdateParamsPaymentType] `json:"payment_type"`
	// The receiving account ID. Can be an `external_account`.
	ReceivingAccountID param.Field[string] `json:"receiving_account_id" format:"uuid"`
	// The email of the recipient of the invoice. Leaving this value as null will
	// fallback to using the counterparty's name.
	RecipientEmail param.Field[string] `json:"recipient_email"`
	// The name of the recipient of the invoice. Leaving this value as null will
	// fallback to using the counterparty's name.
	RecipientName param.Field[string] `json:"recipient_name"`
	// Invoice status must be updated in a `PATCH` request that does not modify any
	// other invoice attributes. Valid state transitions are `draft` to `unpaid`,
	// `draft` or `unpaid` to `voided`, and `draft` or `unpaid` to `paid`.
	Status param.Field[string] `json:"status"`
	// The ID of the virtual account the invoice should be paid to.
	VirtualAccountID param.Field[string] `json:"virtual_account_id"`
}

func (InvoiceUpdateParams) MarshalJSON

func (r InvoiceUpdateParams) MarshalJSON() (data []byte, err error)

type InvoiceUpdateParamsContactDetail

type InvoiceUpdateParamsContactDetail struct {
	ID                    param.Field[string]                                                 `json:"id,required" format:"uuid"`
	ContactIdentifier     param.Field[string]                                                 `json:"contact_identifier,required"`
	ContactIdentifierType param.Field[InvoiceUpdateParamsContactDetailsContactIdentifierType] `json:"contact_identifier_type,required"`
	CreatedAt             param.Field[time.Time]                                              `json:"created_at,required" format:"date-time"`
	DiscardedAt           param.Field[time.Time]                                              `json:"discarded_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  param.Field[bool]      `json:"live_mode,required"`
	Object    param.Field[string]    `json:"object,required"`
	UpdatedAt param.Field[time.Time] `json:"updated_at,required" format:"date-time"`
}

func (InvoiceUpdateParamsContactDetail) MarshalJSON

func (r InvoiceUpdateParamsContactDetail) MarshalJSON() (data []byte, err error)

type InvoiceUpdateParamsContactDetailsContactIdentifierType

type InvoiceUpdateParamsContactDetailsContactIdentifierType string
const (
	InvoiceUpdateParamsContactDetailsContactIdentifierTypeEmail       InvoiceUpdateParamsContactDetailsContactIdentifierType = "email"
	InvoiceUpdateParamsContactDetailsContactIdentifierTypePhoneNumber InvoiceUpdateParamsContactDetailsContactIdentifierType = "phone_number"
	InvoiceUpdateParamsContactDetailsContactIdentifierTypeWebsite     InvoiceUpdateParamsContactDetailsContactIdentifierType = "website"
)

type InvoiceUpdateParamsCounterpartyBillingAddress

type InvoiceUpdateParamsCounterpartyBillingAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country,required"`
	Line1   param.Field[string] `json:"line1,required"`
	// Locality or City.
	Locality param.Field[string] `json:"locality,required"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Region or State.
	Region param.Field[string] `json:"region,required"`
	Line2  param.Field[string] `json:"line2"`
}

The counterparty's billing address.

func (InvoiceUpdateParamsCounterpartyBillingAddress) MarshalJSON

func (r InvoiceUpdateParamsCounterpartyBillingAddress) MarshalJSON() (data []byte, err error)

type InvoiceUpdateParamsCounterpartyShippingAddress

type InvoiceUpdateParamsCounterpartyShippingAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country,required"`
	Line1   param.Field[string] `json:"line1,required"`
	// Locality or City.
	Locality param.Field[string] `json:"locality,required"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Region or State.
	Region param.Field[string] `json:"region,required"`
	Line2  param.Field[string] `json:"line2"`
}

The counterparty's shipping address where physical goods should be delivered.

func (InvoiceUpdateParamsCounterpartyShippingAddress) MarshalJSON

func (r InvoiceUpdateParamsCounterpartyShippingAddress) MarshalJSON() (data []byte, err error)

type InvoiceUpdateParamsInvoicerAddress

type InvoiceUpdateParamsInvoicerAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country,required"`
	Line1   param.Field[string] `json:"line1,required"`
	// Locality or City.
	Locality param.Field[string] `json:"locality,required"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code,required"`
	// Region or State.
	Region param.Field[string] `json:"region,required"`
	Line2  param.Field[string] `json:"line2"`
}

The invoice issuer's business address.

func (InvoiceUpdateParamsInvoicerAddress) MarshalJSON

func (r InvoiceUpdateParamsInvoicerAddress) MarshalJSON() (data []byte, err error)

type InvoiceUpdateParamsPaymentMethod added in v1.1.0

type InvoiceUpdateParamsPaymentMethod string

The method by which the invoice can be paid. `ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.\nIf the invoice amount is positive, the automatically initiated payment order's direction will be debit. If the invoice amount is negative, the automatically initiated payment order's direction will be credit. One of `manual`, `ui`, or `automatic`.

const (
	InvoiceUpdateParamsPaymentMethodUi        InvoiceUpdateParamsPaymentMethod = "ui"
	InvoiceUpdateParamsPaymentMethodManual    InvoiceUpdateParamsPaymentMethod = "manual"
	InvoiceUpdateParamsPaymentMethodAutomatic InvoiceUpdateParamsPaymentMethod = "automatic"
)

type InvoiceUpdateParamsPaymentType added in v1.1.0

type InvoiceUpdateParamsPaymentType string

One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`, `zengin`.

const (
	InvoiceUpdateParamsPaymentTypeACH         InvoiceUpdateParamsPaymentType = "ach"
	InvoiceUpdateParamsPaymentTypeAuBecs      InvoiceUpdateParamsPaymentType = "au_becs"
	InvoiceUpdateParamsPaymentTypeSeBankgirot InvoiceUpdateParamsPaymentType = "se_bankgirot"
	InvoiceUpdateParamsPaymentTypeBacs        InvoiceUpdateParamsPaymentType = "bacs"
	InvoiceUpdateParamsPaymentTypeBook        InvoiceUpdateParamsPaymentType = "book"
	InvoiceUpdateParamsPaymentTypeCard        InvoiceUpdateParamsPaymentType = "card"
	InvoiceUpdateParamsPaymentTypeCheck       InvoiceUpdateParamsPaymentType = "check"
	InvoiceUpdateParamsPaymentTypeEft         InvoiceUpdateParamsPaymentType = "eft"
	InvoiceUpdateParamsPaymentTypeCrossBorder InvoiceUpdateParamsPaymentType = "cross_border"
	InvoiceUpdateParamsPaymentTypeInterac     InvoiceUpdateParamsPaymentType = "interac"
	InvoiceUpdateParamsPaymentTypeMasav       InvoiceUpdateParamsPaymentType = "masav"
	InvoiceUpdateParamsPaymentTypeNeft        InvoiceUpdateParamsPaymentType = "neft"
	InvoiceUpdateParamsPaymentTypeNics        InvoiceUpdateParamsPaymentType = "nics"
	InvoiceUpdateParamsPaymentTypeProvxchange InvoiceUpdateParamsPaymentType = "provxchange"
	InvoiceUpdateParamsPaymentTypeRtp         InvoiceUpdateParamsPaymentType = "rtp"
	InvoiceUpdateParamsPaymentTypeSen         InvoiceUpdateParamsPaymentType = "sen"
	InvoiceUpdateParamsPaymentTypeSic         InvoiceUpdateParamsPaymentType = "sic"
	InvoiceUpdateParamsPaymentTypeSepa        InvoiceUpdateParamsPaymentType = "sepa"
	InvoiceUpdateParamsPaymentTypeSignet      InvoiceUpdateParamsPaymentType = "signet"
	InvoiceUpdateParamsPaymentTypeWire        InvoiceUpdateParamsPaymentType = "wire"
	InvoiceUpdateParamsPaymentTypeZengin      InvoiceUpdateParamsPaymentType = "zengin"
)

type Ledger

type Ledger struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// An optional free-form description for internal use.
	Description string    `json:"description,required,nullable"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" 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"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// The name of the ledger.
	Name        string                 `json:"name,required"`
	Object      string                 `json:"object,required"`
	UpdatedAt   time.Time              `json:"updated_at,required" format:"date-time"`
	ExtraFields map[string]interface{} `json:"-,extras"`
	JSON        ledgerJSON
}

func (*Ledger) UnmarshalJSON

func (r *Ledger) UnmarshalJSON(data []byte) (err error)

type LedgerAccount

type LedgerAccount struct {
	ID string `json:"id,required" format:"uuid"`
	// The pending, posted, and available balances for this ledger account. The posted
	// balance is the sum of all posted entries on the account. The pending balance is
	// the sum of all pending and posted entries on the account. The available balance
	// is the posted incoming entries minus the sum of the pending and posted outgoing
	// amounts.
	Balances  LedgerAccountBalances `json:"balances,required"`
	CreatedAt time.Time             `json:"created_at,required" format:"date-time"`
	// The description of the ledger account.
	Description string    `json:"description,required,nullable"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
	// The id of the ledger that this account belongs to.
	LedgerID string `json:"ledger_id,required" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the id will be
	// populated here, otherwise null.
	LedgerableID string `json:"ledgerable_id,required,nullable" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the type will
	// be populated here, otherwise null. The value is one of internal_account or
	// external_account.
	LedgerableType LedgerAccountLedgerableType `json:"ledgerable_type,required,nullable"`
	// 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"`
	// Lock version of the ledger account.
	LockVersion int64 `json:"lock_version,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// The name of the ledger account.
	Name string `json:"name,required"`
	// The normal balance of the ledger account.
	NormalBalance LedgerAccountNormalBalance `json:"normal_balance,required"`
	Object        string                     `json:"object,required"`
	UpdatedAt     time.Time                  `json:"updated_at,required" format:"date-time"`
	JSON          ledgerAccountJSON
}

func (*LedgerAccount) UnmarshalJSON

func (r *LedgerAccount) UnmarshalJSON(data []byte) (err error)

type LedgerAccountBalanceMonitor added in v1.5.0

type LedgerAccountBalanceMonitor struct {
	ID string `json:"id,required" format:"uuid"`
	// Describes the condition that must be satisfied for the monitor to be triggered.
	AlertCondition LedgerAccountBalanceMonitorAlertCondition `json:"alert_condition,required"`
	CreatedAt      time.Time                                 `json:"created_at,required" format:"date-time"`
	// The ledger account's balances and the monitor state as of the current ledger
	// account lock version.
	CurrentLedgerAccountBalanceState LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceState `json:"current_ledger_account_balance_state,required"`
	// An optional, free-form description for internal use.
	Description string    `json:"description,required,nullable"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
	// The ledger account associated with this balance monitor.
	LedgerAccountID string `json:"ledger_account_id,required"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata  map[string]string `json:"metadata,required"`
	Object    string            `json:"object,required"`
	UpdatedAt time.Time         `json:"updated_at,required" format:"date-time"`
	JSON      ledgerAccountBalanceMonitorJSON
}

func (*LedgerAccountBalanceMonitor) UnmarshalJSON added in v1.5.0

func (r *LedgerAccountBalanceMonitor) UnmarshalJSON(data []byte) (err error)

type LedgerAccountBalanceMonitorAlertCondition added in v1.5.0

type LedgerAccountBalanceMonitorAlertCondition struct {
	// One of `available_balance_amount`, `pending_balance_amount`,
	// `posted_balance_amount`, `ledger_account_lock_version`.
	Field string `json:"field,required"`
	// A logical operator to compare the `field` against the `value`. One of
	// `less_than`, `less_than_or_equals`, `equals`, `greater_than_or_equals`,
	// `greater_than`.
	Operator string `json:"operator,required"`
	// The monitor's `current_ledger_account_balance_state.triggered` will be `true`
	// when comparing the `field` to this integer value using the `operator` is
	// logically true.
	Value int64 `json:"value,required"`
	JSON  ledgerAccountBalanceMonitorAlertConditionJSON
}

Describes the condition that must be satisfied for the monitor to be triggered.

func (*LedgerAccountBalanceMonitorAlertCondition) UnmarshalJSON added in v1.5.0

func (r *LedgerAccountBalanceMonitorAlertCondition) UnmarshalJSON(data []byte) (err error)

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceState added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceState struct {
	Balances LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalances `json:"balances,required"`
	// The current lock version of the ledger account.
	LedgerAccountLockVersion int64 `json:"ledger_account_lock_version,required"`
	// If `true`, the ledger account's balances satisfy the `alert_condition` at this
	// lock version.
	Triggered bool `json:"triggered,required"`
	JSON      ledgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateJSON
}

The ledger account's balances and the monitor state as of the current ledger account lock version.

func (*LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceState) UnmarshalJSON added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalances added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalances struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPostedBalance `json:"posted_balance,required"`
	JSON          ledgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesJSON
}

func (*LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalances) UnmarshalJSON added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesAvailableBalance added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesAvailableBalance) UnmarshalJSON added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPendingBalance added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPendingBalance) UnmarshalJSON added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPostedBalance added in v1.5.0

type LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerAccountBalanceMonitorCurrentLedgerAccountBalanceStateBalancesPostedBalance) UnmarshalJSON added in v1.5.0

type LedgerAccountBalanceMonitorListParams added in v1.5.0

type LedgerAccountBalanceMonitorListParams struct {
	// If you have specific IDs to retrieve in bulk, you can pass them as query
	// parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
	ID          param.Field[[]string] `query:"id"`
	AfterCursor param.Field[string]   `query:"after_cursor"`
	// Query the balance monitors for a single ledger account.
	LedgerAccountID param.Field[string] `query:"ledger_account_id"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	PerPage  param.Field[int64]             `query:"per_page"`
}

func (LedgerAccountBalanceMonitorListParams) URLQuery added in v1.5.0

URLQuery serializes LedgerAccountBalanceMonitorListParams's query parameters as `url.Values`.

type LedgerAccountBalanceMonitorNewParams added in v1.5.0

type LedgerAccountBalanceMonitorNewParams struct {
	// Describes the condition that must be satisfied for the monitor to be triggered.
	AlertCondition param.Field[LedgerAccountBalanceMonitorNewParamsAlertCondition] `json:"alert_condition,required"`
	// The ledger account associated with this balance monitor.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required"`
	// An optional, free-form description for internal use.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerAccountBalanceMonitorNewParams) MarshalJSON added in v1.5.0

func (r LedgerAccountBalanceMonitorNewParams) MarshalJSON() (data []byte, err error)

type LedgerAccountBalanceMonitorNewParamsAlertCondition added in v1.5.0

type LedgerAccountBalanceMonitorNewParamsAlertCondition struct {
	// One of `available_balance_amount`, `pending_balance_amount`,
	// `posted_balance_amount`, `ledger_account_lock_version`.
	Field param.Field[string] `json:"field,required"`
	// A logical operator to compare the `field` against the `value`. One of
	// `less_than`, `less_than_or_equals`, `equals`, `greater_than_or_equals`,
	// `greater_than`.
	Operator param.Field[string] `json:"operator,required"`
	// The monitor's `current_ledger_account_balance_state.triggered` will be `true`
	// when comparing the `field` to this integer value using the `operator` is
	// logically true.
	Value param.Field[int64] `json:"value,required"`
}

Describes the condition that must be satisfied for the monitor to be triggered.

func (LedgerAccountBalanceMonitorNewParamsAlertCondition) MarshalJSON added in v1.5.0

func (r LedgerAccountBalanceMonitorNewParamsAlertCondition) MarshalJSON() (data []byte, err error)

type LedgerAccountBalanceMonitorService added in v1.5.0

type LedgerAccountBalanceMonitorService struct {
	Options []option.RequestOption
}

LedgerAccountBalanceMonitorService 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 NewLedgerAccountBalanceMonitorService method instead.

func NewLedgerAccountBalanceMonitorService added in v1.5.0

func NewLedgerAccountBalanceMonitorService(opts ...option.RequestOption) (r *LedgerAccountBalanceMonitorService)

NewLedgerAccountBalanceMonitorService 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 (*LedgerAccountBalanceMonitorService) Delete added in v1.5.0

Delete a ledger account balance monitor.

func (*LedgerAccountBalanceMonitorService) Get added in v1.5.0

Get details on a single ledger account balance monitor.

func (*LedgerAccountBalanceMonitorService) List added in v1.5.0

Get a list of ledger account balance monitors.

func (*LedgerAccountBalanceMonitorService) ListAutoPaging added in v1.5.0

Get a list of ledger account balance monitors.

func (*LedgerAccountBalanceMonitorService) New added in v1.5.0

Create a ledger account balance monitor.

func (*LedgerAccountBalanceMonitorService) Update added in v1.5.0

Update a ledger account balance monitor.

type LedgerAccountBalanceMonitorUpdateParams added in v1.5.0

type LedgerAccountBalanceMonitorUpdateParams struct {
	// An optional, free-form description for internal use.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerAccountBalanceMonitorUpdateParams) MarshalJSON added in v1.5.0

func (r LedgerAccountBalanceMonitorUpdateParams) MarshalJSON() (data []byte, err error)

type LedgerAccountBalances

type LedgerAccountBalances struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerAccountBalancesAvailableBalance `json:"available_balance,required"`
	// The inclusive lower bound of the effective_at timestamp for the returned
	// balances.
	EffectiveAtLowerBound string `json:"effective_at_lower_bound,required,nullable" format:"time"`
	// The exclusive upper bound of the effective_at timestamp for the returned
	// balances.
	EffectiveAtUpperBound string `json:"effective_at_upper_bound,required,nullable" format:"time"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerAccountBalancesPendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerAccountBalancesPostedBalance `json:"posted_balance,required"`
	JSON          ledgerAccountBalancesJSON
}

The pending, posted, and available balances for this ledger account. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts.

func (*LedgerAccountBalances) UnmarshalJSON

func (r *LedgerAccountBalances) UnmarshalJSON(data []byte) (err error)

type LedgerAccountBalancesAvailableBalance

type LedgerAccountBalancesAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountBalancesAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerAccountBalancesAvailableBalance) UnmarshalJSON

func (r *LedgerAccountBalancesAvailableBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountBalancesPendingBalance

type LedgerAccountBalancesPendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountBalancesPendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerAccountBalancesPendingBalance) UnmarshalJSON

func (r *LedgerAccountBalancesPendingBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountBalancesPostedBalance

type LedgerAccountBalancesPostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountBalancesPostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerAccountBalancesPostedBalance) UnmarshalJSON

func (r *LedgerAccountBalancesPostedBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountCategory

type LedgerAccountCategory struct {
	ID string `json:"id,required" format:"uuid"`
	// The pending, posted, and available balances for this ledger account category.
	// The posted balance is the sum of all posted entries on the account. The pending
	// balance is the sum of all pending and posted entries on the account. The
	// available balance is the posted incoming entries minus the sum of the pending
	// and posted outgoing amounts.
	Balances  LedgerAccountCategoryBalances `json:"balances,required"`
	CreatedAt time.Time                     `json:"created_at,required" format:"date-time"`
	// The description of the ledger account category.
	Description string    `json:"description,required,nullable"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
	// The id of the ledger that this account category belongs to.
	LedgerID string `json:"ledger_id,required" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// The name of the ledger account category.
	Name string `json:"name,required"`
	// The normal balance of the ledger account category.
	NormalBalance LedgerAccountCategoryNormalBalance `json:"normal_balance,required"`
	Object        string                             `json:"object,required"`
	UpdatedAt     time.Time                          `json:"updated_at,required" format:"date-time"`
	JSON          ledgerAccountCategoryJSON
}

func (*LedgerAccountCategory) UnmarshalJSON

func (r *LedgerAccountCategory) UnmarshalJSON(data []byte) (err error)

type LedgerAccountCategoryBalances

type LedgerAccountCategoryBalances struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerAccountCategoryBalancesAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerAccountCategoryBalancesPendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerAccountCategoryBalancesPostedBalance `json:"posted_balance,required"`
	JSON          ledgerAccountCategoryBalancesJSON
}

The pending, posted, and available balances for this ledger account category. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts.

func (*LedgerAccountCategoryBalances) UnmarshalJSON

func (r *LedgerAccountCategoryBalances) UnmarshalJSON(data []byte) (err error)

type LedgerAccountCategoryBalancesAvailableBalance

type LedgerAccountCategoryBalancesAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountCategoryBalancesAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerAccountCategoryBalancesAvailableBalance) UnmarshalJSON

func (r *LedgerAccountCategoryBalancesAvailableBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountCategoryBalancesPendingBalance

type LedgerAccountCategoryBalancesPendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountCategoryBalancesPendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerAccountCategoryBalancesPendingBalance) UnmarshalJSON

func (r *LedgerAccountCategoryBalancesPendingBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountCategoryBalancesPostedBalance

type LedgerAccountCategoryBalancesPostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountCategoryBalancesPostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerAccountCategoryBalancesPostedBalance) UnmarshalJSON

func (r *LedgerAccountCategoryBalancesPostedBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountCategoryGetParams

type LedgerAccountCategoryGetParams struct {
	// For example, if you want the balances as of a particular time (ISO8601), the
	// encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`.
	// The balances as of a time are inclusive of entries with that exact time.
	Balances param.Field[LedgerAccountCategoryGetParamsBalances] `query:"balances"`
}

func (LedgerAccountCategoryGetParams) URLQuery

func (r LedgerAccountCategoryGetParams) URLQuery() (v url.Values)

URLQuery serializes LedgerAccountCategoryGetParams's query parameters as `url.Values`.

type LedgerAccountCategoryGetParamsBalances

type LedgerAccountCategoryGetParamsBalances struct {
	AsOfDate    param.Field[time.Time] `query:"as_of_date" format:"date"`
	EffectiveAt param.Field[time.Time] `query:"effective_at" format:"date-time"`
}

For example, if you want the balances as of a particular time (ISO8601), the encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`. The balances as of a time are inclusive of entries with that exact time.

func (LedgerAccountCategoryGetParamsBalances) URLQuery

URLQuery serializes LedgerAccountCategoryGetParamsBalances's query parameters as `url.Values`.

type LedgerAccountCategoryListParams

type LedgerAccountCategoryListParams struct {
	// If you have specific IDs to retrieve in bulk, you can pass them as query
	// parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
	ID          param.Field[[]string] `query:"id"`
	AfterCursor param.Field[string]   `query:"after_cursor"`
	// For example, if you want the balances as of a particular time (ISO8601), the
	// encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`.
	// The balances as of a time are inclusive of entries with that exact time.
	Balances param.Field[LedgerAccountCategoryListParamsBalances] `query:"balances"`
	// Query categories which contain a ledger account directly or through child
	// categories.
	LedgerAccountID param.Field[string] `query:"ledger_account_id"`
	LedgerID        param.Field[string] `query:"ledger_id"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	Name     param.Field[string]            `query:"name"`
	// Query categories that are nested underneath a parent category
	ParentLedgerAccountCategoryID param.Field[string] `query:"parent_ledger_account_category_id"`
	PerPage                       param.Field[int64]  `query:"per_page"`
}

func (LedgerAccountCategoryListParams) URLQuery

func (r LedgerAccountCategoryListParams) URLQuery() (v url.Values)

URLQuery serializes LedgerAccountCategoryListParams's query parameters as `url.Values`.

type LedgerAccountCategoryListParamsBalances added in v1.2.0

type LedgerAccountCategoryListParamsBalances struct {
	EffectiveAt param.Field[time.Time] `query:"effective_at" format:"date-time"`
}

For example, if you want the balances as of a particular time (ISO8601), the encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`. The balances as of a time are inclusive of entries with that exact time.

func (LedgerAccountCategoryListParamsBalances) URLQuery added in v1.2.0

URLQuery serializes LedgerAccountCategoryListParamsBalances's query parameters as `url.Values`.

type LedgerAccountCategoryNewParams

type LedgerAccountCategoryNewParams struct {
	// The currency of the ledger account category.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the ledger that this account category belongs to.
	LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
	// The name of the ledger account category.
	Name param.Field[string] `json:"name,required"`
	// The normal balance of the ledger account category.
	NormalBalance param.Field[LedgerAccountCategoryNewParamsNormalBalance] `json:"normal_balance,required"`
	// The currency exponent of the ledger account category.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// The description of the ledger account category.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerAccountCategoryNewParams) MarshalJSON

func (r LedgerAccountCategoryNewParams) MarshalJSON() (data []byte, err error)

type LedgerAccountCategoryNewParamsNormalBalance

type LedgerAccountCategoryNewParamsNormalBalance string

The normal balance of the ledger account category.

const (
	LedgerAccountCategoryNewParamsNormalBalanceCredit LedgerAccountCategoryNewParamsNormalBalance = "credit"
	LedgerAccountCategoryNewParamsNormalBalanceDebit  LedgerAccountCategoryNewParamsNormalBalance = "debit"
)

type LedgerAccountCategoryNormalBalance

type LedgerAccountCategoryNormalBalance string

The normal balance of the ledger account category.

const (
	LedgerAccountCategoryNormalBalanceCredit LedgerAccountCategoryNormalBalance = "credit"
	LedgerAccountCategoryNormalBalanceDebit  LedgerAccountCategoryNormalBalance = "debit"
)

type LedgerAccountCategoryService

type LedgerAccountCategoryService struct {
	Options []option.RequestOption
}

LedgerAccountCategoryService 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 NewLedgerAccountCategoryService method instead.

func NewLedgerAccountCategoryService

func NewLedgerAccountCategoryService(opts ...option.RequestOption) (r *LedgerAccountCategoryService)

NewLedgerAccountCategoryService 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 (*LedgerAccountCategoryService) AddLedgerAccount

func (r *LedgerAccountCategoryService) AddLedgerAccount(ctx context.Context, id string, ledgerAccountID string, opts ...option.RequestOption) (err error)

Add a ledger account to a ledger account category.

func (*LedgerAccountCategoryService) AddNestedCategory

func (r *LedgerAccountCategoryService) AddNestedCategory(ctx context.Context, id string, subCategoryID string, opts ...option.RequestOption) (err error)

Add a ledger account category to a ledger account category.

func (*LedgerAccountCategoryService) Delete

Delete a ledger account category.

func (*LedgerAccountCategoryService) Get

Get the details on a single ledger account category.

func (*LedgerAccountCategoryService) List

Get a list of ledger account categories.

func (*LedgerAccountCategoryService) ListAutoPaging

Get a list of ledger account categories.

func (*LedgerAccountCategoryService) New

Create a ledger account category.

func (*LedgerAccountCategoryService) RemoveLedgerAccount

func (r *LedgerAccountCategoryService) RemoveLedgerAccount(ctx context.Context, id string, ledgerAccountID string, opts ...option.RequestOption) (err error)

Remove a ledger account from a ledger account category.

func (*LedgerAccountCategoryService) RemoveNestedCategory

func (r *LedgerAccountCategoryService) RemoveNestedCategory(ctx context.Context, id string, subCategoryID string, opts ...option.RequestOption) (err error)

Delete a ledger account category from a ledger account category.

func (*LedgerAccountCategoryService) Update

Update the details of a ledger account category.

type LedgerAccountCategoryUpdateParams

type LedgerAccountCategoryUpdateParams struct {
	// The description of the ledger account category.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// The name of the ledger account category.
	Name param.Field[string] `json:"name"`
}

func (LedgerAccountCategoryUpdateParams) MarshalJSON

func (r LedgerAccountCategoryUpdateParams) MarshalJSON() (data []byte, err error)

type LedgerAccountGetParams

type LedgerAccountGetParams struct {
	// Use `balances[effective_at_lower_bound]` and
	// `balances[effective_at_upper_bound]` to get the balances change between the two
	// timestamps. The lower bound is inclusive while the upper bound is exclusive of
	// the provided timestamps. If no value is supplied the balances will be retrieved
	// not including that bound. Use `balances[as_of_lock_version]` to retrieve a
	// balance as of a specific Ledger Account `lock_version`.
	Balances param.Field[LedgerAccountGetParamsBalances] `query:"balances"`
}

func (LedgerAccountGetParams) URLQuery

func (r LedgerAccountGetParams) URLQuery() (v url.Values)

URLQuery serializes LedgerAccountGetParams's query parameters as `url.Values`.

type LedgerAccountGetParamsBalances

type LedgerAccountGetParamsBalances struct {
	AsOfDate              param.Field[time.Time] `query:"as_of_date" format:"date"`
	AsOfLockVersion       param.Field[int64]     `query:"as_of_lock_version"`
	EffectiveAt           param.Field[time.Time] `query:"effective_at" format:"date-time"`
	EffectiveAtLowerBound param.Field[time.Time] `query:"effective_at_lower_bound" format:"date-time"`
	EffectiveAtUpperBound param.Field[time.Time] `query:"effective_at_upper_bound" format:"date-time"`
}

Use `balances[effective_at_lower_bound]` and `balances[effective_at_upper_bound]` to get the balances change between the two timestamps. The lower bound is inclusive while the upper bound is exclusive of the provided timestamps. If no value is supplied the balances will be retrieved not including that bound. Use `balances[as_of_lock_version]` to retrieve a balance as of a specific Ledger Account `lock_version`.

func (LedgerAccountGetParamsBalances) URLQuery

func (r LedgerAccountGetParamsBalances) URLQuery() (v url.Values)

URLQuery serializes LedgerAccountGetParamsBalances's query parameters as `url.Values`.

type LedgerAccountLedgerableType

type LedgerAccountLedgerableType string

If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.

const (
	LedgerAccountLedgerableTypeExternalAccount LedgerAccountLedgerableType = "external_account"
	LedgerAccountLedgerableTypeInternalAccount LedgerAccountLedgerableType = "internal_account"
)

type LedgerAccountListParams

type LedgerAccountListParams struct {
	// If you have specific IDs to retrieve in bulk, you can pass them as query
	// parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
	ID          param.Field[[]string] `query:"id"`
	AfterCursor param.Field[string]   `query:"after_cursor"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), `eq` (=), or `not_eq` (!=) to
	// filter by balance amount.
	AvailableBalanceAmount param.Field[LedgerAccountListParamsAvailableBalanceAmount] `query:"available_balance_amount"`
	// Use `balances[effective_at_lower_bound]` and
	// `balances[effective_at_upper_bound]` to get the balances change between the two
	// timestamps. The lower bound is inclusive while the upper bound is exclusive of
	// the provided timestamps. If no value is supplied the balances will be retrieved
	// not including that bound.
	Balances param.Field[LedgerAccountListParamsBalances] `query:"balances"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// created at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use
	// created_at%5Bgt%5D=2000-01-01T12:00:00Z.
	CreatedAt               param.Field[map[string]time.Time] `query:"created_at" format:"date-time"`
	Currency                param.Field[string]               `query:"currency"`
	LedgerAccountCategoryID param.Field[string]               `query:"ledger_account_category_id"`
	LedgerID                param.Field[string]               `query:"ledger_id"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	Name     param.Field[string]            `query:"name"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), `eq` (=), or `not_eq` (!=) to
	// filter by balance amount.
	PendingBalanceAmount param.Field[LedgerAccountListParamsPendingBalanceAmount] `query:"pending_balance_amount"`
	PerPage              param.Field[int64]                                       `query:"per_page"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), `eq` (=), or `not_eq` (!=) to
	// filter by balance amount.
	PostedBalanceAmount param.Field[LedgerAccountListParamsPostedBalanceAmount] `query:"posted_balance_amount"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// updated at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use
	// updated_at%5Bgt%5D=2000-01-01T12:00:00Z.
	UpdatedAt param.Field[map[string]time.Time] `query:"updated_at" format:"date-time"`
}

func (LedgerAccountListParams) URLQuery

func (r LedgerAccountListParams) URLQuery() (v url.Values)

URLQuery serializes LedgerAccountListParams's query parameters as `url.Values`.

type LedgerAccountListParamsAvailableBalanceAmount added in v1.5.0

type LedgerAccountListParamsAvailableBalanceAmount struct {
	Eq    param.Field[int64] `query:"eq"`
	Gt    param.Field[int64] `query:"gt"`
	Gte   param.Field[int64] `query:"gte"`
	Lt    param.Field[int64] `query:"lt"`
	Lte   param.Field[int64] `query:"lte"`
	NotEq param.Field[int64] `query:"not_eq"`
}

Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), `eq` (=), or `not_eq` (!=) to filter by balance amount.

func (LedgerAccountListParamsAvailableBalanceAmount) URLQuery added in v1.5.0

URLQuery serializes LedgerAccountListParamsAvailableBalanceAmount's query parameters as `url.Values`.

type LedgerAccountListParamsBalances

type LedgerAccountListParamsBalances struct {
	AsOfDate              param.Field[time.Time] `query:"as_of_date" format:"date"`
	EffectiveAt           param.Field[time.Time] `query:"effective_at" format:"date-time"`
	EffectiveAtLowerBound param.Field[time.Time] `query:"effective_at_lower_bound" format:"date-time"`
	EffectiveAtUpperBound param.Field[time.Time] `query:"effective_at_upper_bound" format:"date-time"`
}

Use `balances[effective_at_lower_bound]` and `balances[effective_at_upper_bound]` to get the balances change between the two timestamps. The lower bound is inclusive while the upper bound is exclusive of the provided timestamps. If no value is supplied the balances will be retrieved not including that bound.

func (LedgerAccountListParamsBalances) URLQuery

func (r LedgerAccountListParamsBalances) URLQuery() (v url.Values)

URLQuery serializes LedgerAccountListParamsBalances's query parameters as `url.Values`.

type LedgerAccountListParamsPendingBalanceAmount added in v1.5.0

type LedgerAccountListParamsPendingBalanceAmount struct {
	Eq    param.Field[int64] `query:"eq"`
	Gt    param.Field[int64] `query:"gt"`
	Gte   param.Field[int64] `query:"gte"`
	Lt    param.Field[int64] `query:"lt"`
	Lte   param.Field[int64] `query:"lte"`
	NotEq param.Field[int64] `query:"not_eq"`
}

Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), `eq` (=), or `not_eq` (!=) to filter by balance amount.

func (LedgerAccountListParamsPendingBalanceAmount) URLQuery added in v1.5.0

URLQuery serializes LedgerAccountListParamsPendingBalanceAmount's query parameters as `url.Values`.

type LedgerAccountListParamsPostedBalanceAmount added in v1.5.0

type LedgerAccountListParamsPostedBalanceAmount struct {
	Eq    param.Field[int64] `query:"eq"`
	Gt    param.Field[int64] `query:"gt"`
	Gte   param.Field[int64] `query:"gte"`
	Lt    param.Field[int64] `query:"lt"`
	Lte   param.Field[int64] `query:"lte"`
	NotEq param.Field[int64] `query:"not_eq"`
}

Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), `eq` (=), or `not_eq` (!=) to filter by balance amount.

func (LedgerAccountListParamsPostedBalanceAmount) URLQuery added in v1.5.0

URLQuery serializes LedgerAccountListParamsPostedBalanceAmount's query parameters as `url.Values`.

type LedgerAccountNewParams

type LedgerAccountNewParams struct {
	// The currency of the ledger account.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the ledger that this account belongs to.
	LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
	// The name of the ledger account.
	Name param.Field[string] `json:"name,required"`
	// The normal balance of the ledger account.
	NormalBalance param.Field[LedgerAccountNewParamsNormalBalance] `json:"normal_balance,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// The description of the ledger account.
	Description param.Field[string] `json:"description"`
	// If the ledger account links to another object in Modern Treasury, the id will be
	// populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the type will
	// be populated here, otherwise null. The value is one of internal_account or
	// external_account.
	LedgerableType param.Field[LedgerAccountNewParamsLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerAccountNewParams) MarshalJSON

func (r LedgerAccountNewParams) MarshalJSON() (data []byte, err error)

type LedgerAccountNewParamsLedgerableType

type LedgerAccountNewParamsLedgerableType string

If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.

const (
	LedgerAccountNewParamsLedgerableTypeExternalAccount LedgerAccountNewParamsLedgerableType = "external_account"
	LedgerAccountNewParamsLedgerableTypeInternalAccount LedgerAccountNewParamsLedgerableType = "internal_account"
)

type LedgerAccountNewParamsNormalBalance

type LedgerAccountNewParamsNormalBalance string

The normal balance of the ledger account.

const (
	LedgerAccountNewParamsNormalBalanceCredit LedgerAccountNewParamsNormalBalance = "credit"
	LedgerAccountNewParamsNormalBalanceDebit  LedgerAccountNewParamsNormalBalance = "debit"
)

type LedgerAccountNormalBalance

type LedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	LedgerAccountNormalBalanceCredit LedgerAccountNormalBalance = "credit"
	LedgerAccountNormalBalanceDebit  LedgerAccountNormalBalance = "debit"
)

type LedgerAccountPayout

type LedgerAccountPayout struct {
	ID string `json:"id,required" format:"uuid"`
	// The amount of the ledger account payout.
	Amount    int64     `json:"amount,required,nullable"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The currency of the ledger account payout.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account payout.
	CurrencyExponent int64 `json:"currency_exponent,required,nullable"`
	// The description of the ledger account payout.
	Description string `json:"description,required,nullable"`
	// The exclusive upper bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account payout. The default value is the created_at
	// timestamp of the ledger account payout.
	EffectiveAtUpperBound string `json:"effective_at_upper_bound,required" format:"time"`
	// The id of the funding ledger account that sends to or receives funds from the
	// payout ledger account.
	FundingLedgerAccountID string `json:"funding_ledger_account_id,required" format:"uuid"`
	// The id of the ledger that this ledger account payout belongs to.
	LedgerID string `json:"ledger_id,required" format:"uuid"`
	// The id of the ledger transaction that this payout is associated with.
	LedgerTransactionID string `json:"ledger_transaction_id,required,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The id of the payout ledger account whose ledger entries are queried against,
	// and its balance is reduced as a result.
	PayoutLedgerAccountID string `json:"payout_ledger_account_id,required" format:"uuid"`
	// The status of the ledger account payout. One of `processing`, `pending`,
	// `posted`, `archiving` or `archived`.
	Status    LedgerAccountPayoutStatus `json:"status,required"`
	UpdatedAt time.Time                 `json:"updated_at,required" format:"date-time"`
	JSON      ledgerAccountPayoutJSON
}

func (*LedgerAccountPayout) UnmarshalJSON

func (r *LedgerAccountPayout) UnmarshalJSON(data []byte) (err error)

type LedgerAccountPayoutListParams

type LedgerAccountPayoutListParams struct {
	// If you have specific IDs to retrieve in bulk, you can pass them as query
	// parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
	ID          param.Field[[]string] `query:"id"`
	AfterCursor param.Field[string]   `query:"after_cursor"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata              param.Field[map[string]string] `query:"metadata"`
	PayoutLedgerAccountID param.Field[string]            `query:"payout_ledger_account_id"`
	PerPage               param.Field[int64]             `query:"per_page"`
}

func (LedgerAccountPayoutListParams) URLQuery

func (r LedgerAccountPayoutListParams) URLQuery() (v url.Values)

URLQuery serializes LedgerAccountPayoutListParams's query parameters as `url.Values`.

type LedgerAccountPayoutNewParams

type LedgerAccountPayoutNewParams struct {
	// The id of the funding ledger account that sends to or receives funds from the
	// payout ledger account.
	FundingLedgerAccountID param.Field[string] `json:"funding_ledger_account_id,required" format:"uuid"`
	// The id of the payout ledger account whose ledger entries are queried against,
	// and its balance is reduced as a result.
	PayoutLedgerAccountID param.Field[string] `json:"payout_ledger_account_id,required" format:"uuid"`
	// The description of the ledger account payout.
	Description param.Field[string] `json:"description"`
	// The exclusive upper bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account payout. The default value is the created_at
	// timestamp of the ledger account payout.
	EffectiveAtUpperBound param.Field[string] `json:"effective_at_upper_bound" format:"time"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// It is set to `false` by default. It should be set to `true` when migrating
	// existing payouts.
	SkipPayoutLedgerTransaction param.Field[bool] `json:"skip_payout_ledger_transaction"`
	// The status of the ledger account payout. It is set to `pending` by default. To
	// post a ledger account payout at creation, use `posted`.
	Status param.Field[LedgerAccountPayoutNewParamsStatus] `json:"status"`
}

func (LedgerAccountPayoutNewParams) MarshalJSON

func (r LedgerAccountPayoutNewParams) MarshalJSON() (data []byte, err error)

type LedgerAccountPayoutNewParamsStatus

type LedgerAccountPayoutNewParamsStatus string

The status of the ledger account payout. It is set to `pending` by default. To post a ledger account payout at creation, use `posted`.

const (
	LedgerAccountPayoutNewParamsStatusPending LedgerAccountPayoutNewParamsStatus = "pending"
	LedgerAccountPayoutNewParamsStatusPosted  LedgerAccountPayoutNewParamsStatus = "posted"
)

type LedgerAccountPayoutService

type LedgerAccountPayoutService struct {
	Options []option.RequestOption
}

LedgerAccountPayoutService 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 NewLedgerAccountPayoutService method instead.

func NewLedgerAccountPayoutService

func NewLedgerAccountPayoutService(opts ...option.RequestOption) (r *LedgerAccountPayoutService)

NewLedgerAccountPayoutService 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 (*LedgerAccountPayoutService) Get added in v1.5.0

Get details on a single ledger account payout.

func (*LedgerAccountPayoutService) List

Get a list of ledger account payouts.

func (*LedgerAccountPayoutService) ListAutoPaging

Get a list of ledger account payouts.

func (*LedgerAccountPayoutService) New

Create a ledger account payout.

func (*LedgerAccountPayoutService) Retireve deprecated

Get details on a single ledger account payout.

Deprecated: use `Get` instead

func (*LedgerAccountPayoutService) Update

Update the details of a ledger account payout.

type LedgerAccountPayoutStatus

type LedgerAccountPayoutStatus string

The status of the ledger account payout. One of `processing`, `pending`, `posted`, `archiving` or `archived`.

const (
	LedgerAccountPayoutStatusArchived   LedgerAccountPayoutStatus = "archived"
	LedgerAccountPayoutStatusArchiving  LedgerAccountPayoutStatus = "archiving"
	LedgerAccountPayoutStatusPending    LedgerAccountPayoutStatus = "pending"
	LedgerAccountPayoutStatusPosted     LedgerAccountPayoutStatus = "posted"
	LedgerAccountPayoutStatusProcessing LedgerAccountPayoutStatus = "processing"
)

type LedgerAccountPayoutUpdateParams

type LedgerAccountPayoutUpdateParams struct {
	// The description of the ledger account payout.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// To post a pending ledger account payout, use `posted`. To archive a pending
	// ledger transaction, use `archived`.
	Status param.Field[LedgerAccountPayoutUpdateParamsStatus] `json:"status"`
}

func (LedgerAccountPayoutUpdateParams) MarshalJSON

func (r LedgerAccountPayoutUpdateParams) MarshalJSON() (data []byte, err error)

type LedgerAccountPayoutUpdateParamsStatus

type LedgerAccountPayoutUpdateParamsStatus string

To post a pending ledger account payout, use `posted`. To archive a pending ledger transaction, use `archived`.

const (
	LedgerAccountPayoutUpdateParamsStatusPosted   LedgerAccountPayoutUpdateParamsStatus = "posted"
	LedgerAccountPayoutUpdateParamsStatusArchived LedgerAccountPayoutUpdateParamsStatus = "archived"
)

type LedgerAccountService

type LedgerAccountService struct {
	Options []option.RequestOption
}

LedgerAccountService 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 NewLedgerAccountService method instead.

func NewLedgerAccountService

func NewLedgerAccountService(opts ...option.RequestOption) (r *LedgerAccountService)

NewLedgerAccountService 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 (*LedgerAccountService) Delete

func (r *LedgerAccountService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *LedgerAccount, err error)

Delete a ledger account.

func (*LedgerAccountService) Get

Get details on a single ledger account.

func (*LedgerAccountService) List

Get a list of ledger accounts.

func (*LedgerAccountService) ListAutoPaging

Get a list of ledger accounts.

func (*LedgerAccountService) New

Create a ledger account.

func (*LedgerAccountService) Update

Update the details of a ledger account.

type LedgerAccountStatementGetResponse

type LedgerAccountStatementGetResponse struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The description of the ledger account statement.
	Description string `json:"description,required,nullable"`
	// The inclusive lower bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account statement.
	EffectiveAtLowerBound string `json:"effective_at_lower_bound,required" format:"time"`
	// The exclusive upper bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account statement.
	EffectiveAtUpperBound string `json:"effective_at_upper_bound,required" format:"time"`
	// The pending, posted, and available balances for this ledger account at the
	// `effective_at_upper_bound`. The posted balance is the sum of all posted entries
	// on the account. The pending balance is the sum of all pending and posted entries
	// on the account. The available balance is the posted incoming entries minus the
	// sum of the pending and posted outgoing amounts.
	EndingBalance LedgerAccountStatementGetResponseEndingBalance `json:"ending_balance,required"`
	// The id of the ledger account whose ledger entries are queried against, and its
	// balances are computed as a result.
	LedgerAccountID string `json:"ledger_account_id,required" format:"uuid"`
	// Lock version of the ledger account at the time of statement generation.
	LedgerAccountLockVersion int64 `json:"ledger_account_lock_version,required"`
	// The normal balance of the ledger account.
	LedgerAccountNormalBalance LedgerAccountStatementGetResponseLedgerAccountNormalBalance `json:"ledger_account_normal_balance,required"`
	// The id of the ledger that this ledger account statement belongs to.
	LedgerID string `json:"ledger_id,required" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The pending, posted, and available balances for this ledger account at the
	// `effective_at_lower_bound`. The posted balance is the sum of all posted entries
	// on the account. The pending balance is the sum of all pending and posted entries
	// on the account. The available balance is the posted incoming entries minus the
	// sum of the pending and posted outgoing amounts.
	StartingBalance LedgerAccountStatementGetResponseStartingBalance `json:"starting_balance,required"`
	UpdatedAt       time.Time                                        `json:"updated_at,required" format:"date-time"`
	JSON            ledgerAccountStatementGetResponseJSON
}

func (*LedgerAccountStatementGetResponse) UnmarshalJSON

func (r *LedgerAccountStatementGetResponse) UnmarshalJSON(data []byte) (err error)

type LedgerAccountStatementGetResponseEndingBalance

type LedgerAccountStatementGetResponseEndingBalance struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerAccountStatementGetResponseEndingBalanceAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerAccountStatementGetResponseEndingBalancePendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerAccountStatementGetResponseEndingBalancePostedBalance `json:"posted_balance,required"`
	JSON          ledgerAccountStatementGetResponseEndingBalanceJSON
}

The pending, posted, and available balances for this ledger account at the `effective_at_upper_bound`. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts.

func (*LedgerAccountStatementGetResponseEndingBalance) UnmarshalJSON

func (r *LedgerAccountStatementGetResponseEndingBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountStatementGetResponseEndingBalanceAvailableBalance

type LedgerAccountStatementGetResponseEndingBalanceAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementGetResponseEndingBalanceAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerAccountStatementGetResponseEndingBalanceAvailableBalance) UnmarshalJSON

type LedgerAccountStatementGetResponseEndingBalancePendingBalance

type LedgerAccountStatementGetResponseEndingBalancePendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementGetResponseEndingBalancePendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerAccountStatementGetResponseEndingBalancePendingBalance) UnmarshalJSON

type LedgerAccountStatementGetResponseEndingBalancePostedBalance

type LedgerAccountStatementGetResponseEndingBalancePostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementGetResponseEndingBalancePostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerAccountStatementGetResponseEndingBalancePostedBalance) UnmarshalJSON

type LedgerAccountStatementGetResponseLedgerAccountNormalBalance

type LedgerAccountStatementGetResponseLedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	LedgerAccountStatementGetResponseLedgerAccountNormalBalanceCredit LedgerAccountStatementGetResponseLedgerAccountNormalBalance = "credit"
	LedgerAccountStatementGetResponseLedgerAccountNormalBalanceDebit  LedgerAccountStatementGetResponseLedgerAccountNormalBalance = "debit"
)

type LedgerAccountStatementGetResponseStartingBalance

type LedgerAccountStatementGetResponseStartingBalance struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerAccountStatementGetResponseStartingBalanceAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerAccountStatementGetResponseStartingBalancePendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerAccountStatementGetResponseStartingBalancePostedBalance `json:"posted_balance,required"`
	JSON          ledgerAccountStatementGetResponseStartingBalanceJSON
}

The pending, posted, and available balances for this ledger account at the `effective_at_lower_bound`. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts.

func (*LedgerAccountStatementGetResponseStartingBalance) UnmarshalJSON

func (r *LedgerAccountStatementGetResponseStartingBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountStatementGetResponseStartingBalanceAvailableBalance

type LedgerAccountStatementGetResponseStartingBalanceAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementGetResponseStartingBalanceAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerAccountStatementGetResponseStartingBalanceAvailableBalance) UnmarshalJSON

type LedgerAccountStatementGetResponseStartingBalancePendingBalance

type LedgerAccountStatementGetResponseStartingBalancePendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementGetResponseStartingBalancePendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerAccountStatementGetResponseStartingBalancePendingBalance) UnmarshalJSON

type LedgerAccountStatementGetResponseStartingBalancePostedBalance

type LedgerAccountStatementGetResponseStartingBalancePostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementGetResponseStartingBalancePostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerAccountStatementGetResponseStartingBalancePostedBalance) UnmarshalJSON

type LedgerAccountStatementNewParams

type LedgerAccountStatementNewParams struct {
	// The inclusive lower bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account statement.
	EffectiveAtLowerBound param.Field[string] `json:"effective_at_lower_bound,required" format:"time"`
	// The exclusive upper bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account statement.
	EffectiveAtUpperBound param.Field[string] `json:"effective_at_upper_bound,required" format:"time"`
	// The id of the ledger account whose ledger entries are queried against, and its
	// balances are computed as a result.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required" format:"uuid"`
	// The description of the ledger account statement.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerAccountStatementNewParams) MarshalJSON

func (r LedgerAccountStatementNewParams) MarshalJSON() (data []byte, err error)

type LedgerAccountStatementNewResponse

type LedgerAccountStatementNewResponse struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The description of the ledger account statement.
	Description string `json:"description,required,nullable"`
	// The inclusive lower bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account statement.
	EffectiveAtLowerBound string `json:"effective_at_lower_bound,required" format:"time"`
	// The exclusive upper bound of the effective_at timestamp of the ledger entries to
	// be included in the ledger account statement.
	EffectiveAtUpperBound string `json:"effective_at_upper_bound,required" format:"time"`
	// The pending, posted, and available balances for this ledger account at the
	// `effective_at_upper_bound`. The posted balance is the sum of all posted entries
	// on the account. The pending balance is the sum of all pending and posted entries
	// on the account. The available balance is the posted incoming entries minus the
	// sum of the pending and posted outgoing amounts.
	EndingBalance LedgerAccountStatementNewResponseEndingBalance `json:"ending_balance,required"`
	// The id of the ledger account whose ledger entries are queried against, and its
	// balances are computed as a result.
	LedgerAccountID string `json:"ledger_account_id,required" format:"uuid"`
	// Lock version of the ledger account at the time of statement generation.
	LedgerAccountLockVersion int64 `json:"ledger_account_lock_version,required"`
	// The normal balance of the ledger account.
	LedgerAccountNormalBalance LedgerAccountStatementNewResponseLedgerAccountNormalBalance `json:"ledger_account_normal_balance,required"`
	// The id of the ledger that this ledger account statement belongs to.
	LedgerID string `json:"ledger_id,required" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The pending, posted, and available balances for this ledger account at the
	// `effective_at_lower_bound`. The posted balance is the sum of all posted entries
	// on the account. The pending balance is the sum of all pending and posted entries
	// on the account. The available balance is the posted incoming entries minus the
	// sum of the pending and posted outgoing amounts.
	StartingBalance LedgerAccountStatementNewResponseStartingBalance `json:"starting_balance,required"`
	UpdatedAt       time.Time                                        `json:"updated_at,required" format:"date-time"`
	JSON            ledgerAccountStatementNewResponseJSON
}

func (*LedgerAccountStatementNewResponse) UnmarshalJSON

func (r *LedgerAccountStatementNewResponse) UnmarshalJSON(data []byte) (err error)

type LedgerAccountStatementNewResponseEndingBalance

type LedgerAccountStatementNewResponseEndingBalance struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerAccountStatementNewResponseEndingBalanceAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerAccountStatementNewResponseEndingBalancePendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerAccountStatementNewResponseEndingBalancePostedBalance `json:"posted_balance,required"`
	JSON          ledgerAccountStatementNewResponseEndingBalanceJSON
}

The pending, posted, and available balances for this ledger account at the `effective_at_upper_bound`. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts.

func (*LedgerAccountStatementNewResponseEndingBalance) UnmarshalJSON

func (r *LedgerAccountStatementNewResponseEndingBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountStatementNewResponseEndingBalanceAvailableBalance

type LedgerAccountStatementNewResponseEndingBalanceAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementNewResponseEndingBalanceAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerAccountStatementNewResponseEndingBalanceAvailableBalance) UnmarshalJSON

type LedgerAccountStatementNewResponseEndingBalancePendingBalance

type LedgerAccountStatementNewResponseEndingBalancePendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementNewResponseEndingBalancePendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerAccountStatementNewResponseEndingBalancePendingBalance) UnmarshalJSON

type LedgerAccountStatementNewResponseEndingBalancePostedBalance

type LedgerAccountStatementNewResponseEndingBalancePostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementNewResponseEndingBalancePostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerAccountStatementNewResponseEndingBalancePostedBalance) UnmarshalJSON

type LedgerAccountStatementNewResponseLedgerAccountNormalBalance

type LedgerAccountStatementNewResponseLedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	LedgerAccountStatementNewResponseLedgerAccountNormalBalanceCredit LedgerAccountStatementNewResponseLedgerAccountNormalBalance = "credit"
	LedgerAccountStatementNewResponseLedgerAccountNormalBalanceDebit  LedgerAccountStatementNewResponseLedgerAccountNormalBalance = "debit"
)

type LedgerAccountStatementNewResponseStartingBalance

type LedgerAccountStatementNewResponseStartingBalance struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerAccountStatementNewResponseStartingBalanceAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerAccountStatementNewResponseStartingBalancePendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerAccountStatementNewResponseStartingBalancePostedBalance `json:"posted_balance,required"`
	JSON          ledgerAccountStatementNewResponseStartingBalanceJSON
}

The pending, posted, and available balances for this ledger account at the `effective_at_lower_bound`. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts.

func (*LedgerAccountStatementNewResponseStartingBalance) UnmarshalJSON

func (r *LedgerAccountStatementNewResponseStartingBalance) UnmarshalJSON(data []byte) (err error)

type LedgerAccountStatementNewResponseStartingBalanceAvailableBalance

type LedgerAccountStatementNewResponseStartingBalanceAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementNewResponseStartingBalanceAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerAccountStatementNewResponseStartingBalanceAvailableBalance) UnmarshalJSON

type LedgerAccountStatementNewResponseStartingBalancePendingBalance

type LedgerAccountStatementNewResponseStartingBalancePendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementNewResponseStartingBalancePendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerAccountStatementNewResponseStartingBalancePendingBalance) UnmarshalJSON

type LedgerAccountStatementNewResponseStartingBalancePostedBalance

type LedgerAccountStatementNewResponseStartingBalancePostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerAccountStatementNewResponseStartingBalancePostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerAccountStatementNewResponseStartingBalancePostedBalance) UnmarshalJSON

type LedgerAccountStatementService

type LedgerAccountStatementService struct {
	Options []option.RequestOption
}

LedgerAccountStatementService 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 NewLedgerAccountStatementService method instead.

func NewLedgerAccountStatementService

func NewLedgerAccountStatementService(opts ...option.RequestOption) (r *LedgerAccountStatementService)

NewLedgerAccountStatementService 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 (*LedgerAccountStatementService) Get

Get details on a single ledger account statement.

func (*LedgerAccountStatementService) New

Create a ledger account statement.

type LedgerAccountUpdateParams

type LedgerAccountUpdateParams struct {
	// The description of the ledger account.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// The name of the ledger account.
	Name param.Field[string] `json:"name"`
}

func (LedgerAccountUpdateParams) MarshalJSON

func (r LedgerAccountUpdateParams) MarshalJSON() (data []byte, err error)

type LedgerEntry

type LedgerEntry struct {
	ID string `json:"id,required" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount    int64     `json:"amount,required"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// 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   LedgerEntryDirection `json:"direction,required"`
	DiscardedAt time.Time            `json:"discarded_at,required,nullable" format:"date-time"`
	// The currency of the ledger account.
	LedgerAccountCurrency string `json:"ledger_account_currency,required"`
	// The currency exponent of the ledger account.
	LedgerAccountCurrencyExponent int64 `json:"ledger_account_currency_exponent,required"`
	// The ledger account that this ledger entry is associated with.
	LedgerAccountID string `json:"ledger_account_id,required" format:"uuid"`
	// Lock version of the ledger account. This can be passed when creating a ledger
	// transaction to only succeed if no ledger transactions have posted since the
	// given version. See our post about Designing the Ledgers API with Optimistic
	// Locking for more details.
	LedgerAccountLockVersion int64 `json:"ledger_account_lock_version,required,nullable"`
	// The ledger transaction that this ledger entry is associated with.
	LedgerTransactionID string `json:"ledger_transaction_id,required"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The pending, posted, and available balances for this ledger entry's ledger
	// account. The posted balance is the sum of all posted entries on the account. The
	// pending balance is the sum of all pending and posted entries on the account. The
	// available balance is the posted incoming entries minus the sum of the pending
	// and posted outgoing amounts. Please see
	// https://docs.moderntreasury.com/docs/transaction-status-and-balances for more
	// details.
	ResultingLedgerAccountBalances LedgerEntryResultingLedgerAccountBalances `json:"resulting_ledger_account_balances,required,nullable"`
	// Equal to the state of the ledger transaction when the ledger entry was created.
	// One of `pending`, `posted`, or `archived`.
	Status    LedgerEntryStatus `json:"status,required"`
	UpdatedAt time.Time         `json:"updated_at,required" format:"date-time"`
	JSON      ledgerEntryJSON
}

func (*LedgerEntry) UnmarshalJSON

func (r *LedgerEntry) UnmarshalJSON(data []byte) (err error)

type LedgerEntryDirection

type LedgerEntryDirection string

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`.

const (
	LedgerEntryDirectionCredit LedgerEntryDirection = "credit"
	LedgerEntryDirectionDebit  LedgerEntryDirection = "debit"
)

type LedgerEntryGetParams

type LedgerEntryGetParams struct {
	// If true, response will include the balances attached to the ledger entry. If
	// there is no balance available, null will be returned instead.
	ShowBalances param.Field[bool] `query:"show_balances"`
}

func (LedgerEntryGetParams) URLQuery

func (r LedgerEntryGetParams) URLQuery() (v url.Values)

URLQuery serializes LedgerEntryGetParams's query parameters as `url.Values`.

type LedgerEntryListParams

type LedgerEntryListParams struct {
	// If you have specific IDs to retrieve in bulk, you can pass them as query
	// parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
	ID          param.Field[[]string] `query:"id"`
	AfterCursor param.Field[string]   `query:"after_cursor"`
	// Shows all ledger entries that were present on a ledger account at a particular
	// `lock_version`. You must also specify `ledger_account_id`.
	AsOfLockVersion param.Field[int64] `query:"as_of_lock_version"`
	// If true, response will include ledger entries that were deleted. When you update
	// a ledger transaction to specify a new set of entries, the previous entries are
	// deleted.
	Direction param.Field[LedgerEntryListParamsDirection] `query:"direction"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// transaction's effective time. Format ISO8601
	EffectiveAt param.Field[map[string]string] `query:"effective_at" format:"time"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// transaction's effective date. Format YYYY-MM-DD
	EffectiveDate param.Field[map[string]time.Time] `query:"effective_date" format:"date"`
	// Get all ledger entries that match the direction specified. One of `credit`,
	// `debit`.
	LedgerAccountCategoryID param.Field[string] `query:"ledger_account_category_id"`
	LedgerAccountID         param.Field[string] `query:"ledger_account_id"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// lock_version of a ledger account. For example, for all entries created at or
	// before before lock_version 1000 of a ledger account, use
	// `ledger_account_lock_version%5Blte%5D=1000`.
	LedgerAccountLockVersion param.Field[map[string]int64] `query:"ledger_account_lock_version"`
	LedgerAccountPayoutID    param.Field[string]           `query:"ledger_account_payout_id"`
	// Get all ledger entries that are included in the ledger account statement.
	LedgerAccountStatementID param.Field[string] `query:"ledger_account_statement_id"`
	LedgerTransactionID      param.Field[string] `query:"ledger_transaction_id"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	// Order by `created_at` or `effective_at` in `asc` or `desc` order. For example,
	// to order by `effective_at asc`, use `order_by%5Beffective_at%5D=asc`. Ordering
	// by only one field at a time is supported.
	OrderBy param.Field[LedgerEntryListParamsOrderBy] `query:"order_by"`
	PerPage param.Field[int64]                        `query:"per_page"`
	// If true, response will include the balances attached to the ledger entry. If
	// there is no balance available, null will be returned instead.
	ShowBalances param.Field[bool] `query:"show_balances"`
	// If true, response will include ledger entries that were deleted. When you update
	// a ledger transaction to specify a new set of entries, the previous entries are
	// deleted.
	ShowDeleted param.Field[bool] `query:"show_deleted"`
	// Get all ledger entries that match the status specified. One of `pending`,
	// `posted`, or `archived`.
	Status param.Field[LedgerEntryListParamsStatus] `query:"status"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// posted at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use
	// updated_at%5Bgt%5D=2000-01-01T12:00:00Z.
	UpdatedAt param.Field[map[string]time.Time] `query:"updated_at" format:"date-time"`
}

func (LedgerEntryListParams) URLQuery

func (r LedgerEntryListParams) URLQuery() (v url.Values)

URLQuery serializes LedgerEntryListParams's query parameters as `url.Values`.

type LedgerEntryListParamsDirection

type LedgerEntryListParamsDirection string

If true, response will include ledger entries that were deleted. When you update a ledger transaction to specify a new set of entries, the previous entries are deleted.

const (
	LedgerEntryListParamsDirectionCredit LedgerEntryListParamsDirection = "credit"
	LedgerEntryListParamsDirectionDebit  LedgerEntryListParamsDirection = "debit"
)

type LedgerEntryListParamsOrderBy

type LedgerEntryListParamsOrderBy struct {
	CreatedAt   param.Field[LedgerEntryListParamsOrderByCreatedAt]   `query:"created_at"`
	EffectiveAt param.Field[LedgerEntryListParamsOrderByEffectiveAt] `query:"effective_at"`
}

Order by `created_at` or `effective_at` in `asc` or `desc` order. For example, to order by `effective_at asc`, use `order_by%5Beffective_at%5D=asc`. Ordering by only one field at a time is supported.

func (LedgerEntryListParamsOrderBy) URLQuery

func (r LedgerEntryListParamsOrderBy) URLQuery() (v url.Values)

URLQuery serializes LedgerEntryListParamsOrderBy's query parameters as `url.Values`.

type LedgerEntryListParamsOrderByCreatedAt

type LedgerEntryListParamsOrderByCreatedAt string
const (
	LedgerEntryListParamsOrderByCreatedAtAsc  LedgerEntryListParamsOrderByCreatedAt = "asc"
	LedgerEntryListParamsOrderByCreatedAtDesc LedgerEntryListParamsOrderByCreatedAt = "desc"
)

type LedgerEntryListParamsOrderByEffectiveAt

type LedgerEntryListParamsOrderByEffectiveAt string
const (
	LedgerEntryListParamsOrderByEffectiveAtAsc  LedgerEntryListParamsOrderByEffectiveAt = "asc"
	LedgerEntryListParamsOrderByEffectiveAtDesc LedgerEntryListParamsOrderByEffectiveAt = "desc"
)

type LedgerEntryListParamsStatus

type LedgerEntryListParamsStatus string

Get all ledger entries that match the status specified. One of `pending`, `posted`, or `archived`.

const (
	LedgerEntryListParamsStatusPending  LedgerEntryListParamsStatus = "pending"
	LedgerEntryListParamsStatusPosted   LedgerEntryListParamsStatus = "posted"
	LedgerEntryListParamsStatusArchived LedgerEntryListParamsStatus = "archived"
)

type LedgerEntryResultingLedgerAccountBalances

type LedgerEntryResultingLedgerAccountBalances struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerEntryResultingLedgerAccountBalancesAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerEntryResultingLedgerAccountBalancesPendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerEntryResultingLedgerAccountBalancesPostedBalance `json:"posted_balance,required"`
	JSON          ledgerEntryResultingLedgerAccountBalancesJSON
}

The pending, posted, and available balances for this ledger entry's ledger account. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts. Please see https://docs.moderntreasury.com/docs/transaction-status-and-balances for more details.

func (*LedgerEntryResultingLedgerAccountBalances) UnmarshalJSON

func (r *LedgerEntryResultingLedgerAccountBalances) UnmarshalJSON(data []byte) (err error)

type LedgerEntryResultingLedgerAccountBalancesAvailableBalance

type LedgerEntryResultingLedgerAccountBalancesAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerEntryResultingLedgerAccountBalancesAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerEntryResultingLedgerAccountBalancesAvailableBalance) UnmarshalJSON

type LedgerEntryResultingLedgerAccountBalancesPendingBalance

type LedgerEntryResultingLedgerAccountBalancesPendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerEntryResultingLedgerAccountBalancesPendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerEntryResultingLedgerAccountBalancesPendingBalance) UnmarshalJSON

type LedgerEntryResultingLedgerAccountBalancesPostedBalance

type LedgerEntryResultingLedgerAccountBalancesPostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerEntryResultingLedgerAccountBalancesPostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerEntryResultingLedgerAccountBalancesPostedBalance) UnmarshalJSON

func (r *LedgerEntryResultingLedgerAccountBalancesPostedBalance) UnmarshalJSON(data []byte) (err error)

type LedgerEntryService

type LedgerEntryService struct {
	Options []option.RequestOption
}

LedgerEntryService 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 NewLedgerEntryService method instead.

func NewLedgerEntryService

func NewLedgerEntryService(opts ...option.RequestOption) (r *LedgerEntryService)

NewLedgerEntryService 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 (*LedgerEntryService) Get

Get details on a single ledger entry.

func (*LedgerEntryService) List

Get a list of all ledger entries.

func (*LedgerEntryService) ListAutoPaging

Get a list of all ledger entries.

type LedgerEntryStatus

type LedgerEntryStatus string

Equal to the state of the ledger transaction when the ledger entry was created. One of `pending`, `posted`, or `archived`.

const (
	LedgerEntryStatusArchived LedgerEntryStatus = "archived"
	LedgerEntryStatusPending  LedgerEntryStatus = "pending"
	LedgerEntryStatusPosted   LedgerEntryStatus = "posted"
)

type LedgerEventHandlerDeleteResponse

type LedgerEventHandlerDeleteResponse struct {
	ID         string                                     `json:"id,required" format:"uuid"`
	Conditions LedgerEventHandlerDeleteResponseConditions `json:"conditions,required,nullable"`
	CreatedAt  time.Time                                  `json:"created_at,required" format:"date-time"`
	// An optional description.
	Description               string                                                    `json:"description,required,nullable"`
	DiscardedAt               time.Time                                                 `json:"discarded_at,required,nullable" format:"date-time"`
	LedgerTransactionTemplate LedgerEventHandlerDeleteResponseLedgerTransactionTemplate `json:"ledger_transaction_template,required"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	// Name of the ledger event handler.
	Name      string    `json:"name,required"`
	Object    string    `json:"object,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      ledgerEventHandlerDeleteResponseJSON
}

func (*LedgerEventHandlerDeleteResponse) UnmarshalJSON

func (r *LedgerEventHandlerDeleteResponse) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerDeleteResponseConditions

type LedgerEventHandlerDeleteResponseConditions struct {
	// The field you're fetching from the `ledgerable_event`.
	Field string `json:"field,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Operator string `json:"operator,required"`
	// What raw string you are comparing the `field` against.
	Value string `json:"value,required"`
	JSON  ledgerEventHandlerDeleteResponseConditionsJSON
}

func (*LedgerEventHandlerDeleteResponseConditions) UnmarshalJSON

func (r *LedgerEventHandlerDeleteResponseConditions) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerDeleteResponseLedgerTransactionTemplate

type LedgerEventHandlerDeleteResponseLedgerTransactionTemplate struct {
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt string `json:"effective_at,required,nullable" format:"datetime"`
	// An array of ledger entry objects.
	LedgerEntries []LedgerEventHandlerDeleteResponseLedgerTransactionTemplateLedgerEntry `json:"ledger_entries,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	JSON     ledgerEventHandlerDeleteResponseLedgerTransactionTemplateJSON
}

func (*LedgerEventHandlerDeleteResponseLedgerTransactionTemplate) UnmarshalJSON

type LedgerEventHandlerDeleteResponseLedgerTransactionTemplateLedgerEntry

type LedgerEventHandlerDeleteResponseLedgerTransactionTemplateLedgerEntry struct {
	// The field you're fetching from the `ledgerable_event`.
	Amount string `json:"amount,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Direction string `json:"direction,required"`
	// What raw string you are comparing the `field` against.
	LedgerAccountID string `json:"ledger_account_id,required"`
	JSON            ledgerEventHandlerDeleteResponseLedgerTransactionTemplateLedgerEntryJSON
}

func (*LedgerEventHandlerDeleteResponseLedgerTransactionTemplateLedgerEntry) UnmarshalJSON

type LedgerEventHandlerGetResponse

type LedgerEventHandlerGetResponse struct {
	ID         string                                  `json:"id,required" format:"uuid"`
	Conditions LedgerEventHandlerGetResponseConditions `json:"conditions,required,nullable"`
	CreatedAt  time.Time                               `json:"created_at,required" format:"date-time"`
	// An optional description.
	Description               string                                                 `json:"description,required,nullable"`
	DiscardedAt               time.Time                                              `json:"discarded_at,required,nullable" format:"date-time"`
	LedgerTransactionTemplate LedgerEventHandlerGetResponseLedgerTransactionTemplate `json:"ledger_transaction_template,required"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	// Name of the ledger event handler.
	Name      string    `json:"name,required"`
	Object    string    `json:"object,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      ledgerEventHandlerGetResponseJSON
}

func (*LedgerEventHandlerGetResponse) UnmarshalJSON

func (r *LedgerEventHandlerGetResponse) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerGetResponseConditions

type LedgerEventHandlerGetResponseConditions struct {
	// The field you're fetching from the `ledgerable_event`.
	Field string `json:"field,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Operator string `json:"operator,required"`
	// What raw string you are comparing the `field` against.
	Value string `json:"value,required"`
	JSON  ledgerEventHandlerGetResponseConditionsJSON
}

func (*LedgerEventHandlerGetResponseConditions) UnmarshalJSON

func (r *LedgerEventHandlerGetResponseConditions) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerGetResponseLedgerTransactionTemplate

type LedgerEventHandlerGetResponseLedgerTransactionTemplate struct {
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt string `json:"effective_at,required,nullable" format:"datetime"`
	// An array of ledger entry objects.
	LedgerEntries []LedgerEventHandlerGetResponseLedgerTransactionTemplateLedgerEntry `json:"ledger_entries,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	JSON     ledgerEventHandlerGetResponseLedgerTransactionTemplateJSON
}

func (*LedgerEventHandlerGetResponseLedgerTransactionTemplate) UnmarshalJSON

func (r *LedgerEventHandlerGetResponseLedgerTransactionTemplate) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerGetResponseLedgerTransactionTemplateLedgerEntry

type LedgerEventHandlerGetResponseLedgerTransactionTemplateLedgerEntry struct {
	// The field you're fetching from the `ledgerable_event`.
	Amount string `json:"amount,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Direction string `json:"direction,required"`
	// What raw string you are comparing the `field` against.
	LedgerAccountID string `json:"ledger_account_id,required"`
	JSON            ledgerEventHandlerGetResponseLedgerTransactionTemplateLedgerEntryJSON
}

func (*LedgerEventHandlerGetResponseLedgerTransactionTemplateLedgerEntry) UnmarshalJSON

type LedgerEventHandlerListParams

type LedgerEventHandlerListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// posted at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use
	// created_at%5Bgt%5D=2000-01-01T12:00:00Z.
	CreatedAt param.Field[map[string]time.Time] `query:"created_at" format:"date-time"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	Name     param.Field[string]            `query:"name"`
	PerPage  param.Field[int64]             `query:"per_page"`
}

func (LedgerEventHandlerListParams) URLQuery

func (r LedgerEventHandlerListParams) URLQuery() (v url.Values)

URLQuery serializes LedgerEventHandlerListParams's query parameters as `url.Values`.

type LedgerEventHandlerListResponse

type LedgerEventHandlerListResponse struct {
	ID         string                                   `json:"id,required" format:"uuid"`
	Conditions LedgerEventHandlerListResponseConditions `json:"conditions,required,nullable"`
	CreatedAt  time.Time                                `json:"created_at,required" format:"date-time"`
	// An optional description.
	Description               string                                                  `json:"description,required,nullable"`
	DiscardedAt               time.Time                                               `json:"discarded_at,required,nullable" format:"date-time"`
	LedgerTransactionTemplate LedgerEventHandlerListResponseLedgerTransactionTemplate `json:"ledger_transaction_template,required"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	// Name of the ledger event handler.
	Name      string    `json:"name,required"`
	Object    string    `json:"object,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      ledgerEventHandlerListResponseJSON
}

func (*LedgerEventHandlerListResponse) UnmarshalJSON

func (r *LedgerEventHandlerListResponse) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerListResponseConditions

type LedgerEventHandlerListResponseConditions struct {
	// The field you're fetching from the `ledgerable_event`.
	Field string `json:"field,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Operator string `json:"operator,required"`
	// What raw string you are comparing the `field` against.
	Value string `json:"value,required"`
	JSON  ledgerEventHandlerListResponseConditionsJSON
}

func (*LedgerEventHandlerListResponseConditions) UnmarshalJSON

func (r *LedgerEventHandlerListResponseConditions) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerListResponseLedgerTransactionTemplate

type LedgerEventHandlerListResponseLedgerTransactionTemplate struct {
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt string `json:"effective_at,required,nullable" format:"datetime"`
	// An array of ledger entry objects.
	LedgerEntries []LedgerEventHandlerListResponseLedgerTransactionTemplateLedgerEntry `json:"ledger_entries,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	JSON     ledgerEventHandlerListResponseLedgerTransactionTemplateJSON
}

func (*LedgerEventHandlerListResponseLedgerTransactionTemplate) UnmarshalJSON

type LedgerEventHandlerListResponseLedgerTransactionTemplateLedgerEntry

type LedgerEventHandlerListResponseLedgerTransactionTemplateLedgerEntry struct {
	// The field you're fetching from the `ledgerable_event`.
	Amount string `json:"amount,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Direction string `json:"direction,required"`
	// What raw string you are comparing the `field` against.
	LedgerAccountID string `json:"ledger_account_id,required"`
	JSON            ledgerEventHandlerListResponseLedgerTransactionTemplateLedgerEntryJSON
}

func (*LedgerEventHandlerListResponseLedgerTransactionTemplateLedgerEntry) UnmarshalJSON

type LedgerEventHandlerNewParams

type LedgerEventHandlerNewParams struct {
	LedgerTransactionTemplate param.Field[LedgerEventHandlerNewParamsLedgerTransactionTemplate] `json:"ledger_transaction_template,required"`
	// Name of the ledger event handler.
	Name       param.Field[string]                                `json:"name,required"`
	Conditions param.Field[LedgerEventHandlerNewParamsConditions] `json:"conditions"`
	// An optional description.
	Description param.Field[string] `json:"description"`
	// The id of the ledger that this account belongs to.
	LedgerID param.Field[string] `json:"ledger_id" format:"uuid"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerEventHandlerNewParams) MarshalJSON

func (r LedgerEventHandlerNewParams) MarshalJSON() (data []byte, err error)

type LedgerEventHandlerNewParamsConditions

type LedgerEventHandlerNewParamsConditions struct {
	// The field you're fetching from the `ledgerable_event`.
	Field param.Field[string] `json:"field,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Operator param.Field[string] `json:"operator,required"`
	// What raw string you are comparing the `field` against.
	Value param.Field[string] `json:"value,required"`
}

func (LedgerEventHandlerNewParamsConditions) MarshalJSON

func (r LedgerEventHandlerNewParamsConditions) MarshalJSON() (data []byte, err error)

type LedgerEventHandlerNewParamsLedgerTransactionTemplate

type LedgerEventHandlerNewParamsLedgerTransactionTemplate struct {
	// An optional description for internal use.
	Description param.Field[string] `json:"description,required"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt param.Field[string] `json:"effective_at,required" format:"datetime"`
	// An array of ledger entry objects.
	LedgerEntries param.Field[[]LedgerEventHandlerNewParamsLedgerTransactionTemplateLedgerEntry] `json:"ledger_entries,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata,required"`
}

func (LedgerEventHandlerNewParamsLedgerTransactionTemplate) MarshalJSON

func (r LedgerEventHandlerNewParamsLedgerTransactionTemplate) MarshalJSON() (data []byte, err error)

type LedgerEventHandlerNewParamsLedgerTransactionTemplateLedgerEntry

type LedgerEventHandlerNewParamsLedgerTransactionTemplateLedgerEntry struct {
	// The field you're fetching from the `ledgerable_event`.
	Amount param.Field[string] `json:"amount,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Direction param.Field[string] `json:"direction,required"`
	// What raw string you are comparing the `field` against.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required"`
}

func (LedgerEventHandlerNewParamsLedgerTransactionTemplateLedgerEntry) MarshalJSON

type LedgerEventHandlerNewResponse

type LedgerEventHandlerNewResponse struct {
	ID         string                                  `json:"id,required" format:"uuid"`
	Conditions LedgerEventHandlerNewResponseConditions `json:"conditions,required,nullable"`
	CreatedAt  time.Time                               `json:"created_at,required" format:"date-time"`
	// An optional description.
	Description               string                                                 `json:"description,required,nullable"`
	DiscardedAt               time.Time                                              `json:"discarded_at,required,nullable" format:"date-time"`
	LedgerTransactionTemplate LedgerEventHandlerNewResponseLedgerTransactionTemplate `json:"ledger_transaction_template,required"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	// Name of the ledger event handler.
	Name      string    `json:"name,required"`
	Object    string    `json:"object,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      ledgerEventHandlerNewResponseJSON
}

func (*LedgerEventHandlerNewResponse) UnmarshalJSON

func (r *LedgerEventHandlerNewResponse) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerNewResponseConditions

type LedgerEventHandlerNewResponseConditions struct {
	// The field you're fetching from the `ledgerable_event`.
	Field string `json:"field,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Operator string `json:"operator,required"`
	// What raw string you are comparing the `field` against.
	Value string `json:"value,required"`
	JSON  ledgerEventHandlerNewResponseConditionsJSON
}

func (*LedgerEventHandlerNewResponseConditions) UnmarshalJSON

func (r *LedgerEventHandlerNewResponseConditions) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerNewResponseLedgerTransactionTemplate

type LedgerEventHandlerNewResponseLedgerTransactionTemplate struct {
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt string `json:"effective_at,required,nullable" format:"datetime"`
	// An array of ledger entry objects.
	LedgerEntries []LedgerEventHandlerNewResponseLedgerTransactionTemplateLedgerEntry `json:"ledger_entries,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	JSON     ledgerEventHandlerNewResponseLedgerTransactionTemplateJSON
}

func (*LedgerEventHandlerNewResponseLedgerTransactionTemplate) UnmarshalJSON

func (r *LedgerEventHandlerNewResponseLedgerTransactionTemplate) UnmarshalJSON(data []byte) (err error)

type LedgerEventHandlerNewResponseLedgerTransactionTemplateLedgerEntry

type LedgerEventHandlerNewResponseLedgerTransactionTemplateLedgerEntry struct {
	// The field you're fetching from the `ledgerable_event`.
	Amount string `json:"amount,required"`
	// What the operator between the `field` and `value` is. Currently only supports
	// `equals`.
	Direction string `json:"direction,required"`
	// What raw string you are comparing the `field` against.
	LedgerAccountID string `json:"ledger_account_id,required"`
	JSON            ledgerEventHandlerNewResponseLedgerTransactionTemplateLedgerEntryJSON
}

func (*LedgerEventHandlerNewResponseLedgerTransactionTemplateLedgerEntry) UnmarshalJSON

type LedgerEventHandlerService

type LedgerEventHandlerService struct {
	Options []option.RequestOption
}

LedgerEventHandlerService 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 NewLedgerEventHandlerService method instead.

func NewLedgerEventHandlerService

func NewLedgerEventHandlerService(opts ...option.RequestOption) (r *LedgerEventHandlerService)

NewLedgerEventHandlerService 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 (*LedgerEventHandlerService) Delete

Archive a ledger event handler.

func (*LedgerEventHandlerService) Get

Get details on a single ledger event handler.

func (*LedgerEventHandlerService) List

Get a list of ledger event handlers.

func (*LedgerEventHandlerService) ListAutoPaging

Get a list of ledger event handlers.

func (*LedgerEventHandlerService) New

create ledger_event_handler

type LedgerListParams

type LedgerListParams struct {
	// If you have specific IDs to retrieve in bulk, you can pass them as query
	// parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
	ID          param.Field[[]string] `query:"id"`
	AfterCursor param.Field[string]   `query:"after_cursor"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	PerPage  param.Field[int64]             `query:"per_page"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// posted at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use
	// updated_at%5Bgt%5D=2000-01-01T12:00:00Z.
	UpdatedAt param.Field[map[string]time.Time] `query:"updated_at" format:"date-time"`
}

func (LedgerListParams) URLQuery

func (r LedgerListParams) URLQuery() (v url.Values)

URLQuery serializes LedgerListParams's query parameters as `url.Values`.

type LedgerNewParams

type LedgerNewParams struct {
	// The name of the ledger.
	Name param.Field[string] `json:"name,required"`
	// An optional free-form description for internal use.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerNewParams) MarshalJSON

func (r LedgerNewParams) MarshalJSON() (data []byte, err error)

type LedgerService

type LedgerService struct {
	Options []option.RequestOption
}

LedgerService 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 NewLedgerService method instead.

func NewLedgerService

func NewLedgerService(opts ...option.RequestOption) (r *LedgerService)

NewLedgerService 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 (*LedgerService) Delete

func (r *LedgerService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *Ledger, err error)

Delete a ledger.

func (*LedgerService) Get

func (r *LedgerService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Ledger, err error)

Get details on a single ledger.

func (*LedgerService) List

func (r *LedgerService) List(ctx context.Context, query LedgerListParams, opts ...option.RequestOption) (res *shared.Page[Ledger], err error)

Get a list of ledgers.

func (*LedgerService) ListAutoPaging

func (r *LedgerService) ListAutoPaging(ctx context.Context, query LedgerListParams, opts ...option.RequestOption) *shared.PageAutoPager[Ledger]

Get a list of ledgers.

func (*LedgerService) New

func (r *LedgerService) New(ctx context.Context, body LedgerNewParams, opts ...option.RequestOption) (res *Ledger, err error)

Create a ledger.

func (*LedgerService) Update

func (r *LedgerService) Update(ctx context.Context, id string, body LedgerUpdateParams, opts ...option.RequestOption) (res *Ledger, err error)

Update the details of a ledger.

type LedgerTransaction

type LedgerTransaction struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt time.Time `json:"effective_at,required" format:"date"`
	// The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
	// purposes.
	EffectiveDate time.Time `json:"effective_date,required" format:"date"`
	// A unique string to represent the ledger transaction. Only one pending or posted
	// ledger transaction may have this ID in the ledger.
	ExternalID string `json:"external_id,required,nullable"`
	// An array of ledger entry objects.
	LedgerEntries []LedgerEntry `json:"ledger_entries,required"`
	// The ID of the ledger this ledger transaction belongs to.
	LedgerID string `json:"ledger_id,required" 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,required,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, or reversal.
	LedgerableType LedgerTransactionLedgerableType `json:"ledgerable_type,required,nullable"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The time on which the ledger transaction posted. This is null if the ledger
	// transaction is pending.
	PostedAt string `json:"posted_at,required,nullable" format:"time"`
	// The ID of the original ledger transaction that this ledger transaction reverses.
	ReversesLedgerTransactionID string `json:"reverses_ledger_transaction_id,required,nullable"`
	// To post a ledger transaction at creation, use `posted`.
	Status    LedgerTransactionStatus `json:"status,required"`
	UpdatedAt time.Time               `json:"updated_at,required" format:"date-time"`
	JSON      ledgerTransactionJSON
}

func (*LedgerTransaction) UnmarshalJSON

func (r *LedgerTransaction) UnmarshalJSON(data []byte) (err error)

type LedgerTransactionLedgerableType

type LedgerTransactionLedgerableType string

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, or reversal.

const (
	LedgerTransactionLedgerableTypeCounterparty          LedgerTransactionLedgerableType = "counterparty"
	LedgerTransactionLedgerableTypeExpectedPayment       LedgerTransactionLedgerableType = "expected_payment"
	LedgerTransactionLedgerableTypeIncomingPaymentDetail LedgerTransactionLedgerableType = "incoming_payment_detail"
	LedgerTransactionLedgerableTypeInternalAccount       LedgerTransactionLedgerableType = "internal_account"
	LedgerTransactionLedgerableTypeLineItem              LedgerTransactionLedgerableType = "line_item"
	LedgerTransactionLedgerableTypePaperItem             LedgerTransactionLedgerableType = "paper_item"
	LedgerTransactionLedgerableTypePaymentOrder          LedgerTransactionLedgerableType = "payment_order"
	LedgerTransactionLedgerableTypePaymentOrderAttempt   LedgerTransactionLedgerableType = "payment_order_attempt"
	LedgerTransactionLedgerableTypeReturn                LedgerTransactionLedgerableType = "return"
	LedgerTransactionLedgerableTypeReversal              LedgerTransactionLedgerableType = "reversal"
)

type LedgerTransactionListParams

type LedgerTransactionListParams struct {
	// If you have specific IDs to retrieve in bulk, you can pass them as query
	// parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
	ID          param.Field[[]string] `query:"id"`
	AfterCursor param.Field[string]   `query:"after_cursor"`
	// Use "gt" (>), "gte" (>=), "lt" (<), "lte" (<=), or "eq" (=) to filter by
	// effective at. For example, for all transactions after Jan 1 2000, use
	// effective_at%5Bgt%5D=2000-01-01T00:00:00:00.000Z.
	EffectiveAt param.Field[map[string]string] `query:"effective_at" format:"time"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by
	// effective date. For example, for all dates after Jan 1 2000, use
	// effective_date%5Bgt%5D=2000-01-01.
	EffectiveDate           param.Field[map[string]time.Time]                      `query:"effective_date" format:"date-time"`
	ExternalID              param.Field[string]                                    `query:"external_id"`
	LedgerAccountCategoryID param.Field[string]                                    `query:"ledger_account_category_id"`
	LedgerAccountID         param.Field[string]                                    `query:"ledger_account_id"`
	LedgerAccountPayoutID   param.Field[string]                                    `query:"ledger_account_payout_id"`
	LedgerID                param.Field[string]                                    `query:"ledger_id"`
	LedgerableID            param.Field[string]                                    `query:"ledgerable_id"`
	LedgerableType          param.Field[LedgerTransactionListParamsLedgerableType] `query:"ledgerable_type"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	// Order by `created_at` or `effective_at` in `asc` or `desc` order. For example,
	// to order by `effective_at asc`, use `order_by%5Beffective_at%5D=asc`. Ordering
	// by only one field at a time is supported.
	OrderBy param.Field[LedgerTransactionListParamsOrderBy] `query:"order_by"`
	PerPage param.Field[int64]                              `query:"per_page"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// posted at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use
	// posted_at%5Bgt%5D=2000-01-01T12:00:00Z.
	PostedAt                    param.Field[map[string]time.Time]              `query:"posted_at" format:"date-time"`
	ReversesLedgerTransactionID param.Field[string]                            `query:"reverses_ledger_transaction_id"`
	Status                      param.Field[LedgerTransactionListParamsStatus] `query:"status"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// posted at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use
	// updated_at%5Bgt%5D=2000-01-01T12:00:00Z.
	UpdatedAt param.Field[map[string]time.Time] `query:"updated_at" format:"date-time"`
}

func (LedgerTransactionListParams) URLQuery

func (r LedgerTransactionListParams) URLQuery() (v url.Values)

URLQuery serializes LedgerTransactionListParams's query parameters as `url.Values`.

type LedgerTransactionListParamsLedgerableType

type LedgerTransactionListParamsLedgerableType string
const (
	LedgerTransactionListParamsLedgerableTypeCounterparty          LedgerTransactionListParamsLedgerableType = "counterparty"
	LedgerTransactionListParamsLedgerableTypeExpectedPayment       LedgerTransactionListParamsLedgerableType = "expected_payment"
	LedgerTransactionListParamsLedgerableTypeIncomingPaymentDetail LedgerTransactionListParamsLedgerableType = "incoming_payment_detail"
	LedgerTransactionListParamsLedgerableTypeInternalAccount       LedgerTransactionListParamsLedgerableType = "internal_account"
	LedgerTransactionListParamsLedgerableTypeLineItem              LedgerTransactionListParamsLedgerableType = "line_item"
	LedgerTransactionListParamsLedgerableTypePaperItem             LedgerTransactionListParamsLedgerableType = "paper_item"
	LedgerTransactionListParamsLedgerableTypePaymentOrder          LedgerTransactionListParamsLedgerableType = "payment_order"
	LedgerTransactionListParamsLedgerableTypePaymentOrderAttempt   LedgerTransactionListParamsLedgerableType = "payment_order_attempt"
	LedgerTransactionListParamsLedgerableTypeReturn                LedgerTransactionListParamsLedgerableType = "return"
	LedgerTransactionListParamsLedgerableTypeReversal              LedgerTransactionListParamsLedgerableType = "reversal"
)

type LedgerTransactionListParamsOrderBy

type LedgerTransactionListParamsOrderBy struct {
	CreatedAt   param.Field[LedgerTransactionListParamsOrderByCreatedAt]   `query:"created_at"`
	EffectiveAt param.Field[LedgerTransactionListParamsOrderByEffectiveAt] `query:"effective_at"`
}

Order by `created_at` or `effective_at` in `asc` or `desc` order. For example, to order by `effective_at asc`, use `order_by%5Beffective_at%5D=asc`. Ordering by only one field at a time is supported.

func (LedgerTransactionListParamsOrderBy) URLQuery

URLQuery serializes LedgerTransactionListParamsOrderBy's query parameters as `url.Values`.

type LedgerTransactionListParamsOrderByCreatedAt

type LedgerTransactionListParamsOrderByCreatedAt string
const (
	LedgerTransactionListParamsOrderByCreatedAtAsc  LedgerTransactionListParamsOrderByCreatedAt = "asc"
	LedgerTransactionListParamsOrderByCreatedAtDesc LedgerTransactionListParamsOrderByCreatedAt = "desc"
)

type LedgerTransactionListParamsOrderByEffectiveAt

type LedgerTransactionListParamsOrderByEffectiveAt string
const (
	LedgerTransactionListParamsOrderByEffectiveAtAsc  LedgerTransactionListParamsOrderByEffectiveAt = "asc"
	LedgerTransactionListParamsOrderByEffectiveAtDesc LedgerTransactionListParamsOrderByEffectiveAt = "desc"
)

type LedgerTransactionListParamsStatus

type LedgerTransactionListParamsStatus string
const (
	LedgerTransactionListParamsStatusPending  LedgerTransactionListParamsStatus = "pending"
	LedgerTransactionListParamsStatusPosted   LedgerTransactionListParamsStatus = "posted"
	LedgerTransactionListParamsStatusArchived LedgerTransactionListParamsStatus = "archived"
)

type LedgerTransactionNewParams

type LedgerTransactionNewParams struct {
	// An array of ledger entry objects.
	LedgerEntries param.Field[[]LedgerTransactionNewParamsLedgerEntry] `json:"ledger_entries,required"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date"`
	// The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
	// purposes.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// A unique string to represent the ledger transaction. Only one pending or posted
	// ledger transaction may have this ID in the ledger.
	ExternalID param.Field[string] `json:"external_id"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the id will be populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the type will be populated here, otherwise null. This can be one of
	// payment_order, incoming_payment_detail, expected_payment, return, or reversal.
	LedgerableType param.Field[LedgerTransactionNewParamsLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// To post a ledger transaction at creation, use `posted`.
	Status param.Field[LedgerTransactionNewParamsStatus] `json:"status"`
}

func (LedgerTransactionNewParams) MarshalJSON

func (r LedgerTransactionNewParams) MarshalJSON() (data []byte, err error)

type LedgerTransactionNewParamsLedgerEntriesDirection

type LedgerTransactionNewParamsLedgerEntriesDirection string

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`.

const (
	LedgerTransactionNewParamsLedgerEntriesDirectionCredit LedgerTransactionNewParamsLedgerEntriesDirection = "credit"
	LedgerTransactionNewParamsLedgerEntriesDirectionDebit  LedgerTransactionNewParamsLedgerEntriesDirection = "debit"
)

type LedgerTransactionNewParamsLedgerEntry

type LedgerTransactionNewParamsLedgerEntry struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount param.Field[int64] `json:"amount,required"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[LedgerTransactionNewParamsLedgerEntriesDirection] `json:"direction,required"`
	// The ledger account that this ledger entry is associated with.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required" format:"uuid"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s available balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	AvailableBalanceAmount param.Field[map[string]int64] `json:"available_balance_amount"`
	// Lock version of the ledger account. This can be passed when creating a ledger
	// transaction to only succeed if no ledger transactions have posted since the
	// given version. See our post about Designing the Ledgers API with Optimistic
	// Locking for more details.
	LockVersion param.Field[int64] `json:"lock_version"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s pending balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PendingBalanceAmount param.Field[map[string]int64] `json:"pending_balance_amount"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s posted balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PostedBalanceAmount param.Field[map[string]int64] `json:"posted_balance_amount"`
	// If true, response will include the balance of the associated ledger account for
	// the entry.
	ShowResultingLedgerAccountBalances param.Field[bool] `json:"show_resulting_ledger_account_balances"`
}

func (LedgerTransactionNewParamsLedgerEntry) MarshalJSON

func (r LedgerTransactionNewParamsLedgerEntry) MarshalJSON() (data []byte, err error)

type LedgerTransactionNewParamsLedgerableType

type LedgerTransactionNewParamsLedgerableType string

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, or reversal.

const (
	LedgerTransactionNewParamsLedgerableTypeCounterparty          LedgerTransactionNewParamsLedgerableType = "counterparty"
	LedgerTransactionNewParamsLedgerableTypeExpectedPayment       LedgerTransactionNewParamsLedgerableType = "expected_payment"
	LedgerTransactionNewParamsLedgerableTypeIncomingPaymentDetail LedgerTransactionNewParamsLedgerableType = "incoming_payment_detail"
	LedgerTransactionNewParamsLedgerableTypeInternalAccount       LedgerTransactionNewParamsLedgerableType = "internal_account"
	LedgerTransactionNewParamsLedgerableTypeLineItem              LedgerTransactionNewParamsLedgerableType = "line_item"
	LedgerTransactionNewParamsLedgerableTypePaperItem             LedgerTransactionNewParamsLedgerableType = "paper_item"
	LedgerTransactionNewParamsLedgerableTypePaymentOrder          LedgerTransactionNewParamsLedgerableType = "payment_order"
	LedgerTransactionNewParamsLedgerableTypePaymentOrderAttempt   LedgerTransactionNewParamsLedgerableType = "payment_order_attempt"
	LedgerTransactionNewParamsLedgerableTypeReturn                LedgerTransactionNewParamsLedgerableType = "return"
	LedgerTransactionNewParamsLedgerableTypeReversal              LedgerTransactionNewParamsLedgerableType = "reversal"
)

type LedgerTransactionNewParamsStatus

type LedgerTransactionNewParamsStatus string

To post a ledger transaction at creation, use `posted`.

const (
	LedgerTransactionNewParamsStatusArchived LedgerTransactionNewParamsStatus = "archived"
	LedgerTransactionNewParamsStatusPending  LedgerTransactionNewParamsStatus = "pending"
	LedgerTransactionNewParamsStatusPosted   LedgerTransactionNewParamsStatus = "posted"
)

type LedgerTransactionNewReversalParams

type LedgerTransactionNewReversalParams struct {
	// An optional free-form description for the reversal ledger transaction. Maximum
	// of 1000 characters allowed.
	Description param.Field[string] `json:"description"`
	// The timestamp (ISO8601 format) at which the reversal ledger transaction happened
	// for reporting purposes. It defaults to the `effective_at` of the original ledger
	// transaction if not provided.
	EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date-time"`
	// Must be unique within the ledger.
	ExternalID param.Field[string] `json:"external_id"`
	// Specify this if you'd like to link the reversal ledger transaction to a Payment
	// object like Return or Reversal.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// Specify this if you'd like to link the reversal ledger transaction to a Payment
	// object like Return or Reversal.
	LedgerableType param.Field[LedgerTransactionNewReversalParamsLedgerableType] `json:"ledgerable_type"`
	// Additional data to be added to the reversal ledger transaction as key-value
	// pairs. Both the key and value must be strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// Status of the reversal ledger transaction. It defaults to `posted` if not
	// provided.
	Status param.Field[LedgerTransactionNewReversalParamsStatus] `json:"status"`
}

func (LedgerTransactionNewReversalParams) MarshalJSON

func (r LedgerTransactionNewReversalParams) MarshalJSON() (data []byte, err error)

type LedgerTransactionNewReversalParamsLedgerableType

type LedgerTransactionNewReversalParamsLedgerableType string

Specify this if you'd like to link the reversal ledger transaction to a Payment object like Return or Reversal.

const (
	LedgerTransactionNewReversalParamsLedgerableTypeCounterparty          LedgerTransactionNewReversalParamsLedgerableType = "counterparty"
	LedgerTransactionNewReversalParamsLedgerableTypeExpectedPayment       LedgerTransactionNewReversalParamsLedgerableType = "expected_payment"
	LedgerTransactionNewReversalParamsLedgerableTypeIncomingPaymentDetail LedgerTransactionNewReversalParamsLedgerableType = "incoming_payment_detail"
	LedgerTransactionNewReversalParamsLedgerableTypeInternalAccount       LedgerTransactionNewReversalParamsLedgerableType = "internal_account"
	LedgerTransactionNewReversalParamsLedgerableTypeLineItem              LedgerTransactionNewReversalParamsLedgerableType = "line_item"
	LedgerTransactionNewReversalParamsLedgerableTypePaperItem             LedgerTransactionNewReversalParamsLedgerableType = "paper_item"
	LedgerTransactionNewReversalParamsLedgerableTypePaymentOrder          LedgerTransactionNewReversalParamsLedgerableType = "payment_order"
	LedgerTransactionNewReversalParamsLedgerableTypePaymentOrderAttempt   LedgerTransactionNewReversalParamsLedgerableType = "payment_order_attempt"
	LedgerTransactionNewReversalParamsLedgerableTypeReturn                LedgerTransactionNewReversalParamsLedgerableType = "return"
	LedgerTransactionNewReversalParamsLedgerableTypeReversal              LedgerTransactionNewReversalParamsLedgerableType = "reversal"
)

type LedgerTransactionNewReversalParamsStatus

type LedgerTransactionNewReversalParamsStatus string

Status of the reversal ledger transaction. It defaults to `posted` if not provided.

const (
	LedgerTransactionNewReversalParamsStatusArchived LedgerTransactionNewReversalParamsStatus = "archived"
	LedgerTransactionNewReversalParamsStatusPending  LedgerTransactionNewReversalParamsStatus = "pending"
	LedgerTransactionNewReversalParamsStatusPosted   LedgerTransactionNewReversalParamsStatus = "posted"
)

type LedgerTransactionService

type LedgerTransactionService struct {
	Options  []option.RequestOption
	Versions *LedgerTransactionVersionService
}

LedgerTransactionService 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 NewLedgerTransactionService method instead.

func NewLedgerTransactionService

func NewLedgerTransactionService(opts ...option.RequestOption) (r *LedgerTransactionService)

NewLedgerTransactionService 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 (*LedgerTransactionService) Get

Get details on a single ledger transaction.

func (*LedgerTransactionService) List

Get a list of ledger transactions.

func (*LedgerTransactionService) ListAutoPaging

Get a list of ledger transactions.

func (*LedgerTransactionService) New

Create a ledger transaction.

func (*LedgerTransactionService) NewReversal

Create a ledger transaction reversal.

func (*LedgerTransactionService) Update

Update the details of a ledger transaction.

type LedgerTransactionStatus

type LedgerTransactionStatus string

To post a ledger transaction at creation, use `posted`.

const (
	LedgerTransactionStatusArchived LedgerTransactionStatus = "archived"
	LedgerTransactionStatusPending  LedgerTransactionStatus = "pending"
	LedgerTransactionStatusPosted   LedgerTransactionStatus = "posted"
)

type LedgerTransactionUpdateParams

type LedgerTransactionUpdateParams struct {
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date"`
	// An array of ledger entry objects.
	LedgerEntries param.Field[[]LedgerTransactionUpdateParamsLedgerEntry] `json:"ledger_entries"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// To post a ledger transaction at creation, use `posted`.
	Status param.Field[LedgerTransactionUpdateParamsStatus] `json:"status"`
}

func (LedgerTransactionUpdateParams) MarshalJSON

func (r LedgerTransactionUpdateParams) MarshalJSON() (data []byte, err error)

type LedgerTransactionUpdateParamsLedgerEntriesDirection

type LedgerTransactionUpdateParamsLedgerEntriesDirection string

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`.

const (
	LedgerTransactionUpdateParamsLedgerEntriesDirectionCredit LedgerTransactionUpdateParamsLedgerEntriesDirection = "credit"
	LedgerTransactionUpdateParamsLedgerEntriesDirectionDebit  LedgerTransactionUpdateParamsLedgerEntriesDirection = "debit"
)

type LedgerTransactionUpdateParamsLedgerEntry

type LedgerTransactionUpdateParamsLedgerEntry struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount param.Field[int64] `json:"amount,required"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[LedgerTransactionUpdateParamsLedgerEntriesDirection] `json:"direction,required"`
	// The ledger account that this ledger entry is associated with.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required" format:"uuid"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s available balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	AvailableBalanceAmount param.Field[map[string]int64] `json:"available_balance_amount"`
	// Lock version of the ledger account. This can be passed when creating a ledger
	// transaction to only succeed if no ledger transactions have posted since the
	// given version. See our post about Designing the Ledgers API with Optimistic
	// Locking for more details.
	LockVersion param.Field[int64] `json:"lock_version"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s pending balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PendingBalanceAmount param.Field[map[string]int64] `json:"pending_balance_amount"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s posted balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PostedBalanceAmount param.Field[map[string]int64] `json:"posted_balance_amount"`
	// If true, response will include the balance of the associated ledger account for
	// the entry.
	ShowResultingLedgerAccountBalances param.Field[bool] `json:"show_resulting_ledger_account_balances"`
}

func (LedgerTransactionUpdateParamsLedgerEntry) MarshalJSON

func (r LedgerTransactionUpdateParamsLedgerEntry) MarshalJSON() (data []byte, err error)

type LedgerTransactionUpdateParamsStatus

type LedgerTransactionUpdateParamsStatus string

To post a ledger transaction at creation, use `posted`.

const (
	LedgerTransactionUpdateParamsStatusArchived LedgerTransactionUpdateParamsStatus = "archived"
	LedgerTransactionUpdateParamsStatusPending  LedgerTransactionUpdateParamsStatus = "pending"
	LedgerTransactionUpdateParamsStatusPosted   LedgerTransactionUpdateParamsStatus = "posted"
)

type LedgerTransactionVersion

type LedgerTransactionVersion struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt string `json:"effective_at,required" format:"time"`
	// The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
	// purposes.
	EffectiveDate time.Time `json:"effective_date,required" format:"date"`
	// A unique string to represent the ledger transaction. Only one pending or posted
	// ledger transaction may have this ID in the ledger.
	ExternalID string `json:"external_id,required,nullable"`
	// An array of ledger entry objects.
	LedgerEntries []LedgerTransactionVersionLedgerEntry `json:"ledger_entries,required"`
	// The ID of the ledger this ledger transaction belongs to.
	LedgerID string `json:"ledger_id,required" format:"uuid"`
	// The ID of the ledger transaction
	LedgerTransactionID string `json:"ledger_transaction_id,required" 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,required,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, or reversal.
	LedgerableType LedgerTransactionVersionLedgerableType `json:"ledgerable_type,required,nullable"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The time on which the ledger transaction posted. This is null if the ledger
	// transaction is pending.
	PostedAt string `json:"posted_at,required,nullable" format:"time"`
	// One of `pending`, `posted`, or `archived`
	Status LedgerTransactionVersionStatus `json:"status,required"`
	// Version number of the ledger transaction.
	Version int64 `json:"version,required"`
	JSON    ledgerTransactionVersionJSON
}

func (*LedgerTransactionVersion) UnmarshalJSON

func (r *LedgerTransactionVersion) UnmarshalJSON(data []byte) (err error)

type LedgerTransactionVersionLedgerEntriesDirection

type LedgerTransactionVersionLedgerEntriesDirection string

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`.

const (
	LedgerTransactionVersionLedgerEntriesDirectionCredit LedgerTransactionVersionLedgerEntriesDirection = "credit"
	LedgerTransactionVersionLedgerEntriesDirectionDebit  LedgerTransactionVersionLedgerEntriesDirection = "debit"
)

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalances

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalances struct {
	// The available_balance is the sum of all posted inbound entries and pending
	// outbound entries. For credit normal, available_amount = posted_credits -
	// pending_debits; for debit normal, available_amount = posted_debits -
	// pending_credits.
	AvailableBalance LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesAvailableBalance `json:"available_balance,required"`
	// The pending_balance is the sum of all pending and posted entries.
	PendingBalance LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPendingBalance `json:"pending_balance,required"`
	// The posted_balance is the sum of all posted entries.
	PostedBalance LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPostedBalance `json:"posted_balance,required"`
	JSON          ledgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesJSON
}

The pending, posted, and available balances for this ledger entry's ledger account. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts. Please see https://docs.moderntreasury.com/docs/transaction-status-and-balances for more details.

func (*LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalances) UnmarshalJSON

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesAvailableBalance

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesAvailableBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesAvailableBalanceJSON
}

The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits.

func (*LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesAvailableBalance) UnmarshalJSON

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPendingBalance

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPendingBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPendingBalanceJSON
}

The pending_balance is the sum of all pending and posted entries.

func (*LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPendingBalance) UnmarshalJSON

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPostedBalance

type LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPostedBalance struct {
	Amount  int64 `json:"amount,required"`
	Credits int64 `json:"credits,required"`
	// The currency of the ledger account.
	Currency string `json:"currency,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent int64 `json:"currency_exponent,required"`
	Debits           int64 `json:"debits,required"`
	JSON             ledgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPostedBalanceJSON
}

The posted_balance is the sum of all posted entries.

func (*LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalancesPostedBalance) UnmarshalJSON

type LedgerTransactionVersionLedgerEntriesStatus

type LedgerTransactionVersionLedgerEntriesStatus string

Equal to the state of the ledger transaction when the ledger entry was created. One of `pending`, `posted`, or `archived`.

const (
	LedgerTransactionVersionLedgerEntriesStatusArchived LedgerTransactionVersionLedgerEntriesStatus = "archived"
	LedgerTransactionVersionLedgerEntriesStatusPending  LedgerTransactionVersionLedgerEntriesStatus = "pending"
	LedgerTransactionVersionLedgerEntriesStatusPosted   LedgerTransactionVersionLedgerEntriesStatus = "posted"
)

type LedgerTransactionVersionLedgerEntry

type LedgerTransactionVersionLedgerEntry struct {
	ID string `json:"id,required" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount    int64     `json:"amount,required"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// 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 LedgerTransactionVersionLedgerEntriesDirection `json:"direction,required"`
	// The currency of the ledger account.
	LedgerAccountCurrency string `json:"ledger_account_currency,required"`
	// The currency exponent of the ledger account.
	LedgerAccountCurrencyExponent int64 `json:"ledger_account_currency_exponent,required"`
	// The ledger account that this ledger entry is associated with.
	LedgerAccountID string `json:"ledger_account_id,required" format:"uuid"`
	// Lock version of the ledger account. This can be passed when creating a ledger
	// transaction to only succeed if no ledger transactions have posted since the
	// given version. See our post about Designing the Ledgers API with Optimistic
	// Locking for more details.
	LedgerAccountLockVersion int64 `json:"ledger_account_lock_version,required,nullable"`
	// The ledger transaction that this ledger entry is associated with.
	LedgerTransactionID string `json:"ledger_transaction_id,required"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The pending, posted, and available balances for this ledger entry's ledger
	// account. The posted balance is the sum of all posted entries on the account. The
	// pending balance is the sum of all pending and posted entries on the account. The
	// available balance is the posted incoming entries minus the sum of the pending
	// and posted outgoing amounts. Please see
	// https://docs.moderntreasury.com/docs/transaction-status-and-balances for more
	// details.
	ResultingLedgerAccountBalances LedgerTransactionVersionLedgerEntriesResultingLedgerAccountBalances `json:"resulting_ledger_account_balances,required,nullable"`
	// Equal to the state of the ledger transaction when the ledger entry was created.
	// One of `pending`, `posted`, or `archived`.
	Status LedgerTransactionVersionLedgerEntriesStatus `json:"status,required"`
	JSON   ledgerTransactionVersionLedgerEntryJSON
}

func (*LedgerTransactionVersionLedgerEntry) UnmarshalJSON

func (r *LedgerTransactionVersionLedgerEntry) UnmarshalJSON(data []byte) (err error)

type LedgerTransactionVersionLedgerableType

type LedgerTransactionVersionLedgerableType string

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, or reversal.

const (
	LedgerTransactionVersionLedgerableTypeCounterparty          LedgerTransactionVersionLedgerableType = "counterparty"
	LedgerTransactionVersionLedgerableTypeExpectedPayment       LedgerTransactionVersionLedgerableType = "expected_payment"
	LedgerTransactionVersionLedgerableTypeIncomingPaymentDetail LedgerTransactionVersionLedgerableType = "incoming_payment_detail"
	LedgerTransactionVersionLedgerableTypeInternalAccount       LedgerTransactionVersionLedgerableType = "internal_account"
	LedgerTransactionVersionLedgerableTypeLineItem              LedgerTransactionVersionLedgerableType = "line_item"
	LedgerTransactionVersionLedgerableTypePaperItem             LedgerTransactionVersionLedgerableType = "paper_item"
	LedgerTransactionVersionLedgerableTypePaymentOrder          LedgerTransactionVersionLedgerableType = "payment_order"
	LedgerTransactionVersionLedgerableTypePaymentOrderAttempt   LedgerTransactionVersionLedgerableType = "payment_order_attempt"
	LedgerTransactionVersionLedgerableTypeReturn                LedgerTransactionVersionLedgerableType = "return"
	LedgerTransactionVersionLedgerableTypeReversal              LedgerTransactionVersionLedgerableType = "reversal"
)

type LedgerTransactionVersionListParams

type LedgerTransactionVersionListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// created_at timestamp. For example, for all dates after Jan 1 2000 12:00 UTC, use
	// created_at%5Bgt%5D=2000-01-01T12:00:00Z.
	CreatedAt param.Field[map[string]time.Time] `query:"created_at" format:"date-time"`
	// Get all ledger transaction versions that are included in the ledger account
	// statement.
	LedgerAccountStatementID param.Field[string] `query:"ledger_account_statement_id"`
	// Get all the ledger transaction versions corresponding to the ID of a ledger
	// transaction.
	LedgerTransactionID param.Field[string] `query:"ledger_transaction_id"`
	PerPage             param.Field[int64]  `query:"per_page"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
	// version. For example, for all versions after 2, use version%5Bgt%5D=2.
	Version param.Field[map[string]int64] `query:"version"`
}

func (LedgerTransactionVersionListParams) URLQuery

URLQuery serializes LedgerTransactionVersionListParams's query parameters as `url.Values`.

type LedgerTransactionVersionService

type LedgerTransactionVersionService struct {
	Options []option.RequestOption
}

LedgerTransactionVersionService 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 NewLedgerTransactionVersionService method instead.

func NewLedgerTransactionVersionService

func NewLedgerTransactionVersionService(opts ...option.RequestOption) (r *LedgerTransactionVersionService)

NewLedgerTransactionVersionService 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 (*LedgerTransactionVersionService) List

Get a list of ledger transaction versions.

func (*LedgerTransactionVersionService) ListAutoPaging

Get a list of ledger transaction versions.

type LedgerTransactionVersionStatus

type LedgerTransactionVersionStatus string

One of `pending`, `posted`, or `archived`

const (
	LedgerTransactionVersionStatusArchived LedgerTransactionVersionStatus = "archived"
	LedgerTransactionVersionStatusPending  LedgerTransactionVersionStatus = "pending"
	LedgerTransactionVersionStatusPosted   LedgerTransactionVersionStatus = "posted"
)

type LedgerUpdateParams

type LedgerUpdateParams struct {
	// An optional free-form description for internal use.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// The name of the ledger.
	Name param.Field[string] `json:"name"`
}

func (LedgerUpdateParams) MarshalJSON

func (r LedgerUpdateParams) MarshalJSON() (data []byte, err error)

type LedgerableEvent

type LedgerableEvent struct {
	ID string `json:"id,required" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount    int64     `json:"amount,required"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// An ISO 4217 conformed currency or a custom currency.
	Currency string `json:"currency,required"`
	// Must be included if currency is a custom currency. The currency_exponent cannot
	// exceed 30.
	CurrencyExponent int64 `json:"currency_exponent,required,nullable"`
	// Additionally data to be used by the Ledger Event Handler.
	CustomData interface{} `json:"custom_data,required,nullable"`
	// Description of the ledgerable event.
	Description string `json:"description,required,nullable"`
	// One of `credit`, `debit`.
	Direction string `json:"direction,required,nullable"`
	// Id of the ledger event handler that is used to create a ledger transaction.
	LedgerEventHandlerID string `json:"ledger_event_handler_id,required" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required,nullable"`
	// Name of the ledgerable event.
	Name      string    `json:"name,required"`
	Object    string    `json:"object,required"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      ledgerableEventJSON
}

func (*LedgerableEvent) UnmarshalJSON

func (r *LedgerableEvent) UnmarshalJSON(data []byte) (err error)

type LedgerableEventNewParams

type LedgerableEventNewParams struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount param.Field[int64] `json:"amount,required"`
	// Name of the ledgerable event.
	Name param.Field[string] `json:"name,required"`
	// An ISO 4217 conformed currency or a custom currency.
	Currency param.Field[string] `json:"currency"`
	// Must be included if currency is a custom currency. The currency_exponent cannot
	// exceed 30.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// Additionally data to be used by the Ledger Event Handler.
	CustomData param.Field[interface{}] `json:"custom_data"`
	// Description of the ledgerable event.
	Description param.Field[string] `json:"description"`
	// One of `credit`, `debit`.
	Direction param.Field[string] `json:"direction"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LedgerableEventNewParams) MarshalJSON

func (r LedgerableEventNewParams) MarshalJSON() (data []byte, err error)

type LedgerableEventService

type LedgerableEventService struct {
	Options []option.RequestOption
}

LedgerableEventService 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 NewLedgerableEventService method instead.

func NewLedgerableEventService

func NewLedgerableEventService(opts ...option.RequestOption) (r *LedgerableEventService)

NewLedgerableEventService 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 (*LedgerableEventService) Get

Get details on a single ledgerable event.

func (*LedgerableEventService) New

Translation missing: en.openapi.descriptions.ledger.operations.create_ledgerable_event

type LineItem

type LineItem struct {
	ID         string             `json:"id,required" format:"uuid"`
	Accounting LineItemAccounting `json:"accounting,required"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID string `json:"accounting_category_id,required,nullable" format:"uuid"`
	// The ID of one of the class objects in your accounting system. Class objects
	// track segments of your business independent of client or project. Note that
	// these will only be accessible if your accounting system has been connected.
	AccountingLedgerClassID string `json:"accounting_ledger_class_id,required,nullable" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount    int64     `json:"amount,required"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// A free-form description of the line item.
	Description string `json:"description,required,nullable"`
	// The ID of the payment order or expected payment.
	ItemizableID string `json:"itemizable_id,required" format:"uuid"`
	// One of `payment_orders` or `expected_payments`.
	ItemizableType LineItemItemizableType `json:"itemizable_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"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata  map[string]string `json:"metadata,required"`
	Object    string            `json:"object,required"`
	UpdatedAt time.Time         `json:"updated_at,required" format:"date-time"`
	JSON      lineItemJSON
}

func (*LineItem) UnmarshalJSON

func (r *LineItem) UnmarshalJSON(data []byte) (err error)

type LineItemAccounting

type LineItemAccounting struct {
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountID string `json:"account_id,nullable" format:"uuid"`
	// The ID of one of the class objects in your accounting system. Class objects
	// track segments of your business independent of client or project. Note that
	// these will only be accessible if your accounting system has been connected.
	ClassID string `json:"class_id,nullable" format:"uuid"`
	JSON    lineItemAccountingJSON
}

func (*LineItemAccounting) UnmarshalJSON

func (r *LineItemAccounting) UnmarshalJSON(data []byte) (err error)

type LineItemGetParamsItemizableType

type LineItemGetParamsItemizableType string
const (
	LineItemGetParamsItemizableTypeExpectedPayments LineItemGetParamsItemizableType = "expected_payments"
	LineItemGetParamsItemizableTypePaymentOrders    LineItemGetParamsItemizableType = "payment_orders"
)

type LineItemItemizableType

type LineItemItemizableType string

One of `payment_orders` or `expected_payments`.

const (
	LineItemItemizableTypeExpectedPayment LineItemItemizableType = "ExpectedPayment"
	LineItemItemizableTypePaymentOrder    LineItemItemizableType = "PaymentOrder"
)

type LineItemListParams

type LineItemListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	PerPage     param.Field[int64]  `query:"per_page"`
}

func (LineItemListParams) URLQuery

func (r LineItemListParams) URLQuery() (v url.Values)

URLQuery serializes LineItemListParams's query parameters as `url.Values`.

type LineItemListParamsItemizableType

type LineItemListParamsItemizableType string
const (
	LineItemListParamsItemizableTypeExpectedPayments LineItemListParamsItemizableType = "expected_payments"
	LineItemListParamsItemizableTypePaymentOrders    LineItemListParamsItemizableType = "payment_orders"
)

type LineItemService

type LineItemService struct {
	Options []option.RequestOption
}

LineItemService 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 NewLineItemService method instead.

func NewLineItemService

func NewLineItemService(opts ...option.RequestOption) (r *LineItemService)

NewLineItemService 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 (*LineItemService) Get

func (r *LineItemService) Get(ctx context.Context, itemizableType LineItemGetParamsItemizableType, itemizableID string, id string, opts ...option.RequestOption) (res *LineItem, err error)

Get a single line item

func (*LineItemService) List

func (r *LineItemService) List(ctx context.Context, itemizableType LineItemListParamsItemizableType, itemizableID string, query LineItemListParams, opts ...option.RequestOption) (res *shared.Page[LineItem], err error)

Get a list of line items

func (*LineItemService) ListAutoPaging

func (r *LineItemService) ListAutoPaging(ctx context.Context, itemizableType LineItemListParamsItemizableType, itemizableID string, query LineItemListParams, opts ...option.RequestOption) *shared.PageAutoPager[LineItem]

Get a list of line items

func (*LineItemService) Update

func (r *LineItemService) Update(ctx context.Context, itemizableType LineItemUpdateParamsItemizableType, itemizableID string, id string, body LineItemUpdateParams, opts ...option.RequestOption) (res *LineItem, err error)

update line item

type LineItemUpdateParams

type LineItemUpdateParams struct {
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (LineItemUpdateParams) MarshalJSON

func (r LineItemUpdateParams) MarshalJSON() (data []byte, err error)

type LineItemUpdateParamsItemizableType

type LineItemUpdateParamsItemizableType string
const (
	LineItemUpdateParamsItemizableTypeExpectedPayments LineItemUpdateParamsItemizableType = "expected_payments"
	LineItemUpdateParamsItemizableTypePaymentOrders    LineItemUpdateParamsItemizableType = "payment_orders"
)

type PaperItem

type PaperItem struct {
	ID string `json:"id,required" format:"uuid"`
	// The account number on the paper item.
	AccountNumber string `json:"account_number,required,nullable"`
	// The last 4 digits of the account_number.
	AccountNumberSafe string `json:"account_number_safe,required,nullable"`
	// The amount of the paper item.
	Amount int64 `json:"amount,required"`
	// The check number on the paper item.
	CheckNumber string    `json:"check_number,required,nullable"`
	CreatedAt   time.Time `json:"created_at,required" format:"date-time"`
	// The currency of the paper item.
	Currency shared.Currency `json:"currency,required,nullable"`
	// The date the paper item was deposited into your organization's bank account.
	DepositDate time.Time `json:"deposit_date,required" format:"date"`
	// 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"`
	// The identifier for the lockbox assigned by the bank.
	LockboxNumber string `json:"lockbox_number,required"`
	// The memo field on the paper item.
	MemoField string `json:"memo_field,required,nullable"`
	Object    string `json:"object,required"`
	// The name of the remitter on the paper item.
	RemitterName string `json:"remitter_name,required,nullable"`
	// The routing number on the paper item.
	RoutingNumber string `json:"routing_number,required,nullable"`
	// The current status of the paper item. One of `pending`, `completed`, or
	// `returned`.
	Status PaperItemStatus `json:"status,required"`
	// The ID of the reconciled Transaction or `null`.
	TransactionID string `json:"transaction_id,required,nullable" format:"uuid"`
	// The ID of the reconciled Transaction Line Item or `null`.
	TransactionLineItemID string    `json:"transaction_line_item_id,required,nullable" format:"uuid"`
	UpdatedAt             time.Time `json:"updated_at,required" format:"date-time"`
	JSON                  paperItemJSON
}

func (*PaperItem) UnmarshalJSON

func (r *PaperItem) UnmarshalJSON(data []byte) (err error)

type PaperItemListParams

type PaperItemListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Specify an inclusive end date (YYYY-MM-DD) when filtering by deposit_date
	DepositDateEnd param.Field[time.Time] `query:"deposit_date_end" format:"date"`
	// Specify an inclusive start date (YYYY-MM-DD) when filtering by deposit_date
	DepositDateStart param.Field[time.Time] `query:"deposit_date_start" format:"date"`
	// Specify `lockbox_number` if you wish to see paper items that are associated with
	// a specific lockbox number.
	LockboxNumber param.Field[string] `query:"lockbox_number"`
	PerPage       param.Field[int64]  `query:"per_page"`
}

func (PaperItemListParams) URLQuery

func (r PaperItemListParams) URLQuery() (v url.Values)

URLQuery serializes PaperItemListParams's query parameters as `url.Values`.

type PaperItemService

type PaperItemService struct {
	Options []option.RequestOption
}

PaperItemService 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 NewPaperItemService method instead.

func NewPaperItemService

func NewPaperItemService(opts ...option.RequestOption) (r *PaperItemService)

NewPaperItemService 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 (*PaperItemService) Get

func (r *PaperItemService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaperItem, err error)

Get details on a single paper item.

func (*PaperItemService) List

Get a list of all paper items.

func (*PaperItemService) ListAutoPaging

Get a list of all paper items.

type PaperItemStatus

type PaperItemStatus string

The current status of the paper item. One of `pending`, `completed`, or `returned`.

const (
	PaperItemStatusCompleted PaperItemStatus = "completed"
	PaperItemStatusPending   PaperItemStatus = "pending"
	PaperItemStatusReturned  PaperItemStatus = "returned"
)

type PaymentFlow

type PaymentFlow struct {
	ID string `json:"id" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount int64 `json:"amount"`
	// The client token of the payment flow. This token can be used to embed a payment
	// workflow in your client-side application.
	ClientToken string `json:"client_token"`
	// The ID of a counterparty associated with the payment. As part of the payment
	// workflow an external account will be associated with this counterparty.
	CounterpartyID string    `json:"counterparty_id,nullable" format:"uuid"`
	CreatedAt      time.Time `json:"created_at" format:"date-time"`
	// The currency of the payment.
	Currency string `json:"currency"`
	// Describes the direction money is flowing in the transaction. Can only be
	// `debit`. A `debit` pulls money from someone else's account to your own.
	Direction PaymentFlowDirection `json:"direction"`
	// The due date for the flow. Can only be passed in when
	// `effective_date_selection_enabled` is `true`.
	DueDate time.Time `json:"due_date,nullable" format:"date"`
	// When `true`, your end-user can schedule the payment `effective_date` while
	// completing the pre-built UI.
	EffectiveDateSelectionEnabled bool `json:"effective_date_selection_enabled"`
	// 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"`
	Object   string `json:"object"`
	// The ID of one of your organization's internal accounts.
	OriginatingAccountID string `json:"originating_account_id,nullable" format:"uuid"`
	// If present, the ID of the payment order created using this flow.
	PaymentOrderID string `json:"payment_order_id,nullable" format:"uuid"`
	// If present, the ID of the external account created using this flow.
	ReceivingAccountID string `json:"receiving_account_id,nullable" format:"uuid"`
	// This field is set after your end-user selects a payment date while completing
	// the pre-built UI. This field is always `null` unless
	// `effective_date_selection_enabled` is `true`.
	SelectedEffectiveDate time.Time `json:"selected_effective_date,nullable" format:"date"`
	// The current status of the payment flow. One of `pending`, `completed`,
	// `expired`, or `cancelled`.
	Status    PaymentFlowStatus `json:"status"`
	UpdatedAt time.Time         `json:"updated_at" format:"date-time"`
	JSON      paymentFlowJSON
}

func (*PaymentFlow) UnmarshalJSON

func (r *PaymentFlow) UnmarshalJSON(data []byte) (err error)

type PaymentFlowDirection

type PaymentFlowDirection string

Describes the direction money is flowing in the transaction. Can only be `debit`. A `debit` pulls money from someone else's account to your own.

const (
	PaymentFlowDirectionCredit PaymentFlowDirection = "credit"
	PaymentFlowDirectionDebit  PaymentFlowDirection = "debit"
)

type PaymentFlowListParams

type PaymentFlowListParams struct {
	AfterCursor          param.Field[string] `query:"after_cursor"`
	ClientToken          param.Field[string] `query:"client_token"`
	CounterpartyID       param.Field[string] `query:"counterparty_id"`
	OriginatingAccountID param.Field[string] `query:"originating_account_id"`
	PaymentOrderID       param.Field[string] `query:"payment_order_id"`
	PerPage              param.Field[int64]  `query:"per_page"`
	ReceivingAccountID   param.Field[string] `query:"receiving_account_id"`
	Status               param.Field[string] `query:"status"`
}

func (PaymentFlowListParams) URLQuery

func (r PaymentFlowListParams) URLQuery() (v url.Values)

URLQuery serializes PaymentFlowListParams's query parameters as `url.Values`.

type PaymentFlowNewParams

type PaymentFlowNewParams struct {
	// Required. Value in specified currency's smallest unit. e.g. $10 would be
	// represented as 1000. Can be any integer up to 36 digits.
	Amount param.Field[int64] `json:"amount,required"`
	// Required. The ID of a counterparty associated with the payment. As part of the
	// payment workflow an external account will be associated with this model.
	CounterpartyID param.Field[string] `json:"counterparty_id,required" format:"uuid"`
	// Required. The currency of the payment.
	Currency param.Field[string] `json:"currency,required"`
	// Required. Describes the direction money is flowing in the transaction. Can only
	// be `debit`. A `debit` pulls money from someone else's account to your own.
	Direction param.Field[PaymentFlowNewParamsDirection] `json:"direction,required"`
	// Required. The ID of one of your organization's internal accounts.
	OriginatingAccountID param.Field[string] `json:"originating_account_id,required" format:"uuid"`
	// Optional. Can only be passed in when `effective_date_selection_enabled` is
	// `true`. When set, the due date is shown to your end-user in the pre-built UI as
	// they are selecting a payment `effective_date`.
	DueDate param.Field[time.Time] `json:"due_date" format:"date"`
}

func (PaymentFlowNewParams) MarshalJSON

func (r PaymentFlowNewParams) MarshalJSON() (data []byte, err error)

type PaymentFlowNewParamsDirection

type PaymentFlowNewParamsDirection string

Required. Describes the direction money is flowing in the transaction. Can only be `debit`. A `debit` pulls money from someone else's account to your own.

const (
	PaymentFlowNewParamsDirectionCredit PaymentFlowNewParamsDirection = "credit"
	PaymentFlowNewParamsDirectionDebit  PaymentFlowNewParamsDirection = "debit"
)

type PaymentFlowService

type PaymentFlowService struct {
	Options []option.RequestOption
}

PaymentFlowService 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 NewPaymentFlowService method instead.

func NewPaymentFlowService

func NewPaymentFlowService(opts ...option.RequestOption) (r *PaymentFlowService)

NewPaymentFlowService 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 (*PaymentFlowService) Get

func (r *PaymentFlowService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentFlow, err error)

get payment_flow

func (*PaymentFlowService) List

list payment_flows

func (*PaymentFlowService) ListAutoPaging

list payment_flows

func (*PaymentFlowService) New

create payment_flow

func (*PaymentFlowService) Update

update payment_flow

type PaymentFlowStatus

type PaymentFlowStatus string

The current status of the payment flow. One of `pending`, `completed`, `expired`, or `cancelled`.

const (
	PaymentFlowStatusCancelled PaymentFlowStatus = "cancelled"
	PaymentFlowStatusCompleted PaymentFlowStatus = "completed"
	PaymentFlowStatusExpired   PaymentFlowStatus = "expired"
	PaymentFlowStatusPending   PaymentFlowStatus = "pending"
)

type PaymentFlowUpdateParams

type PaymentFlowUpdateParams struct {
	// Required. The updated status of the payment flow. Can only be used to mark a
	// flow as `cancelled`.
	Status param.Field[PaymentFlowUpdateParamsStatus] `json:"status,required"`
}

func (PaymentFlowUpdateParams) MarshalJSON

func (r PaymentFlowUpdateParams) MarshalJSON() (data []byte, err error)

type PaymentFlowUpdateParamsStatus

type PaymentFlowUpdateParamsStatus string

Required. The updated status of the payment flow. Can only be used to mark a flow as `cancelled`.

const (
	PaymentFlowUpdateParamsStatusCancelled PaymentFlowUpdateParamsStatus = "cancelled"
)

type PaymentOrder

type PaymentOrder struct {
	ID         string                 `json:"id,required" format:"uuid"`
	Accounting PaymentOrderAccounting `json:"accounting,required"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID string `json:"accounting_category_id,required,nullable" format:"uuid"`
	// The ID of one of your accounting ledger classes. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingLedgerClassID string `json:"accounting_ledger_class_id,required,nullable" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented as
	// 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000.
	Amount int64 `json:"amount,required"`
	// The party that will pay the fees for the payment order. Only applies to wire
	// payment orders. Can be one of shared, sender, or receiver, which correspond
	// respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`.
	ChargeBearer PaymentOrderChargeBearer `json:"charge_bearer,required,nullable"`
	// Custom key-value pair for usage in compliance rules. Please contact support
	// before making changes to this field.
	ComplianceRuleMetadata map[string]interface{} `json:"compliance_rule_metadata,required,nullable"`
	// If the payment order is tied to a specific Counterparty, their id will appear,
	// otherwise `null`.
	CounterpartyID string    `json:"counterparty_id,required,nullable" format:"uuid"`
	CreatedAt      time.Time `json:"created_at,required" format:"date-time"`
	// Defaults to the currency of the originating account.
	Currency shared.Currency `json:"currency,required,nullable"`
	// If the payment order's status is `returned`, this will include the return
	// object's data.
	CurrentReturn ReturnObject `json:"current_return,required,nullable"`
	// The ID of the compliance decision for the payment order, if transaction
	// monitoring is enabled.
	DecisionID string `json:"decision_id,required,nullable" format:"uuid"`
	// An optional description for internal use.
	Description string `json:"description,required,nullable"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction PaymentOrderDirection `json:"direction,required"`
	// Date transactions are to be posted to the participants' account. Defaults to the
	// current business day or the next business day if the current day is a bank
	// holiday or weekend. Format: yyyy-mm-dd.
	EffectiveDate time.Time `json:"effective_date,required" format:"date"`
	// RFP payments require an expires_at. This value must be past the effective_date.
	ExpiresAt time.Time `json:"expires_at,required,nullable" format:"date-time"`
	// If present, indicates a specific foreign exchange contract number that has been
	// generated by your financial institution.
	ForeignExchangeContract string `json:"foreign_exchange_contract,required,nullable"`
	// Indicates the type of FX transfer to initiate, can be either
	// `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order
	// currency matches the originating account currency.
	ForeignExchangeIndicator PaymentOrderForeignExchangeIndicator `json:"foreign_exchange_indicator,required,nullable"`
	// The ID of the ledger transaction linked to the payment order.
	LedgerTransactionID string `json:"ledger_transaction_id,required,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// A boolean to determine if NSF Protection is enabled for this payment order. Note
	// that this setting must also be turned on in your organization settings page.
	NsfProtected bool   `json:"nsf_protected,required"`
	Object       string `json:"object,required"`
	// The ID of one of your organization's internal accounts.
	OriginatingAccountID string `json:"originating_account_id,required" format:"uuid"`
	// If present, this will replace your default company name on receiver's bank
	// statement. This field can only be used for ACH payments currently. For ACH, only
	// the first 16 characters of this string will be used. Any additional characters
	// will be truncated.
	OriginatingPartyName string `json:"originating_party_name,required,nullable"`
	// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
	// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
	// an overnight check rather than standard mail.
	Priority PaymentOrderPriority `json:"priority,required"`
	// For `wire`, this is usually the purpose which is transmitted via the
	// "InstrForDbtrAgt" field in the ISO20022 file. If you are using Currencycloud,
	// this is the `payment.purpose_code` field. For `eft`, this field is the 3 digit
	// CPA Code that will be attached to the payment.
	Purpose string `json:"purpose,required,nullable"`
	// The receiving account ID. Can be an `external_account` or `internal_account`.
	ReceivingAccountID   string                           `json:"receiving_account_id,required" format:"uuid"`
	ReceivingAccountType PaymentOrderReceivingAccountType `json:"receiving_account_type,required"`
	ReferenceNumbers     []PaymentOrderReferenceNumber    `json:"reference_numbers,required"`
	// For `ach`, this field will be passed through on an addenda record. For `wire`
	// payments the field will be passed through as the "Originator to Beneficiary
	// Information", also known as OBI or Fedwire tag 6000.
	RemittanceInformation string `json:"remittance_information,required,nullable"`
	// Send an email to the counterparty when the payment order is sent to the bank. If
	// `null`, `send_remittance_advice` on the Counterparty is used.
	SendRemittanceAdvice bool `json:"send_remittance_advice,required,nullable"`
	// An optional descriptor which will appear in the receiver's statement. For
	// `check` payments this field will be used as the memo line. For `ach` the maximum
	// length is 10 characters. Note that for ACH payments, the name on your bank
	// account will be included automatically by the bank, so you can use the
	// characters for other useful information. For `eft` the maximum length is 15
	// characters.
	StatementDescriptor string `json:"statement_descriptor,required,nullable"`
	// The current status of the payment order.
	Status PaymentOrderStatus `json:"status,required"`
	// An additional layer of classification for the type of payment order you are
	// doing. This field is only used for `ach` payment orders currently. For `ach`
	// payment orders, the `subtype` represents the SEC code. We currently support
	// `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`.
	Subtype PaymentOrderSubtype `json:"subtype,required,nullable"`
	// The IDs of all the transactions associated to this payment order. Usually, you
	// will only have a single transaction ID. However, if a payment order initially
	// results in a Return, but gets redrafted and is later successfully completed, it
	// can have many transactions.
	TransactionIDs []string `json:"transaction_ids,required" format:"uuid"`
	// A flag that determines whether a payment order should go through transaction
	// monitoring.
	TransactionMonitoringEnabled bool `json:"transaction_monitoring_enabled,required"`
	// One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`,
	// `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`,
	// `zengin`.
	Type PaymentOrderType `json:"type,required"`
	// Identifier of the ultimate originator of the payment order.
	UltimateOriginatingPartyIdentifier string `json:"ultimate_originating_party_identifier,required,nullable"`
	// Name of the ultimate originator of the payment order.
	UltimateOriginatingPartyName     string    `json:"ultimate_originating_party_name,required,nullable"`
	UltimateReceivingPartyIdentifier string    `json:"ultimate_receiving_party_identifier,required,nullable"`
	UltimateReceivingPartyName       string    `json:"ultimate_receiving_party_name,required,nullable"`
	UpdatedAt                        time.Time `json:"updated_at,required" format:"date-time"`
	// This field will be populated if a vendor (e.g. Currencycloud) failure occurs.
	// Logic shouldn't be built on its value as it is free-form.
	VendorFailureReason string `json:"vendor_failure_reason,required,nullable"`
	JSON                paymentOrderJSON
}

func (*PaymentOrder) UnmarshalJSON

func (r *PaymentOrder) UnmarshalJSON(data []byte) (err error)

type PaymentOrderAccounting

type PaymentOrderAccounting struct {
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountID string `json:"account_id,nullable" format:"uuid"`
	// The ID of one of the class objects in your accounting system. Class objects
	// track segments of your business independent of client or project. Note that
	// these will only be accessible if your accounting system has been connected.
	ClassID string `json:"class_id,nullable" format:"uuid"`
	JSON    paymentOrderAccountingJSON
}

func (*PaymentOrderAccounting) UnmarshalJSON

func (r *PaymentOrderAccounting) UnmarshalJSON(data []byte) (err error)

type PaymentOrderChargeBearer

type PaymentOrderChargeBearer string

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`.

const (
	PaymentOrderChargeBearerShared   PaymentOrderChargeBearer = "shared"
	PaymentOrderChargeBearerSender   PaymentOrderChargeBearer = "sender"
	PaymentOrderChargeBearerReceiver PaymentOrderChargeBearer = "receiver"
)

type PaymentOrderDirection

type PaymentOrderDirection string

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`.

const (
	PaymentOrderDirectionCredit PaymentOrderDirection = "credit"
	PaymentOrderDirectionDebit  PaymentOrderDirection = "debit"
)

type PaymentOrderForeignExchangeIndicator

type PaymentOrderForeignExchangeIndicator string

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.

const (
	PaymentOrderForeignExchangeIndicatorFixedToVariable PaymentOrderForeignExchangeIndicator = "fixed_to_variable"
	PaymentOrderForeignExchangeIndicatorVariableToFixed PaymentOrderForeignExchangeIndicator = "variable_to_fixed"
)

type PaymentOrderListParams

type PaymentOrderListParams struct {
	AfterCursor    param.Field[string]                          `query:"after_cursor"`
	CounterpartyID param.Field[string]                          `query:"counterparty_id" format:"uuid"`
	Direction      param.Field[PaymentOrderListParamsDirection] `query:"direction"`
	// An inclusive upper bound for searching effective_date
	EffectiveDateEnd param.Field[time.Time] `query:"effective_date_end" format:"date"`
	// An inclusive lower bound for searching effective_date
	EffectiveDateStart param.Field[time.Time] `query:"effective_date_start" format:"date"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata             param.Field[map[string]string] `query:"metadata"`
	OriginatingAccountID param.Field[string]            `query:"originating_account_id" format:"uuid"`
	PerPage              param.Field[int64]             `query:"per_page"`
	// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
	// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
	// an overnight check rather than standard mail.
	Priority param.Field[PaymentOrderListParamsPriority] `query:"priority"`
	// Query for records with the provided reference number
	ReferenceNumber param.Field[string]                       `query:"reference_number"`
	Status          param.Field[PaymentOrderListParamsStatus] `query:"status"`
	// The ID of a transaction that the payment order has been reconciled to.
	TransactionID param.Field[string]                     `query:"transaction_id" format:"uuid"`
	Type          param.Field[PaymentOrderListParamsType] `query:"type"`
}

func (PaymentOrderListParams) URLQuery

func (r PaymentOrderListParams) URLQuery() (v url.Values)

URLQuery serializes PaymentOrderListParams's query parameters as `url.Values`.

type PaymentOrderListParamsDirection

type PaymentOrderListParamsDirection string
const (
	PaymentOrderListParamsDirectionCredit PaymentOrderListParamsDirection = "credit"
	PaymentOrderListParamsDirectionDebit  PaymentOrderListParamsDirection = "debit"
)

type PaymentOrderListParamsPriority

type PaymentOrderListParamsPriority string

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.

const (
	PaymentOrderListParamsPriorityHigh   PaymentOrderListParamsPriority = "high"
	PaymentOrderListParamsPriorityNormal PaymentOrderListParamsPriority = "normal"
)

type PaymentOrderListParamsStatus

type PaymentOrderListParamsStatus string
const (
	PaymentOrderListParamsStatusApproved      PaymentOrderListParamsStatus = "approved"
	PaymentOrderListParamsStatusCancelled     PaymentOrderListParamsStatus = "cancelled"
	PaymentOrderListParamsStatusCompleted     PaymentOrderListParamsStatus = "completed"
	PaymentOrderListParamsStatusDenied        PaymentOrderListParamsStatus = "denied"
	PaymentOrderListParamsStatusFailed        PaymentOrderListParamsStatus = "failed"
	PaymentOrderListParamsStatusNeedsApproval PaymentOrderListParamsStatus = "needs_approval"
	PaymentOrderListParamsStatusPending       PaymentOrderListParamsStatus = "pending"
	PaymentOrderListParamsStatusProcessing    PaymentOrderListParamsStatus = "processing"
	PaymentOrderListParamsStatusReturned      PaymentOrderListParamsStatus = "returned"
	PaymentOrderListParamsStatusReversed      PaymentOrderListParamsStatus = "reversed"
	PaymentOrderListParamsStatusSent          PaymentOrderListParamsStatus = "sent"
)

type PaymentOrderListParamsType

type PaymentOrderListParamsType string
const (
	PaymentOrderListParamsTypeACH         PaymentOrderListParamsType = "ach"
	PaymentOrderListParamsTypeAuBecs      PaymentOrderListParamsType = "au_becs"
	PaymentOrderListParamsTypeBacs        PaymentOrderListParamsType = "bacs"
	PaymentOrderListParamsTypeBook        PaymentOrderListParamsType = "book"
	PaymentOrderListParamsTypeCard        PaymentOrderListParamsType = "card"
	PaymentOrderListParamsTypeCheck       PaymentOrderListParamsType = "check"
	PaymentOrderListParamsTypeCrossBorder PaymentOrderListParamsType = "cross_border"
	PaymentOrderListParamsTypeEft         PaymentOrderListParamsType = "eft"
	PaymentOrderListParamsTypeInterac     PaymentOrderListParamsType = "interac"
	PaymentOrderListParamsTypeMasav       PaymentOrderListParamsType = "masav"
	PaymentOrderListParamsTypeNeft        PaymentOrderListParamsType = "neft"
	PaymentOrderListParamsTypeNics        PaymentOrderListParamsType = "nics"
	PaymentOrderListParamsTypeProvxchange PaymentOrderListParamsType = "provxchange"
	PaymentOrderListParamsTypeRtp         PaymentOrderListParamsType = "rtp"
	PaymentOrderListParamsTypeSeBankgirot PaymentOrderListParamsType = "se_bankgirot"
	PaymentOrderListParamsTypeSen         PaymentOrderListParamsType = "sen"
	PaymentOrderListParamsTypeSepa        PaymentOrderListParamsType = "sepa"
	PaymentOrderListParamsTypeSic         PaymentOrderListParamsType = "sic"
	PaymentOrderListParamsTypeSignet      PaymentOrderListParamsType = "signet"
	PaymentOrderListParamsTypeWire        PaymentOrderListParamsType = "wire"
	PaymentOrderListParamsTypeZengin      PaymentOrderListParamsType = "zengin"
)

type PaymentOrderNewAsyncParams

type PaymentOrderNewAsyncParams struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented as
	// 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000.
	Amount param.Field[int64] `json:"amount,required"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[PaymentOrderNewAsyncParamsDirection] `json:"direction,required"`
	// The ID of one of your organization's internal accounts.
	OriginatingAccountID param.Field[string] `json:"originating_account_id,required" format:"uuid"`
	// One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`,
	// `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`,
	// `zengin`.
	Type       param.Field[PaymentOrderType]                     `json:"type,required"`
	Accounting param.Field[PaymentOrderNewAsyncParamsAccounting] `json:"accounting"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID param.Field[string] `json:"accounting_category_id" format:"uuid"`
	// The ID of one of your accounting ledger classes. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingLedgerClassID param.Field[string] `json:"accounting_ledger_class_id" format:"uuid"`
	// The party that will pay the fees for the payment order. Only applies to wire
	// payment orders. Can be one of shared, sender, or receiver, which correspond
	// respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`.
	ChargeBearer param.Field[PaymentOrderNewAsyncParamsChargeBearer] `json:"charge_bearer"`
	// Defaults to the currency of the originating account.
	Currency param.Field[shared.Currency] `json:"currency"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// Date transactions are to be posted to the participants' account. Defaults to the
	// current business day or the next business day if the current day is a bank
	// holiday or weekend. Format: yyyy-mm-dd.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// RFP payments require an expires_at. This value must be past the effective_date.
	ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
	// A payment type to fallback to if the original type is not valid for the
	// receiving account. Currently, this only supports falling back from RTP to ACH
	// (type=rtp and fallback_type=ach)
	FallbackType param.Field[PaymentOrderNewAsyncParamsFallbackType] `json:"fallback_type"`
	// If present, indicates a specific foreign exchange contract number that has been
	// generated by your financial institution.
	ForeignExchangeContract param.Field[string] `json:"foreign_exchange_contract"`
	// Indicates the type of FX transfer to initiate, can be either
	// `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order
	// currency matches the originating account currency.
	ForeignExchangeIndicator param.Field[PaymentOrderNewAsyncParamsForeignExchangeIndicator] `json:"foreign_exchange_indicator"`
	// Specifies a ledger transaction object that will be created with the payment
	// order. If the ledger transaction cannot be created, then the payment order
	// creation will fail. The resulting ledger transaction will mirror the status of
	// the payment order.
	LedgerTransaction param.Field[PaymentOrderNewAsyncParamsLedgerTransaction] `json:"ledger_transaction"`
	// An array of line items that must sum up to the amount of the payment order.
	LineItems param.Field[[]PaymentOrderNewAsyncParamsLineItem] `json:"line_items"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A boolean to determine if NSF Protection is enabled for this payment order. Note
	// that this setting must also be turned on in your organization settings page.
	NsfProtected param.Field[bool] `json:"nsf_protected"`
	// If present, this will replace your default company name on receiver's bank
	// statement. This field can only be used for ACH payments currently. For ACH, only
	// the first 16 characters of this string will be used. Any additional characters
	// will be truncated.
	OriginatingPartyName param.Field[string] `json:"originating_party_name"`
	// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
	// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
	// an overnight check rather than standard mail.
	Priority param.Field[PaymentOrderNewAsyncParamsPriority] `json:"priority"`
	// For `wire`, this is usually the purpose which is transmitted via the
	// "InstrForDbtrAgt" field in the ISO20022 file. If you are using Currencycloud,
	// this is the `payment.purpose_code` field. For `eft`, this field is the 3 digit
	// CPA Code that will be attached to the payment.
	Purpose param.Field[string] `json:"purpose"`
	// Either `receiving_account` or `receiving_account_id` must be present. When using
	// `receiving_account_id`, you may pass the id of an external account or an
	// internal account.
	ReceivingAccount param.Field[PaymentOrderNewAsyncParamsReceivingAccount] `json:"receiving_account"`
	// Either `receiving_account` or `receiving_account_id` must be present. When using
	// `receiving_account_id`, you may pass the id of an external account or an
	// internal account.
	ReceivingAccountID param.Field[string] `json:"receiving_account_id" format:"uuid"`
	// For `ach`, this field will be passed through on an addenda record. For `wire`
	// payments the field will be passed through as the "Originator to Beneficiary
	// Information", also known as OBI or Fedwire tag 6000.
	RemittanceInformation param.Field[string] `json:"remittance_information"`
	// Send an email to the counterparty when the payment order is sent to the bank. If
	// `null`, `send_remittance_advice` on the Counterparty is used.
	SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
	// An optional descriptor which will appear in the receiver's statement. For
	// `check` payments this field will be used as the memo line. For `ach` the maximum
	// length is 10 characters. Note that for ACH payments, the name on your bank
	// account will be included automatically by the bank, so you can use the
	// characters for other useful information. For `eft` the maximum length is 15
	// characters.
	StatementDescriptor param.Field[string] `json:"statement_descriptor"`
	// An additional layer of classification for the type of payment order you are
	// doing. This field is only used for `ach` payment orders currently. For `ach`
	// payment orders, the `subtype` represents the SEC code. We currently support
	// `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`.
	Subtype param.Field[PaymentOrderSubtype] `json:"subtype"`
	// A flag that determines whether a payment order should go through transaction
	// monitoring.
	TransactionMonitoringEnabled param.Field[bool] `json:"transaction_monitoring_enabled"`
	// Identifier of the ultimate originator of the payment order.
	UltimateOriginatingPartyIdentifier param.Field[string] `json:"ultimate_originating_party_identifier"`
	// Name of the ultimate originator of the payment order.
	UltimateOriginatingPartyName param.Field[string] `json:"ultimate_originating_party_name"`
	// Identifier of the ultimate funds recipient.
	UltimateReceivingPartyIdentifier param.Field[string] `json:"ultimate_receiving_party_identifier"`
	// Name of the ultimate funds recipient.
	UltimateReceivingPartyName param.Field[string] `json:"ultimate_receiving_party_name"`
}

func (PaymentOrderNewAsyncParams) MarshalJSON

func (r PaymentOrderNewAsyncParams) MarshalJSON() (data []byte, err error)

type PaymentOrderNewAsyncParamsAccounting

type PaymentOrderNewAsyncParamsAccounting struct {
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountID param.Field[string] `json:"account_id" format:"uuid"`
	// The ID of one of the class objects in your accounting system. Class objects
	// track segments of your business independent of client or project. Note that
	// these will only be accessible if your accounting system has been connected.
	ClassID param.Field[string] `json:"class_id" format:"uuid"`
}

func (PaymentOrderNewAsyncParamsAccounting) MarshalJSON

func (r PaymentOrderNewAsyncParamsAccounting) MarshalJSON() (data []byte, err error)

type PaymentOrderNewAsyncParamsChargeBearer

type PaymentOrderNewAsyncParamsChargeBearer string

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`.

const (
	PaymentOrderNewAsyncParamsChargeBearerShared   PaymentOrderNewAsyncParamsChargeBearer = "shared"
	PaymentOrderNewAsyncParamsChargeBearerSender   PaymentOrderNewAsyncParamsChargeBearer = "sender"
	PaymentOrderNewAsyncParamsChargeBearerReceiver PaymentOrderNewAsyncParamsChargeBearer = "receiver"
)

type PaymentOrderNewAsyncParamsDirection

type PaymentOrderNewAsyncParamsDirection string

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`.

const (
	PaymentOrderNewAsyncParamsDirectionCredit PaymentOrderNewAsyncParamsDirection = "credit"
	PaymentOrderNewAsyncParamsDirectionDebit  PaymentOrderNewAsyncParamsDirection = "debit"
)

type PaymentOrderNewAsyncParamsFallbackType

type PaymentOrderNewAsyncParamsFallbackType string

A payment type to fallback to if the original type is not valid for the receiving account. Currently, this only supports falling back from RTP to ACH (type=rtp and fallback_type=ach)

const (
	PaymentOrderNewAsyncParamsFallbackTypeACH PaymentOrderNewAsyncParamsFallbackType = "ach"
)

type PaymentOrderNewAsyncParamsForeignExchangeIndicator

type PaymentOrderNewAsyncParamsForeignExchangeIndicator string

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.

const (
	PaymentOrderNewAsyncParamsForeignExchangeIndicatorFixedToVariable PaymentOrderNewAsyncParamsForeignExchangeIndicator = "fixed_to_variable"
	PaymentOrderNewAsyncParamsForeignExchangeIndicatorVariableToFixed PaymentOrderNewAsyncParamsForeignExchangeIndicator = "variable_to_fixed"
)

type PaymentOrderNewAsyncParamsLedgerTransaction

type PaymentOrderNewAsyncParamsLedgerTransaction struct {
	// An array of ledger entry objects.
	LedgerEntries param.Field[[]PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntry] `json:"ledger_entries,required"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date"`
	// The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
	// purposes.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// A unique string to represent the ledger transaction. Only one pending or posted
	// ledger transaction may have this ID in the ledger.
	ExternalID param.Field[string] `json:"external_id"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the id will be populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the type will be populated here, otherwise null. This can be one of
	// payment_order, incoming_payment_detail, expected_payment, return, or reversal.
	LedgerableType param.Field[PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// To post a ledger transaction at creation, use `posted`.
	Status param.Field[PaymentOrderNewAsyncParamsLedgerTransactionStatus] `json:"status"`
}

Specifies a ledger transaction object that will be created with the payment order. If the ledger transaction cannot be created, then the payment order creation will fail. The resulting ledger transaction will mirror the status of the payment order.

func (PaymentOrderNewAsyncParamsLedgerTransaction) MarshalJSON

func (r PaymentOrderNewAsyncParamsLedgerTransaction) MarshalJSON() (data []byte, err error)

type PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntriesDirection

type PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntriesDirection string

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`.

const (
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntriesDirectionCredit PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntriesDirection = "credit"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntriesDirectionDebit  PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntriesDirection = "debit"
)

type PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntry

type PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntry struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount param.Field[int64] `json:"amount,required"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntriesDirection] `json:"direction,required"`
	// The ledger account that this ledger entry is associated with.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required" format:"uuid"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s available balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	AvailableBalanceAmount param.Field[map[string]int64] `json:"available_balance_amount"`
	// Lock version of the ledger account. This can be passed when creating a ledger
	// transaction to only succeed if no ledger transactions have posted since the
	// given version. See our post about Designing the Ledgers API with Optimistic
	// Locking for more details.
	LockVersion param.Field[int64] `json:"lock_version"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s pending balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PendingBalanceAmount param.Field[map[string]int64] `json:"pending_balance_amount"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s posted balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PostedBalanceAmount param.Field[map[string]int64] `json:"posted_balance_amount"`
	// If true, response will include the balance of the associated ledger account for
	// the entry.
	ShowResultingLedgerAccountBalances param.Field[bool] `json:"show_resulting_ledger_account_balances"`
}

func (PaymentOrderNewAsyncParamsLedgerTransactionLedgerEntry) MarshalJSON

type PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType

type PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType string

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, or reversal.

const (
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeCounterparty          PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "counterparty"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeExpectedPayment       PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "expected_payment"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeIncomingPaymentDetail PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "incoming_payment_detail"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeInternalAccount       PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "internal_account"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeLineItem              PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "line_item"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypePaperItem             PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "paper_item"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypePaymentOrder          PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "payment_order"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypePaymentOrderAttempt   PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "payment_order_attempt"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeReturn                PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "return"
	PaymentOrderNewAsyncParamsLedgerTransactionLedgerableTypeReversal              PaymentOrderNewAsyncParamsLedgerTransactionLedgerableType = "reversal"
)

type PaymentOrderNewAsyncParamsLedgerTransactionStatus

type PaymentOrderNewAsyncParamsLedgerTransactionStatus string

To post a ledger transaction at creation, use `posted`.

const (
	PaymentOrderNewAsyncParamsLedgerTransactionStatusArchived PaymentOrderNewAsyncParamsLedgerTransactionStatus = "archived"
	PaymentOrderNewAsyncParamsLedgerTransactionStatusPending  PaymentOrderNewAsyncParamsLedgerTransactionStatus = "pending"
	PaymentOrderNewAsyncParamsLedgerTransactionStatusPosted   PaymentOrderNewAsyncParamsLedgerTransactionStatus = "posted"
)

type PaymentOrderNewAsyncParamsLineItem

type PaymentOrderNewAsyncParamsLineItem struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount param.Field[int64] `json:"amount,required"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID param.Field[string] `json:"accounting_category_id"`
	// A free-form description of the line item.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (PaymentOrderNewAsyncParamsLineItem) MarshalJSON

func (r PaymentOrderNewAsyncParamsLineItem) MarshalJSON() (data []byte, err error)

type PaymentOrderNewAsyncParamsPriority

type PaymentOrderNewAsyncParamsPriority string

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.

const (
	PaymentOrderNewAsyncParamsPriorityHigh   PaymentOrderNewAsyncParamsPriority = "high"
	PaymentOrderNewAsyncParamsPriorityNormal PaymentOrderNewAsyncParamsPriority = "normal"
)

type PaymentOrderNewAsyncParamsReceivingAccount

type PaymentOrderNewAsyncParamsReceivingAccount struct {
	AccountDetails param.Field[[]PaymentOrderNewAsyncParamsReceivingAccountAccountDetail] `json:"account_details"`
	// Can be `checking`, `savings` or `other`.
	AccountType    param.Field[ExternalAccountType]                                       `json:"account_type"`
	ContactDetails param.Field[[]PaymentOrderNewAsyncParamsReceivingAccountContactDetail] `json:"contact_details"`
	// Specifies a ledger account object that will be created with the external
	// account. The resulting ledger account is linked to the external account for
	// auto-ledgering Payment objects. See
	// https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
	// for more details.
	LedgerAccount param.Field[PaymentOrderNewAsyncParamsReceivingAccountLedgerAccount] `json:"ledger_account"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name param.Field[string] `json:"name"`
	// Required if receiving wire payments.
	PartyAddress    param.Field[PaymentOrderNewAsyncParamsReceivingAccountPartyAddress] `json:"party_address"`
	PartyIdentifier param.Field[string]                                                 `json:"party_identifier"`
	// If this value isn't provided, it will be inherited from the counterparty's name.
	PartyName param.Field[string] `json:"party_name"`
	// Either `individual` or `business`.
	PartyType param.Field[PaymentOrderNewAsyncParamsReceivingAccountPartyType] `json:"party_type"`
	// If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
	// you can pass the processor token in this field.
	PlaidProcessorToken param.Field[string]                                                    `json:"plaid_processor_token"`
	RoutingDetails      param.Field[[]PaymentOrderNewAsyncParamsReceivingAccountRoutingDetail] `json:"routing_details"`
}

Either `receiving_account` or `receiving_account_id` must be present. When using `receiving_account_id`, you may pass the id of an external account or an internal account.

func (PaymentOrderNewAsyncParamsReceivingAccount) MarshalJSON

func (r PaymentOrderNewAsyncParamsReceivingAccount) MarshalJSON() (data []byte, err error)

type PaymentOrderNewAsyncParamsReceivingAccountAccountDetail

type PaymentOrderNewAsyncParamsReceivingAccountAccountDetail struct {
	AccountNumber     param.Field[string]                                                                    `json:"account_number,required"`
	AccountNumberType param.Field[PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType] `json:"account_number_type"`
}

func (PaymentOrderNewAsyncParamsReceivingAccountAccountDetail) MarshalJSON

type PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType

type PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType string
const (
	PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberTypeIban          PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType = "iban"
	PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberTypeClabe         PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType = "clabe"
	PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberTypeWalletAddress PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType = "wallet_address"
	PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberTypePan           PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType = "pan"
	PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberTypeOther         PaymentOrderNewAsyncParamsReceivingAccountAccountDetailsAccountNumberType = "other"
)

type PaymentOrderNewAsyncParamsReceivingAccountContactDetail

type PaymentOrderNewAsyncParamsReceivingAccountContactDetail struct {
	ContactIdentifier     param.Field[string]                                                                        `json:"contact_identifier"`
	ContactIdentifierType param.Field[PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}

func (PaymentOrderNewAsyncParamsReceivingAccountContactDetail) MarshalJSON

type PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierType

type PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierType string
const (
	PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierTypeEmail       PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierType = "email"
	PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierTypePhoneNumber PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierType = "phone_number"
	PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierTypeWebsite     PaymentOrderNewAsyncParamsReceivingAccountContactDetailsContactIdentifierType = "website"
)

type PaymentOrderNewAsyncParamsReceivingAccountLedgerAccount

type PaymentOrderNewAsyncParamsReceivingAccountLedgerAccount struct {
	// The currency of the ledger account.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the ledger that this account belongs to.
	LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
	// The name of the ledger account.
	Name param.Field[string] `json:"name,required"`
	// The normal balance of the ledger account.
	NormalBalance param.Field[PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountNormalBalance] `json:"normal_balance,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// The description of the ledger account.
	Description param.Field[string] `json:"description"`
	// If the ledger account links to another object in Modern Treasury, the id will be
	// populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the type will
	// be populated here, otherwise null. The value is one of internal_account or
	// external_account.
	LedgerableType param.Field[PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

Specifies a ledger account object that will be created with the external account. The resulting ledger account is linked to the external account for auto-ledgering Payment objects. See https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects for more details.

func (PaymentOrderNewAsyncParamsReceivingAccountLedgerAccount) MarshalJSON

type PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableType

type PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableType string

If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.

const (
	PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableTypeExternalAccount PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableType = "external_account"
	PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableTypeInternalAccount PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountLedgerableType = "internal_account"
)

type PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountNormalBalance

type PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountNormalBalanceCredit PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountNormalBalance = "credit"
	PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountNormalBalanceDebit  PaymentOrderNewAsyncParamsReceivingAccountLedgerAccountNormalBalance = "debit"
)

type PaymentOrderNewAsyncParamsReceivingAccountPartyAddress

type PaymentOrderNewAsyncParamsReceivingAccountPartyAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country"`
	Line1   param.Field[string] `json:"line1"`
	Line2   param.Field[string] `json:"line2"`
	// Locality or City.
	Locality param.Field[string] `json:"locality"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code"`
	// Region or State.
	Region param.Field[string] `json:"region"`
}

Required if receiving wire payments.

func (PaymentOrderNewAsyncParamsReceivingAccountPartyAddress) MarshalJSON

type PaymentOrderNewAsyncParamsReceivingAccountPartyType

type PaymentOrderNewAsyncParamsReceivingAccountPartyType string

Either `individual` or `business`.

const (
	PaymentOrderNewAsyncParamsReceivingAccountPartyTypeBusiness   PaymentOrderNewAsyncParamsReceivingAccountPartyType = "business"
	PaymentOrderNewAsyncParamsReceivingAccountPartyTypeIndividual PaymentOrderNewAsyncParamsReceivingAccountPartyType = "individual"
)

type PaymentOrderNewAsyncParamsReceivingAccountRoutingDetail

type PaymentOrderNewAsyncParamsReceivingAccountRoutingDetail struct {
	RoutingNumber     param.Field[string]                                                                    `json:"routing_number,required"`
	RoutingNumberType param.Field[PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
	PaymentType       param.Field[PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType]       `json:"payment_type"`
}

func (PaymentOrderNewAsyncParamsReceivingAccountRoutingDetail) MarshalJSON

type PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType

type PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType string
const (
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeACH         PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "ach"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeAuBecs      PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "au_becs"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeSeBankgirot PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "se_bankgirot"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeBacs        PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "bacs"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeBook        PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "book"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeCard        PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "card"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeCheck       PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "check"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeEft         PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "eft"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeCrossBorder PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "cross_border"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeInterac     PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "interac"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeMasav       PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "masav"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeNeft        PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "neft"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeNics        PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "nics"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeProvxchange PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "provxchange"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeRtp         PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "rtp"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeSen         PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "sen"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeSic         PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "sic"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeSepa        PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "sepa"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeSignet      PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "signet"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeWire        PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "wire"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentTypeZengin      PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsPaymentType = "zengin"
)

type PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType

type PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType string
const (
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeAba                    PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "aba"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeAuBsb                  PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "au_bsb"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeBrCodigo               PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "br_codigo"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeCaCpa                  PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "ca_cpa"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeChips                  PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "chips"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeCnaps                  PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "cnaps"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeGBSortCode             PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "gb_sort_code"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeInIfsc                 PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "in_ifsc"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeMyBranchCode           PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "my_branch_code"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeSwift                  PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "swift"
	PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberTypeJpZenginCode           PaymentOrderNewAsyncParamsReceivingAccountRoutingDetailsRoutingNumberType = "jp_zengin_code"
)

type PaymentOrderNewParams

type PaymentOrderNewParams struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented as
	// 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000.
	Amount param.Field[int64] `json:"amount,required"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[PaymentOrderNewParamsDirection] `json:"direction,required"`
	// The ID of one of your organization's internal accounts.
	OriginatingAccountID param.Field[string] `json:"originating_account_id,required" format:"uuid"`
	// One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`,
	// `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`,
	// `zengin`.
	Type       param.Field[PaymentOrderType]                `json:"type,required"`
	Accounting param.Field[PaymentOrderNewParamsAccounting] `json:"accounting"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID param.Field[string] `json:"accounting_category_id" format:"uuid"`
	// The ID of one of your accounting ledger classes. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingLedgerClassID param.Field[string] `json:"accounting_ledger_class_id" format:"uuid"`
	// The party that will pay the fees for the payment order. Only applies to wire
	// payment orders. Can be one of shared, sender, or receiver, which correspond
	// respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`.
	ChargeBearer param.Field[PaymentOrderNewParamsChargeBearer] `json:"charge_bearer"`
	// Defaults to the currency of the originating account.
	Currency param.Field[shared.Currency] `json:"currency"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// An array of documents to be attached to the payment order. Note that if you
	// attach documents, the request's content type must be `multipart/form-data`.
	Documents param.Field[[]PaymentOrderNewParamsDocument] `json:"documents"`
	// Date transactions are to be posted to the participants' account. Defaults to the
	// current business day or the next business day if the current day is a bank
	// holiday or weekend. Format: yyyy-mm-dd.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// RFP payments require an expires_at. This value must be past the effective_date.
	ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
	// A payment type to fallback to if the original type is not valid for the
	// receiving account. Currently, this only supports falling back from RTP to ACH
	// (type=rtp and fallback_type=ach)
	FallbackType param.Field[PaymentOrderNewParamsFallbackType] `json:"fallback_type"`
	// If present, indicates a specific foreign exchange contract number that has been
	// generated by your financial institution.
	ForeignExchangeContract param.Field[string] `json:"foreign_exchange_contract"`
	// Indicates the type of FX transfer to initiate, can be either
	// `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order
	// currency matches the originating account currency.
	ForeignExchangeIndicator param.Field[PaymentOrderNewParamsForeignExchangeIndicator] `json:"foreign_exchange_indicator"`
	// Specifies a ledger transaction object that will be created with the payment
	// order. If the ledger transaction cannot be created, then the payment order
	// creation will fail. The resulting ledger transaction will mirror the status of
	// the payment order.
	LedgerTransaction param.Field[PaymentOrderNewParamsLedgerTransaction] `json:"ledger_transaction"`
	// An array of line items that must sum up to the amount of the payment order.
	LineItems param.Field[[]PaymentOrderNewParamsLineItem] `json:"line_items"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A boolean to determine if NSF Protection is enabled for this payment order. Note
	// that this setting must also be turned on in your organization settings page.
	NsfProtected param.Field[bool] `json:"nsf_protected"`
	// If present, this will replace your default company name on receiver's bank
	// statement. This field can only be used for ACH payments currently. For ACH, only
	// the first 16 characters of this string will be used. Any additional characters
	// will be truncated.
	OriginatingPartyName param.Field[string] `json:"originating_party_name"`
	// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
	// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
	// an overnight check rather than standard mail.
	Priority param.Field[PaymentOrderNewParamsPriority] `json:"priority"`
	// For `wire`, this is usually the purpose which is transmitted via the
	// "InstrForDbtrAgt" field in the ISO20022 file. If you are using Currencycloud,
	// this is the `payment.purpose_code` field. For `eft`, this field is the 3 digit
	// CPA Code that will be attached to the payment.
	Purpose param.Field[string] `json:"purpose"`
	// Either `receiving_account` or `receiving_account_id` must be present. When using
	// `receiving_account_id`, you may pass the id of an external account or an
	// internal account.
	ReceivingAccount param.Field[PaymentOrderNewParamsReceivingAccount] `json:"receiving_account"`
	// Either `receiving_account` or `receiving_account_id` must be present. When using
	// `receiving_account_id`, you may pass the id of an external account or an
	// internal account.
	ReceivingAccountID param.Field[string] `json:"receiving_account_id" format:"uuid"`
	// For `ach`, this field will be passed through on an addenda record. For `wire`
	// payments the field will be passed through as the "Originator to Beneficiary
	// Information", also known as OBI or Fedwire tag 6000.
	RemittanceInformation param.Field[string] `json:"remittance_information"`
	// Send an email to the counterparty when the payment order is sent to the bank. If
	// `null`, `send_remittance_advice` on the Counterparty is used.
	SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
	// An optional descriptor which will appear in the receiver's statement. For
	// `check` payments this field will be used as the memo line. For `ach` the maximum
	// length is 10 characters. Note that for ACH payments, the name on your bank
	// account will be included automatically by the bank, so you can use the
	// characters for other useful information. For `eft` the maximum length is 15
	// characters.
	StatementDescriptor param.Field[string] `json:"statement_descriptor"`
	// An additional layer of classification for the type of payment order you are
	// doing. This field is only used for `ach` payment orders currently. For `ach`
	// payment orders, the `subtype` represents the SEC code. We currently support
	// `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`.
	Subtype param.Field[PaymentOrderSubtype] `json:"subtype"`
	// A flag that determines whether a payment order should go through transaction
	// monitoring.
	TransactionMonitoringEnabled param.Field[bool] `json:"transaction_monitoring_enabled"`
	// Identifier of the ultimate originator of the payment order.
	UltimateOriginatingPartyIdentifier param.Field[string] `json:"ultimate_originating_party_identifier"`
	// Name of the ultimate originator of the payment order.
	UltimateOriginatingPartyName param.Field[string] `json:"ultimate_originating_party_name"`
	// Identifier of the ultimate funds recipient.
	UltimateReceivingPartyIdentifier param.Field[string] `json:"ultimate_receiving_party_identifier"`
	// Name of the ultimate funds recipient.
	UltimateReceivingPartyName param.Field[string] `json:"ultimate_receiving_party_name"`
}

func (PaymentOrderNewParams) MarshalMultipart

func (r PaymentOrderNewParams) MarshalMultipart() (data []byte, contentType string, err error)

type PaymentOrderNewParamsAccounting

type PaymentOrderNewParamsAccounting struct {
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountID param.Field[string] `json:"account_id" format:"uuid"`
	// The ID of one of the class objects in your accounting system. Class objects
	// track segments of your business independent of client or project. Note that
	// these will only be accessible if your accounting system has been connected.
	ClassID param.Field[string] `json:"class_id" format:"uuid"`
}

func (PaymentOrderNewParamsAccounting) MarshalJSON

func (r PaymentOrderNewParamsAccounting) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsChargeBearer

type PaymentOrderNewParamsChargeBearer string

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`.

const (
	PaymentOrderNewParamsChargeBearerShared   PaymentOrderNewParamsChargeBearer = "shared"
	PaymentOrderNewParamsChargeBearerSender   PaymentOrderNewParamsChargeBearer = "sender"
	PaymentOrderNewParamsChargeBearerReceiver PaymentOrderNewParamsChargeBearer = "receiver"
)

type PaymentOrderNewParamsDirection

type PaymentOrderNewParamsDirection string

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`.

const (
	PaymentOrderNewParamsDirectionCredit PaymentOrderNewParamsDirection = "credit"
	PaymentOrderNewParamsDirectionDebit  PaymentOrderNewParamsDirection = "debit"
)

type PaymentOrderNewParamsDocument

type PaymentOrderNewParamsDocument struct {
	// The unique identifier for the associated object.
	DocumentableID   param.Field[string]                                         `json:"documentable_id,required"`
	DocumentableType param.Field[PaymentOrderNewParamsDocumentsDocumentableType] `json:"documentable_type,required"`
	File             param.Field[io.Reader]                                      `json:"file,required" format:"binary"`
	// A category given to the document, can be `null`.
	DocumentType param.Field[string] `json:"document_type"`
}

func (PaymentOrderNewParamsDocument) MarshalJSON

func (r PaymentOrderNewParamsDocument) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsDocumentsDocumentableType

type PaymentOrderNewParamsDocumentsDocumentableType string
const (
	PaymentOrderNewParamsDocumentsDocumentableTypeCases            PaymentOrderNewParamsDocumentsDocumentableType = "cases"
	PaymentOrderNewParamsDocumentsDocumentableTypeCounterparties   PaymentOrderNewParamsDocumentsDocumentableType = "counterparties"
	PaymentOrderNewParamsDocumentsDocumentableTypeExpectedPayments PaymentOrderNewParamsDocumentsDocumentableType = "expected_payments"
	PaymentOrderNewParamsDocumentsDocumentableTypeExternalAccounts PaymentOrderNewParamsDocumentsDocumentableType = "external_accounts"
	PaymentOrderNewParamsDocumentsDocumentableTypeInternalAccounts PaymentOrderNewParamsDocumentsDocumentableType = "internal_accounts"
	PaymentOrderNewParamsDocumentsDocumentableTypeOrganizations    PaymentOrderNewParamsDocumentsDocumentableType = "organizations"
	PaymentOrderNewParamsDocumentsDocumentableTypePaperItems       PaymentOrderNewParamsDocumentsDocumentableType = "paper_items"
	PaymentOrderNewParamsDocumentsDocumentableTypePaymentOrders    PaymentOrderNewParamsDocumentsDocumentableType = "payment_orders"
	PaymentOrderNewParamsDocumentsDocumentableTypeTransactions     PaymentOrderNewParamsDocumentsDocumentableType = "transactions"
	PaymentOrderNewParamsDocumentsDocumentableTypeDecisions        PaymentOrderNewParamsDocumentsDocumentableType = "decisions"
	PaymentOrderNewParamsDocumentsDocumentableTypeConnections      PaymentOrderNewParamsDocumentsDocumentableType = "connections"
)

type PaymentOrderNewParamsFallbackType

type PaymentOrderNewParamsFallbackType string

A payment type to fallback to if the original type is not valid for the receiving account. Currently, this only supports falling back from RTP to ACH (type=rtp and fallback_type=ach)

const (
	PaymentOrderNewParamsFallbackTypeACH PaymentOrderNewParamsFallbackType = "ach"
)

type PaymentOrderNewParamsForeignExchangeIndicator

type PaymentOrderNewParamsForeignExchangeIndicator string

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.

const (
	PaymentOrderNewParamsForeignExchangeIndicatorFixedToVariable PaymentOrderNewParamsForeignExchangeIndicator = "fixed_to_variable"
	PaymentOrderNewParamsForeignExchangeIndicatorVariableToFixed PaymentOrderNewParamsForeignExchangeIndicator = "variable_to_fixed"
)

type PaymentOrderNewParamsLedgerTransaction

type PaymentOrderNewParamsLedgerTransaction struct {
	// An array of ledger entry objects.
	LedgerEntries param.Field[[]PaymentOrderNewParamsLedgerTransactionLedgerEntry] `json:"ledger_entries,required"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date"`
	// The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
	// purposes.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// A unique string to represent the ledger transaction. Only one pending or posted
	// ledger transaction may have this ID in the ledger.
	ExternalID param.Field[string] `json:"external_id"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the id will be populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the type will be populated here, otherwise null. This can be one of
	// payment_order, incoming_payment_detail, expected_payment, return, or reversal.
	LedgerableType param.Field[PaymentOrderNewParamsLedgerTransactionLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// To post a ledger transaction at creation, use `posted`.
	Status param.Field[PaymentOrderNewParamsLedgerTransactionStatus] `json:"status"`
}

Specifies a ledger transaction object that will be created with the payment order. If the ledger transaction cannot be created, then the payment order creation will fail. The resulting ledger transaction will mirror the status of the payment order.

func (PaymentOrderNewParamsLedgerTransaction) MarshalJSON

func (r PaymentOrderNewParamsLedgerTransaction) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsLedgerTransactionLedgerEntriesDirection

type PaymentOrderNewParamsLedgerTransactionLedgerEntriesDirection string

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`.

const (
	PaymentOrderNewParamsLedgerTransactionLedgerEntriesDirectionCredit PaymentOrderNewParamsLedgerTransactionLedgerEntriesDirection = "credit"
	PaymentOrderNewParamsLedgerTransactionLedgerEntriesDirectionDebit  PaymentOrderNewParamsLedgerTransactionLedgerEntriesDirection = "debit"
)

type PaymentOrderNewParamsLedgerTransactionLedgerEntry

type PaymentOrderNewParamsLedgerTransactionLedgerEntry struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount param.Field[int64] `json:"amount,required"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[PaymentOrderNewParamsLedgerTransactionLedgerEntriesDirection] `json:"direction,required"`
	// The ledger account that this ledger entry is associated with.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required" format:"uuid"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s available balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	AvailableBalanceAmount param.Field[map[string]int64] `json:"available_balance_amount"`
	// Lock version of the ledger account. This can be passed when creating a ledger
	// transaction to only succeed if no ledger transactions have posted since the
	// given version. See our post about Designing the Ledgers API with Optimistic
	// Locking for more details.
	LockVersion param.Field[int64] `json:"lock_version"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s pending balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PendingBalanceAmount param.Field[map[string]int64] `json:"pending_balance_amount"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s posted balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PostedBalanceAmount param.Field[map[string]int64] `json:"posted_balance_amount"`
	// If true, response will include the balance of the associated ledger account for
	// the entry.
	ShowResultingLedgerAccountBalances param.Field[bool] `json:"show_resulting_ledger_account_balances"`
}

func (PaymentOrderNewParamsLedgerTransactionLedgerEntry) MarshalJSON

func (r PaymentOrderNewParamsLedgerTransactionLedgerEntry) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsLedgerTransactionLedgerableType

type PaymentOrderNewParamsLedgerTransactionLedgerableType string

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, or reversal.

const (
	PaymentOrderNewParamsLedgerTransactionLedgerableTypeCounterparty          PaymentOrderNewParamsLedgerTransactionLedgerableType = "counterparty"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypeExpectedPayment       PaymentOrderNewParamsLedgerTransactionLedgerableType = "expected_payment"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypeIncomingPaymentDetail PaymentOrderNewParamsLedgerTransactionLedgerableType = "incoming_payment_detail"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypeInternalAccount       PaymentOrderNewParamsLedgerTransactionLedgerableType = "internal_account"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypeLineItem              PaymentOrderNewParamsLedgerTransactionLedgerableType = "line_item"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypePaperItem             PaymentOrderNewParamsLedgerTransactionLedgerableType = "paper_item"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypePaymentOrder          PaymentOrderNewParamsLedgerTransactionLedgerableType = "payment_order"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypePaymentOrderAttempt   PaymentOrderNewParamsLedgerTransactionLedgerableType = "payment_order_attempt"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypeReturn                PaymentOrderNewParamsLedgerTransactionLedgerableType = "return"
	PaymentOrderNewParamsLedgerTransactionLedgerableTypeReversal              PaymentOrderNewParamsLedgerTransactionLedgerableType = "reversal"
)

type PaymentOrderNewParamsLedgerTransactionStatus

type PaymentOrderNewParamsLedgerTransactionStatus string

To post a ledger transaction at creation, use `posted`.

const (
	PaymentOrderNewParamsLedgerTransactionStatusArchived PaymentOrderNewParamsLedgerTransactionStatus = "archived"
	PaymentOrderNewParamsLedgerTransactionStatusPending  PaymentOrderNewParamsLedgerTransactionStatus = "pending"
	PaymentOrderNewParamsLedgerTransactionStatusPosted   PaymentOrderNewParamsLedgerTransactionStatus = "posted"
)

type PaymentOrderNewParamsLineItem

type PaymentOrderNewParamsLineItem struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount param.Field[int64] `json:"amount,required"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID param.Field[string] `json:"accounting_category_id"`
	// A free-form description of the line item.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (PaymentOrderNewParamsLineItem) MarshalJSON

func (r PaymentOrderNewParamsLineItem) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsPriority

type PaymentOrderNewParamsPriority string

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.

const (
	PaymentOrderNewParamsPriorityHigh   PaymentOrderNewParamsPriority = "high"
	PaymentOrderNewParamsPriorityNormal PaymentOrderNewParamsPriority = "normal"
)

type PaymentOrderNewParamsReceivingAccount

type PaymentOrderNewParamsReceivingAccount struct {
	AccountDetails param.Field[[]PaymentOrderNewParamsReceivingAccountAccountDetail] `json:"account_details"`
	// Can be `checking`, `savings` or `other`.
	AccountType    param.Field[ExternalAccountType]                                  `json:"account_type"`
	ContactDetails param.Field[[]PaymentOrderNewParamsReceivingAccountContactDetail] `json:"contact_details"`
	// Specifies a ledger account object that will be created with the external
	// account. The resulting ledger account is linked to the external account for
	// auto-ledgering Payment objects. See
	// https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
	// for more details.
	LedgerAccount param.Field[PaymentOrderNewParamsReceivingAccountLedgerAccount] `json:"ledger_account"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name param.Field[string] `json:"name"`
	// Required if receiving wire payments.
	PartyAddress    param.Field[PaymentOrderNewParamsReceivingAccountPartyAddress] `json:"party_address"`
	PartyIdentifier param.Field[string]                                            `json:"party_identifier"`
	// If this value isn't provided, it will be inherited from the counterparty's name.
	PartyName param.Field[string] `json:"party_name"`
	// Either `individual` or `business`.
	PartyType param.Field[PaymentOrderNewParamsReceivingAccountPartyType] `json:"party_type"`
	// If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
	// you can pass the processor token in this field.
	PlaidProcessorToken param.Field[string]                                               `json:"plaid_processor_token"`
	RoutingDetails      param.Field[[]PaymentOrderNewParamsReceivingAccountRoutingDetail] `json:"routing_details"`
}

Either `receiving_account` or `receiving_account_id` must be present. When using `receiving_account_id`, you may pass the id of an external account or an internal account.

func (PaymentOrderNewParamsReceivingAccount) MarshalJSON

func (r PaymentOrderNewParamsReceivingAccount) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsReceivingAccountAccountDetail

type PaymentOrderNewParamsReceivingAccountAccountDetail struct {
	AccountNumber     param.Field[string]                                                               `json:"account_number,required"`
	AccountNumberType param.Field[PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType] `json:"account_number_type"`
}

func (PaymentOrderNewParamsReceivingAccountAccountDetail) MarshalJSON

func (r PaymentOrderNewParamsReceivingAccountAccountDetail) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType

type PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType string
const (
	PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberTypeIban          PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType = "iban"
	PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberTypeClabe         PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType = "clabe"
	PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberTypeWalletAddress PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType = "wallet_address"
	PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberTypePan           PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType = "pan"
	PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberTypeOther         PaymentOrderNewParamsReceivingAccountAccountDetailsAccountNumberType = "other"
)

type PaymentOrderNewParamsReceivingAccountContactDetail

type PaymentOrderNewParamsReceivingAccountContactDetail struct {
	ContactIdentifier     param.Field[string]                                                                   `json:"contact_identifier"`
	ContactIdentifierType param.Field[PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}

func (PaymentOrderNewParamsReceivingAccountContactDetail) MarshalJSON

func (r PaymentOrderNewParamsReceivingAccountContactDetail) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierType

type PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierType string
const (
	PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierTypeEmail       PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierType = "email"
	PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierTypePhoneNumber PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierType = "phone_number"
	PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierTypeWebsite     PaymentOrderNewParamsReceivingAccountContactDetailsContactIdentifierType = "website"
)

type PaymentOrderNewParamsReceivingAccountLedgerAccount

type PaymentOrderNewParamsReceivingAccountLedgerAccount struct {
	// The currency of the ledger account.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the ledger that this account belongs to.
	LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
	// The name of the ledger account.
	Name param.Field[string] `json:"name,required"`
	// The normal balance of the ledger account.
	NormalBalance param.Field[PaymentOrderNewParamsReceivingAccountLedgerAccountNormalBalance] `json:"normal_balance,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// The description of the ledger account.
	Description param.Field[string] `json:"description"`
	// If the ledger account links to another object in Modern Treasury, the id will be
	// populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the type will
	// be populated here, otherwise null. The value is one of internal_account or
	// external_account.
	LedgerableType param.Field[PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

Specifies a ledger account object that will be created with the external account. The resulting ledger account is linked to the external account for auto-ledgering Payment objects. See https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects for more details.

func (PaymentOrderNewParamsReceivingAccountLedgerAccount) MarshalJSON

func (r PaymentOrderNewParamsReceivingAccountLedgerAccount) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableType

type PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableType string

If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.

const (
	PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableTypeExternalAccount PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableType = "external_account"
	PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableTypeInternalAccount PaymentOrderNewParamsReceivingAccountLedgerAccountLedgerableType = "internal_account"
)

type PaymentOrderNewParamsReceivingAccountLedgerAccountNormalBalance

type PaymentOrderNewParamsReceivingAccountLedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	PaymentOrderNewParamsReceivingAccountLedgerAccountNormalBalanceCredit PaymentOrderNewParamsReceivingAccountLedgerAccountNormalBalance = "credit"
	PaymentOrderNewParamsReceivingAccountLedgerAccountNormalBalanceDebit  PaymentOrderNewParamsReceivingAccountLedgerAccountNormalBalance = "debit"
)

type PaymentOrderNewParamsReceivingAccountPartyAddress

type PaymentOrderNewParamsReceivingAccountPartyAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country"`
	Line1   param.Field[string] `json:"line1"`
	Line2   param.Field[string] `json:"line2"`
	// Locality or City.
	Locality param.Field[string] `json:"locality"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code"`
	// Region or State.
	Region param.Field[string] `json:"region"`
}

Required if receiving wire payments.

func (PaymentOrderNewParamsReceivingAccountPartyAddress) MarshalJSON

func (r PaymentOrderNewParamsReceivingAccountPartyAddress) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsReceivingAccountPartyType

type PaymentOrderNewParamsReceivingAccountPartyType string

Either `individual` or `business`.

const (
	PaymentOrderNewParamsReceivingAccountPartyTypeBusiness   PaymentOrderNewParamsReceivingAccountPartyType = "business"
	PaymentOrderNewParamsReceivingAccountPartyTypeIndividual PaymentOrderNewParamsReceivingAccountPartyType = "individual"
)

type PaymentOrderNewParamsReceivingAccountRoutingDetail

type PaymentOrderNewParamsReceivingAccountRoutingDetail struct {
	RoutingNumber     param.Field[string]                                                               `json:"routing_number,required"`
	RoutingNumberType param.Field[PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
	PaymentType       param.Field[PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType]       `json:"payment_type"`
}

func (PaymentOrderNewParamsReceivingAccountRoutingDetail) MarshalJSON

func (r PaymentOrderNewParamsReceivingAccountRoutingDetail) MarshalJSON() (data []byte, err error)

type PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType

type PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType string
const (
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeACH         PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "ach"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeAuBecs      PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "au_becs"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeSeBankgirot PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "se_bankgirot"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeBacs        PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "bacs"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeBook        PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "book"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeCard        PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "card"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeCheck       PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "check"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeEft         PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "eft"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeCrossBorder PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "cross_border"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeInterac     PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "interac"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeMasav       PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "masav"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeNeft        PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "neft"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeNics        PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "nics"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeProvxchange PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "provxchange"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeRtp         PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "rtp"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeSen         PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "sen"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeSic         PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "sic"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeSepa        PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "sepa"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeSignet      PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "signet"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeWire        PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "wire"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentTypeZengin      PaymentOrderNewParamsReceivingAccountRoutingDetailsPaymentType = "zengin"
)

type PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType

type PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType string
const (
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeAba                    PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "aba"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeAuBsb                  PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "au_bsb"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeBrCodigo               PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "br_codigo"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeCaCpa                  PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "ca_cpa"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeChips                  PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "chips"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeCnaps                  PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "cnaps"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeGBSortCode             PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "gb_sort_code"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeInIfsc                 PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "in_ifsc"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeMyBranchCode           PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "my_branch_code"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeSwift                  PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "swift"
	PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberTypeJpZenginCode           PaymentOrderNewParamsReceivingAccountRoutingDetailsRoutingNumberType = "jp_zengin_code"
)

type PaymentOrderPriority

type PaymentOrderPriority string

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.

const (
	PaymentOrderPriorityHigh   PaymentOrderPriority = "high"
	PaymentOrderPriorityNormal PaymentOrderPriority = "normal"
)

type PaymentOrderReceivingAccountType

type PaymentOrderReceivingAccountType string
const (
	PaymentOrderReceivingAccountTypeInternalAccount PaymentOrderReceivingAccountType = "internal_account"
	PaymentOrderReceivingAccountTypeExternalAccount PaymentOrderReceivingAccountType = "external_account"
)

type PaymentOrderReferenceNumber

type PaymentOrderReferenceNumber struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool   `json:"live_mode,required"`
	Object   string `json:"object,required"`
	// The vendor reference number.
	ReferenceNumber string `json:"reference_number,required"`
	// The type of the reference number. Referring to the vendor payment id.
	ReferenceNumberType PaymentOrderReferenceNumbersReferenceNumberType `json:"reference_number_type,required"`
	UpdatedAt           time.Time                                       `json:"updated_at,required" format:"date-time"`
	JSON                paymentOrderReferenceNumberJSON
}

func (*PaymentOrderReferenceNumber) UnmarshalJSON

func (r *PaymentOrderReferenceNumber) UnmarshalJSON(data []byte) (err error)

type PaymentOrderReferenceNumbersReferenceNumberType

type PaymentOrderReferenceNumbersReferenceNumberType string

The type of the reference number. Referring to the vendor payment id.

const (
	PaymentOrderReferenceNumbersReferenceNumberTypeACHOriginalTraceNumber          PaymentOrderReferenceNumbersReferenceNumberType = "ach_original_trace_number"
	PaymentOrderReferenceNumbersReferenceNumberTypeACHTraceNumber                  PaymentOrderReferenceNumbersReferenceNumberType = "ach_trace_number"
	PaymentOrderReferenceNumbersReferenceNumberTypeBankprovPaymentActivityDate     PaymentOrderReferenceNumbersReferenceNumberType = "bankprov_payment_activity_date"
	PaymentOrderReferenceNumbersReferenceNumberTypeBankprovPaymentID               PaymentOrderReferenceNumbersReferenceNumberType = "bankprov_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeBnkDevPrenotificationID         PaymentOrderReferenceNumbersReferenceNumberType = "bnk_dev_prenotification_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeBnkDevTransferID                PaymentOrderReferenceNumbersReferenceNumberType = "bnk_dev_transfer_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeBofaEndToEndID                  PaymentOrderReferenceNumbersReferenceNumberType = "bofa_end_to_end_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeBofaTransactionID               PaymentOrderReferenceNumbersReferenceNumberType = "bofa_transaction_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeCheckNumber                     PaymentOrderReferenceNumbersReferenceNumberType = "check_number"
	PaymentOrderReferenceNumbersReferenceNumberTypeColumnFxQuoteID                 PaymentOrderReferenceNumbersReferenceNumberType = "column_fx_quote_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeColumnReversalPairTransferID    PaymentOrderReferenceNumbersReferenceNumberType = "column_reversal_pair_transfer_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeColumnTransferID                PaymentOrderReferenceNumbersReferenceNumberType = "column_transfer_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverPaymentID             PaymentOrderReferenceNumbersReferenceNumberType = "cross_river_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeCrossRiverTransactionID         PaymentOrderReferenceNumbersReferenceNumberType = "cross_river_transaction_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeCurrencycloudConversionID       PaymentOrderReferenceNumbersReferenceNumberType = "currencycloud_conversion_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeCurrencycloudPaymentID          PaymentOrderReferenceNumbersReferenceNumberType = "currencycloud_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeDcBankTransactionID             PaymentOrderReferenceNumbersReferenceNumberType = "dc_bank_transaction_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeDwollaTransactionID             PaymentOrderReferenceNumbersReferenceNumberType = "dwolla_transaction_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeEftTraceNumber                  PaymentOrderReferenceNumbersReferenceNumberType = "eft_trace_number"
	PaymentOrderReferenceNumbersReferenceNumberTypeEvolveTransactionID             PaymentOrderReferenceNumbersReferenceNumberType = "evolve_transaction_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeFedwireImad                     PaymentOrderReferenceNumbersReferenceNumberType = "fedwire_imad"
	PaymentOrderReferenceNumbersReferenceNumberTypeFedwireOmad                     PaymentOrderReferenceNumbersReferenceNumberType = "fedwire_omad"
	PaymentOrderReferenceNumbersReferenceNumberTypeFirstRepublicInternalID         PaymentOrderReferenceNumbersReferenceNumberType = "first_republic_internal_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsCollectionRequestID PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_collection_request_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsEndToEndID          PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_end_to_end_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsPaymentRequestID    PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_payment_request_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsRequestID           PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_request_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeGoldmanSachsUniquePaymentID     PaymentOrderReferenceNumbersReferenceNumberType = "goldman_sachs_unique_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeInteracMessageID                PaymentOrderReferenceNumbersReferenceNumberType = "interac_message_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcCcn                         PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_ccn"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcCustomerReferenceID         PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_customer_reference_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcEndToEndID                  PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_end_to_end_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcFirmRootID                  PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_firm_root_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcP3ID                        PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_p3_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentBatchID              PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_payment_batch_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentInformationID        PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_payment_information_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeJpmcPaymentReturnedDatetime     PaymentOrderReferenceNumbersReferenceNumberType = "jpmc_payment_returned_datetime"
	PaymentOrderReferenceNumbersReferenceNumberTypeLobCheckID                      PaymentOrderReferenceNumbersReferenceNumberType = "lob_check_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeOther                           PaymentOrderReferenceNumbersReferenceNumberType = "other"
	PaymentOrderReferenceNumbersReferenceNumberTypePartialSwiftMir                 PaymentOrderReferenceNumbersReferenceNumberType = "partial_swift_mir"
	PaymentOrderReferenceNumbersReferenceNumberTypePncClearingReference            PaymentOrderReferenceNumbersReferenceNumberType = "pnc_clearing_reference"
	PaymentOrderReferenceNumbersReferenceNumberTypePncInstructionID                PaymentOrderReferenceNumbersReferenceNumberType = "pnc_instruction_id"
	PaymentOrderReferenceNumbersReferenceNumberTypePncMultipaymentID               PaymentOrderReferenceNumbersReferenceNumberType = "pnc_multipayment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypePncPaymentTraceID               PaymentOrderReferenceNumbersReferenceNumberType = "pnc_payment_trace_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeRspecVendorPaymentID            PaymentOrderReferenceNumbersReferenceNumberType = "rspec_vendor_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeRtpInstructionID                PaymentOrderReferenceNumbersReferenceNumberType = "rtp_instruction_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeSignetAPIReferenceID            PaymentOrderReferenceNumbersReferenceNumberType = "signet_api_reference_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeSignetConfirmationID            PaymentOrderReferenceNumbersReferenceNumberType = "signet_confirmation_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeSignetRequestID                 PaymentOrderReferenceNumbersReferenceNumberType = "signet_request_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeSilvergatePaymentID             PaymentOrderReferenceNumbersReferenceNumberType = "silvergate_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeSwiftMir                        PaymentOrderReferenceNumbersReferenceNumberType = "swift_mir"
	PaymentOrderReferenceNumbersReferenceNumberTypeSwiftUetr                       PaymentOrderReferenceNumbersReferenceNumberType = "swift_uetr"
	PaymentOrderReferenceNumbersReferenceNumberTypeUsbankPaymentID                 PaymentOrderReferenceNumbersReferenceNumberType = "usbank_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoPaymentID             PaymentOrderReferenceNumbersReferenceNumberType = "wells_fargo_payment_id"
	PaymentOrderReferenceNumbersReferenceNumberTypeWellsFargoTraceNumber           PaymentOrderReferenceNumbersReferenceNumberType = "wells_fargo_trace_number"
)

type PaymentOrderReversalListParams

type PaymentOrderReversalListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	PerPage     param.Field[int64]  `query:"per_page"`
}

func (PaymentOrderReversalListParams) URLQuery

func (r PaymentOrderReversalListParams) URLQuery() (v url.Values)

URLQuery serializes PaymentOrderReversalListParams's query parameters as `url.Values`.

type PaymentOrderReversalNewParams

type PaymentOrderReversalNewParams struct {
	// The reason for the reversal. Must be one of `duplicate`, `incorrect_amount`,
	// `incorrect_receiving_account`, `date_earlier_than_intended`,
	// `date_later_than_intended`.
	Reason param.Field[PaymentOrderReversalNewParamsReason] `json:"reason,required"`
	// Specifies a ledger transaction object that will be created with the reversal. If
	// the ledger transaction cannot be created, then the reversal creation will fail.
	// The resulting ledger transaction will mirror the status of the reversal.
	LedgerTransaction param.Field[PaymentOrderReversalNewParamsLedgerTransaction] `json:"ledger_transaction"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (PaymentOrderReversalNewParams) MarshalJSON

func (r PaymentOrderReversalNewParams) MarshalJSON() (data []byte, err error)

type PaymentOrderReversalNewParamsLedgerTransaction

type PaymentOrderReversalNewParamsLedgerTransaction struct {
	// An array of ledger entry objects.
	LedgerEntries param.Field[[]PaymentOrderReversalNewParamsLedgerTransactionLedgerEntry] `json:"ledger_entries,required"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// The timestamp (ISO8601 format) at which the ledger transaction happened for
	// reporting purposes.
	EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date"`
	// The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
	// purposes.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// A unique string to represent the ledger transaction. Only one pending or posted
	// ledger transaction may have this ID in the ledger.
	ExternalID param.Field[string] `json:"external_id"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the id will be populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger transaction can be reconciled to another object in Modern
	// Treasury, the type will be populated here, otherwise null. This can be one of
	// payment_order, incoming_payment_detail, expected_payment, return, or reversal.
	LedgerableType param.Field[PaymentOrderReversalNewParamsLedgerTransactionLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// To post a ledger transaction at creation, use `posted`.
	Status param.Field[PaymentOrderReversalNewParamsLedgerTransactionStatus] `json:"status"`
}

Specifies a ledger transaction object that will be created with the reversal. If the ledger transaction cannot be created, then the reversal creation will fail. The resulting ledger transaction will mirror the status of the reversal.

func (PaymentOrderReversalNewParamsLedgerTransaction) MarshalJSON

func (r PaymentOrderReversalNewParamsLedgerTransaction) MarshalJSON() (data []byte, err error)

type PaymentOrderReversalNewParamsLedgerTransactionLedgerEntriesDirection

type PaymentOrderReversalNewParamsLedgerTransactionLedgerEntriesDirection string

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`.

const (
	PaymentOrderReversalNewParamsLedgerTransactionLedgerEntriesDirectionCredit PaymentOrderReversalNewParamsLedgerTransactionLedgerEntriesDirection = "credit"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerEntriesDirectionDebit  PaymentOrderReversalNewParamsLedgerTransactionLedgerEntriesDirection = "debit"
)

type PaymentOrderReversalNewParamsLedgerTransactionLedgerEntry

type PaymentOrderReversalNewParamsLedgerTransactionLedgerEntry struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000. Can be any integer up to 36 digits.
	Amount param.Field[int64] `json:"amount,required"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[PaymentOrderReversalNewParamsLedgerTransactionLedgerEntriesDirection] `json:"direction,required"`
	// The ledger account that this ledger entry is associated with.
	LedgerAccountID param.Field[string] `json:"ledger_account_id,required" format:"uuid"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s available balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	AvailableBalanceAmount param.Field[map[string]int64] `json:"available_balance_amount"`
	// Lock version of the ledger account. This can be passed when creating a ledger
	// transaction to only succeed if no ledger transactions have posted since the
	// given version. See our post about Designing the Ledgers API with Optimistic
	// Locking for more details.
	LockVersion param.Field[int64] `json:"lock_version"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s pending balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PendingBalanceAmount param.Field[map[string]int64] `json:"pending_balance_amount"`
	// Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
	// account’s posted balance. If any of these conditions would be false after the
	// transaction is created, the entire call will fail with error code 422.
	PostedBalanceAmount param.Field[map[string]int64] `json:"posted_balance_amount"`
	// If true, response will include the balance of the associated ledger account for
	// the entry.
	ShowResultingLedgerAccountBalances param.Field[bool] `json:"show_resulting_ledger_account_balances"`
}

func (PaymentOrderReversalNewParamsLedgerTransactionLedgerEntry) MarshalJSON

type PaymentOrderReversalNewParamsLedgerTransactionLedgerableType

type PaymentOrderReversalNewParamsLedgerTransactionLedgerableType string

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, or reversal.

const (
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypeCounterparty          PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "counterparty"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypeExpectedPayment       PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "expected_payment"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypeIncomingPaymentDetail PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "incoming_payment_detail"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypeInternalAccount       PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "internal_account"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypeLineItem              PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "line_item"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypePaperItem             PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "paper_item"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypePaymentOrder          PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "payment_order"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypePaymentOrderAttempt   PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "payment_order_attempt"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypeReturn                PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "return"
	PaymentOrderReversalNewParamsLedgerTransactionLedgerableTypeReversal              PaymentOrderReversalNewParamsLedgerTransactionLedgerableType = "reversal"
)

type PaymentOrderReversalNewParamsLedgerTransactionStatus

type PaymentOrderReversalNewParamsLedgerTransactionStatus string

To post a ledger transaction at creation, use `posted`.

const (
	PaymentOrderReversalNewParamsLedgerTransactionStatusArchived PaymentOrderReversalNewParamsLedgerTransactionStatus = "archived"
	PaymentOrderReversalNewParamsLedgerTransactionStatusPending  PaymentOrderReversalNewParamsLedgerTransactionStatus = "pending"
	PaymentOrderReversalNewParamsLedgerTransactionStatusPosted   PaymentOrderReversalNewParamsLedgerTransactionStatus = "posted"
)

type PaymentOrderReversalNewParamsReason

type PaymentOrderReversalNewParamsReason string

The reason for the reversal. Must be one of `duplicate`, `incorrect_amount`, `incorrect_receiving_account`, `date_earlier_than_intended`, `date_later_than_intended`.

const (
	PaymentOrderReversalNewParamsReasonDuplicate                 PaymentOrderReversalNewParamsReason = "duplicate"
	PaymentOrderReversalNewParamsReasonIncorrectAmount           PaymentOrderReversalNewParamsReason = "incorrect_amount"
	PaymentOrderReversalNewParamsReasonIncorrectReceivingAccount PaymentOrderReversalNewParamsReason = "incorrect_receiving_account"
	PaymentOrderReversalNewParamsReasonDateEarlierThanIntended   PaymentOrderReversalNewParamsReason = "date_earlier_than_intended"
	PaymentOrderReversalNewParamsReasonDateLaterThanIntended     PaymentOrderReversalNewParamsReason = "date_later_than_intended"
)

type PaymentOrderReversalService

type PaymentOrderReversalService struct {
	Options []option.RequestOption
}

PaymentOrderReversalService 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 NewPaymentOrderReversalService method instead.

func NewPaymentOrderReversalService

func NewPaymentOrderReversalService(opts ...option.RequestOption) (r *PaymentOrderReversalService)

NewPaymentOrderReversalService 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 (*PaymentOrderReversalService) Get

func (r *PaymentOrderReversalService) Get(ctx context.Context, paymentOrderID string, reversalID string, opts ...option.RequestOption) (res *Reversal, err error)

Get details on a single reversal of a payment order.

func (*PaymentOrderReversalService) List

Get a list of all reversals of a payment order.

func (*PaymentOrderReversalService) ListAutoPaging

Get a list of all reversals of a payment order.

func (*PaymentOrderReversalService) New

func (r *PaymentOrderReversalService) New(ctx context.Context, paymentOrderID string, body PaymentOrderReversalNewParams, opts ...option.RequestOption) (res *Reversal, err error)

Create a reversal for a payment order.

type PaymentOrderService

type PaymentOrderService struct {
	Options   []option.RequestOption
	Reversals *PaymentOrderReversalService
}

PaymentOrderService contains methods and other services that help with interacting with the Modern Treasury API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPaymentOrderService method instead.

func NewPaymentOrderService

func NewPaymentOrderService(opts ...option.RequestOption) (r *PaymentOrderService)

NewPaymentOrderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PaymentOrderService) Get

func (r *PaymentOrderService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentOrder, err error)

Get details on a single payment order

func (*PaymentOrderService) List

Get a list of all payment orders

func (*PaymentOrderService) ListAutoPaging

Get a list of all payment orders

func (*PaymentOrderService) New

Create a new Payment Order

func (*PaymentOrderService) NewAsync

Create a new payment order asynchronously

func (*PaymentOrderService) Update

Update a payment order

type PaymentOrderStatus

type PaymentOrderStatus string

The current status of the payment order.

const (
	PaymentOrderStatusApproved      PaymentOrderStatus = "approved"
	PaymentOrderStatusCancelled     PaymentOrderStatus = "cancelled"
	PaymentOrderStatusCompleted     PaymentOrderStatus = "completed"
	PaymentOrderStatusDenied        PaymentOrderStatus = "denied"
	PaymentOrderStatusFailed        PaymentOrderStatus = "failed"
	PaymentOrderStatusNeedsApproval PaymentOrderStatus = "needs_approval"
	PaymentOrderStatusPending       PaymentOrderStatus = "pending"
	PaymentOrderStatusProcessing    PaymentOrderStatus = "processing"
	PaymentOrderStatusReturned      PaymentOrderStatus = "returned"
	PaymentOrderStatusReversed      PaymentOrderStatus = "reversed"
	PaymentOrderStatusSent          PaymentOrderStatus = "sent"
)

type PaymentOrderSubtype

type PaymentOrderSubtype string

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`.

const (
	PaymentOrderSubtypeBacsNewInstruction          PaymentOrderSubtype = "0C"
	PaymentOrderSubtypeBacsCancellationInstruction PaymentOrderSubtype = "0N"
	PaymentOrderSubtypeBacsConversionInstruction   PaymentOrderSubtype = "0S"
	PaymentOrderSubtypeCcd                         PaymentOrderSubtype = "CCD"
	PaymentOrderSubtypeCie                         PaymentOrderSubtype = "CIE"
	PaymentOrderSubtypeCtx                         PaymentOrderSubtype = "CTX"
	PaymentOrderSubtypeIat                         PaymentOrderSubtype = "IAT"
	PaymentOrderSubtypePpd                         PaymentOrderSubtype = "PPD"
	PaymentOrderSubtypeTel                         PaymentOrderSubtype = "TEL"
	PaymentOrderSubtypeWeb                         PaymentOrderSubtype = "WEB"
)

type PaymentOrderType

type PaymentOrderType string

One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`, `zengin`.

const (
	PaymentOrderTypeACH         PaymentOrderType = "ach"
	PaymentOrderTypeAuBecs      PaymentOrderType = "au_becs"
	PaymentOrderTypeBacs        PaymentOrderType = "bacs"
	PaymentOrderTypeBook        PaymentOrderType = "book"
	PaymentOrderTypeCard        PaymentOrderType = "card"
	PaymentOrderTypeCheck       PaymentOrderType = "check"
	PaymentOrderTypeCrossBorder PaymentOrderType = "cross_border"
	PaymentOrderTypeEft         PaymentOrderType = "eft"
	PaymentOrderTypeInterac     PaymentOrderType = "interac"
	PaymentOrderTypeMasav       PaymentOrderType = "masav"
	PaymentOrderTypeNeft        PaymentOrderType = "neft"
	PaymentOrderTypeNics        PaymentOrderType = "nics"
	PaymentOrderTypeProvxchange PaymentOrderType = "provxchange"
	PaymentOrderTypeRtp         PaymentOrderType = "rtp"
	PaymentOrderTypeSeBankgirot PaymentOrderType = "se_bankgirot"
	PaymentOrderTypeSen         PaymentOrderType = "sen"
	PaymentOrderTypeSepa        PaymentOrderType = "sepa"
	PaymentOrderTypeSic         PaymentOrderType = "sic"
	PaymentOrderTypeSignet      PaymentOrderType = "signet"
	PaymentOrderTypeWire        PaymentOrderType = "wire"
	PaymentOrderTypeZengin      PaymentOrderType = "zengin"
)

type PaymentOrderUpdateParams

type PaymentOrderUpdateParams struct {
	Accounting param.Field[PaymentOrderUpdateParamsAccounting] `json:"accounting"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID param.Field[string] `json:"accounting_category_id" format:"uuid"`
	// The ID of one of your accounting ledger classes. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingLedgerClassID param.Field[string] `json:"accounting_ledger_class_id" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented as
	// 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000.
	Amount param.Field[int64] `json:"amount"`
	// The party that will pay the fees for the payment order. Only applies to wire
	// payment orders. Can be one of shared, sender, or receiver, which correspond
	// respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`.
	ChargeBearer param.Field[PaymentOrderUpdateParamsChargeBearer] `json:"charge_bearer"`
	// Required when receiving_account_id is passed the ID of an external account.
	CounterpartyID param.Field[string] `json:"counterparty_id" format:"uuid"`
	// Defaults to the currency of the originating account.
	Currency param.Field[shared.Currency] `json:"currency"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// One of `credit`, `debit`. Describes the direction money is flowing in the
	// transaction. A `credit` moves money from your account to someone else's. A
	// `debit` pulls money from someone else's account to your own. Note that wire,
	// rtp, and check payments will always be `credit`.
	Direction param.Field[PaymentOrderUpdateParamsDirection] `json:"direction"`
	// Date transactions are to be posted to the participants' account. Defaults to the
	// current business day or the next business day if the current day is a bank
	// holiday or weekend. Format: yyyy-mm-dd.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// RFP payments require an expires_at. This value must be past the effective_date.
	ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
	// A payment type to fallback to if the original type is not valid for the
	// receiving account. Currently, this only supports falling back from RTP to ACH
	// (type=rtp and fallback_type=ach)
	FallbackType param.Field[PaymentOrderUpdateParamsFallbackType] `json:"fallback_type"`
	// If present, indicates a specific foreign exchange contract number that has been
	// generated by your financial institution.
	ForeignExchangeContract param.Field[string] `json:"foreign_exchange_contract"`
	// Indicates the type of FX transfer to initiate, can be either
	// `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order
	// currency matches the originating account currency.
	ForeignExchangeIndicator param.Field[PaymentOrderUpdateParamsForeignExchangeIndicator] `json:"foreign_exchange_indicator"`
	// An array of line items that must sum up to the amount of the payment order.
	LineItems param.Field[[]PaymentOrderUpdateParamsLineItem] `json:"line_items"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A boolean to determine if NSF Protection is enabled for this payment order. Note
	// that this setting must also be turned on in your organization settings page.
	NsfProtected param.Field[bool] `json:"nsf_protected"`
	// The ID of one of your organization's internal accounts.
	OriginatingAccountID param.Field[string] `json:"originating_account_id" format:"uuid"`
	// If present, this will replace your default company name on receiver's bank
	// statement. This field can only be used for ACH payments currently. For ACH, only
	// the first 16 characters of this string will be used. Any additional characters
	// will be truncated.
	OriginatingPartyName param.Field[string] `json:"originating_party_name"`
	// Either `normal` or `high`. For ACH and EFT payments, `high` represents a
	// same-day ACH or EFT transfer, respectively. For check payments, `high` can mean
	// an overnight check rather than standard mail.
	Priority param.Field[PaymentOrderUpdateParamsPriority] `json:"priority"`
	// For `wire`, this is usually the purpose which is transmitted via the
	// "InstrForDbtrAgt" field in the ISO20022 file. If you are using Currencycloud,
	// this is the `payment.purpose_code` field. For `eft`, this field is the 3 digit
	// CPA Code that will be attached to the payment.
	Purpose param.Field[string] `json:"purpose"`
	// Either `receiving_account` or `receiving_account_id` must be present. When using
	// `receiving_account_id`, you may pass the id of an external account or an
	// internal account.
	ReceivingAccount param.Field[PaymentOrderUpdateParamsReceivingAccount] `json:"receiving_account"`
	// Either `receiving_account` or `receiving_account_id` must be present. When using
	// `receiving_account_id`, you may pass the id of an external account or an
	// internal account.
	ReceivingAccountID param.Field[string] `json:"receiving_account_id" format:"uuid"`
	// For `ach`, this field will be passed through on an addenda record. For `wire`
	// payments the field will be passed through as the "Originator to Beneficiary
	// Information", also known as OBI or Fedwire tag 6000.
	RemittanceInformation param.Field[string] `json:"remittance_information"`
	// Send an email to the counterparty when the payment order is sent to the bank. If
	// `null`, `send_remittance_advice` on the Counterparty is used.
	SendRemittanceAdvice param.Field[bool] `json:"send_remittance_advice"`
	// An optional descriptor which will appear in the receiver's statement. For
	// `check` payments this field will be used as the memo line. For `ach` the maximum
	// length is 10 characters. Note that for ACH payments, the name on your bank
	// account will be included automatically by the bank, so you can use the
	// characters for other useful information. For `eft` the maximum length is 15
	// characters.
	StatementDescriptor param.Field[string] `json:"statement_descriptor"`
	// To cancel a payment order, use `cancelled`. To redraft a returned payment order,
	// use `approved`. To undo approval on a denied or approved payment order, use
	// `needs_approval`.
	Status param.Field[PaymentOrderUpdateParamsStatus] `json:"status"`
	// An additional layer of classification for the type of payment order you are
	// doing. This field is only used for `ach` payment orders currently. For `ach`
	// payment orders, the `subtype` represents the SEC code. We currently support
	// `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`.
	Subtype param.Field[PaymentOrderSubtype] `json:"subtype"`
	// One of `ach`, `bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`,
	// `bacs`, `au_becs`, `interac`, `neft`, `nics`, `sic`, `signet`, `provexchange`,
	// `zengin`.
	Type param.Field[PaymentOrderType] `json:"type"`
	// This represents the identifier by which the person is known to the receiver when
	// using the CIE subtype for ACH payments. Only the first 22 characters of this
	// string will be used. Any additional characters will be truncated.
	UltimateOriginatingPartyIdentifier param.Field[string] `json:"ultimate_originating_party_identifier"`
	// This represents the name of the person that the payment is on behalf of when
	// using the CIE subtype for ACH payments. Only the first 15 characters of this
	// string will be used. Any additional characters will be truncated.
	UltimateOriginatingPartyName param.Field[string] `json:"ultimate_originating_party_name"`
	// This represents the name of the merchant that the payment is being sent to when
	// using the CIE subtype for ACH payments. Only the first 22 characters of this
	// string will be used. Any additional characters will be truncated.
	UltimateReceivingPartyIdentifier param.Field[string] `json:"ultimate_receiving_party_identifier"`
	// This represents the identifier by which the merchant is known to the person
	// initiating an ACH payment with CIE subtype. Only the first 15 characters of this
	// string will be used. Any additional characters will be truncated.
	UltimateReceivingPartyName param.Field[string] `json:"ultimate_receiving_party_name"`
}

func (PaymentOrderUpdateParams) MarshalJSON

func (r PaymentOrderUpdateParams) MarshalJSON() (data []byte, err error)

type PaymentOrderUpdateParamsAccounting

type PaymentOrderUpdateParamsAccounting struct {
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountID param.Field[string] `json:"account_id" format:"uuid"`
	// The ID of one of the class objects in your accounting system. Class objects
	// track segments of your business independent of client or project. Note that
	// these will only be accessible if your accounting system has been connected.
	ClassID param.Field[string] `json:"class_id" format:"uuid"`
}

func (PaymentOrderUpdateParamsAccounting) MarshalJSON

func (r PaymentOrderUpdateParamsAccounting) MarshalJSON() (data []byte, err error)

type PaymentOrderUpdateParamsChargeBearer

type PaymentOrderUpdateParamsChargeBearer string

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`.

const (
	PaymentOrderUpdateParamsChargeBearerShared   PaymentOrderUpdateParamsChargeBearer = "shared"
	PaymentOrderUpdateParamsChargeBearerSender   PaymentOrderUpdateParamsChargeBearer = "sender"
	PaymentOrderUpdateParamsChargeBearerReceiver PaymentOrderUpdateParamsChargeBearer = "receiver"
)

type PaymentOrderUpdateParamsDirection

type PaymentOrderUpdateParamsDirection string

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`.

const (
	PaymentOrderUpdateParamsDirectionCredit PaymentOrderUpdateParamsDirection = "credit"
	PaymentOrderUpdateParamsDirectionDebit  PaymentOrderUpdateParamsDirection = "debit"
)

type PaymentOrderUpdateParamsFallbackType

type PaymentOrderUpdateParamsFallbackType string

A payment type to fallback to if the original type is not valid for the receiving account. Currently, this only supports falling back from RTP to ACH (type=rtp and fallback_type=ach)

const (
	PaymentOrderUpdateParamsFallbackTypeACH PaymentOrderUpdateParamsFallbackType = "ach"
)

type PaymentOrderUpdateParamsForeignExchangeIndicator

type PaymentOrderUpdateParamsForeignExchangeIndicator string

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.

const (
	PaymentOrderUpdateParamsForeignExchangeIndicatorFixedToVariable PaymentOrderUpdateParamsForeignExchangeIndicator = "fixed_to_variable"
	PaymentOrderUpdateParamsForeignExchangeIndicatorVariableToFixed PaymentOrderUpdateParamsForeignExchangeIndicator = "variable_to_fixed"
)

type PaymentOrderUpdateParamsLineItem

type PaymentOrderUpdateParamsLineItem struct {
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount param.Field[int64] `json:"amount,required"`
	// The ID of one of your accounting categories. Note that these will only be
	// accessible if your accounting system has been connected.
	AccountingCategoryID param.Field[string] `json:"accounting_category_id"`
	// A free-form description of the line item.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (PaymentOrderUpdateParamsLineItem) MarshalJSON

func (r PaymentOrderUpdateParamsLineItem) MarshalJSON() (data []byte, err error)

type PaymentOrderUpdateParamsPriority

type PaymentOrderUpdateParamsPriority string

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.

const (
	PaymentOrderUpdateParamsPriorityHigh   PaymentOrderUpdateParamsPriority = "high"
	PaymentOrderUpdateParamsPriorityNormal PaymentOrderUpdateParamsPriority = "normal"
)

type PaymentOrderUpdateParamsReceivingAccount

type PaymentOrderUpdateParamsReceivingAccount struct {
	AccountDetails param.Field[[]PaymentOrderUpdateParamsReceivingAccountAccountDetail] `json:"account_details"`
	// Can be `checking`, `savings` or `other`.
	AccountType    param.Field[ExternalAccountType]                                     `json:"account_type"`
	ContactDetails param.Field[[]PaymentOrderUpdateParamsReceivingAccountContactDetail] `json:"contact_details"`
	// Specifies a ledger account object that will be created with the external
	// account. The resulting ledger account is linked to the external account for
	// auto-ledgering Payment objects. See
	// https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
	// for more details.
	LedgerAccount param.Field[PaymentOrderUpdateParamsReceivingAccountLedgerAccount] `json:"ledger_account"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// A nickname for the external account. This is only for internal usage and won't
	// affect any payments
	Name param.Field[string] `json:"name"`
	// Required if receiving wire payments.
	PartyAddress    param.Field[PaymentOrderUpdateParamsReceivingAccountPartyAddress] `json:"party_address"`
	PartyIdentifier param.Field[string]                                               `json:"party_identifier"`
	// If this value isn't provided, it will be inherited from the counterparty's name.
	PartyName param.Field[string] `json:"party_name"`
	// Either `individual` or `business`.
	PartyType param.Field[PaymentOrderUpdateParamsReceivingAccountPartyType] `json:"party_type"`
	// If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
	// you can pass the processor token in this field.
	PlaidProcessorToken param.Field[string]                                                  `json:"plaid_processor_token"`
	RoutingDetails      param.Field[[]PaymentOrderUpdateParamsReceivingAccountRoutingDetail] `json:"routing_details"`
}

Either `receiving_account` or `receiving_account_id` must be present. When using `receiving_account_id`, you may pass the id of an external account or an internal account.

func (PaymentOrderUpdateParamsReceivingAccount) MarshalJSON

func (r PaymentOrderUpdateParamsReceivingAccount) MarshalJSON() (data []byte, err error)

type PaymentOrderUpdateParamsReceivingAccountAccountDetail

type PaymentOrderUpdateParamsReceivingAccountAccountDetail struct {
	AccountNumber     param.Field[string]                                                                  `json:"account_number,required"`
	AccountNumberType param.Field[PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType] `json:"account_number_type"`
}

func (PaymentOrderUpdateParamsReceivingAccountAccountDetail) MarshalJSON

type PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType

type PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType string
const (
	PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberTypeIban          PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType = "iban"
	PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberTypeClabe         PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType = "clabe"
	PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberTypeWalletAddress PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType = "wallet_address"
	PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberTypePan           PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType = "pan"
	PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberTypeOther         PaymentOrderUpdateParamsReceivingAccountAccountDetailsAccountNumberType = "other"
)

type PaymentOrderUpdateParamsReceivingAccountContactDetail

type PaymentOrderUpdateParamsReceivingAccountContactDetail struct {
	ContactIdentifier     param.Field[string]                                                                      `json:"contact_identifier"`
	ContactIdentifierType param.Field[PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierType] `json:"contact_identifier_type"`
}

func (PaymentOrderUpdateParamsReceivingAccountContactDetail) MarshalJSON

type PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierType

type PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierType string
const (
	PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierTypeEmail       PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierType = "email"
	PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierTypePhoneNumber PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierType = "phone_number"
	PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierTypeWebsite     PaymentOrderUpdateParamsReceivingAccountContactDetailsContactIdentifierType = "website"
)

type PaymentOrderUpdateParamsReceivingAccountLedgerAccount

type PaymentOrderUpdateParamsReceivingAccountLedgerAccount struct {
	// The currency of the ledger account.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the ledger that this account belongs to.
	LedgerID param.Field[string] `json:"ledger_id,required" format:"uuid"`
	// The name of the ledger account.
	Name param.Field[string] `json:"name,required"`
	// The normal balance of the ledger account.
	NormalBalance param.Field[PaymentOrderUpdateParamsReceivingAccountLedgerAccountNormalBalance] `json:"normal_balance,required"`
	// The currency exponent of the ledger account.
	CurrencyExponent param.Field[int64] `json:"currency_exponent"`
	// The description of the ledger account.
	Description param.Field[string] `json:"description"`
	// If the ledger account links to another object in Modern Treasury, the id will be
	// populated here, otherwise null.
	LedgerableID param.Field[string] `json:"ledgerable_id" format:"uuid"`
	// If the ledger account links to another object in Modern Treasury, the type will
	// be populated here, otherwise null. The value is one of internal_account or
	// external_account.
	LedgerableType param.Field[PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableType] `json:"ledgerable_type"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

Specifies a ledger account object that will be created with the external account. The resulting ledger account is linked to the external account for auto-ledgering Payment objects. See https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects for more details.

func (PaymentOrderUpdateParamsReceivingAccountLedgerAccount) MarshalJSON

type PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableType

type PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableType string

If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.

const (
	PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableTypeExternalAccount PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableType = "external_account"
	PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableTypeInternalAccount PaymentOrderUpdateParamsReceivingAccountLedgerAccountLedgerableType = "internal_account"
)

type PaymentOrderUpdateParamsReceivingAccountLedgerAccountNormalBalance

type PaymentOrderUpdateParamsReceivingAccountLedgerAccountNormalBalance string

The normal balance of the ledger account.

const (
	PaymentOrderUpdateParamsReceivingAccountLedgerAccountNormalBalanceCredit PaymentOrderUpdateParamsReceivingAccountLedgerAccountNormalBalance = "credit"
	PaymentOrderUpdateParamsReceivingAccountLedgerAccountNormalBalanceDebit  PaymentOrderUpdateParamsReceivingAccountLedgerAccountNormalBalance = "debit"
)

type PaymentOrderUpdateParamsReceivingAccountPartyAddress

type PaymentOrderUpdateParamsReceivingAccountPartyAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country param.Field[string] `json:"country"`
	Line1   param.Field[string] `json:"line1"`
	Line2   param.Field[string] `json:"line2"`
	// Locality or City.
	Locality param.Field[string] `json:"locality"`
	// The postal code of the address.
	PostalCode param.Field[string] `json:"postal_code"`
	// Region or State.
	Region param.Field[string] `json:"region"`
}

Required if receiving wire payments.

func (PaymentOrderUpdateParamsReceivingAccountPartyAddress) MarshalJSON

func (r PaymentOrderUpdateParamsReceivingAccountPartyAddress) MarshalJSON() (data []byte, err error)

type PaymentOrderUpdateParamsReceivingAccountPartyType

type PaymentOrderUpdateParamsReceivingAccountPartyType string

Either `individual` or `business`.

const (
	PaymentOrderUpdateParamsReceivingAccountPartyTypeBusiness   PaymentOrderUpdateParamsReceivingAccountPartyType = "business"
	PaymentOrderUpdateParamsReceivingAccountPartyTypeIndividual PaymentOrderUpdateParamsReceivingAccountPartyType = "individual"
)

type PaymentOrderUpdateParamsReceivingAccountRoutingDetail

type PaymentOrderUpdateParamsReceivingAccountRoutingDetail struct {
	RoutingNumber     param.Field[string]                                                                  `json:"routing_number,required"`
	RoutingNumberType param.Field[PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
	PaymentType       param.Field[PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType]       `json:"payment_type"`
}

func (PaymentOrderUpdateParamsReceivingAccountRoutingDetail) MarshalJSON

type PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType

type PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType string
const (
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeACH         PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "ach"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeAuBecs      PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "au_becs"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeSeBankgirot PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "se_bankgirot"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeBacs        PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "bacs"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeBook        PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "book"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeCard        PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "card"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeCheck       PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "check"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeEft         PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "eft"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeCrossBorder PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "cross_border"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeInterac     PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "interac"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeMasav       PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "masav"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeNeft        PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "neft"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeNics        PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "nics"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeProvxchange PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "provxchange"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeRtp         PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "rtp"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeSen         PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "sen"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeSic         PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "sic"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeSepa        PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "sepa"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeSignet      PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "signet"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeWire        PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "wire"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentTypeZengin      PaymentOrderUpdateParamsReceivingAccountRoutingDetailsPaymentType = "zengin"
)

type PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType

type PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType string
const (
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeAba                    PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "aba"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeAuBsb                  PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "au_bsb"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeBrCodigo               PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "br_codigo"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeCaCpa                  PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "ca_cpa"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeChips                  PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "chips"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeCnaps                  PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "cnaps"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeGBSortCode             PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "gb_sort_code"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeInIfsc                 PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "in_ifsc"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeMyBranchCode           PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "my_branch_code"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeSwift                  PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "swift"
	PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberTypeJpZenginCode           PaymentOrderUpdateParamsReceivingAccountRoutingDetailsRoutingNumberType = "jp_zengin_code"
)

type PaymentOrderUpdateParamsStatus

type PaymentOrderUpdateParamsStatus string

To cancel a payment order, use `cancelled`. To redraft a returned payment order, use `approved`. To undo approval on a denied or approved payment order, use `needs_approval`.

const (
	PaymentOrderUpdateParamsStatusApproved      PaymentOrderUpdateParamsStatus = "approved"
	PaymentOrderUpdateParamsStatusCancelled     PaymentOrderUpdateParamsStatus = "cancelled"
	PaymentOrderUpdateParamsStatusCompleted     PaymentOrderUpdateParamsStatus = "completed"
	PaymentOrderUpdateParamsStatusDenied        PaymentOrderUpdateParamsStatus = "denied"
	PaymentOrderUpdateParamsStatusFailed        PaymentOrderUpdateParamsStatus = "failed"
	PaymentOrderUpdateParamsStatusNeedsApproval PaymentOrderUpdateParamsStatus = "needs_approval"
	PaymentOrderUpdateParamsStatusPending       PaymentOrderUpdateParamsStatus = "pending"
	PaymentOrderUpdateParamsStatusProcessing    PaymentOrderUpdateParamsStatus = "processing"
	PaymentOrderUpdateParamsStatusReturned      PaymentOrderUpdateParamsStatus = "returned"
	PaymentOrderUpdateParamsStatusReversed      PaymentOrderUpdateParamsStatus = "reversed"
	PaymentOrderUpdateParamsStatusSent          PaymentOrderUpdateParamsStatus = "sent"
)

type PaymentReference

type PaymentReference struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool   `json:"live_mode,required"`
	Object   string `json:"object,required"`
	// The actual reference number assigned by the bank.
	ReferenceNumber string `json:"reference_number,required"`
	// The type of reference number.
	ReferenceNumberType PaymentReferenceReferenceNumberType `json:"reference_number_type,required"`
	// The id of the referenceable to search for. Must be accompanied by the
	// referenceable_type or will return an error.
	ReferenceableID string `json:"referenceable_id,required"`
	// One of the referenceable types. This must be accompanied by the id of the
	// referenceable or will return an error.
	ReferenceableType PaymentReferenceReferenceableType `json:"referenceable_type,required"`
	UpdatedAt         time.Time                         `json:"updated_at,required" format:"date-time"`
	JSON              paymentReferenceJSON
}

func (*PaymentReference) UnmarshalJSON

func (r *PaymentReference) UnmarshalJSON(data []byte) (err error)

type PaymentReferenceListParams

type PaymentReferenceListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	PerPage     param.Field[int64]  `query:"per_page"`
	// The actual reference number assigned by the bank.
	ReferenceNumber param.Field[string] `query:"reference_number"`
	// The id of the referenceable to search for. Must be accompanied by the
	// referenceable_type or will return an error.
	ReferenceableID param.Field[string] `query:"referenceable_id"`
	// One of the referenceable types. This must be accompanied by the id of the
	// referenceable or will return an error.
	ReferenceableType param.Field[PaymentReferenceListParamsReferenceableType] `query:"referenceable_type"`
}

func (PaymentReferenceListParams) URLQuery

func (r PaymentReferenceListParams) URLQuery() (v url.Values)

URLQuery serializes PaymentReferenceListParams's query parameters as `url.Values`.

type PaymentReferenceListParamsReferenceableType

type PaymentReferenceListParamsReferenceableType string

One of the referenceable types. This must be accompanied by the id of the referenceable or will return an error.

const (
	PaymentReferenceListParamsReferenceableTypePaymentOrder PaymentReferenceListParamsReferenceableType = "payment_order"
	PaymentReferenceListParamsReferenceableTypeReturn       PaymentReferenceListParamsReferenceableType = "return"
	PaymentReferenceListParamsReferenceableTypeReversal     PaymentReferenceListParamsReferenceableType = "reversal"
)

type PaymentReferenceReferenceNumberType

type PaymentReferenceReferenceNumberType string

The type of reference number.

const (
	PaymentReferenceReferenceNumberTypeACHOriginalTraceNumber          PaymentReferenceReferenceNumberType = "ach_original_trace_number"
	PaymentReferenceReferenceNumberTypeACHTraceNumber                  PaymentReferenceReferenceNumberType = "ach_trace_number"
	PaymentReferenceReferenceNumberTypeBankprovPaymentActivityDate     PaymentReferenceReferenceNumberType = "bankprov_payment_activity_date"
	PaymentReferenceReferenceNumberTypeBankprovPaymentID               PaymentReferenceReferenceNumberType = "bankprov_payment_id"
	PaymentReferenceReferenceNumberTypeBnkDevPrenotificationID         PaymentReferenceReferenceNumberType = "bnk_dev_prenotification_id"
	PaymentReferenceReferenceNumberTypeBnkDevTransferID                PaymentReferenceReferenceNumberType = "bnk_dev_transfer_id"
	PaymentReferenceReferenceNumberTypeBofaEndToEndID                  PaymentReferenceReferenceNumberType = "bofa_end_to_end_id"
	PaymentReferenceReferenceNumberTypeBofaTransactionID               PaymentReferenceReferenceNumberType = "bofa_transaction_id"
	PaymentReferenceReferenceNumberTypeCheckNumber                     PaymentReferenceReferenceNumberType = "check_number"
	PaymentReferenceReferenceNumberTypeColumnFxQuoteID                 PaymentReferenceReferenceNumberType = "column_fx_quote_id"
	PaymentReferenceReferenceNumberTypeColumnReversalPairTransferID    PaymentReferenceReferenceNumberType = "column_reversal_pair_transfer_id"
	PaymentReferenceReferenceNumberTypeColumnTransferID                PaymentReferenceReferenceNumberType = "column_transfer_id"
	PaymentReferenceReferenceNumberTypeCrossRiverPaymentID             PaymentReferenceReferenceNumberType = "cross_river_payment_id"
	PaymentReferenceReferenceNumberTypeCrossRiverTransactionID         PaymentReferenceReferenceNumberType = "cross_river_transaction_id"
	PaymentReferenceReferenceNumberTypeCurrencycloudConversionID       PaymentReferenceReferenceNumberType = "currencycloud_conversion_id"
	PaymentReferenceReferenceNumberTypeCurrencycloudPaymentID          PaymentReferenceReferenceNumberType = "currencycloud_payment_id"
	PaymentReferenceReferenceNumberTypeDcBankTransactionID             PaymentReferenceReferenceNumberType = "dc_bank_transaction_id"
	PaymentReferenceReferenceNumberTypeDwollaTransactionID             PaymentReferenceReferenceNumberType = "dwolla_transaction_id"
	PaymentReferenceReferenceNumberTypeEftTraceNumber                  PaymentReferenceReferenceNumberType = "eft_trace_number"
	PaymentReferenceReferenceNumberTypeEvolveTransactionID             PaymentReferenceReferenceNumberType = "evolve_transaction_id"
	PaymentReferenceReferenceNumberTypeFedwireImad                     PaymentReferenceReferenceNumberType = "fedwire_imad"
	PaymentReferenceReferenceNumberTypeFedwireOmad                     PaymentReferenceReferenceNumberType = "fedwire_omad"
	PaymentReferenceReferenceNumberTypeFirstRepublicInternalID         PaymentReferenceReferenceNumberType = "first_republic_internal_id"
	PaymentReferenceReferenceNumberTypeGoldmanSachsCollectionRequestID PaymentReferenceReferenceNumberType = "goldman_sachs_collection_request_id"
	PaymentReferenceReferenceNumberTypeGoldmanSachsEndToEndID          PaymentReferenceReferenceNumberType = "goldman_sachs_end_to_end_id"
	PaymentReferenceReferenceNumberTypeGoldmanSachsPaymentRequestID    PaymentReferenceReferenceNumberType = "goldman_sachs_payment_request_id"
	PaymentReferenceReferenceNumberTypeGoldmanSachsRequestID           PaymentReferenceReferenceNumberType = "goldman_sachs_request_id"
	PaymentReferenceReferenceNumberTypeGoldmanSachsUniquePaymentID     PaymentReferenceReferenceNumberType = "goldman_sachs_unique_payment_id"
	PaymentReferenceReferenceNumberTypeInteracMessageID                PaymentReferenceReferenceNumberType = "interac_message_id"
	PaymentReferenceReferenceNumberTypeJpmcCcn                         PaymentReferenceReferenceNumberType = "jpmc_ccn"
	PaymentReferenceReferenceNumberTypeJpmcCustomerReferenceID         PaymentReferenceReferenceNumberType = "jpmc_customer_reference_id"
	PaymentReferenceReferenceNumberTypeJpmcEndToEndID                  PaymentReferenceReferenceNumberType = "jpmc_end_to_end_id"
	PaymentReferenceReferenceNumberTypeJpmcFirmRootID                  PaymentReferenceReferenceNumberType = "jpmc_firm_root_id"
	PaymentReferenceReferenceNumberTypeJpmcP3ID                        PaymentReferenceReferenceNumberType = "jpmc_p3_id"
	PaymentReferenceReferenceNumberTypeJpmcPaymentBatchID              PaymentReferenceReferenceNumberType = "jpmc_payment_batch_id"
	PaymentReferenceReferenceNumberTypeJpmcPaymentInformationID        PaymentReferenceReferenceNumberType = "jpmc_payment_information_id"
	PaymentReferenceReferenceNumberTypeJpmcPaymentReturnedDatetime     PaymentReferenceReferenceNumberType = "jpmc_payment_returned_datetime"
	PaymentReferenceReferenceNumberTypeLobCheckID                      PaymentReferenceReferenceNumberType = "lob_check_id"
	PaymentReferenceReferenceNumberTypeOther                           PaymentReferenceReferenceNumberType = "other"
	PaymentReferenceReferenceNumberTypePartialSwiftMir                 PaymentReferenceReferenceNumberType = "partial_swift_mir"
	PaymentReferenceReferenceNumberTypePncClearingReference            PaymentReferenceReferenceNumberType = "pnc_clearing_reference"
	PaymentReferenceReferenceNumberTypePncInstructionID                PaymentReferenceReferenceNumberType = "pnc_instruction_id"
	PaymentReferenceReferenceNumberTypePncMultipaymentID               PaymentReferenceReferenceNumberType = "pnc_multipayment_id"
	PaymentReferenceReferenceNumberTypePncPaymentTraceID               PaymentReferenceReferenceNumberType = "pnc_payment_trace_id"
	PaymentReferenceReferenceNumberTypeRspecVendorPaymentID            PaymentReferenceReferenceNumberType = "rspec_vendor_payment_id"
	PaymentReferenceReferenceNumberTypeRtpInstructionID                PaymentReferenceReferenceNumberType = "rtp_instruction_id"
	PaymentReferenceReferenceNumberTypeSignetAPIReferenceID            PaymentReferenceReferenceNumberType = "signet_api_reference_id"
	PaymentReferenceReferenceNumberTypeSignetConfirmationID            PaymentReferenceReferenceNumberType = "signet_confirmation_id"
	PaymentReferenceReferenceNumberTypeSignetRequestID                 PaymentReferenceReferenceNumberType = "signet_request_id"
	PaymentReferenceReferenceNumberTypeSilvergatePaymentID             PaymentReferenceReferenceNumberType = "silvergate_payment_id"
	PaymentReferenceReferenceNumberTypeSwiftMir                        PaymentReferenceReferenceNumberType = "swift_mir"
	PaymentReferenceReferenceNumberTypeSwiftUetr                       PaymentReferenceReferenceNumberType = "swift_uetr"
	PaymentReferenceReferenceNumberTypeUsbankPaymentID                 PaymentReferenceReferenceNumberType = "usbank_payment_id"
	PaymentReferenceReferenceNumberTypeWellsFargoPaymentID             PaymentReferenceReferenceNumberType = "wells_fargo_payment_id"
	PaymentReferenceReferenceNumberTypeWellsFargoTraceNumber           PaymentReferenceReferenceNumberType = "wells_fargo_trace_number"
)

type PaymentReferenceReferenceableType

type PaymentReferenceReferenceableType string

One of the referenceable types. This must be accompanied by the id of the referenceable or will return an error.

const (
	PaymentReferenceReferenceableTypePaymentOrder PaymentReferenceReferenceableType = "payment_order"
	PaymentReferenceReferenceableTypeReversal     PaymentReferenceReferenceableType = "reversal"
	PaymentReferenceReferenceableTypeReturn       PaymentReferenceReferenceableType = "return"
)

type PaymentReferenceService

type PaymentReferenceService struct {
	Options []option.RequestOption
}

PaymentReferenceService 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 NewPaymentReferenceService method instead.

func NewPaymentReferenceService

func NewPaymentReferenceService(opts ...option.RequestOption) (r *PaymentReferenceService)

NewPaymentReferenceService 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 (*PaymentReferenceService) Get added in v1.5.0

get payment_reference

func (*PaymentReferenceService) List

list payment_references

func (*PaymentReferenceService) ListAutoPaging

list payment_references

func (*PaymentReferenceService) Retireve deprecated

func (r *PaymentReferenceService) Retireve(ctx context.Context, id string, opts ...option.RequestOption) (res *PaymentReference, err error)

get payment_reference

Deprecated: use `Get` instead

type PingResponse

type PingResponse struct {
	Ping string `json:"ping,required"`
	JSON pingResponseJSON
}

func (*PingResponse) UnmarshalJSON

func (r *PingResponse) UnmarshalJSON(data []byte) (err error)

type ReturnListParams

type ReturnListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Specify `counterparty_id` if you wish to see returns that occurred with a
	// specific counterparty.
	CounterpartyID param.Field[string] `query:"counterparty_id"`
	// Specify `internal_account_id` if you wish to see returns to/from a specific
	// account.
	InternalAccountID param.Field[string] `query:"internal_account_id"`
	PerPage           param.Field[int64]  `query:"per_page"`
	// The ID of a valid returnable. Must be accompanied by `returnable_type`.
	ReturnableID param.Field[string] `query:"returnable_id"`
	// One of `payment_order`, `paper_item`, `reversal`, or `incoming_payment_detail`.
	// Must be accompanied by `returnable_id`.
	ReturnableType param.Field[ReturnListParamsReturnableType] `query:"returnable_type"`
}

func (ReturnListParams) URLQuery

func (r ReturnListParams) URLQuery() (v url.Values)

URLQuery serializes ReturnListParams's query parameters as `url.Values`.

type ReturnListParamsReturnableType

type ReturnListParamsReturnableType string

One of `payment_order`, `paper_item`, `reversal`, or `incoming_payment_detail`. Must be accompanied by `returnable_id`.

const (
	ReturnListParamsReturnableTypeIncomingPaymentDetail ReturnListParamsReturnableType = "incoming_payment_detail"
	ReturnListParamsReturnableTypePaperItem             ReturnListParamsReturnableType = "paper_item"
	ReturnListParamsReturnableTypePaymentOrder          ReturnListParamsReturnableType = "payment_order"
	ReturnListParamsReturnableTypeReturn                ReturnListParamsReturnableType = "return"
	ReturnListParamsReturnableTypeReversal              ReturnListParamsReturnableType = "reversal"
)

type ReturnNewParams

type ReturnNewParams struct {
	// The ID of the object being returned or `null`.
	ReturnableID param.Field[string] `json:"returnable_id,required" format:"uuid"`
	// The type of object being returned. Currently, this may only be
	// incoming_payment_detail.
	ReturnableType param.Field[ReturnNewParamsReturnableType] `json:"returnable_type,required"`
	// Some returns may include additional information from the bank. In these cases,
	// this string will be present.
	AdditionalInformation param.Field[string] `json:"additional_information"`
	// The return code. For ACH returns, this is the required ACH return code.
	Code param.Field[ReturnNewParamsCode] `json:"code"`
	// If the return code is `R14` or `R15` this is the date the deceased counterparty
	// passed away.
	DateOfDeath param.Field[time.Time] `json:"date_of_death" format:"date"`
	// An optional description of the reason for the return. This is for internal usage
	// and will not be transmitted to the bank.”
	Reason param.Field[string] `json:"reason"`
}

func (ReturnNewParams) MarshalJSON

func (r ReturnNewParams) MarshalJSON() (data []byte, err error)

type ReturnNewParamsCode

type ReturnNewParamsCode string

The return code. For ACH returns, this is the required ACH return code.

const (
	ReturnNewParamsCode901           ReturnNewParamsCode = "901"
	ReturnNewParamsCode902           ReturnNewParamsCode = "902"
	ReturnNewParamsCode903           ReturnNewParamsCode = "903"
	ReturnNewParamsCode904           ReturnNewParamsCode = "904"
	ReturnNewParamsCode905           ReturnNewParamsCode = "905"
	ReturnNewParamsCode907           ReturnNewParamsCode = "907"
	ReturnNewParamsCode908           ReturnNewParamsCode = "908"
	ReturnNewParamsCode909           ReturnNewParamsCode = "909"
	ReturnNewParamsCode910           ReturnNewParamsCode = "910"
	ReturnNewParamsCode911           ReturnNewParamsCode = "911"
	ReturnNewParamsCode912           ReturnNewParamsCode = "912"
	ReturnNewParamsCode914           ReturnNewParamsCode = "914"
	ReturnNewParamsCodeR01           ReturnNewParamsCode = "R01"
	ReturnNewParamsCodeR02           ReturnNewParamsCode = "R02"
	ReturnNewParamsCodeR03           ReturnNewParamsCode = "R03"
	ReturnNewParamsCodeR04           ReturnNewParamsCode = "R04"
	ReturnNewParamsCodeR05           ReturnNewParamsCode = "R05"
	ReturnNewParamsCodeR06           ReturnNewParamsCode = "R06"
	ReturnNewParamsCodeR07           ReturnNewParamsCode = "R07"
	ReturnNewParamsCodeR08           ReturnNewParamsCode = "R08"
	ReturnNewParamsCodeR09           ReturnNewParamsCode = "R09"
	ReturnNewParamsCodeR10           ReturnNewParamsCode = "R10"
	ReturnNewParamsCodeR11           ReturnNewParamsCode = "R11"
	ReturnNewParamsCodeR12           ReturnNewParamsCode = "R12"
	ReturnNewParamsCodeR14           ReturnNewParamsCode = "R14"
	ReturnNewParamsCodeR15           ReturnNewParamsCode = "R15"
	ReturnNewParamsCodeR16           ReturnNewParamsCode = "R16"
	ReturnNewParamsCodeR17           ReturnNewParamsCode = "R17"
	ReturnNewParamsCodeR20           ReturnNewParamsCode = "R20"
	ReturnNewParamsCodeR21           ReturnNewParamsCode = "R21"
	ReturnNewParamsCodeR22           ReturnNewParamsCode = "R22"
	ReturnNewParamsCodeR23           ReturnNewParamsCode = "R23"
	ReturnNewParamsCodeR24           ReturnNewParamsCode = "R24"
	ReturnNewParamsCodeR29           ReturnNewParamsCode = "R29"
	ReturnNewParamsCodeR31           ReturnNewParamsCode = "R31"
	ReturnNewParamsCodeR33           ReturnNewParamsCode = "R33"
	ReturnNewParamsCodeR37           ReturnNewParamsCode = "R37"
	ReturnNewParamsCodeR38           ReturnNewParamsCode = "R38"
	ReturnNewParamsCodeR39           ReturnNewParamsCode = "R39"
	ReturnNewParamsCodeR51           ReturnNewParamsCode = "R51"
	ReturnNewParamsCodeR52           ReturnNewParamsCode = "R52"
	ReturnNewParamsCodeR53           ReturnNewParamsCode = "R53"
	ReturnNewParamsCodeCurrencycloud ReturnNewParamsCode = "currencycloud"
)

type ReturnNewParamsReturnableType

type ReturnNewParamsReturnableType string

The type of object being returned. Currently, this may only be incoming_payment_detail.

const (
	ReturnNewParamsReturnableTypeIncomingPaymentDetail ReturnNewParamsReturnableType = "incoming_payment_detail"
)

type ReturnObject

type ReturnObject struct {
	ID string `json:"id,required" format:"uuid"`
	// Some returns may include additional information from the bank. In these cases,
	// this string will be present.
	AdditionalInformation string `json:"additional_information,required,nullable"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount int64 `json:"amount,required"`
	// The return code. For ACH returns, this is the required ACH return code.
	Code      ReturnObjectCode `json:"code,required,nullable"`
	CreatedAt time.Time        `json:"created_at,required" format:"date-time"`
	// Currency that this transaction is denominated in.
	Currency shared.Currency `json:"currency,required,nullable"`
	// If the return's status is `returned`, this will include the return object's data
	// that is returning this return.
	CurrentReturn *ReturnObject `json:"current_return,required,nullable"`
	// If the return code is `R14` or `R15` this is the date the deceased counterparty
	// passed away.
	DateOfDeath time.Time `json:"date_of_death,required,nullable" format:"date"`
	// If an originating return failed to be processed by the bank, a description of
	// the failure reason will be available.
	FailureReason string `json:"failure_reason,required,nullable"`
	// The ID of the relevant Internal Account.
	InternalAccountID string `json:"internal_account_id,required,nullable" format:"uuid"`
	// The ID of the ledger transaction linked to the return.
	LedgerTransactionID string `json:"ledger_transaction_id,required,nullable" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool   `json:"live_mode,required"`
	Object   string `json:"object,required"`
	// Often the bank will provide an explanation for the return, which is a short
	// human readable string.
	Reason string `json:"reason,required,nullable"`
	// An array of Payment Reference objects.
	ReferenceNumbers []ReturnObjectReferenceNumber `json:"reference_numbers,required"`
	// The ID of the object being returned or `null`.
	ReturnableID string `json:"returnable_id,required,nullable" format:"uuid"`
	// The type of object being returned or `null`.
	ReturnableType ReturnObjectReturnableType `json:"returnable_type,required,nullable"`
	// The role of the return, can be `originating` or `receiving`.
	Role ReturnObjectRole `json:"role,required"`
	// The current status of the return.
	Status ReturnObjectStatus `json:"status,required"`
	// The ID of the relevant Transaction or `null`.
	TransactionID string `json:"transaction_id,required,nullable" format:"uuid"`
	// The ID of the relevant Transaction Line Item or `null`.
	TransactionLineItemID string `json:"transaction_line_item_id,required,nullable" format:"uuid"`
	// The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`,
	// `interac`, `manual`, `paper_item`, `wire`.
	Type      ReturnObjectType `json:"type,required"`
	UpdatedAt time.Time        `json:"updated_at,required" format:"date-time"`
	JSON      returnObjectJSON
}

func (*ReturnObject) UnmarshalJSON

func (r *ReturnObject) UnmarshalJSON(data []byte) (err error)

type ReturnObjectCode

type ReturnObjectCode string

The return code. For ACH returns, this is the required ACH return code.

const (
	ReturnObjectCode901           ReturnObjectCode = "901"
	ReturnObjectCode902           ReturnObjectCode = "902"
	ReturnObjectCode903           ReturnObjectCode = "903"
	ReturnObjectCode904           ReturnObjectCode = "904"
	ReturnObjectCode905           ReturnObjectCode = "905"
	ReturnObjectCode907           ReturnObjectCode = "907"
	ReturnObjectCode908           ReturnObjectCode = "908"
	ReturnObjectCode909           ReturnObjectCode = "909"
	ReturnObjectCode910           ReturnObjectCode = "910"
	ReturnObjectCode911           ReturnObjectCode = "911"
	ReturnObjectCode912           ReturnObjectCode = "912"
	ReturnObjectCode914           ReturnObjectCode = "914"
	ReturnObjectCodeR01           ReturnObjectCode = "R01"
	ReturnObjectCodeR02           ReturnObjectCode = "R02"
	ReturnObjectCodeR03           ReturnObjectCode = "R03"
	ReturnObjectCodeR04           ReturnObjectCode = "R04"
	ReturnObjectCodeR05           ReturnObjectCode = "R05"
	ReturnObjectCodeR06           ReturnObjectCode = "R06"
	ReturnObjectCodeR07           ReturnObjectCode = "R07"
	ReturnObjectCodeR08           ReturnObjectCode = "R08"
	ReturnObjectCodeR09           ReturnObjectCode = "R09"
	ReturnObjectCodeR10           ReturnObjectCode = "R10"
	ReturnObjectCodeR11           ReturnObjectCode = "R11"
	ReturnObjectCodeR12           ReturnObjectCode = "R12"
	ReturnObjectCodeR14           ReturnObjectCode = "R14"
	ReturnObjectCodeR15           ReturnObjectCode = "R15"
	ReturnObjectCodeR16           ReturnObjectCode = "R16"
	ReturnObjectCodeR17           ReturnObjectCode = "R17"
	ReturnObjectCodeR20           ReturnObjectCode = "R20"
	ReturnObjectCodeR21           ReturnObjectCode = "R21"
	ReturnObjectCodeR22           ReturnObjectCode = "R22"
	ReturnObjectCodeR23           ReturnObjectCode = "R23"
	ReturnObjectCodeR24           ReturnObjectCode = "R24"
	ReturnObjectCodeR29           ReturnObjectCode = "R29"
	ReturnObjectCodeR31           ReturnObjectCode = "R31"
	ReturnObjectCodeR33           ReturnObjectCode = "R33"
	ReturnObjectCodeR37           ReturnObjectCode = "R37"
	ReturnObjectCodeR38           ReturnObjectCode = "R38"
	ReturnObjectCodeR39           ReturnObjectCode = "R39"
	ReturnObjectCodeR51           ReturnObjectCode = "R51"
	ReturnObjectCodeR52           ReturnObjectCode = "R52"
	ReturnObjectCodeR53           ReturnObjectCode = "R53"
	ReturnObjectCodeCurrencycloud ReturnObjectCode = "currencycloud"
)

type ReturnObjectReferenceNumber

type ReturnObjectReferenceNumber struct {
	ID        string    `json:"id,required" format:"uuid"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool   `json:"live_mode,required"`
	Object   string `json:"object,required"`
	// The vendor reference number.
	ReferenceNumber string `json:"reference_number,required"`
	// The type of the reference number. Referring to the vendor payment id.
	ReferenceNumberType ReturnObjectReferenceNumbersReferenceNumberType `json:"reference_number_type,required"`
	UpdatedAt           time.Time                                       `json:"updated_at,required" format:"date-time"`
	JSON                returnObjectReferenceNumberJSON
}

func (*ReturnObjectReferenceNumber) UnmarshalJSON

func (r *ReturnObjectReferenceNumber) UnmarshalJSON(data []byte) (err error)

type ReturnObjectReferenceNumbersReferenceNumberType

type ReturnObjectReferenceNumbersReferenceNumberType string

The type of the reference number. Referring to the vendor payment id.

const (
	ReturnObjectReferenceNumbersReferenceNumberTypeACHOriginalTraceNumber          ReturnObjectReferenceNumbersReferenceNumberType = "ach_original_trace_number"
	ReturnObjectReferenceNumbersReferenceNumberTypeACHTraceNumber                  ReturnObjectReferenceNumbersReferenceNumberType = "ach_trace_number"
	ReturnObjectReferenceNumbersReferenceNumberTypeBankprovPaymentActivityDate     ReturnObjectReferenceNumbersReferenceNumberType = "bankprov_payment_activity_date"
	ReturnObjectReferenceNumbersReferenceNumberTypeBankprovPaymentID               ReturnObjectReferenceNumbersReferenceNumberType = "bankprov_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeBnkDevPrenotificationID         ReturnObjectReferenceNumbersReferenceNumberType = "bnk_dev_prenotification_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeBnkDevTransferID                ReturnObjectReferenceNumbersReferenceNumberType = "bnk_dev_transfer_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeBofaEndToEndID                  ReturnObjectReferenceNumbersReferenceNumberType = "bofa_end_to_end_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeBofaTransactionID               ReturnObjectReferenceNumbersReferenceNumberType = "bofa_transaction_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeCheckNumber                     ReturnObjectReferenceNumbersReferenceNumberType = "check_number"
	ReturnObjectReferenceNumbersReferenceNumberTypeColumnFxQuoteID                 ReturnObjectReferenceNumbersReferenceNumberType = "column_fx_quote_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeColumnReversalPairTransferID    ReturnObjectReferenceNumbersReferenceNumberType = "column_reversal_pair_transfer_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeColumnTransferID                ReturnObjectReferenceNumbersReferenceNumberType = "column_transfer_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeCrossRiverPaymentID             ReturnObjectReferenceNumbersReferenceNumberType = "cross_river_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeCrossRiverTransactionID         ReturnObjectReferenceNumbersReferenceNumberType = "cross_river_transaction_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeCurrencycloudConversionID       ReturnObjectReferenceNumbersReferenceNumberType = "currencycloud_conversion_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeCurrencycloudPaymentID          ReturnObjectReferenceNumbersReferenceNumberType = "currencycloud_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeDcBankTransactionID             ReturnObjectReferenceNumbersReferenceNumberType = "dc_bank_transaction_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeDwollaTransactionID             ReturnObjectReferenceNumbersReferenceNumberType = "dwolla_transaction_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeEftTraceNumber                  ReturnObjectReferenceNumbersReferenceNumberType = "eft_trace_number"
	ReturnObjectReferenceNumbersReferenceNumberTypeEvolveTransactionID             ReturnObjectReferenceNumbersReferenceNumberType = "evolve_transaction_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeFedwireImad                     ReturnObjectReferenceNumbersReferenceNumberType = "fedwire_imad"
	ReturnObjectReferenceNumbersReferenceNumberTypeFedwireOmad                     ReturnObjectReferenceNumbersReferenceNumberType = "fedwire_omad"
	ReturnObjectReferenceNumbersReferenceNumberTypeFirstRepublicInternalID         ReturnObjectReferenceNumbersReferenceNumberType = "first_republic_internal_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeGoldmanSachsCollectionRequestID ReturnObjectReferenceNumbersReferenceNumberType = "goldman_sachs_collection_request_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeGoldmanSachsEndToEndID          ReturnObjectReferenceNumbersReferenceNumberType = "goldman_sachs_end_to_end_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeGoldmanSachsPaymentRequestID    ReturnObjectReferenceNumbersReferenceNumberType = "goldman_sachs_payment_request_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeGoldmanSachsRequestID           ReturnObjectReferenceNumbersReferenceNumberType = "goldman_sachs_request_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeGoldmanSachsUniquePaymentID     ReturnObjectReferenceNumbersReferenceNumberType = "goldman_sachs_unique_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeInteracMessageID                ReturnObjectReferenceNumbersReferenceNumberType = "interac_message_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcCcn                         ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_ccn"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcCustomerReferenceID         ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_customer_reference_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcEndToEndID                  ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_end_to_end_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcFirmRootID                  ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_firm_root_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcP3ID                        ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_p3_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcPaymentBatchID              ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_payment_batch_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcPaymentInformationID        ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_payment_information_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeJpmcPaymentReturnedDatetime     ReturnObjectReferenceNumbersReferenceNumberType = "jpmc_payment_returned_datetime"
	ReturnObjectReferenceNumbersReferenceNumberTypeLobCheckID                      ReturnObjectReferenceNumbersReferenceNumberType = "lob_check_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeOther                           ReturnObjectReferenceNumbersReferenceNumberType = "other"
	ReturnObjectReferenceNumbersReferenceNumberTypePartialSwiftMir                 ReturnObjectReferenceNumbersReferenceNumberType = "partial_swift_mir"
	ReturnObjectReferenceNumbersReferenceNumberTypePncClearingReference            ReturnObjectReferenceNumbersReferenceNumberType = "pnc_clearing_reference"
	ReturnObjectReferenceNumbersReferenceNumberTypePncInstructionID                ReturnObjectReferenceNumbersReferenceNumberType = "pnc_instruction_id"
	ReturnObjectReferenceNumbersReferenceNumberTypePncMultipaymentID               ReturnObjectReferenceNumbersReferenceNumberType = "pnc_multipayment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypePncPaymentTraceID               ReturnObjectReferenceNumbersReferenceNumberType = "pnc_payment_trace_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeRspecVendorPaymentID            ReturnObjectReferenceNumbersReferenceNumberType = "rspec_vendor_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeRtpInstructionID                ReturnObjectReferenceNumbersReferenceNumberType = "rtp_instruction_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeSignetAPIReferenceID            ReturnObjectReferenceNumbersReferenceNumberType = "signet_api_reference_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeSignetConfirmationID            ReturnObjectReferenceNumbersReferenceNumberType = "signet_confirmation_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeSignetRequestID                 ReturnObjectReferenceNumbersReferenceNumberType = "signet_request_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeSilvergatePaymentID             ReturnObjectReferenceNumbersReferenceNumberType = "silvergate_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeSwiftMir                        ReturnObjectReferenceNumbersReferenceNumberType = "swift_mir"
	ReturnObjectReferenceNumbersReferenceNumberTypeSwiftUetr                       ReturnObjectReferenceNumbersReferenceNumberType = "swift_uetr"
	ReturnObjectReferenceNumbersReferenceNumberTypeUsbankPaymentID                 ReturnObjectReferenceNumbersReferenceNumberType = "usbank_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeWellsFargoPaymentID             ReturnObjectReferenceNumbersReferenceNumberType = "wells_fargo_payment_id"
	ReturnObjectReferenceNumbersReferenceNumberTypeWellsFargoTraceNumber           ReturnObjectReferenceNumbersReferenceNumberType = "wells_fargo_trace_number"
)

type ReturnObjectReturnableType

type ReturnObjectReturnableType string

The type of object being returned or `null`.

const (
	ReturnObjectReturnableTypeIncomingPaymentDetail ReturnObjectReturnableType = "incoming_payment_detail"
	ReturnObjectReturnableTypePaperItem             ReturnObjectReturnableType = "paper_item"
	ReturnObjectReturnableTypePaymentOrder          ReturnObjectReturnableType = "payment_order"
	ReturnObjectReturnableTypeReturn                ReturnObjectReturnableType = "return"
	ReturnObjectReturnableTypeReversal              ReturnObjectReturnableType = "reversal"
)

type ReturnObjectRole

type ReturnObjectRole string

The role of the return, can be `originating` or `receiving`.

const (
	ReturnObjectRoleOriginating ReturnObjectRole = "originating"
	ReturnObjectRoleReceiving   ReturnObjectRole = "receiving"
)

type ReturnObjectStatus

type ReturnObjectStatus string

The current status of the return.

const (
	ReturnObjectStatusCompleted  ReturnObjectStatus = "completed"
	ReturnObjectStatusFailed     ReturnObjectStatus = "failed"
	ReturnObjectStatusPending    ReturnObjectStatus = "pending"
	ReturnObjectStatusProcessing ReturnObjectStatus = "processing"
	ReturnObjectStatusReturned   ReturnObjectStatus = "returned"
	ReturnObjectStatusSent       ReturnObjectStatus = "sent"
)

type ReturnObjectType

type ReturnObjectType string

The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`, `interac`, `manual`, `paper_item`, `wire`.

const (
	ReturnObjectTypeACH       ReturnObjectType = "ach"
	ReturnObjectTypeACHNoc    ReturnObjectType = "ach_noc"
	ReturnObjectTypeAuBecs    ReturnObjectType = "au_becs"
	ReturnObjectTypeBacs      ReturnObjectType = "bacs"
	ReturnObjectTypeBook      ReturnObjectType = "book"
	ReturnObjectTypeCheck     ReturnObjectType = "check"
	ReturnObjectTypeEft       ReturnObjectType = "eft"
	ReturnObjectTypeInterac   ReturnObjectType = "interac"
	ReturnObjectTypeManual    ReturnObjectType = "manual"
	ReturnObjectTypePaperItem ReturnObjectType = "paper_item"
	ReturnObjectTypeSepa      ReturnObjectType = "sepa"
	ReturnObjectTypeWire      ReturnObjectType = "wire"
)

type ReturnService

type ReturnService struct {
	Options []option.RequestOption
}

ReturnService 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 NewReturnService method instead.

func NewReturnService

func NewReturnService(opts ...option.RequestOption) (r *ReturnService)

NewReturnService 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 (*ReturnService) Get

func (r *ReturnService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ReturnObject, err error)

Get a single return.

func (*ReturnService) List

func (r *ReturnService) List(ctx context.Context, query ReturnListParams, opts ...option.RequestOption) (res *shared.Page[ReturnObject], err error)

Get a list of returns.

func (*ReturnService) ListAutoPaging

Get a list of returns.

func (*ReturnService) New

func (r *ReturnService) New(ctx context.Context, body ReturnNewParams, opts ...option.RequestOption) (res *ReturnObject, err error)

Create a return.

type Reversal

type Reversal 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"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// The ID of the relevant Payment Order.
	PaymentOrderID string `json:"payment_order_id,required,nullable" format:"uuid"`
	// The reason for the reversal.
	Reason ReversalReason `json:"reason,required"`
	// The current status of the reversal.
	Status    ReversalStatus `json:"status,required"`
	UpdatedAt time.Time      `json:"updated_at,required" format:"date-time"`
	JSON      reversalJSON
}

func (*Reversal) UnmarshalJSON

func (r *Reversal) UnmarshalJSON(data []byte) (err error)

type ReversalReason

type ReversalReason string

The reason for the reversal.

const (
	ReversalReasonDuplicate                 ReversalReason = "duplicate"
	ReversalReasonIncorrectAmount           ReversalReason = "incorrect_amount"
	ReversalReasonIncorrectReceivingAccount ReversalReason = "incorrect_receiving_account"
	ReversalReasonDateEarlierThanIntended   ReversalReason = "date_earlier_than_intended"
	ReversalReasonDateLaterThanIntended     ReversalReason = "date_later_than_intended"
)

type ReversalStatus

type ReversalStatus string

The current status of the reversal.

const (
	ReversalStatusCompleted  ReversalStatus = "completed"
	ReversalStatusFailed     ReversalStatus = "failed"
	ReversalStatusPending    ReversalStatus = "pending"
	ReversalStatusProcessing ReversalStatus = "processing"
	ReversalStatusReturned   ReversalStatus = "returned"
	ReversalStatusSent       ReversalStatus = "sent"
)

type RoutingDetail

type RoutingDetail struct {
	ID          string                   `json:"id,required" format:"uuid"`
	BankAddress RoutingDetailBankAddress `json:"bank_address,required,nullable"`
	// The name of the bank.
	BankName    string    `json:"bank_name,required"`
	CreatedAt   time.Time `json:"created_at,required" format:"date-time"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" 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"`
	// If the routing detail is to be used for a specific payment type this field will
	// be populated, otherwise null.
	PaymentType RoutingDetailPaymentType `json:"payment_type,required,nullable"`
	// The routing number of the bank.
	RoutingNumber string `json:"routing_number,required"`
	// One of `aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.
	RoutingNumberType RoutingDetailRoutingNumberType `json:"routing_number_type,required"`
	UpdatedAt         time.Time                      `json:"updated_at,required" format:"date-time"`
	JSON              routingDetailJSON
}

func (*RoutingDetail) UnmarshalJSON

func (r *RoutingDetail) UnmarshalJSON(data []byte) (err error)

type RoutingDetailBankAddress

type RoutingDetailBankAddress struct {
	ID string `json:"id,required" format:"uuid"`
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country   string    `json:"country,required,nullable"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	Line1     string    `json:"line1,required,nullable"`
	Line2     string    `json:"line2,required,nullable"`
	// 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"`
	// Locality or City.
	Locality string `json:"locality,required,nullable"`
	Object   string `json:"object,required"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,required,nullable"`
	// Region or State.
	Region    string    `json:"region,required,nullable"`
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	JSON      routingDetailBankAddressJSON
}

func (*RoutingDetailBankAddress) UnmarshalJSON

func (r *RoutingDetailBankAddress) UnmarshalJSON(data []byte) (err error)

type RoutingDetailDeleteParamsAccountsType

type RoutingDetailDeleteParamsAccountsType string
const (
	RoutingDetailDeleteParamsAccountsTypeExternalAccounts RoutingDetailDeleteParamsAccountsType = "external_accounts"
)

type RoutingDetailListParams

type RoutingDetailListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	PerPage     param.Field[int64]  `query:"per_page"`
}

func (RoutingDetailListParams) URLQuery

func (r RoutingDetailListParams) URLQuery() (v url.Values)

URLQuery serializes RoutingDetailListParams's query parameters as `url.Values`.

type RoutingDetailNewParams

type RoutingDetailNewParams struct {
	// The routing number of the bank.
	RoutingNumber param.Field[string] `json:"routing_number,required"`
	// One of `aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.
	RoutingNumberType param.Field[RoutingDetailNewParamsRoutingNumberType] `json:"routing_number_type,required"`
	// If the routing detail is to be used for a specific payment type this field will
	// be populated, otherwise null.
	PaymentType param.Field[RoutingDetailNewParamsPaymentType] `json:"payment_type"`
}

func (RoutingDetailNewParams) MarshalJSON

func (r RoutingDetailNewParams) MarshalJSON() (data []byte, err error)

type RoutingDetailNewParamsAccountsType

type RoutingDetailNewParamsAccountsType string
const (
	RoutingDetailNewParamsAccountsTypeExternalAccounts RoutingDetailNewParamsAccountsType = "external_accounts"
)

type RoutingDetailNewParamsPaymentType

type RoutingDetailNewParamsPaymentType string

If the routing detail is to be used for a specific payment type this field will be populated, otherwise null.

const (
	RoutingDetailNewParamsPaymentTypeACH         RoutingDetailNewParamsPaymentType = "ach"
	RoutingDetailNewParamsPaymentTypeAuBecs      RoutingDetailNewParamsPaymentType = "au_becs"
	RoutingDetailNewParamsPaymentTypeBacs        RoutingDetailNewParamsPaymentType = "bacs"
	RoutingDetailNewParamsPaymentTypeBook        RoutingDetailNewParamsPaymentType = "book"
	RoutingDetailNewParamsPaymentTypeCard        RoutingDetailNewParamsPaymentType = "card"
	RoutingDetailNewParamsPaymentTypeCheck       RoutingDetailNewParamsPaymentType = "check"
	RoutingDetailNewParamsPaymentTypeCrossBorder RoutingDetailNewParamsPaymentType = "cross_border"
	RoutingDetailNewParamsPaymentTypeEft         RoutingDetailNewParamsPaymentType = "eft"
	RoutingDetailNewParamsPaymentTypeInterac     RoutingDetailNewParamsPaymentType = "interac"
	RoutingDetailNewParamsPaymentTypeMasav       RoutingDetailNewParamsPaymentType = "masav"
	RoutingDetailNewParamsPaymentTypeNeft        RoutingDetailNewParamsPaymentType = "neft"
	RoutingDetailNewParamsPaymentTypeNics        RoutingDetailNewParamsPaymentType = "nics"
	RoutingDetailNewParamsPaymentTypeProvxchange RoutingDetailNewParamsPaymentType = "provxchange"
	RoutingDetailNewParamsPaymentTypeRtp         RoutingDetailNewParamsPaymentType = "rtp"
	RoutingDetailNewParamsPaymentTypeSeBankgirot RoutingDetailNewParamsPaymentType = "se_bankgirot"
	RoutingDetailNewParamsPaymentTypeSen         RoutingDetailNewParamsPaymentType = "sen"
	RoutingDetailNewParamsPaymentTypeSepa        RoutingDetailNewParamsPaymentType = "sepa"
	RoutingDetailNewParamsPaymentTypeSic         RoutingDetailNewParamsPaymentType = "sic"
	RoutingDetailNewParamsPaymentTypeSignet      RoutingDetailNewParamsPaymentType = "signet"
	RoutingDetailNewParamsPaymentTypeWire        RoutingDetailNewParamsPaymentType = "wire"
	RoutingDetailNewParamsPaymentTypeZengin      RoutingDetailNewParamsPaymentType = "zengin"
)

type RoutingDetailNewParamsRoutingNumberType

type RoutingDetailNewParamsRoutingNumberType string

One of `aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.

const (
	RoutingDetailNewParamsRoutingNumberTypeAba                    RoutingDetailNewParamsRoutingNumberType = "aba"
	RoutingDetailNewParamsRoutingNumberTypeAuBsb                  RoutingDetailNewParamsRoutingNumberType = "au_bsb"
	RoutingDetailNewParamsRoutingNumberTypeBrCodigo               RoutingDetailNewParamsRoutingNumberType = "br_codigo"
	RoutingDetailNewParamsRoutingNumberTypeCaCpa                  RoutingDetailNewParamsRoutingNumberType = "ca_cpa"
	RoutingDetailNewParamsRoutingNumberTypeChips                  RoutingDetailNewParamsRoutingNumberType = "chips"
	RoutingDetailNewParamsRoutingNumberTypeCnaps                  RoutingDetailNewParamsRoutingNumberType = "cnaps"
	RoutingDetailNewParamsRoutingNumberTypeGBSortCode             RoutingDetailNewParamsRoutingNumberType = "gb_sort_code"
	RoutingDetailNewParamsRoutingNumberTypeInIfsc                 RoutingDetailNewParamsRoutingNumberType = "in_ifsc"
	RoutingDetailNewParamsRoutingNumberTypeJpZenginCode           RoutingDetailNewParamsRoutingNumberType = "jp_zengin_code"
	RoutingDetailNewParamsRoutingNumberTypeMyBranchCode           RoutingDetailNewParamsRoutingNumberType = "my_branch_code"
	RoutingDetailNewParamsRoutingNumberTypeSeBankgiroClearingCode RoutingDetailNewParamsRoutingNumberType = "se_bankgiro_clearing_code"
	RoutingDetailNewParamsRoutingNumberTypeSwift                  RoutingDetailNewParamsRoutingNumberType = "swift"
)

type RoutingDetailPaymentType

type RoutingDetailPaymentType string

If the routing detail is to be used for a specific payment type this field will be populated, otherwise null.

const (
	RoutingDetailPaymentTypeACH         RoutingDetailPaymentType = "ach"
	RoutingDetailPaymentTypeAuBecs      RoutingDetailPaymentType = "au_becs"
	RoutingDetailPaymentTypeBacs        RoutingDetailPaymentType = "bacs"
	RoutingDetailPaymentTypeBook        RoutingDetailPaymentType = "book"
	RoutingDetailPaymentTypeCard        RoutingDetailPaymentType = "card"
	RoutingDetailPaymentTypeCheck       RoutingDetailPaymentType = "check"
	RoutingDetailPaymentTypeCrossBorder RoutingDetailPaymentType = "cross_border"
	RoutingDetailPaymentTypeEft         RoutingDetailPaymentType = "eft"
	RoutingDetailPaymentTypeInterac     RoutingDetailPaymentType = "interac"
	RoutingDetailPaymentTypeMasav       RoutingDetailPaymentType = "masav"
	RoutingDetailPaymentTypeNeft        RoutingDetailPaymentType = "neft"
	RoutingDetailPaymentTypeNics        RoutingDetailPaymentType = "nics"
	RoutingDetailPaymentTypeProvxchange RoutingDetailPaymentType = "provxchange"
	RoutingDetailPaymentTypeRtp         RoutingDetailPaymentType = "rtp"
	RoutingDetailPaymentTypeSeBankgirot RoutingDetailPaymentType = "se_bankgirot"
	RoutingDetailPaymentTypeSen         RoutingDetailPaymentType = "sen"
	RoutingDetailPaymentTypeSepa        RoutingDetailPaymentType = "sepa"
	RoutingDetailPaymentTypeSic         RoutingDetailPaymentType = "sic"
	RoutingDetailPaymentTypeSignet      RoutingDetailPaymentType = "signet"
	RoutingDetailPaymentTypeWire        RoutingDetailPaymentType = "wire"
	RoutingDetailPaymentTypeZengin      RoutingDetailPaymentType = "zengin"
)

type RoutingDetailRoutingNumberType

type RoutingDetailRoutingNumberType string

One of `aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.

const (
	RoutingDetailRoutingNumberTypeAba                    RoutingDetailRoutingNumberType = "aba"
	RoutingDetailRoutingNumberTypeAuBsb                  RoutingDetailRoutingNumberType = "au_bsb"
	RoutingDetailRoutingNumberTypeBrCodigo               RoutingDetailRoutingNumberType = "br_codigo"
	RoutingDetailRoutingNumberTypeCaCpa                  RoutingDetailRoutingNumberType = "ca_cpa"
	RoutingDetailRoutingNumberTypeChips                  RoutingDetailRoutingNumberType = "chips"
	RoutingDetailRoutingNumberTypeCnaps                  RoutingDetailRoutingNumberType = "cnaps"
	RoutingDetailRoutingNumberTypeGBSortCode             RoutingDetailRoutingNumberType = "gb_sort_code"
	RoutingDetailRoutingNumberTypeInIfsc                 RoutingDetailRoutingNumberType = "in_ifsc"
	RoutingDetailRoutingNumberTypeJpZenginCode           RoutingDetailRoutingNumberType = "jp_zengin_code"
	RoutingDetailRoutingNumberTypeMyBranchCode           RoutingDetailRoutingNumberType = "my_branch_code"
	RoutingDetailRoutingNumberTypeSeBankgiroClearingCode RoutingDetailRoutingNumberType = "se_bankgiro_clearing_code"
	RoutingDetailRoutingNumberTypeSwift                  RoutingDetailRoutingNumberType = "swift"
)

type RoutingDetailService

type RoutingDetailService struct {
	Options []option.RequestOption
}

RoutingDetailService 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 NewRoutingDetailService method instead.

func NewRoutingDetailService

func NewRoutingDetailService(opts ...option.RequestOption) (r *RoutingDetailService)

NewRoutingDetailService 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 (*RoutingDetailService) Delete

func (r *RoutingDetailService) Delete(ctx context.Context, accountsType RoutingDetailDeleteParamsAccountsType, accountID string, id string, opts ...option.RequestOption) (err error)

Delete a routing detail for a single external account.

func (*RoutingDetailService) Get

func (r *RoutingDetailService) Get(ctx context.Context, accountsType shared.AccountsType, accountID string, id string, opts ...option.RequestOption) (res *RoutingDetail, err error)

Get a single routing detail for a single internal or external account.

func (*RoutingDetailService) List

func (r *RoutingDetailService) List(ctx context.Context, accountsType shared.AccountsType, accountID string, query RoutingDetailListParams, opts ...option.RequestOption) (res *shared.Page[RoutingDetail], err error)

Get a list of routing details for a single internal or external account.

func (*RoutingDetailService) ListAutoPaging

Get a list of routing details for a single internal or external account.

func (*RoutingDetailService) New

Create a routing detail for a single external account.

type RoutingNumberLookupRequest

type RoutingNumberLookupRequest struct {
	// The address of the bank.
	BankAddress RoutingNumberLookupRequestBankAddress `json:"bank_address"`
	// The name of the bank.
	BankName string `json:"bank_name"`
	// The routing number of the bank.
	RoutingNumber string `json:"routing_number"`
	// One of `aba`, `au_bsb`, `br_codigo`, `ca_cpa`, `cnaps`, `gb_sort_code`,
	// `in_ifsc`, `my_branch_code`, `se_bankgiro_clearing_code`, or `swift`. In sandbox
	// mode we currently only support `aba` and `swift` with routing numbers
	// '123456789' and 'GRINUST0XXX' respectively.
	RoutingNumberType RoutingNumberLookupRequestRoutingNumberType `json:"routing_number_type"`
	// An object containing key-value pairs, each with a sanctions list as the key and
	// a boolean value representing whether the bank is on that particular sanctions
	// list. Currently, this includes eu_con, uk_hmt, us_ofac, and un sanctions lists.
	Sanctions map[string]interface{} `json:"sanctions"`
	// An array of payment types that are supported for this routing number. This can
	// include `ach`, `wire`, `rtp`, `sepa`, `bacs`, `au_becs` currently.
	SupportedPaymentTypes []RoutingNumberLookupRequestSupportedPaymentType `json:"supported_payment_types"`
	JSON                  routingNumberLookupRequestJSON
}

func (*RoutingNumberLookupRequest) UnmarshalJSON

func (r *RoutingNumberLookupRequest) UnmarshalJSON(data []byte) (err error)

type RoutingNumberLookupRequestBankAddress

type RoutingNumberLookupRequestBankAddress struct {
	// Country code conforms to [ISO 3166-1 alpha-2]
	Country string `json:"country,nullable"`
	Line1   string `json:"line1,nullable"`
	Line2   string `json:"line2,nullable"`
	// Locality or City.
	Locality string `json:"locality,nullable"`
	// The postal code of the address.
	PostalCode string `json:"postal_code,nullable"`
	// Region or State.
	Region string `json:"region,nullable"`
	JSON   routingNumberLookupRequestBankAddressJSON
}

The address of the bank.

func (*RoutingNumberLookupRequestBankAddress) UnmarshalJSON

func (r *RoutingNumberLookupRequestBankAddress) UnmarshalJSON(data []byte) (err error)

type RoutingNumberLookupRequestRoutingNumberType

type RoutingNumberLookupRequestRoutingNumberType string

One of `aba`, `au_bsb`, `br_codigo`, `ca_cpa`, `cnaps`, `gb_sort_code`, `in_ifsc`, `my_branch_code`, `se_bankgiro_clearing_code`, or `swift`. In sandbox mode we currently only support `aba` and `swift` with routing numbers '123456789' and 'GRINUST0XXX' respectively.

const (
	RoutingNumberLookupRequestRoutingNumberTypeAba                    RoutingNumberLookupRequestRoutingNumberType = "aba"
	RoutingNumberLookupRequestRoutingNumberTypeAuBsb                  RoutingNumberLookupRequestRoutingNumberType = "au_bsb"
	RoutingNumberLookupRequestRoutingNumberTypeCaCpa                  RoutingNumberLookupRequestRoutingNumberType = "ca_cpa"
	RoutingNumberLookupRequestRoutingNumberTypeGBSortCode             RoutingNumberLookupRequestRoutingNumberType = "gb_sort_code"
	RoutingNumberLookupRequestRoutingNumberTypeInIfsc                 RoutingNumberLookupRequestRoutingNumberType = "in_ifsc"
	RoutingNumberLookupRequestRoutingNumberTypeSeBankgiroClearingCode RoutingNumberLookupRequestRoutingNumberType = "se_bankgiro_clearing_code"
	RoutingNumberLookupRequestRoutingNumberTypeSwift                  RoutingNumberLookupRequestRoutingNumberType = "swift"
)

type RoutingNumberLookupRequestSupportedPaymentType

type RoutingNumberLookupRequestSupportedPaymentType string
const (
	RoutingNumberLookupRequestSupportedPaymentTypeACH         RoutingNumberLookupRequestSupportedPaymentType = "ach"
	RoutingNumberLookupRequestSupportedPaymentTypeAuBecs      RoutingNumberLookupRequestSupportedPaymentType = "au_becs"
	RoutingNumberLookupRequestSupportedPaymentTypeBacs        RoutingNumberLookupRequestSupportedPaymentType = "bacs"
	RoutingNumberLookupRequestSupportedPaymentTypeBook        RoutingNumberLookupRequestSupportedPaymentType = "book"
	RoutingNumberLookupRequestSupportedPaymentTypeCard        RoutingNumberLookupRequestSupportedPaymentType = "card"
	RoutingNumberLookupRequestSupportedPaymentTypeCheck       RoutingNumberLookupRequestSupportedPaymentType = "check"
	RoutingNumberLookupRequestSupportedPaymentTypeCrossBorder RoutingNumberLookupRequestSupportedPaymentType = "cross_border"
	RoutingNumberLookupRequestSupportedPaymentTypeEft         RoutingNumberLookupRequestSupportedPaymentType = "eft"
	RoutingNumberLookupRequestSupportedPaymentTypeInterac     RoutingNumberLookupRequestSupportedPaymentType = "interac"
	RoutingNumberLookupRequestSupportedPaymentTypeMasav       RoutingNumberLookupRequestSupportedPaymentType = "masav"
	RoutingNumberLookupRequestSupportedPaymentTypeNeft        RoutingNumberLookupRequestSupportedPaymentType = "neft"
	RoutingNumberLookupRequestSupportedPaymentTypeNics        RoutingNumberLookupRequestSupportedPaymentType = "nics"
	RoutingNumberLookupRequestSupportedPaymentTypeProvxchange RoutingNumberLookupRequestSupportedPaymentType = "provxchange"
	RoutingNumberLookupRequestSupportedPaymentTypeRtp         RoutingNumberLookupRequestSupportedPaymentType = "rtp"
	RoutingNumberLookupRequestSupportedPaymentTypeSeBankgirot RoutingNumberLookupRequestSupportedPaymentType = "se_bankgirot"
	RoutingNumberLookupRequestSupportedPaymentTypeSen         RoutingNumberLookupRequestSupportedPaymentType = "sen"
	RoutingNumberLookupRequestSupportedPaymentTypeSepa        RoutingNumberLookupRequestSupportedPaymentType = "sepa"
	RoutingNumberLookupRequestSupportedPaymentTypeSic         RoutingNumberLookupRequestSupportedPaymentType = "sic"
	RoutingNumberLookupRequestSupportedPaymentTypeSignet      RoutingNumberLookupRequestSupportedPaymentType = "signet"
	RoutingNumberLookupRequestSupportedPaymentTypeWire        RoutingNumberLookupRequestSupportedPaymentType = "wire"
	RoutingNumberLookupRequestSupportedPaymentTypeZengin      RoutingNumberLookupRequestSupportedPaymentType = "zengin"
)

type Transaction

type Transaction struct {
	ID string `json:"id,required" format:"uuid"`
	// Value in specified currency's smallest unit. e.g. $10 would be represented
	// as 1000.
	Amount int64 `json:"amount,required"`
	// The date on which the transaction occurred.
	AsOfDate time.Time `json:"as_of_date,required,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,required,nullable" format:"time"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Currency that this transaction is denominated in.
	Currency shared.Currency `json:"currency,required,nullable"`
	// This field contains additional information that the bank provided about the
	// transaction. This is structured data. Some of the data in here might overlap
	// with what is in the `vendor_description`. For example, the OBI could be a part
	// of the vendor description, and it would also be included in here. The attributes
	// that are passed through the details field will vary based on your banking
	// partner. Currently, the following keys may be in the details object:
	// `originator_name`, `originator_to_beneficiary_information`.
	Details map[string]string `json:"details,required"`
	// Either `credit` or `debit`.
	Direction   string    `json:"direction,required"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
	// The ID of the relevant Internal Account.
	InternalAccountID string `json:"internal_account_id,required" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	Object   string            `json:"object,required"`
	// This field will be `true` if the transaction has posted to the account.
	Posted bool `json:"posted,required"`
	// 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,required"`
	// The type of the transaction. Can be one of `ach`, `wire`, `check`, `rtp`,
	// `book`, or `sen`.
	Type      TransactionType `json:"type,required"`
	UpdatedAt time.Time       `json:"updated_at,required" format:"date-time"`
	// 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,required,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`, or `us_bank`.
	VendorCodeType TransactionVendorCodeType `json:"vendor_code_type,required,nullable"`
	// An identifier given to this transaction by the bank, often `null`.
	VendorCustomerID string `json:"vendor_customer_id,required,nullable"`
	// The transaction detail text that often appears in on your bank statement and in
	// your banking portal.
	VendorDescription string `json:"vendor_description,required,nullable"`
	// An identifier given to this transaction by the bank.
	VendorID string `json:"vendor_id,required,nullable"`
	JSON     transactionJSON
}

func (*Transaction) UnmarshalJSON

func (r *Transaction) UnmarshalJSON(data []byte) (err error)

type TransactionLineItem

type TransactionLineItem struct {
	ID string `json:"id,required" format:"uuid"`
	// If a matching object exists in Modern Treasury, `amount` will be populated.
	// Value in specified currency's smallest unit (taken from parent Transaction).
	Amount int64 `json:"amount,required"`
	// The ID for the counterparty for this transaction line item.
	CounterpartyID string    `json:"counterparty_id,required,nullable"`
	CreatedAt      time.Time `json:"created_at,required" format:"date-time"`
	// If no matching object is found, `description` will be a free-form text field
	// describing the line item. This field may contain personally identifiable
	// information (PII) and is not included in API responses by default. Learn more
	// about changing your settings at
	// https://docs.moderntreasury.com/reference/personally-identifiable-information.
	Description string    `json:"description,required"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
	// The ID of the reconciled Expected Payment, otherwise `null`.
	ExpectedPaymentID string `json:"expected_payment_id,required,nullable"`
	// 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"`
	// If a matching object exists in Modern Treasury, the ID will be populated here,
	// otherwise `null`.
	TransactableID string `json:"transactable_id,required,nullable"`
	// If a matching object exists in Modern Treasury, the type will be populated here,
	// otherwise `null`.
	TransactableType TransactionLineItemTransactableType `json:"transactable_type,required,nullable"`
	// The ID of the parent transaction.
	TransactionID string `json:"transaction_id,required"`
	// Indicates whether the line item is `originating` or `receiving` (see
	// https://www.moderntreasury.com/journal/beginners-guide-to-ach for more).
	Type      TransactionLineItemType `json:"type,required"`
	UpdatedAt time.Time               `json:"updated_at,required" format:"date-time"`
	JSON      transactionLineItemJSON
}

func (*TransactionLineItem) UnmarshalJSON

func (r *TransactionLineItem) UnmarshalJSON(data []byte) (err error)

type TransactionLineItemListParams

type TransactionLineItemListParams struct {
	ID            param.Field[map[string]string]                 `query:"id"`
	AfterCursor   param.Field[string]                            `query:"after_cursor"`
	PerPage       param.Field[int64]                             `query:"per_page"`
	TransactionID param.Field[string]                            `query:"transaction_id"`
	Type          param.Field[TransactionLineItemListParamsType] `query:"type"`
}

func (TransactionLineItemListParams) URLQuery

func (r TransactionLineItemListParams) URLQuery() (v url.Values)

URLQuery serializes TransactionLineItemListParams's query parameters as `url.Values`.

type TransactionLineItemListParamsType

type TransactionLineItemListParamsType string
const (
	TransactionLineItemListParamsTypeOriginating TransactionLineItemListParamsType = "originating"
	TransactionLineItemListParamsTypeReceiving   TransactionLineItemListParamsType = "receiving"
)

type TransactionLineItemService

type TransactionLineItemService struct {
	Options []option.RequestOption
}

TransactionLineItemService 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 NewTransactionLineItemService method instead.

func NewTransactionLineItemService

func NewTransactionLineItemService(opts ...option.RequestOption) (r *TransactionLineItemService)

NewTransactionLineItemService 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 (*TransactionLineItemService) Get added in v1.5.0

get transaction line item

func (*TransactionLineItemService) List

list transaction_line_items

func (*TransactionLineItemService) ListAutoPaging

list transaction_line_items

type TransactionLineItemTransactableType

type TransactionLineItemTransactableType string

If a matching object exists in Modern Treasury, the type will be populated here, otherwise `null`.

const (
	TransactionLineItemTransactableTypeIncomingPaymentDetail TransactionLineItemTransactableType = "incoming_payment_detail"
	TransactionLineItemTransactableTypePaperItem             TransactionLineItemTransactableType = "paper_item"
	TransactionLineItemTransactableTypePaymentOrder          TransactionLineItemTransactableType = "payment_order"
	TransactionLineItemTransactableTypePaymentOrderAttempt   TransactionLineItemTransactableType = "payment_order_attempt"
	TransactionLineItemTransactableTypeReturn                TransactionLineItemTransactableType = "return"
	TransactionLineItemTransactableTypeReversal              TransactionLineItemTransactableType = "reversal"
)

type TransactionLineItemType

type TransactionLineItemType string

Indicates whether the line item is `originating` or `receiving` (see https://www.moderntreasury.com/journal/beginners-guide-to-ach for more).

const (
	TransactionLineItemTypeOriginating TransactionLineItemType = "originating"
	TransactionLineItemTypeReceiving   TransactionLineItemType = "receiving"
)

type TransactionListParams

type TransactionListParams struct {
	AfterCursor param.Field[string] `query:"after_cursor"`
	// Filters transactions with an `as_of_date` starting on or before the specified
	// date (YYYY-MM-DD).
	AsOfDateEnd param.Field[time.Time] `query:"as_of_date_end" format:"date"`
	// Filters transactions with an `as_of_date` starting on or after the specified
	// date (YYYY-MM-DD).
	AsOfDateStart  param.Field[time.Time] `query:"as_of_date_start" format:"date"`
	CounterpartyID param.Field[string]    `query:"counterparty_id" format:"uuid"`
	// Filters for transactions including the queried string in the description.
	Description param.Field[string] `query:"description"`
	Direction   param.Field[string] `query:"direction"`
	// Specify `internal_account_id` if you wish to see transactions to/from a specific
	// account.
	InternalAccountID param.Field[string] `query:"internal_account_id" format:"uuid"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata    param.Field[map[string]string] `query:"metadata"`
	PaymentType param.Field[string]            `query:"payment_type"`
	PerPage     param.Field[int64]             `query:"per_page"`
	// Either `true` or `false`.
	Posted           param.Field[bool]   `query:"posted"`
	TransactableType param.Field[string] `query:"transactable_type"`
	// Filters for transactions including the queried vendor id (an identifier given to
	// transactions by the bank).
	VendorID         param.Field[string] `query:"vendor_id"`
	VirtualAccountID param.Field[string] `query:"virtual_account_id" format:"uuid"`
}

func (TransactionListParams) URLQuery

func (r TransactionListParams) URLQuery() (v url.Values)

URLQuery serializes TransactionListParams's query parameters as `url.Values`.

type TransactionService

type TransactionService struct {
	Options   []option.RequestOption
	LineItems *TransactionLineItemService
}

TransactionService 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 NewTransactionService method instead.

func NewTransactionService

func NewTransactionService(opts ...option.RequestOption) (r *TransactionService)

NewTransactionService 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 (*TransactionService) Get

func (r *TransactionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Transaction, err error)

Get details on a single transaction.

func (*TransactionService) List

Get a list of all transactions.

func (*TransactionService) ListAutoPaging

Get a list of all transactions.

func (*TransactionService) Update

Update a single transaction.

type TransactionType

type TransactionType string

The type of the transaction. Can be one of `ach`, `wire`, `check`, `rtp`, `book`, or `sen`.

const (
	TransactionTypeACH         TransactionType = "ach"
	TransactionTypeAuBecs      TransactionType = "au_becs"
	TransactionTypeBacs        TransactionType = "bacs"
	TransactionTypeBook        TransactionType = "book"
	TransactionTypeCard        TransactionType = "card"
	TransactionTypeCheck       TransactionType = "check"
	TransactionTypeCrossBorder TransactionType = "cross_border"
	TransactionTypeEft         TransactionType = "eft"
	TransactionTypeInterac     TransactionType = "interac"
	TransactionTypeMasav       TransactionType = "masav"
	TransactionTypeNeft        TransactionType = "neft"
	TransactionTypeNics        TransactionType = "nics"
	TransactionTypeProvxchange TransactionType = "provxchange"
	TransactionTypeRtp         TransactionType = "rtp"
	TransactionTypeSeBankgirot TransactionType = "se_bankgirot"
	TransactionTypeSen         TransactionType = "sen"
	TransactionTypeSepa        TransactionType = "sepa"
	TransactionTypeSic         TransactionType = "sic"
	TransactionTypeSignet      TransactionType = "signet"
	TransactionTypeWire        TransactionType = "wire"
	TransactionTypeZengin      TransactionType = "zengin"
)

type TransactionUpdateParams

type TransactionUpdateParams struct {
	// Additional data in the form of key-value pairs. Pairs can be removed by passing
	// an empty string or `null` as the value.
	Metadata param.Field[map[string]string] `json:"metadata"`
}

func (TransactionUpdateParams) MarshalJSON

func (r TransactionUpdateParams) MarshalJSON() (data []byte, err error)

type TransactionVendorCodeType

type TransactionVendorCodeType string

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`, or `us_bank`.

const (
	TransactionVendorCodeTypeBai2          TransactionVendorCodeType = "bai2"
	TransactionVendorCodeTypeBankprov      TransactionVendorCodeType = "bankprov"
	TransactionVendorCodeTypeBnkDev        TransactionVendorCodeType = "bnk_dev"
	TransactionVendorCodeTypeCleartouch    TransactionVendorCodeType = "cleartouch"
	TransactionVendorCodeTypeColumn        TransactionVendorCodeType = "column"
	TransactionVendorCodeTypeCrossRiver    TransactionVendorCodeType = "cross_river"
	TransactionVendorCodeTypeCurrencycloud TransactionVendorCodeType = "currencycloud"
	TransactionVendorCodeTypeDcBank        TransactionVendorCodeType = "dc_bank"
	TransactionVendorCodeTypeDwolla        TransactionVendorCodeType = "dwolla"
	TransactionVendorCodeTypeEvolve        TransactionVendorCodeType = "evolve"
	TransactionVendorCodeTypeGoldmanSachs  TransactionVendorCodeType = "goldman_sachs"
	TransactionVendorCodeTypeIso20022      TransactionVendorCodeType = "iso20022"
	TransactionVendorCodeTypeJpmc          TransactionVendorCodeType = "jpmc"
	TransactionVendorCodeTypeMx            TransactionVendorCodeType = "mx"
	TransactionVendorCodeTypePlaid         TransactionVendorCodeType = "plaid"
	TransactionVendorCodeTypeRspecVendor   TransactionVendorCodeType = "rspec_vendor"
	TransactionVendorCodeTypeSignet        TransactionVendorCodeType = "signet"
	TransactionVendorCodeTypeSilvergate    TransactionVendorCodeType = "silvergate"
	TransactionVendorCodeTypeSwift         TransactionVendorCodeType = "swift"
	TransactionVendorCodeTypeUsBank        TransactionVendorCodeType = "us_bank"
)

type ValidationService

type ValidationService struct {
	Options []option.RequestOption
}

ValidationService 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 NewValidationService method instead.

func NewValidationService

func NewValidationService(opts ...option.RequestOption) (r *ValidationService)

NewValidationService 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 (*ValidationService) ValidateRoutingNumber

Validates the routing number information supplied without creating a routing detail

type ValidationValidateRoutingNumberParams

type ValidationValidateRoutingNumberParams struct {
	// The routing number that is being validated.
	RoutingNumber param.Field[string] `query:"routing_number,required"`
	// One of `aba`, `au_bsb`, `br_codigo`, `ca_cpa`, `cnaps`, `gb_sort_code`,
	// `in_ifsc`, `my_branch_code`, `se_bankgiro_clearing_code`, or `swift`. In sandbox
	// mode we currently only support `aba` and `swift` with routing numbers
	// '123456789' and 'GRINUST0XXX' respectively.
	RoutingNumberType param.Field[ValidationValidateRoutingNumberParamsRoutingNumberType] `query:"routing_number_type,required"`
}

func (ValidationValidateRoutingNumberParams) URLQuery

URLQuery serializes ValidationValidateRoutingNumberParams's query parameters as `url.Values`.

type ValidationValidateRoutingNumberParamsRoutingNumberType

type ValidationValidateRoutingNumberParamsRoutingNumberType string

One of `aba`, `au_bsb`, `br_codigo`, `ca_cpa`, `cnaps`, `gb_sort_code`, `in_ifsc`, `my_branch_code`, `se_bankgiro_clearing_code`, or `swift`. In sandbox mode we currently only support `aba` and `swift` with routing numbers '123456789' and 'GRINUST0XXX' respectively.

const (
	ValidationValidateRoutingNumberParamsRoutingNumberTypeAba                    ValidationValidateRoutingNumberParamsRoutingNumberType = "aba"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeAuBsb                  ValidationValidateRoutingNumberParamsRoutingNumberType = "au_bsb"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeBrCodigo               ValidationValidateRoutingNumberParamsRoutingNumberType = "br_codigo"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeCaCpa                  ValidationValidateRoutingNumberParamsRoutingNumberType = "ca_cpa"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeChips                  ValidationValidateRoutingNumberParamsRoutingNumberType = "chips"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeCnaps                  ValidationValidateRoutingNumberParamsRoutingNumberType = "cnaps"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeGBSortCode             ValidationValidateRoutingNumberParamsRoutingNumberType = "gb_sort_code"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeInIfsc                 ValidationValidateRoutingNumberParamsRoutingNumberType = "in_ifsc"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeJpZenginCode           ValidationValidateRoutingNumberParamsRoutingNumberType = "jp_zengin_code"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeMyBranchCode           ValidationValidateRoutingNumberParamsRoutingNumberType = "my_branch_code"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeSeBankgiroClearingCode ValidationValidateRoutingNumberParamsRoutingNumberType = "se_bankgiro_clearing_code"
	ValidationValidateRoutingNumberParamsRoutingNumberTypeSwift                  ValidationValidateRoutingNumberParamsRoutingNumberType = "swift"
)

type VirtualAccount

type VirtualAccount struct {
	ID string `json:"id,required" format:"uuid"`
	// An array of account detail objects.
	AccountDetails []AccountDetail `json:"account_details,required"`
	// The ID of a counterparty that the virtual account belongs to. Optional.
	CounterpartyID string    `json:"counterparty_id,required,nullable" format:"uuid"`
	CreatedAt      time.Time `json:"created_at,required" format:"date-time"`
	// The ID of a credit normal ledger account. When money enters the virtual account,
	// this ledger account will be credited. Must be accompanied by a
	// debit_ledger_account_id if present.
	CreditLedgerAccountID string `json:"credit_ledger_account_id,required,nullable" format:"uuid"`
	// The ID of a debit normal ledger account. When money enters the virtual account,
	// this ledger account will be debited. Must be accompanied by a
	// credit_ledger_account_id if present.
	DebitLedgerAccountID string `json:"debit_ledger_account_id,required,nullable" format:"uuid"`
	// An optional free-form description for internal use.
	Description string    `json:"description,required,nullable"`
	DiscardedAt time.Time `json:"discarded_at,required,nullable" format:"date-time"`
	// The ID of the internal account that the virtual account is in.
	InternalAccountID string `json:"internal_account_id,required" format:"uuid"`
	// This field will be true if this object exists in the live environment or false
	// if it exists in the test environment.
	LiveMode bool `json:"live_mode,required"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata map[string]string `json:"metadata,required"`
	// The name of the virtual account.
	Name   string `json:"name,required"`
	Object string `json:"object,required"`
	// An array of routing detail objects. These will be the routing details of the
	// internal account.
	RoutingDetails []RoutingDetail `json:"routing_details,required"`
	UpdatedAt      time.Time       `json:"updated_at,required" format:"date-time"`
	JSON           virtualAccountJSON
}

func (*VirtualAccount) UnmarshalJSON

func (r *VirtualAccount) UnmarshalJSON(data []byte) (err error)

type VirtualAccountListParams

type VirtualAccountListParams struct {
	AfterCursor       param.Field[string] `query:"after_cursor"`
	CounterpartyID    param.Field[string] `query:"counterparty_id" format:"uuid"`
	InternalAccountID param.Field[string] `query:"internal_account_id" format:"uuid"`
	// For example, if you want to query for records with metadata key `Type` and value
	// `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
	// parameters.
	Metadata param.Field[map[string]string] `query:"metadata"`
	PerPage  param.Field[int64]             `query:"per_page"`
}

func (VirtualAccountListParams) URLQuery

func (r VirtualAccountListParams) URLQuery() (v url.Values)

URLQuery serializes VirtualAccountListParams's query parameters as `url.Values`.

type VirtualAccountNewParams

type VirtualAccountNewParams struct {
	// The ID of the internal account that this virtual account is associated with.
	InternalAccountID param.Field[string] `json:"internal_account_id,required" format:"uuid"`
	// The name of the virtual account.
	Name param.Field[string] `json:"name,required"`
	// An array of account detail objects.
	AccountDetails param.Field[[]VirtualAccountNewParamsAccountDetail] `json:"account_details"`
	// The ID of the counterparty that the virtual account belongs to.
	CounterpartyID param.Field[string] `json:"counterparty_id" format:"uuid"`
	// The ID of a credit normal ledger account. When money leaves the virtual account,
	// this ledger account will be credited. Must be accompanied by a
	// debit_ledger_account_id if present.
	CreditLedgerAccountID param.Field[string] `json:"credit_ledger_account_id" format:"uuid"`
	// The ID of a debit normal ledger account. When money enters the virtual account,
	// this ledger account will be debited. Must be accompanied by a
	// credit_ledger_account_id if present.
	DebitLedgerAccountID param.Field[string] `json:"debit_ledger_account_id" format:"uuid"`
	// An optional description for internal use.
	Description param.Field[string] `json:"description"`
	// Additional data represented as key-value pairs. Both the key and value must be
	// strings.
	Metadata param.Field[map[string]string] `json:"metadata"`
	// An array of routing detail objects.
	RoutingDetails param.Field[[]VirtualAccountNewParamsRoutingDetail] `json:"routing_details"`
}

func (VirtualAccountNewParams) MarshalJSON

func (r VirtualAccountNewParams) MarshalJSON() (data []byte, err error)

type VirtualAccountNewParamsAccountDetail added in v1.1.0

type VirtualAccountNewParamsAccountDetail struct {
	// The account number for the bank account.
	AccountNumber param.Field[string] `json:"account_number,required"`
	// One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank
	// account number is in a generic format.
	AccountNumberType param.Field[VirtualAccountNewParamsAccountDetailsAccountNumberType] `json:"account_number_type"`
}

func (VirtualAccountNewParamsAccountDetail) MarshalJSON added in v1.1.0

func (r VirtualAccountNewParamsAccountDetail) MarshalJSON() (data []byte, err error)

type VirtualAccountNewParamsAccountDetailsAccountNumberType added in v1.1.0

type VirtualAccountNewParamsAccountDetailsAccountNumberType string

One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank account number is in a generic format.

const (
	VirtualAccountNewParamsAccountDetailsAccountNumberTypeClabe         VirtualAccountNewParamsAccountDetailsAccountNumberType = "clabe"
	VirtualAccountNewParamsAccountDetailsAccountNumberTypeIban          VirtualAccountNewParamsAccountDetailsAccountNumberType = "iban"
	VirtualAccountNewParamsAccountDetailsAccountNumberTypeOther         VirtualAccountNewParamsAccountDetailsAccountNumberType = "other"
	VirtualAccountNewParamsAccountDetailsAccountNumberTypePan           VirtualAccountNewParamsAccountDetailsAccountNumberType = "pan"
	VirtualAccountNewParamsAccountDetailsAccountNumberTypeWalletAddress VirtualAccountNewParamsAccountDetailsAccountNumberType = "wallet_address"
)

type VirtualAccountNewParamsRoutingDetail added in v1.1.0

type VirtualAccountNewParamsRoutingDetail struct {
	// The routing number of the bank.
	RoutingNumber param.Field[string] `json:"routing_number,required"`
	// One of `aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.
	RoutingNumberType param.Field[VirtualAccountNewParamsRoutingDetailsRoutingNumberType] `json:"routing_number_type,required"`
	// If the routing detail is to be used for a specific payment type this field will
	// be populated, otherwise null.
	PaymentType param.Field[VirtualAccountNewParamsRoutingDetailsPaymentType] `json:"payment_type"`
}

func (VirtualAccountNewParamsRoutingDetail) MarshalJSON added in v1.1.0

func (r VirtualAccountNewParamsRoutingDetail) MarshalJSON() (data []byte, err error)

type VirtualAccountNewParamsRoutingDetailsPaymentType added in v1.1.0

type VirtualAccountNewParamsRoutingDetailsPaymentType string

If the routing detail is to be used for a specific payment type this field will be populated, otherwise null.

const (
	VirtualAccountNewParamsRoutingDetailsPaymentTypeACH         VirtualAccountNewParamsRoutingDetailsPaymentType = "ach"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeAuBecs      VirtualAccountNewParamsRoutingDetailsPaymentType = "au_becs"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeBacs        VirtualAccountNewParamsRoutingDetailsPaymentType = "bacs"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeBook        VirtualAccountNewParamsRoutingDetailsPaymentType = "book"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeCard        VirtualAccountNewParamsRoutingDetailsPaymentType = "card"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeCheck       VirtualAccountNewParamsRoutingDetailsPaymentType = "check"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeCrossBorder VirtualAccountNewParamsRoutingDetailsPaymentType = "cross_border"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeEft         VirtualAccountNewParamsRoutingDetailsPaymentType = "eft"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeInterac     VirtualAccountNewParamsRoutingDetailsPaymentType = "interac"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeMasav       VirtualAccountNewParamsRoutingDetailsPaymentType = "masav"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeNeft        VirtualAccountNewParamsRoutingDetailsPaymentType = "neft"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeNics        VirtualAccountNewParamsRoutingDetailsPaymentType = "nics"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeProvxchange VirtualAccountNewParamsRoutingDetailsPaymentType = "provxchange"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeRtp         VirtualAccountNewParamsRoutingDetailsPaymentType = "rtp"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeSeBankgirot VirtualAccountNewParamsRoutingDetailsPaymentType = "se_bankgirot"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeSen         VirtualAccountNewParamsRoutingDetailsPaymentType = "sen"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeSepa        VirtualAccountNewParamsRoutingDetailsPaymentType = "sepa"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeSic         VirtualAccountNewParamsRoutingDetailsPaymentType = "sic"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeSignet      VirtualAccountNewParamsRoutingDetailsPaymentType = "signet"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeWire        VirtualAccountNewParamsRoutingDetailsPaymentType = "wire"
	VirtualAccountNewParamsRoutingDetailsPaymentTypeZengin      VirtualAccountNewParamsRoutingDetailsPaymentType = "zengin"
)

type VirtualAccountNewParamsRoutingDetailsRoutingNumberType added in v1.1.0

type VirtualAccountNewParamsRoutingDetailsRoutingNumberType string

One of `aba`, `swift`, `ca_cpa`, `au_bsb`, `gb_sort_code`, `in_ifsc`, `cnaps`.

const (
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeAba                    VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "aba"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeAuBsb                  VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "au_bsb"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeBrCodigo               VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "br_codigo"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeCaCpa                  VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "ca_cpa"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeChips                  VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "chips"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeCnaps                  VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "cnaps"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeGBSortCode             VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "gb_sort_code"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeInIfsc                 VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "in_ifsc"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeJpZenginCode           VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "jp_zengin_code"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeMyBranchCode           VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "my_branch_code"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeSeBankgiroClearingCode VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "se_bankgiro_clearing_code"
	VirtualAccountNewParamsRoutingDetailsRoutingNumberTypeSwift                  VirtualAccountNewParamsRoutingDetailsRoutingNumberType = "swift"
)

type VirtualAccountService

type VirtualAccountService struct {
	Options []option.RequestOption
}

VirtualAccountService 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 NewVirtualAccountService method instead.

func NewVirtualAccountService

func NewVirtualAccountService(opts ...option.RequestOption) (r *VirtualAccountService)

NewVirtualAccountService 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 (*VirtualAccountService) Delete

func (r *VirtualAccountService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *VirtualAccount, err error)

delete virtual_account

func (*VirtualAccountService) Get

func (r *VirtualAccountService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *VirtualAccount, err error)

get virtual_account

func (*VirtualAccountService) List

Get a list of virtual accounts.

func (*VirtualAccountService) ListAutoPaging

Get a list of virtual accounts.

func (*VirtualAccountService) New

create virtual_account

func (*VirtualAccountService) Update

update virtual_account

type VirtualAccountUpdateParams

type VirtualAccountUpdateParams struct {
	CounterpartyID param.Field[string]            `json:"counterparty_id" format:"uuid"`
	Metadata       param.Field[map[string]string] `json:"metadata"`
	Name           param.Field[string]            `json:"name"`
}

func (VirtualAccountUpdateParams) MarshalJSON

func (r VirtualAccountUpdateParams) MarshalJSON() (data []byte, err error)

type WebhookGetSignatureParams

type WebhookGetSignatureParams struct {
}

type WebhookService

type WebhookService struct {
	Options []option.RequestOption
}

WebhookService 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 NewWebhookService method instead.

func NewWebhookService

func NewWebhookService(opts ...option.RequestOption) (r *WebhookService)

NewWebhookService 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 (*WebhookService) GetSignature

func (r *WebhookService) GetSignature(payload []byte, key string) (res string, err error)

To verify that a webhook was actually sent by Modern Treasury, every payload is signed with a signature that is passed through the `X-Signature` HTTP header.

This method will generate a signature based off of your webhook key which can be found in the Developer Settings, https://app.moderntreasury.com/developers/webhooks, and the webhook payload.

You can then compare the generated signature with the signature sent with the request, if they match then the webhook was sent by Modern Treasury.

func (*WebhookService) ValidateSignature

func (r *WebhookService) ValidateSignature(payload []byte, key string, headers http.Header) (res bool, err error)

Returns whether or not the webhook payload was sent by Modern Treasury.

type WebhookValidateSignatureParams

type WebhookValidateSignatureParams struct {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL