feat(invoices): ROT/RUT payout file dialog and file guards (#1380)

* feat(invoices): ROT/RUT payout file dialog and file guards

Rebuild the UI for the existing headless HUS V6 payout-file flow
(demanded via #789): a dialog on the invoices page to pick eligible
paid ROT/RUT invoices, generate the XML, download it and track
request status. Adds file-level guards from the Skatteverket spec:
future payment dates blocked, one file per payment year, max 100
cases per file, with per-invoice blocker messages.

Submission stays manual (upload + sign in the SKV e-service);
no direct submission API exists.

Fixes #789

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(invoices): compute rot-rut gating date in Europe/Stockholm

The candidate and begäran date defaults used the UTC calendar day,
which near midnight Swedish time could wrongly block or admit an
invoice via FUTURE_PAYMENT_DATE and shift the 31 January deadline
warning. Use getSwedishLocalDate() like the bookkeeping engine.
Raised by the Swedish compliance review on PR #1380.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-08-03 18:16:46 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent df34cae9bf
commit 00d4c8a49e
9 changed files with 830 additions and 14 deletions
+45 -1
View File
@@ -3074,7 +3074,51 @@
"to_pay_label": "Amount to pay",
"total_incl_vat_label": "Total incl. VAT",
"review_customer_missing_title": "Customer details could not be loaded",
"review_customer_missing_description": "Reload the page and try again. Contact support if the problem persists."
"review_customer_missing_description": "Reload the page and try again. Contact support if the problem persists.",
"rot_rut_payout_action": "ROT/RUT file",
"rot_rut_payout_title": "Request a ROT/RUT payout",
"rot_rut_payout_description": "Select paid invoices and download an XML file for Skatteverket's e-service. The file is not submitted automatically: upload and sign it at Skatteverket.",
"rot_rut_type_aria": "Select deduction type",
"rot_rut_type_rot": "ROT",
"rot_rut_type_rut": "RUT",
"rot_rut_year_aria": "Select payment year",
"rot_rut_loading": "Loading ROT/RUT details",
"rot_rut_load_failed_title": "Could not load the ROT/RUT details",
"rot_rut_load_failed_description": "Reload the page and try again.",
"rot_rut_eligible_title": "Invoices to include",
"rot_rut_selected_count": "{selected} selected · {amount}",
"rot_rut_select_all": "Select all",
"rot_rut_clear_selection": "Clear selection",
"rot_rut_no_eligible_title": "No invoices are ready",
"rot_rut_no_eligible_description": "A paid ROT or RUT invoice appears here once its buyer details are complete.",
"rot_rut_paid_at": "Paid {date}",
"rot_rut_max_cases_help": "Skatteverket allows at most {count} cases in one file. Create multiple files if you need to request more invoices.",
"rot_rut_generate_file": "Create and download file",
"rot_rut_generating_file": "Creating file…",
"rot_rut_generated_title": "The ROT/RUT file was downloaded",
"rot_rut_generated_description": "Upload the file in Skatteverket's e-service and sign the request there.",
"rot_rut_generate_failed_title": "Could not create the ROT/RUT file",
"rot_rut_blocked_title": "Cannot be included ({count})",
"rot_rut_history_title": "Previous files",
"rot_rut_upload_help": "After uploading and signing at Skatteverket, mark the file as uploaded here.",
"rot_rut_history_empty": "No files have been created for this deduction type.",
"rot_rut_history_meta": "{date} · {count} cases · {amount}",
"rot_rut_status_generated": "Created",
"rot_rut_status_submitted": "Uploaded",
"rot_rut_status_paid": "Approved",
"rot_rut_status_partially_paid": "Partly approved",
"rot_rut_status_rejected": "Rejected",
"rot_rut_status_cancelled": "Cancelled",
"rot_rut_download_again": "Download again",
"rot_rut_cancel_request": "Cancel",
"rot_rut_mark_uploaded": "Mark as uploaded",
"rot_rut_uploaded_title": "The file is marked as uploaded",
"rot_rut_cancelled_title": "The request was cancelled",
"rot_rut_update_failed_title": "Could not update the request",
"rot_rut_download_failed_title": "Could not download the file",
"rot_rut_download_timeout": "The download took too long. Try again.",
"rot_rut_download_network": "The file could not be downloaded. Check your connection and try again.",
"rot_rut_skatteverket_link": "Open ROT and RUT at Skatteverket"
},
"invoice_review": {
"assigned_number_prefix": "Will be assigned invoice number",
+45 -1
View File
@@ -3074,7 +3074,51 @@
"to_pay_label": "Att betala",
"total_incl_vat_label": "Totalt inkl. moms",
"review_customer_missing_title": "Kunduppgifterna kunde inte laddas",
"review_customer_missing_description": "Ladda om sidan och försök igen. Kontakta support om det inte hjälper."
"review_customer_missing_description": "Ladda om sidan och försök igen. Kontakta support om det inte hjälper.",
"rot_rut_payout_action": "ROT/RUT-fil",
"rot_rut_payout_title": "Begär utbetalning för ROT/RUT",
"rot_rut_payout_description": "Välj betalda fakturor och hämta en XML-fil för Skatteverkets e-tjänst. Filen skickas inte automatiskt: du laddar upp och signerar den hos Skatteverket.",
"rot_rut_type_aria": "Välj avdragstyp",
"rot_rut_type_rot": "ROT",
"rot_rut_type_rut": "RUT",
"rot_rut_year_aria": "Välj betalningsår",
"rot_rut_loading": "Laddar ROT/RUT-underlag",
"rot_rut_load_failed_title": "Kunde inte ladda ROT/RUT-underlaget",
"rot_rut_load_failed_description": "Ladda om sidan och försök igen.",
"rot_rut_eligible_title": "Fakturor att ta med",
"rot_rut_selected_count": "{selected} valda · {amount}",
"rot_rut_select_all": "Välj alla",
"rot_rut_clear_selection": "Rensa val",
"rot_rut_no_eligible_title": "Inga fakturor är redo",
"rot_rut_no_eligible_description": "När en ROT- eller RUT-faktura är betald och har fullständiga köparuppgifter visas den här.",
"rot_rut_paid_at": "Betald {date}",
"rot_rut_max_cases_help": "Skatteverket tillåter högst {count} ärenden i samma fil. Skapa flera filer om fler fakturor ska begäras.",
"rot_rut_generate_file": "Skapa och hämta fil",
"rot_rut_generating_file": "Skapar fil…",
"rot_rut_generated_title": "ROT/RUT-filen är hämtad",
"rot_rut_generated_description": "Ladda upp filen i Skatteverkets e-tjänst och signera begäran där.",
"rot_rut_generate_failed_title": "Kunde inte skapa ROT/RUT-filen",
"rot_rut_blocked_title": "Kan inte tas med ({count})",
"rot_rut_history_title": "Tidigare filer",
"rot_rut_upload_help": "Efter uppladdning och signering hos Skatteverket markerar du filen som uppladdad här.",
"rot_rut_history_empty": "Inga filer har skapats för den här avdragstypen.",
"rot_rut_history_meta": "{date} · {count} ärenden · {amount}",
"rot_rut_status_generated": "Skapad",
"rot_rut_status_submitted": "Uppladdad",
"rot_rut_status_paid": "Beviljad",
"rot_rut_status_partially_paid": "Delvis beviljad",
"rot_rut_status_rejected": "Avslagen",
"rot_rut_status_cancelled": "Avbruten",
"rot_rut_download_again": "Hämta igen",
"rot_rut_cancel_request": "Avbryt",
"rot_rut_mark_uploaded": "Markera uppladdad",
"rot_rut_uploaded_title": "Filen är markerad som uppladdad",
"rot_rut_cancelled_title": "Begäran är avbruten",
"rot_rut_update_failed_title": "Kunde inte uppdatera begäran",
"rot_rut_download_failed_title": "Kunde inte hämta filen",
"rot_rut_download_timeout": "Hämtningen tog för lång tid. Försök igen.",
"rot_rut_download_network": "Filen kunde inte hämtas. Kontrollera anslutningen och försök igen.",
"rot_rut_skatteverket_link": "Öppna ROT och RUT hos Skatteverket"
},
"invoice_review": {
"assigned_number_prefix": "Tilldelas fakturanummer",