ACH transfers — electronic transfers between bank accounts at different
banks, originated through Treasury Prime (for incoming, externally
originated ACH, see TreasuryPrime.IncomingAch).
Creating a transfer
{:ok, ach} =
TreasuryPrime.Ach.create(client, %{
account_id: "acct_123456",
counterparty_id: "cp_098765",
amount: "100.00",
direction: "credit",
sec_code: "ccd"
}, idempotency_key: TreasuryPrime.Idempotency.generate_key())direction is from the perspective of account_id: "credit" sends
money to the counterparty, "debit" pulls money from the
counterparty.
sec_code is one of ccd, ppd, tel, web, cie, arc, boc — see
the ACH network rules for which applies to your use case. Some codes
require sec_details (e.g. payment_type for web/tel).
service defaults to "standard"; pass "sameday" for same-day ACH
(subject to cutoff times and additional fees from your bank).
Summary
Functions
Convenience for update(client, id, %{status: "canceled"}).
Originates an ACH transfer. Required: account_id, counterparty_id,
amount, direction, sec_code. Strongly recommended: pass
idempotency_key: in opts (see TreasuryPrime.Idempotency).
Fetches a single ACH transfer by id.
Lists ACH transfers.
Updates an ACH transfer. The primary use is cancellation: pass
%{status: "canceled"} while the transfer is still "pending".
Types
@type t() :: %TreasuryPrime.Ach{ account_id: String.t() | nil, addenda: [String.t()] | nil, amount: String.t() | nil, bank_id: String.t() | nil, bankdata: map() | nil, batch_key: String.t() | nil, counterparty_id: String.t() | nil, created_at: String.t() | nil, description: String.t() | nil, direction: String.t() | nil, effective_date: String.t() | nil, error: String.t() | nil, id: String.t() | nil, noc_change_code: String.t() | nil, noc_corrected_data: String.t() | nil, org_id: String.t() | nil, originator_name: String.t() | nil, scheduled_settlement: String.t() | nil, sec_code: String.t() | nil, sec_details: sec_details() | nil, service: String.t() | nil, status: String.t() | nil, trace_number: String.t() | nil, trace_suffix: integer() | nil, updated_at: String.t() | nil, userdata: map() | nil }
Functions
@spec cancel(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Convenience for update(client, id, %{status: "canceled"}).
@spec create(TreasuryPrime.Client.t(), map(), keyword()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Originates an ACH transfer. Required: account_id, counterparty_id,
amount, direction, sec_code. Strongly recommended: pass
idempotency_key: in opts (see TreasuryPrime.Idempotency).
@spec create!(TreasuryPrime.Client.t(), map(), keyword()) :: t()
@spec get(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Fetches a single ACH transfer by id.
@spec get!(TreasuryPrime.Client.t(), String.t()) :: t()
@spec list(TreasuryPrime.Client.t(), map()) :: {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}
Lists ACH transfers.
Filterable params
account_id, counterparty_id, direction, effective_date, service,
status, trace_number.
@spec list!(TreasuryPrime.Client.t(), map()) :: TreasuryPrime.Page.t()
@spec update(TreasuryPrime.Client.t(), String.t(), map()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Updates an ACH transfer. The primary use is cancellation: pass
%{status: "canceled"} while the transfer is still "pending".
@spec update!(TreasuryPrime.Client.t(), String.t(), map()) :: t()