Konrad du Plessis 81753695a1 fix: refuse payments where deductions exceed earnings (no negative PayrollRecords)
_process_single_payment wrote logs_amount + adj_amount straight into
PayrollRecord.amount_paid with no floor — a selection where deductions
beat earnings (easy via the split-payslip checkboxes: untick the work
logs, leave a big loan repayment ticked) recorded a NEGATIVE payment,
emailed a negative payslip to Spark Receipt, and deducted the loan.

Per Konrad's decision (12 Jun 2026): REFUSE such payments. New
DeductionsExceedEarningsError raised inside the atomic block (full
rollback — loan balance and adjustments untouched); process_payment
shows a clear error toast, batch_pay names the refused worker in its
summary. Exactly-zero net stays allowed (a repayment consuming the
whole wage legitimately settles a loan with a R 0.00 payslip).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 17:45:39 +02:00
..
2026-02-22 12:14:54 +00:00
2026-04-22 00:19:15 +02:00