TreasuryPrime.Account (TreasuryPrime v1.0.0)

Copy Markdown View Source

Bank accounts: balances, ownership, locking, interest rates, statements, tax documents, and transaction history.

Accounts cannot be created directly through this resource — they're created as the result of an approved TreasuryPrime.AccountApplication. See the "Account Opening" group of modules for that flow.

Field reference (response)

FieldNotes
idacct_...
account_numberFilterable.
routing_number
account_typechecking or savings
account_product_id
nameName of the person/company that owns the account
nickname
statusopen, closed, close_pending. Filterable.
currencyAlways usd today
available_balancedecimal string, may be nil
current_balancedecimal string, may be nil
interest_ratedecimal string
fundedboolean
locked / locksee lock/3 / unlock/2
person_ids / business_idsowners
primary_person_id
org_id / bank_idFilterable.
physical_address / mailing_addressembedded address maps
additional_account_numberslinked TreasuryPrime.InvoiceAccountNumbers
tagsarray of strings, filterable
userdatayour arbitrary metadata
closed_date
created_at / updated_at

Summary

Functions

Lists month-by-month average balances for an account.

Lists day-by-day end-of-day balances for an account.

Deletes a (typically not-yet-filed) tax document.

Fetches a previously generated statement for an account.

Fetches a single tax document by id.

Generates a new monthly account statement (a PDF) for the given month.

Generates (files) a tax document for an account, e.g. a 1099-INT for a given year ("YYYY"). type is currently always "1099".

Fetches a single account by id.

Lists accounts.

Locks an account, blocking activity while a fraud/compliance investigation takes place.

Lists pending (not-yet-posted) transactions for an account, e.g. holds.

Sets or updates an account's interest rate. rate is a float between 0 and 1 (exclusive of 1), e.g. 0.015 for 1.5% APY.

Lists tax documents (e.g. 1099-INT) generated for an account.

Lists posted transactions for an account.

Unlocks a previously locked account.

Updates an account. Accepts name, nickname, tags, userdata, physical_address, mailing_address, and status (only settable value is "close_pending"). For locking, prefer lock/3 and unlock/2 below.

Updates (e.g. re-files / corrects) a tax document.

Types

t()

@type t() :: %TreasuryPrime.Account{
  account_number: String.t() | nil,
  account_product_id: String.t() | nil,
  account_type: String.t() | nil,
  additional_account_numbers: [String.t()] | nil,
  address: map() | nil,
  available_balance: String.t() | nil,
  bank_id: String.t() | nil,
  business_ids: [String.t()] | nil,
  closed_date: String.t() | nil,
  created_at: String.t() | nil,
  currency: String.t() | nil,
  current_balance: String.t() | nil,
  funded: boolean() | nil,
  id: String.t() | nil,
  interest_rate: String.t() | nil,
  lock: map() | nil,
  locked: boolean() | nil,
  mailing_address: map() | nil,
  name: String.t() | nil,
  nickname: String.t() | nil,
  org_id: String.t() | nil,
  person_ids: [String.t()] | nil,
  physical_address: map() | nil,
  primary_person_id: String.t() | nil,
  routing_number: String.t() | nil,
  status: String.t() | nil,
  tags: [String.t()] | nil,
  updated_at: String.t() | nil,
  userdata: map() | nil
}

Functions

average_balances(client, account_id, params \\ %{})

@spec average_balances(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}

Lists month-by-month average balances for an account.

daily_balances(client, account_id, params \\ %{})

@spec daily_balances(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}

Lists day-by-day end-of-day balances for an account.

delete_tax_document(client, account_id, tax_document_id)

@spec delete_tax_document(TreasuryPrime.Client.t(), String.t(), String.t()) ::
  {:ok, nil} | {:error, TreasuryPrime.Error.t()}

Deletes a (typically not-yet-filed) tax document.

fetch_statement(client, account_id, file_id)

@spec fetch_statement(TreasuryPrime.Client.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, TreasuryPrime.Error.t()}

