mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 19:37:46 +01:00
Switzerland raised standard VAT from 7.7% to 8.1% on 2024-01-01. The rate was declared in five places — lib/pricing, lib/payments/tax-compliance, lib/payments/currency (twice), the zod default in api/invoices and the invoices.tax_rate column default — and every copy carried the old rate. Two of those files each described themselves as 'the SSOT for VAT'. Meanwhile lib/services/payment-webhook books Kivvi at 8.1%, and its own comment flagged the divergence as a follow-up nobody closed. So the platform issued invoices at one rate and posted the accounting entry at another, on every paid order. - src/config/tax.ts is now the only declaration; everything derives. - getVATRateLabel() returned a literal '7.7' — that string is printed on invoices, so customers were shown a rate that also wasn't charged. - Migration 140 moves the invoices.tax_rate default to 0.0810. Existing rows are NOT back-filled: the column records what was actually charged, and rewriting it would falsify history rather than correct it. Any commercial correction is a business decision. - ~25 assertions across six suites pinned the old rate, so correcting it looked like a regression. They now derive from the constant; the literal rate is asserted in exactly one place (config/__tests__/tax-ssot.test.ts), which also fails if any source file hardcodes 0.077 again. Verified: migration applied to a real database (it initially targeted the wrong table — caught by applying it rather than reading it), 7802 tests, typecheck, lint 0 errors, umlaut gate clean. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>