# `Accrue.Billing.Coupon`
[🔗](https://github.com/szTheory/accrue/blob/accrue-v0.3.1/lib/accrue/billing/coupon.ex#L1)

Ecto schema for the `accrue_coupons` table.

Stores the local projection of a processor coupon (e.g. Stripe coupon
objects). Supports both amount-off and percent-off discount types.

Full lifecycle changesets arrive in Phase 4.

# `t`

```elixir
@type t() :: %Accrue.Billing.Coupon{
  __meta__: term(),
  amount_off_cents: term(),
  amount_off_minor: term(),
  currency: term(),
  data: term(),
  duration: term(),
  duration_in_months: term(),
  id: term(),
  inserted_at: term(),
  lock_version: term(),
  max_redemptions: term(),
  metadata: term(),
  name: term(),
  percent_off: term(),
  processor: term(),
  processor_id: term(),
  redeem_by: term(),
  times_redeemed: term(),
  updated_at: term(),
  valid: term()
}
```

# `changeset`

```elixir
@spec changeset(
  %Accrue.Billing.Coupon{
    __meta__: term(),
    amount_off_cents: term(),
    amount_off_minor: term(),
    currency: term(),
    data: term(),
    duration: term(),
    duration_in_months: term(),
    id: term(),
    inserted_at: term(),
    lock_version: term(),
    max_redemptions: term(),
    metadata: term(),
    name: term(),
    percent_off: term(),
    processor: term(),
    processor_id: term(),
    redeem_by: term(),
    times_redeemed: term(),
    updated_at: term(),
    valid: term()
  }
  | Ecto.Changeset.t(),
  map()
) :: Ecto.Changeset.t()
```

Builds a changeset for creating or updating a Coupon.

---

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