Packages

The official Elixir SDK for the Nomba One subscription-billing API — recurring billing for Nigeria over card, direct debit, and bank transfer, with dunning that recovers and a ledger that never loses a kobo.

Current section

Files

Jump to
nombaone lib nombaone coupon.ex
Raw

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