feat(billing): Usage & Billing API for the peergos-flutter app (+ commit live ns1 drift) #2

Merged
marchon merged 2 commits from feat/usage-billing-api into overdue-negative-balance-only 2026-10-06 13:26:16 -04:00
Owner

Adds the backend for the peergos-flutter Usage & Billing screen. George approved building, merging and deploying this on 2026-10-06.

Commits

  1. chore: commit live drift. These files were running on ns1 but were never in git: src/jobs/send-invoices.ts, the overdue email HTML, the portal #billing deep link, and the send-invoices npm script. Without this commit, a deploy from git would regress them.
  2. feat(billing). Adds the /portal/api/billing/* routes (summary, usage, estimate, invoices, pay-now with server-side confirm, payment methods via SetupIntent/Checkout, PO info) and the staff routes (storage samples, PO attach/renew). Full spec in docs/USAGE-BILLING-API.md.

Safety

  • The DB changes are additive only: two new tables, storage_samples and purchase_orders, created with CREATE TABLE IF NOT EXISTS. No existing table or column is altered.
  • Nothing here sends email.
  • Nothing charges a card unless the customer confirms a PaymentIntent client-side. Invoices are marked paid only after the server re-reads a succeeded PaymentIntent from Stripe.
  • Card routes return 503 without a real Stripe key and 409 for PO customers.

Tests: 9 new; the full suite passes 283/283 (it was 274 before this PR).

Adds the backend for the peergos-flutter **Usage & Billing** screen. George approved building, merging and deploying this on 2026-10-06. **Commits** 1. `chore: commit live drift`. These files were running on ns1 but were never in git: `src/jobs/send-invoices.ts`, the overdue email HTML, the portal `#billing` deep link, and the `send-invoices` npm script. Without this commit, a deploy from git would regress them. 2. `feat(billing)`. Adds the `/portal/api/billing/*` routes (summary, usage, estimate, invoices, pay-now with server-side confirm, payment methods via SetupIntent/Checkout, PO info) and the staff routes (storage samples, PO attach/renew). Full spec in `docs/USAGE-BILLING-API.md`. **Safety** * The DB changes are additive only: two new tables, `storage_samples` and `purchase_orders`, created with `CREATE TABLE IF NOT EXISTS`. No existing table or column is altered. * Nothing here sends email. * Nothing charges a card unless the customer confirms a PaymentIntent client-side. Invoices are marked paid only after the server re-reads a succeeded PaymentIntent from Stripe. * Card routes return 503 without a real Stripe key and 409 for PO customers. **Tests:** 9 new; the full suite passes 283/283 (it was 274 before this PR).
These files were running on ns1 but never committed. Copied verbatim so the
next deploy from git does not regress them.
/portal/api/billing/{summary,usage,estimate,invoices,invoices/:id/pay[/confirm],
payment-methods[/setup-intent|/checkout-session|/:id|/:id/default],po} behind the
portal session; staff routes for storage samples and purchase orders.
Additive tables storage_samples and purchase_orders (CREATE TABLE IF NOT EXISTS).
Card routes 503 without a real Stripe key; nothing charges without customer
confirmation. 9 new tests; full suite 283/283.
marchon merged commit 700e9820fd into overdue-negative-balance-only 2026-10-06 13:26:16 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marchon/verae-edge-billing!2
No description provided.