AuroraMeter. Schema. Subscription
(Aurora Meter v1.0.0)
View Source
A tenant's plan assignment. Created locally by AuroraMeter.subscribe/2 (free)
or synced from the billing provider (Pro). One row per tenant.
status follows Stripe's vocabulary. Only entitled_statuses/0 grant the
subscription's plan; any other status (canceled, unpaid, incomplete, ...) falls
back to the configured default plan.
Summary
Functions
Builds a changeset for a subscription.
The values transition_confirm may hold, beside NULL.
Whether a subscription currently grants its plan.
Statuses under which the subscription's plan is granted.
The columns a partial AuroraMeter.Storage.put_subscription/1 may replace.
The states transition_state may hold, beside NULL.
Types
@type t() :: %AuroraMeter.Schema.Subscription{ __meta__: term(), current_period_end: term(), current_period_start: term(), id: term(), inserted_at: term(), plan_effective_at: term(), plan_fingerprint: term(), plan_id: term(), plan_version: term(), provider: term(), provider_customer_id: term(), provider_subscription_id: term(), scheduled_effective_at: term(), scheduled_plan_id: term(), scheduled_plan_version: term(), status: term(), tenant_key: term(), transition_applied_at: term(), transition_confirm: term(), transition_ref: term(), transition_state: term(), updated_at: term() }
Functions
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Builds a changeset for a subscription.
@spec confirmations() :: [String.t()]
The values transition_confirm may hold, beside NULL.
Whether a subscription currently grants its plan.
Examples
iex> AuroraMeter.Schema.Subscription.entitled?(%AuroraMeter.Schema.Subscription{status: "canceled"})
false
@spec entitled_statuses() :: [String.t()]
Statuses under which the subscription's plan is granted.
Examples
iex> "active" in AuroraMeter.Schema.Subscription.entitled_statuses()
true
@spec syncable() :: [atom()]
The columns a partial AuroraMeter.Storage.put_subscription/1 may replace.
Examples
iex> :plan_version in AuroraMeter.Schema.Subscription.syncable()
true
iex> :transition_ref in AuroraMeter.Schema.Subscription.syncable()
false
@spec transition_states() :: [String.t()]
The states transition_state may hold, beside NULL.