TreasuryPrime.Transaction (TreasuryPrime v1.0.0)

Copy Markdown View Source

Ledger transactions — the append-only record of everything that's happened to an account's balance (deposits, withdrawals, holds, holds being released, interest, fees, reversals, ...).

Transactions are created automatically as a side effect of other resources (an TreasuryPrime.Ach, TreasuryPrime.Wire, TreasuryPrime.Card authorization, etc.) — there is no create/2 here. The only mutation supported is update/3, used to annotate a transaction's category (e.g. marking one as "interest" or "fees").

Key fields

  • type - one of charge, deposit, hold, hold_release, interest, payment, reversal, withdrawal.
  • amount - positive for credits, negative for debits. hold transactions carry an amount but do not affect balance.
  • balance - the account's balance immediately after this transaction.
  • *_id fields (ach_id, wire_id, book_id, card_id, check_id, incoming_ach_id, incoming_wire_id, issued_check_id, network_transfer_id, fednow_id) - whichever originated this transaction; all others are nil.
  • trace_id - ties related transactions together (e.g. a hold and its later hold_release).

Summary

Functions

Fetches a single transaction by id.

Lists transactions across all accounts.

Updates a transaction. Currently only category ("interest" | "fees" | nil) is settable.

Types

t()

@type t() :: %TreasuryPrime.Transaction{
  account_id: String.t() | nil,
  ach_id: String.t() | nil,
  amount: String.t() | nil,
  balance: String.t() | nil,
  billpay_payment_id: String.t() | nil,
  book_id: String.t() | nil,
  card_id: String.t() | nil,
  category: String.t() | nil,
  check_id: String.t() | nil,
  check_number: String.t() | nil,
  date: String.t() | nil,
  desc: String.t() | nil,
  extended_timestamp: String.t() | nil,
  extended_timestamp_precise: String.t() | nil,
  fednow_id: String.t() | nil,
  fingerprint: String.t() | nil,
  human_readable_description: String.t() | nil,
  id: String.t() | nil,
  incoming_ach_id: String.t() | nil,
  incoming_wire: map() | nil,
  incoming_wire_id: String.t() | nil,
  issued_check_id: String.t() | nil,
  network_transfer_id: String.t() | nil,
  related_transfer_ids: [String.t()] | nil,
  summary: String.t() | nil,
  trace_id: String.t() | nil,
  type: String.t() | nil,
  type_source: String.t() | nil,
  userdata: map() | nil,
  wire: String.t() | nil,
  wire_id: String.t() | nil
}

Functions

get(client, id)

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

Fetches a single transaction 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 transactions across all accounts.

Filterable params

ach_id, book_id, card_id, check_id, fednow_id, incoming_ach_id, incoming_wire_id, issued_check_id, network_transfer_id, trace_id, type, wire_id.

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

update(client, id, params)

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

Updates a transaction. Currently only category ("interest" | "fees" | nil) is settable.

update!(client, id, params)

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