902587683f30b7b824ae7a9cd6d84c3bc68b93b1
- Fix shouldBillToday() month-wrapping logic for PREPAID lead days - POST /api/billing/generate — triggers monthly invoice generation cycle - GET /api/invoices — paginated list with status/subscriber/date filters - GET /api/invoices/[id] — invoice detail with lines and subscriber - POST /api/invoices/[id]/void — void with JE reversal Test coverage (38 tests): - computeBillingPeriod pure function - shouldBillToday: postpaid, prepaid, and month-wrapping edge case - Invoice number sequencing per tenant/year - Invoice generation: amounts, InvoiceLine, period dates - Journal entries: DR AR (1100), CR Revenue (4010), balanced - Idempotency: duplicate prevention via unique(subscriberId, periodStart) - Credit auto-application: full, partial, zero credit, JE (DR 1150, CR 1100) - Billing cycle: active-only, suspended/cancelled excluded, prepaid lead days - Overdue detection: bulk update of DRAFT/SENT/PARTIAL past due date - Void: JE reversal, already-voided guard, PAID guard - getInvoice, listInvoices, status filtering - Tenant isolation: Tenant B cannot see Tenant A invoices
Description
No description provided
Languages
TypeScript
96.6%
Shell
3.3%