Files
accounted/supabase/migrations/20260810191118_supplier_payment_batch_items_payee_city.sql
Jakob Wennberg 4655f3da48 fix(payments): creditor address per Swedbank TwnNm rule (Validex round 2) (#1508)
A present PstlAdr must carry TwnNm from November 2026 (PFH_222), so
BGNR-to-BGNR payments now carry no creditor address at all (rule 020
requires none there), IBAN-debited payments carry the supplier's town
(snapshotted as payee_city) plus Ctry SE, and the debtor address comes
from company settings, clearing the info-level rule 236 as well.

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 21:19:44 +02:00

13 lines
601 B
SQL

-- Swedbank MIG rule PFH_222 (Validex round 2, 2026-08-10): when a creditor
-- postal address is present, TwnNm is mandatory from November 2026. IBAN-
-- debited payments require the address (rule 237), so items snapshot the
-- supplier's city at creation, same immutability rules as the other payee
-- fields. Nullable: suppliers without a city keep working (BGNR-debited
-- payments carry no creditor address at all).
--
-- pg-test: covered-by tests/pg/supplier-payment-batches.pg.test.ts
ALTER TABLE public.supplier_payment_batch_items
ADD COLUMN payee_city text;
NOTIFY pgrst, 'reload schema';