Accrue.Billing.MeteredChargeAttempts (accrue v1.1.2)

Copy Markdown View Source

Replay-safe settlement state transitions for one metered renewal window.

Summary

Functions

ensure_attempt(renewal, subject_uuid)

@spec ensure_attempt(Accrue.Billing.MeteredRenewal.t(), String.t()) ::
  {:ok, Accrue.Billing.MeteredChargeAttempt.t()} | {:error, term()}

get(metered_renewal_id)

mark_awaiting_payment_method(attempt, error)

@spec mark_awaiting_payment_method(Accrue.Billing.MeteredChargeAttempt.t(), term()) ::
  {:ok, Accrue.Billing.MeteredChargeAttempt.t()} | {:error, term()}

mark_failed_exhausted(attempt, error, payment_method)

@spec mark_failed_exhausted(
  Accrue.Billing.MeteredChargeAttempt.t(),
  term(),
  Accrue.Billing.PaymentMethod.t() | nil
) :: {:ok, Accrue.Billing.MeteredChargeAttempt.t()} | {:error, term()}

mark_paid(attempt, charge, payment_method)

mark_retryable(attempt, error, payment_method)