Commit Graph

1 Commits

Author SHA1 Message Date
pbwraith-worker
6d764d46f6 gitea-saas-core#1: billing ledger core (clients/ledger/holds, idempotent, fail-closed)
SQLite schema + ledger operations in gitea_saas/billing_core.py (+ db.py,
schema.sql). balance = credits + refunds - debits - active holds, never
negative; every mutation idempotent via UNIQUE idempotency_key; holds
expire (default 30 min) and auto-release on the next read/query. All ops
return (ok, details) with structured errors; never raise. Thread-safe via
single lock + WAL. 26 hermetic pytest tests (no network/Stripe/Gitea).
2026-08-25 04:16:35 -05:00