MishkaPay.Feature.Entitlement (Mishka Pay v0.0.1)

Copy Markdown View Source

A customer's access to a MishkaPay.Feature right now, given by a product they bought, read with MishkaPay.list_entitlements/4. A guarded_struct the provider fills in.

  • :provider, :id: the provider's id of the entitlement.
  • :feature_id: the feature it gives.
  • :lookup_key: the feature's lookup key, which the host checks access by.

The provider keeps the list current as subscriptions start and end, and sends a webhook when it changes (entitlements.active_entitlement_summary.updated at Stripe).

Summary

Types

t()

The struct that builder/1 returns.

Functions

A sample %MishkaPay.Feature.Entitlement{} populated from defaults + type-based fallbacks.

Types

t()

@type t() :: %MishkaPay.Feature.Entitlement{
  feature_id: String.t() | nil,
  id: String.t() | nil,
  lookup_key: String.t() | nil,
  provider: String.t() | nil
}

The struct that builder/1 returns.

FieldTypeRequiredDefaultDescriptionDerives
:providerString.t() | nilnovalidate(string)
:idString.t() | nilnovalidate(string)
:feature_idString.t() | nilnovalidate(string)
:lookup_keyString.t() | nilnovalidate(string)

Functions

builder(attrs_or_input, error \\ false)

enforce_keys()

enforce_keys(field)

example()

A sample %MishkaPay.Feature.Entitlement{} populated from defaults + type-based fallbacks.

keys()

keys(field)