Fix/invoice delivery and payment accounts (#1116)

* fix: reconcile annual reports with final closing entries

* test: cover annual report depreciation and VAT balances

* Merge remote-tracking branch 'origin/main' into fix/usr-fdbck-ch

* fix: show exact invoice delivery details

* fix: use currency account in invoice emails

* fix: address invoice delivery review feedback

* fix: harden invoice delivery and payment accounts

* test: assert RLS-denied zero-row updates

* fix: close remaining invoice compliance gaps

* fix: harden invoice archive authorization

* fix: close invoice delivery review findings

* fix: verify delivery finalization results

* fix: cap combined invoice email recipients

* fix: close final invoice compliance findings

* fix: prevent stale payment account saves

* test: prove invoice delivery isolation

* fix: close invoice privacy review findings

* test: normalize delivery retention dates
This commit is contained in:
Mattsson
2026-07-23 09:54:02 +02:00
committed by GitHub
parent 321e684523
commit 466e55a015
83 changed files with 6619 additions and 671 deletions
+20
View File
@@ -171,6 +171,17 @@ export type BankConnectionStatus = 'pending' | 'pending_selection' | 'active' |
// Currency types
export type Currency = 'SEK' | 'EUR' | 'USD' | 'GBP' | 'NOK' | 'DKK'
export interface InvoicePaymentAccount {
bank_name: string | null
clearing_number: string | null
account_number: string | null
bankgiro: string | null
plusgiro: string | null
swish: string | null
iban: string | null
bic: string | null
}
// Profile (extends auth.users)
export interface Profile {
id: string
@@ -282,6 +293,9 @@ export interface CompanySettings {
swish: string | null
iban: string | null
bic: string | null
// Invoice payment instructions keyed by the currency they can receive.
// Legacy bank fields above remain the SEK fallback for older companies.
invoice_payment_accounts?: Partial<Record<Currency, InvoicePaymentAccount>>
// Accounting method
accounting_method: AccountingMethod
@@ -352,6 +366,11 @@ export interface CompanySettings {
// Editable invoice email texts. null = all defaults.
invoice_email_texts: InvoiceEmailTexts | null
// Fixed invoice-email recipients. null means the company has not configured
// the setting yet and keeps the historical automatic CC fallback. [] is an
// explicit choice to send no copies.
invoice_email_cc_addresses?: string[] | null
invoice_email_bcc_addresses?: string[] | null
// Automation
send_invoice_reminders: boolean
@@ -1009,6 +1028,7 @@ export interface InvoiceDelivery {
status: InvoiceDeliveryStatus
to_addresses: string[]
cc_addresses: string[]
bcc_addresses: string[]
reply_to: string | null
from_name: string | null
subject: string | null