Monzo.Pots (monzo_client v1.0.0)

Copy Markdown View Source

The Pots resource: listing pots and moving money into/out of them.

Summary

Functions

Moves money from an account into a pot.

Returns a list of pots owned by the currently authorised user for the given current account.

Moves money from a pot into an account.

Types

transfer_params()

@type transfer_params() :: %{
  pot_id: String.t(),
  amount: integer(),
  dedupe_id: String.t()
}

Functions

deposit(client, map)

@spec deposit(Monzo.Client.t(), transfer_params() | %{source_account_id: String.t()}) ::
  {:ok, Monzo.Pot.t()} | {:error, Exception.t()}

Moves money from an account into a pot.

:dedupe_id must remain static across retries of the same logical deposit to prevent Monzo from double-processing it; generate a new one for each new deposit.

list(client, current_account_id)

@spec list(Monzo.Client.t(), String.t()) ::
  {:ok, [Monzo.Pot.t()]} | {:error, Exception.t()}

Returns a list of pots owned by the currently authorised user for the given current account.

withdraw(client, map)

@spec withdraw(
  Monzo.Client.t(),
  transfer_params() | %{destination_account_id: String.t()}
) ::
  {:ok, Monzo.Pot.t()} | {:error, Exception.t()}

Moves money from a pot into an account.

:dedupe_id must remain static across retries of the same logical withdrawal to prevent Monzo from double-processing it.