Behaviour every processor adapter implements, plus a runtime-dispatching
facade so every caller looks like Accrue.Processor.create_customer(...)
regardless of which adapter is wired.
Callback surface
Phase 1 shipped the customer callbacks (create_customer/2,
retrieve_customer/2, update_customer/3). Phase 3 (this plan, 03-03)
grows the behaviour to the full Stripe Billing surface needed by Wave 2
billing context functions:
- Subscription —
create_subscription/2,retrieve_subscription/2,update_subscription/3,cancel_subscription/2,cancel_subscription/3,resume_subscription/2,pause_subscription_collection/4 - Invoice —
create_invoice/2,retrieve_invoice/2,update_invoice/3,finalize_invoice/2,void_invoice/2,pay_invoice/2,send_invoice/2,mark_uncollectible_invoice/2,create_invoice_preview/2 - PaymentIntent —
create_payment_intent/2,retrieve_payment_intent/2,confirm_payment_intent/3 - SetupIntent —
create_setup_intent/2,retrieve_setup_intent/2,confirm_setup_intent/3 - PaymentMethod —
create_payment_method/2,retrieve_payment_method/2,attach_payment_method/3,detach_payment_method/2,list_payment_methods/2,update_payment_method/3,set_default_payment_method/3 - Charge —
create_charge/2,retrieve_charge/2,list_charges/2 - Refund —
create_refund/2,retrieve_refund/2 - Generic fetch —
fetch/2routes(object_type_atom, id)to the rightretrieve_*for the webhook DefaultHandler refetch path (D3-48 step 3).
All adapters return plain maps ({:ok, map}) or
{:error, Accrue.Error.t()}; Billing context functions wrap the
3DS/SCA branches into the intent_result union where applicable
(D3-06..D3-12).
Runtime dispatch
The Phase 1 customer functions resolve the concrete adapter at call
time via Application.get_env(:accrue, :processor, Accrue.Processor.Fake).
The Phase 3 callbacks are called directly on the adapter module by
Billing context functions; adapter resolution is via __impl__/0.
Telemetry
Each public Phase 1 call is wrapped in Accrue.Telemetry.span/3.
Phase 3 callbacks are telemetered inside the Billing context (Wave 2)
so the instrumentation sees the full business op name, not just the
processor leg.
Summary
Types
3DS/SCA-aware return type for intent-carrying ops (D3-06). Billing
context functions use this; the processor behaviour returns plain
{:ok, map()} and lets the context decide when to tag.
Functions
Creates a customer through the configured processor adapter.
Retrieves a customer by id through the configured processor adapter.
Updates a customer by id through the configured processor adapter.
Types
@type id() :: String.t()
@type intent_result(ok) :: {:ok, ok} | {:ok, :requires_action, map()} | {:error, Accrue.Error.t()}
3DS/SCA-aware return type for intent-carrying ops (D3-06). Billing
context functions use this; the processor behaviour returns plain
{:ok, map()} and lets the context decide when to tag.
@type opts() :: keyword()
@type params() :: map()
@type result() :: {:ok, map()} | {:error, Exception.t()}
Callbacks
@callback report_meter_event(Accrue.Billing.MeterEvent.t()) :: {:ok, map()} | {:error, Exception.t() | term()}
Functions
Creates a customer through the configured processor adapter.
Retrieves a customer by id through the configured processor adapter.
Updates a customer by id through the configured processor adapter.