MishkaPay.Balance.Transaction (Mishka Pay v0.0.1)

Copy Markdown View Source

One movement of the seller's balance at the provider: a charge, a refund, a fee, a payout. Listed with MishkaPay.list_balance_transactions/3, such as every one a payout paid out. A guarded_struct the provider fills in.

  • :provider, :id: the provider's id of it (txn_... at Stripe).
  • :amount: what moved, before fees; below zero when money left the balance.
  • :fee: what the provider kept.
  • :net: what the balance changed by, :amount less :fee.
  • :type: the provider's own name for it, such as "charge", "refund" or "payout".
  • :source_id: the provider object it came from, such as a charge or a refund.
  • :status: :available or :pending.
  • :description, :available_at (when its money is available), :created_at.

Summary

Types

t()

The struct that builder/1 returns.

Functions

A sample %MishkaPay.Balance.Transaction{} populated from defaults + type-based fallbacks.

Types

t()

@type t() :: %MishkaPay.Balance.Transaction{
  amount: Money.t() | nil,
  available_at: DateTime.t() | nil,
  created_at: DateTime.t() | nil,
  description: String.t() | nil,
  fee: Money.t() | nil,
  id: String.t() | nil,
  net: Money.t() | nil,
  provider: String.t() | nil,
  source_id: String.t() | nil,
  status: (:available | :pending) | nil,
  type: String.t() | nil
}

The struct that builder/1 returns.

FieldTypeRequiredDefaultDescriptionDerives
:providerString.t() | nilnovalidate(string)
:idString.t() | nilnovalidate(string)
:amountMoney.t() | nilnovalidator {MishkaPay.Money, :signed_field}
:feeMoney.t() | nilnovalidator {MishkaPay.Money, :signed_field}
:netMoney.t() | nilnovalidator {MishkaPay.Money, :signed_field}
:typeString.t() | nilnovalidate(string)
:source_idString.t() | nilnovalidate(string)
:status:available | :pending | nilnovalidate(enum=Atom[available::pending])
:descriptionString.t() | nilnovalidate(string)
:available_atDateTime.t() | nilnovalidate(struct)
:created_atDateTime.t() | nilnovalidate(struct)

Functions

builder(attrs_or_input, error \\ false)

enforce_keys()

enforce_keys(field)

example()

A sample %MishkaPay.Balance.Transaction{} populated from defaults + type-based fallbacks.

keys()

keys(field)