Skip to content

Domain Billing Period

Guard duplicated from ARCHITECTURE §18.4 — ARCHITECTURE wins on conflict.

OPEN → CLOSING → CLOSED → LOCKED

LOCKED = immutable. Service layer MUST reject all adjustments, reversals, or write-offs when billing_period.status = 'LOCKED'. No exceptions.

⚠️ NEVER trust net_amount_idr from client input. Always recompute in service layer before persisting.

net = gross_amount_idr + adjustment_amount_idr
net = honor_amount_idr + transport_amount_idr - penalty_amount_idr + adjustment_amount_idr - pph_withheld_idr

Recompute and write net_amount_idr on every UPDATE to any component field.

Full spec: plans/ARCHITECTURE.md §18.4.