Accrue.Billing.Coupon (accrue v0.3.0)

Copy Markdown View Source

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.

Summary

Functions

Builds a changeset for creating or updating a Coupon.

Types

t()

@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()
}

Functions

changeset(coupon_or_changeset, attrs \\ %{})

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