Fetches a previously generated statement for an account.

fetch_tax_document(client, account_id, tax_document_id)

@spec fetch_tax_document(TreasuryPrime.Client.t(), String.t(), String.t()) ::
  {:ok, TreasuryPrime.TaxDocument.t()} | {:error, TreasuryPrime.Error.t()}

Fetches a single tax document by id.

generate_statement(client, account_id, params)

@spec generate_statement(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, map()} | {:error, TreasuryPrime.Error.t()}

Generates a new monthly account statement (a PDF) for the given month.

params requires date ("YYYY-MM"), type (only "monthly" is currently supported), and the statement boilerplate fields (org_legal_name, phone_number, email_address, support_url, footnote) unless you've set up a TreasuryPrime.StatementConfig that supplies defaults. Returns a map including a "url" to download the PDF.

generate_tax_document(client, account_id, params)

@spec generate_tax_document(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, TreasuryPrime.TaxDocument.t()} | {:error, TreasuryPrime.Error.t()}

Generates (files) a tax document for an account, e.g. a 1099-INT for a given year ("YYYY"). type is currently always "1099".

get(client, id)

@spec get(TreasuryPrime.Client.t(), String.t()) ::
  {:ok, t()} | {:error, TreasuryPrime.Error.t()}

Fetches a single account by id.

get!(client, id)

@spec get!(TreasuryPrime.Client.t(), String.t()) :: t()

list(client, params \\ %{})

@spec list(TreasuryPrime.Client.t(), map()) ::
  {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}

Lists accounts.

Filterable params

account_number, org_id, status, tags, plus standard pagination (page_cursor, page_size, from_date, to_date).

list!(client, params \\ %{})

lock(client, id, reason, opts \\ [])

@spec lock(TreasuryPrime.Client.t(), String.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, TreasuryPrime.Error.t()}

Locks an account, blocking activity while a fraud/compliance investigation takes place.

reason must be one of "transactions_being_investigated_wire", "transactions_being_investigated_card", "transactions_being_investigated_ACH", "transactions_being_investigated_check_issued", "transactions_being_investigated_check_deposit", or "identity_of_customer_being_investigated".

Pass additional_context: "..." (e.g. a related payment ID) via opts — this is forwarded to your partner bank.

pending_transactions(client, account_id, params \\ %{})

@spec pending_transactions(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}

Lists pending (not-yet-posted) transactions for an account, e.g. holds.

set_interest_rate(client, id, rate)

@spec set_interest_rate(TreasuryPrime.Client.t(), String.t(), float()) ::
  {:ok, t()} | {:error, TreasuryPrime.Error.t()}

Sets or updates an account's interest rate. rate is a float between 0 and 1 (exclusive of 1), e.g. 0.015 for 1.5% APY.

tax_documents(client, account_id, params \\ %{})

@spec tax_documents(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}

Lists tax documents (e.g. 1099-INT) generated for an account.

transactions(client, account_id, params \\ %{})

@spec transactions(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}

Lists posted transactions for an account.

unlock(client, id)

@spec unlock(TreasuryPrime.Client.t(), String.t()) ::
  {:ok, t()} | {:error, TreasuryPrime.Error.t()}

Unlocks a previously locked account.

update(client, id, params)

@spec update(TreasuryPrime.Client.t(), String.t(), map()) ::
  {:ok, t()} | {:error, TreasuryPrime.Error.t()}

Updates an account. Accepts name, nickname, tags, userdata, physical_address, mailing_address, and status (only settable value is "close_pending"). For locking, prefer lock/3 and unlock/2 below.

update!(client, id, params)

@spec update!(TreasuryPrime.Client.t(), String.t(), map()) :: t()

update_tax_document(client, account_id, tax_document_id, params)

@spec update_tax_document(TreasuryPrime.Client.t(), String.t(), String.t(), map()) ::
  {:ok, TreasuryPrime.TaxDocument.t()} | {:error, TreasuryPrime.Error.t()}

Updates (e.g. re-files / corrects) a tax document.