# `MishkaPay.Balance.Transaction`
[🔗](https://github.com/mishka-group/mishka_pay/blob/v0.0.1/nofile#L1)

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`.

# `t`

```elixir
@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.

| Field | Type | Required | Default | Description | Derives |
| --- | --- | --- | --- | --- | --- |
| `:provider` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:amount` | `Money.t()` \| `nil` | no |  |  | validator `{MishkaPay.Money, :signed_field}` |
| `:fee` | `Money.t()` \| `nil` | no |  |  | validator `{MishkaPay.Money, :signed_field}` |
| `:net` | `Money.t()` \| `nil` | no |  |  | validator `{MishkaPay.Money, :signed_field}` |
| `:type` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:source_id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:status` | `:available` \| `:pending` \| `nil` | no |  |  | `validate(enum=Atom[available::pending])` |
| `:description` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:available_at` | `DateTime.t()` \| `nil` | no |  |  | `validate(struct)` |
| `:created_at` | `DateTime.t()` \| `nil` | no |  |  | `validate(struct)` |

# `builder`

# `enforce_keys`

# `enforce_keys`

# `example`

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

# `keys`

# `keys`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
