TreasuryPrime.Book (TreasuryPrime v1.0.0)

Copy Markdown View Source

Book transfers — instant transfers between two accounts at the same bank (no ACH/wire rails involved, so they settle immediately and have no network fees). Common uses: moving money between a customer's sub-accounts, or from a customer account to your own operating/reserve account at the same bank.

Creating a transfer

{:ok, book} =
  TreasuryPrime.Book.create(client, %{
    sender_account_id: "acct_123456",
    receiver_account_id: "acct_654321",
    amount: "50.00"
  }, idempotency_key: TreasuryPrime.Idempotency.generate_key())

Summary

Functions

Creates a book transfer. Required: sender_account_id, receiver_account_id, amount. Both accounts must be at the same bank.

Fetches a single book transfer by id.

Lists book transfers.

Updates a book transfer.

Types

t()

@type t() :: %TreasuryPrime.Book{
  amount: String.t() | nil,
  created_at: String.t() | nil,
  description: String.t() | nil,
  error: String.t() | nil,
  id: String.t() | nil,
  org_id: String.t() | nil,
  receiver_account_id: String.t() | nil,
  sender_account_id: String.t() | nil,
  status: String.t() | nil,
  updated_at: String.t() | nil,
  userdata: map() | nil
}

Functions

create(client, params, opts \\ [])

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

Creates a book transfer. Required: sender_account_id, receiver_account_id, amount. Both accounts must be at the same bank.

create!(client, params, opts \\ [])

@spec create!(TreasuryPrime.Client.t(), map(), keyword()) :: t()

get(client, id)

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

Fetches a single book transfer 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 book transfers.

Filterable params

sender_account_id, receiver_account_id, status.

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

update(client, id, params)

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

Updates a book transfer.

update!(client, id, params)

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