Billing
Status: v1 lite — scaffolded, not a primary v1 delivery focus
Packages: packages/domain/billing, packages/application/billing
Purpose
The Billing context tracks the financial relationship between the organisation and its members. It records billable activity as Charge Items, compiles them into Invoice Drafts, and manages the invoice lifecycle through to issuance.
In v1, Billing covers charge tracking and draft invoicing. Payment processing, accounting system integration, and automated fee calculation come later.
Key entities
Charge item (aggregate root or entity)
A single billable line item against a Member. The atomic unit of billing.
Key attributes:
id— unique identifiermemberId— the member being charged (MemberId)bookingId— optional reference to the Booking that generated the charge (BookingId | null)description— human-readable description (e.g.C172 ZK-ABC — 1.2 hrs at $150/hr)quantity— amount or duration (e.g. hours flown)unitPrice— price per unit in cents (avoids floating-point currency issues)total— computed:quantity × unitPriceinvoiceId— null until added to an Invoice DraftcreatedAt— when the charge was recorded
Invoice draft
An un-issued invoice accumulating Charge Items for a Member.
Key attributes:
id— unique identifiermemberId— the invoice recipient (MemberId)lineItems— list ofChargeItemIdreferencessubtotal— sum of all line item totalsstatus—draft|issued|voidcreatedAt— draft creation timestampissuedAt— null until issued
Domain rules
- A Charge Item must reference an active Member.
- Charge Items cannot be modified once added to an issued Invoice.
- An Invoice Draft may be edited freely before issuance.
- Once issued, an Invoice transitions to
issuedand is immutable; corrections require a new invoice or credit note. - All monetary values are stored in the smallest currency unit (e.g. cents).
Key use cases
recordChargeItem— create a Charge Item against a Member (optionally linked to a Booking).createInvoiceDraft— create a new draft Invoice for a Member.addChargeToInvoice— attach a Charge Item to an existing Invoice Draft.issueInvoice— finalise and issue an Invoice Draft.voidInvoice— void a draft or issued invoice.
Cross-context relationships
| Context | Usage |
|---|---|
| People | References MemberId for the charge/invoice recipient |
| Scheduling | Charge Items may reference BookingId to link charges to bookings |
| Notifications | Invoice issuance triggers a notification to the Member |