Domain Billing Period
Guard duplicated from ARCHITECTURE §18.4 — ARCHITECTURE wins on conflict.
Billing Period + Net Amount Guard
Section titled “Billing Period + Net Amount Guard”Period state machine
Section titled “Period state machine”OPEN → CLOSING → CLOSED → LOCKEDLOCKED = immutable. Service layer MUST reject all adjustments, reversals, or write-offs when billing_period.status = 'LOCKED'. No exceptions.
net_amount_idr — service-computed only
Section titled “net_amount_idr — service-computed only”⚠️ NEVER trust net_amount_idr from client input. Always recompute in service layer before persisting.
Student settlement net
Section titled “Student settlement net”net = gross_amount_idr + adjustment_amount_idrTutor settlement net
Section titled “Tutor settlement net”net = honor_amount_idr + transport_amount_idr - penalty_amount_idr + adjustment_amount_idr - pph_withheld_idrRecompute and write net_amount_idr on every UPDATE to any component field.
Full spec: plans/ARCHITECTURE.md §18.4.