Current section
Files
Jump to
Current section
Files
lib/nombaone/coupon.ex
defmodule Nombaone.Coupon do
@moduledoc """
A reusable discount rule. Applying a coupon to a customer or subscription
creates a `Nombaone.Discount` — the coupon is the rule, the discount is one
application of it.
Exactly one of `amount_off_in_kobo` (integer kobo) or `percent_off` (1–100)
is non-`nil`. `duration` is one of `once`, `repeating`, `forever`.
"""
use Nombaone.Model,
fields: [
:domain,
:id,
:code,
:duration,
:amount_off_in_kobo,
:percent_off,
:duration_in_cycles,
:redeem_by,
:max_redemptions,
:times_redeemed,
:mode,
:created_at
]
end