ExDoubleEntry (ExDoubleEntry v0.1.0) View Source

Link to this section Summary

Functions

Examples

iex> [ExDoubleEntry.make_account!(:savings)] |> ExDoubleEntry.lock_accounts(fn -> true end)

Examples

iex> ExDoubleEntry.lookup_account!(:savings, currency: :USD) nil

Examples

iex> ExDoubleEntry.makeaccount!(:savings)._struct ExDoubleEntry.Account

Examples

iex> %ExDoubleEntry.Transfer{ iex> money: Money.new(42, :USD), iex> from: %ExDoubleEntry.Account{identifier: :checking, currency: :USD, balance: Money.new(42, :USD), positive_only?: false}, iex> to: %ExDoubleEntry.Account{identifier: :savings, currency: :USD, balance: Money.new(0, :USD)}, iex> code: :deposit iex> } iex> |> ExDoubleEntry.transfer!() iex> |> Tuple.to_list() iex> |> List.first() :ok

Link to this section Functions

Link to this function

lock_accounts(accounts, fun)

View Source

Examples

iex> [ExDoubleEntry.make_account!(:savings)] |> ExDoubleEntry.lock_accounts(fn -> true end)

Link to this function

lookup_account!(identifier, opts \\ [])

View Source

Examples

iex> ExDoubleEntry.lookup_account!(:savings, currency: :USD) nil

Link to this function

make_account!(identifier, opts \\ [])

View Source

Examples

iex> ExDoubleEntry.makeaccount!(:savings)._struct ExDoubleEntry.Account

Examples

iex> %ExDoubleEntry.Transfer{ iex> money: Money.new(42, :USD), iex> from: %ExDoubleEntry.Account{identifier: :checking, currency: :USD, balance: Money.new(42, :USD), positive_only?: false}, iex> to: %ExDoubleEntry.Account{identifier: :savings, currency: :USD, balance: Money.new(0, :USD)}, iex> code: :deposit iex> } iex> |> ExDoubleEntry.transfer!() iex> |> Tuple.to_list() iex> |> List.first() :ok