Accrue.Billing.SubscriptionScheduleActions (accrue v0.3.0)

Copy Markdown View Source

BILL-16 write surface for Stripe SubscriptionSchedules.

Mirrors the Phase 3 SubscriptionActions shape: Repo.transact → Processor call → projection → local insert/update → event record, all inside a single transaction with deterministic idempotency keys.

Summary

Functions

cancel_schedule(sched, opts \\ [])

@spec cancel_schedule(
  Accrue.Billing.SubscriptionSchedule.t(),
  keyword()
) :: {:ok, Accrue.Billing.SubscriptionSchedule.t()} | {:error, term()}

cancel_schedule!(sched, opts \\ [])

release_schedule(sched, opts \\ [])

@spec release_schedule(
  Accrue.Billing.SubscriptionSchedule.t(),
  keyword()
) :: {:ok, Accrue.Billing.SubscriptionSchedule.t()} | {:error, term()}

release_schedule!(sched, opts \\ [])

subscribe_via_schedule(billable, phases, opts \\ [])

@spec subscribe_via_schedule(term(), [map()], keyword()) ::
  {:ok, Accrue.Billing.SubscriptionSchedule.t()} | {:error, term()}

subscribe_via_schedule!(billable, phases, opts \\ [])

@spec subscribe_via_schedule!(term(), [map()], keyword()) ::
  Accrue.Billing.SubscriptionSchedule.t()

update_schedule(sched, params, opts \\ [])

@spec update_schedule(Accrue.Billing.SubscriptionSchedule.t(), map(), keyword()) ::
  {:ok, Accrue.Billing.SubscriptionSchedule.t()} | {:error, term()}

update_schedule!(sched, params, opts \\ [])