Host-owned resolver for plan metadata that the shared price_id facade
does not carry by itself.
Accrue keeps public billing calls app-facing: host apps call
Accrue.Billing.swap_plan/3 with a stable price_id, while the host owns
any catalog knowledge needed to translate that identifier into
processor-specific metadata.
This resolver is required for Braintree swap-plan flows because Braintree
requires both the target plan_id and the explicit target amount when a
subscription changes plans.
Summary
Types
@type billing_cycle() :: %{unit: interval_unit(), count: pos_integer()}
@type interval_unit() :: :day | :week | :month | :year
@type resolved_plan() :: %{ price_id: String.t(), processor: String.t(), processor_plan_id: String.t(), unit_amount_minor: non_neg_integer(), currency: currency(), billing_cycle: billing_cycle() }
Callbacks
@callback resolve_price(String.t()) :: {:ok, resolved_plan()} | {:error, term()}
Functions
@spec configured?() :: boolean()
@spec impl() :: module() | nil
@spec resolve_price(String.t()) :: {:ok, resolved_plan()} | {:error, Accrue.APIError.t()}