Diagrams
Diagrams
State machines and request flows, drawn from the code so they cannot drift from it.
These diagrams are not drawn from memory. Each one is either generated from the code or checked against it, so a change in the code that the diagram does not reflect fails a test.
- State machines are generated from the transition tables in
backend/walletby a Go golden test. When a table changes, the test fails until the diagram is regenerated withDUMP=1 go test ./internal/docsgen -run TestStateDiagrams. - Sequence diagrams are written by hand while reading the code, and every step is
annotated. An
%% op:line names the API operation an arrow calls, and the docs test suite checks it is a publishedoperationIdwith the same method and path. An%% src:line names the Go function behind a step, and the suite checks that the file still declares it.
State machines
Invoice, subscription, credit note, refund, quote and ledger statuses.
Payment intent
Create, confirm, 3DS, provider webhook, charge paid, merchant webhook.
Refund
Create, submit to the provider, ledger debit, refund webhooks.
Subscription renewal
Scheduler, draft invoice, finalize, charge, paid or dunning.
Payout
Create with a hold, approve, provider transfer, paid or failed.