The Mercury Transactions API for cross-account transaction lookups, updates, and attachments.
Sending money and listing an individual account's transactions live on
Mercury.Accounts (send_money/3, list_transactions/3), matching the
reference API's routing (/account/{id}/transactions).
Summary
Functions
Returns a single transaction by ID. GET /transaction/{id}
Same as get/2 but raises on error.
Returns one page of transactions across every account. GET /transactions
Same as list/2 but raises on error.
A lazy, auto-paginating stream of every transaction across every account.
Updates a transaction's note and/or category. POST /transaction/{id}
Uploads a file attachment (e.g. a receipt) to a transaction.
POST /transaction/{id}/attachment
Functions
@spec get(client :: Mercury.Client.t(), transaction_id :: String.t()) :: {:ok, Mercury.Transaction.t()} | {:error, Exception.t()}
Returns a single transaction by ID. GET /transaction/{id}
@spec get!(client :: Mercury.Client.t(), transaction_id :: String.t()) :: Mercury.Transaction.t()
Same as get/2 but raises on error.
@spec list(client :: Mercury.Client.t(), opts :: keyword()) :: {:ok, Mercury.Page.t(Mercury.Transaction.t())} | {:error, Exception.t()}
Returns one page of transactions across every account. GET /transactions
Accepts :account_id, :limit, :order, :start_after, :end_before,
:status, :kind filters.
@spec list!(client :: Mercury.Client.t(), opts :: keyword()) :: Mercury.Page.t(Mercury.Transaction.t())
Same as list/2 but raises on error.
@spec stream(client :: Mercury.Client.t(), opts :: keyword()) :: Enumerable.t()
A lazy, auto-paginating stream of every transaction across every account.
@spec update( client :: Mercury.Client.t(), transaction_id :: String.t(), attrs :: map() | keyword() ) :: {:ok, Mercury.Transaction.t()} | {:error, Exception.t()}
Updates a transaction's note and/or category. POST /transaction/{id}
Mercury.Transactions.update(client, transaction_id, %{note: "Client lunch"})
@spec update!( client :: Mercury.Client.t(), transaction_id :: String.t(), attrs :: map() | keyword() ) :: Mercury.Transaction.t()
@spec upload_attachment( client :: Mercury.Client.t(), transaction_id :: String.t(), filename :: String.t(), content :: binary() ) :: {:ok, term()} | {:error, Exception.t()}
Uploads a file attachment (e.g. a receipt) to a transaction.
POST /transaction/{id}/attachment
@spec upload_attachment!( client :: Mercury.Client.t(), transaction_id :: String.t(), filename :: String.t(), content :: binary() ) :: term()