Psu type configuration (#248)

* feat: implement salary module with personnummer encryption, salary entries, tax tables, and AGI tracking

- Added personnummer encryption and decryption functions for secure storage.
- Created salary entries handling for journal entries including gross salary, tax withholding, and employer contributions.
- Implemented tax table lookup functionality for calculating tax amounts based on monthly income.
- Developed SQL migration for salary module including tables for payroll configuration, tax rates, employees, salary runs, salary run employees, salary line items, and AGI declarations.
- Established row-level security policies for all new tables to ensure company-scoped access.

* feat: add salary calculation modules for 2026

- Implemented engångsskatt calculation for one-time payments with tax brackets.
- Added löneväxling functionality for salary sacrifice to pension, including employer savings and warnings.
- Created pain.001 generator for salary batch payments in compliance with Swedish banking standards.
- Developed PDF template for payslips, including detailed breakdowns and employer costs.
- Generated seed data for Swedish tax tables for 2026, including SQL insert statements.
- Implemented traktamente calculations for per diem and mileage allowances, adhering to Skatteverket regulations.
- Added seed script for populating tax tables in the database.

* feat: Update meal reduction percentages in traktamente calculation

fix: Remove obsolete seed script for 2026 tax tables

feat: Extend SalaryRunStatus type to include 'corrected' status

feat: Implement KU10 XML generation endpoint for annual employee income statements

feat: Add endpoint for creating corrections to booked salary runs

feat: Implement endpoint for sending payslip PDFs to employees

feat: Create KU10 XML generator for annual reporting

feat: Add salary transaction matcher for auto-linking bank transactions to salary entries

chore: Add database migration for salary correction support

* feat: replace select elements with custom Select component for employment and salary types

* feat: enhance salary calculations with pension entry and avgifter category support

* feat: enhance banking settings with PSU type detection and error handling

* fix: improve error handling for bank connection and update access denial message
This commit is contained in:
Mattsson
2026-04-15 13:48:08 +02:00
committed by GitHub
parent 04dbb31d7e
commit d484c341a4
6 changed files with 114 additions and 17 deletions
@@ -221,13 +221,13 @@ async function authenticatedFetchWithRetry(
/**
* Get list of supported banks (ASPSPs) for a country
*/
export async function getASPSPs(country: string = 'SE'): Promise<ASPSP[]> {
const psuType = process.env.ENABLE_BANKING_PSU_TYPE || 'business'
export async function getASPSPs(country: string = 'SE', psuType?: 'personal' | 'business'): Promise<ASPSP[]> {
const resolvedPsuType = psuType || process.env.ENABLE_BANKING_PSU_TYPE || 'business'
const isSandbox = ENABLE_BANKING_API_URL.includes('tilisy')
const params = new URLSearchParams({
country,
sandbox: String(isSandbox),
psu_type: psuType,
psu_type: resolvedPsuType,
})
const response = await authenticatedFetchWithRetry(`/aspsps?${params.toString()}`)
@@ -238,7 +238,7 @@ export async function getASPSPs(country: string = 'SE'): Promise<ASPSP[]> {
statusText: response.statusText,
body,
country,
psuType,
psuType: resolvedPsuType,
sandbox: isSandbox,
apiUrl: ENABLE_BANKING_API_URL,
})