feat(salary): skattekonto payment file as ISO 20022 pain.001 (#1845)

The tax payment file (skatt + arbetsgivaravgifter to Skatteverket BG
5050-1055) was Bankgirot LB only; banks that take pain.001 for salary,
like SEB via file communication agreements, refuse the LB .txt. The
route now accepts ?format=pain001 and generates the payment through the
supplier-payment pain.001 generator, whose Swedish giro dialect
(BG payee + SCOR OCR, Validex-validated) is exactly this payment shape.

The TaxPaymentPanel gets the same format selector as the salary
PaymentFilePanel, seeded from company_settings.preferred_payment_format,
with the missing-sender warning per format (bankgiro for LB, IBAN for
pain.001). A migration widens the tax_payment_file_format CHECK to
admit 'pain001'; bg_lb stays the default for old clients.


Claude-Session: https://claude.ai/code/session_01DUB7L8DbVP2icn8ZpoPkoE

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-08-24 15:29:21 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5
parent 1b54bcd4bd
commit cef8206f83
6 changed files with 287 additions and 49 deletions
@@ -0,0 +1,16 @@
-- Allow ISO 20022 pain.001 as a tax payment file format.
--
-- The skattekonto payment file (skatt + arbetsgivaravgifter to Skatteverket
-- BG 5050-1055) was Bankgirot LB only; banks are sunsetting LB file uploads
-- during 2026 and companies on pain.001 for salary need the same format for
-- the tax payment. The route now generates either format, so the CHECK on
-- agi_declarations.tax_payment_file_format must admit 'pain001'.
ALTER TABLE public.agi_declarations
DROP CONSTRAINT IF EXISTS agi_declarations_tax_payment_format_check;
ALTER TABLE public.agi_declarations
ADD CONSTRAINT agi_declarations_tax_payment_format_check
CHECK (tax_payment_file_format IS NULL OR tax_payment_file_format IN ('bg_lb', 'pain001'));
NOTIFY pgrst, 'reload schema';