Skip to main content
Petanque Life

Bokföringsintegrationer

F14.10 6 features Planned

At a glance

Bokföringsintegrationer connects Petanque Life to Fortnox, Xero, Visma eEkonomi, and QuickBooks for invoice, payment, and customer sync via OAuth-managed tokens; ships a fully spec-compliant SIE4 export for Swedish accounting and audit handover; and provides a per-tenant chart-of-accounts mapping with validated BAS2024 defaults across eight petanque-specific categories, so federation finances flow into the right ledger automatically with hash-based idempotent re-runs.

How it works

Each accounting backend is configured through an AccountingProviderConfig variant — FortnoxConfig, XeroConfig, VismaConfig, or QuickBooksConfig — that holds Key Vault refs for client_id, client_secret, access_token, and refresh_token, plus provider-specific identifiers (company_id for Fortnox/Visma, xero_tenant_id and tracking_category_id for Xero, realm_id and minor_version for QuickBooks). Tokens are refreshed automatically before expiry. Outbound sync runs as an AccountingSyncJob that batches invoices, payments, and customers, computes a content hash per record, and consults an idempotent AccountingSyncMapping to skip unchanged rows; dry-run mode shows the plan without mutating the provider.

Inbound notifications arrive at AccountingWebhookEvent endpoints, where Fortnox calls are authenticated with HMAC-SHA256 against a shared signing key and Xero/Visma/QuickBooks use their respective signature schemes; idempotency_key deduplication prevents double-posting. Swedish reporting needs are covered by SIE4Export, which renders the standard control codes (#FLAGGA 0, #PROGRAM, #FORMAT PC8, #GEN, #SIETYP 4, #FNR, #FNAMN, #RAR, #KONTO, #IB, #UB, #VER, #TRANS) with configurable fiscal year, date filter, opening/closing balances, and period balances; POST /accounting/sie4-exports/ generates the file and returns metadata, and GET .../download streams the PC8-encoded artefact. ProviderAccountMapping holds the per-tenant chart-of-accounts mapping with a draft→active→archived lifecycle and an AccountMappingRule per category linking internal_category and internal_account_number to provider_account_code, provider_account_name, vat_code, and cost_centre; the validator catches duplicates and enforces numeric account codes for Fortnox.

Out of the box, BAS2024 defaults ship for eight petanque categories — license fees, tournament fees, club fees, membership fees, sponsor income, grants, travel costs, and consumable equipment — and a sync-to-provider endpoint pushes the mapping when it leaves draft.

Key capabilities

  • Fortnox, Xero, Visma eEkonomi, and QuickBooks providers with OAuth token refresh
  • AccountingSyncJob with hash-based change detection, idempotent mapping, and dry-run
  • AccountingWebhookEvent with HMAC-SHA256 signature verification and idempotency
  • SIE4 export with full Swedish control codes and PC8 encoding
  • ProviderAccountMapping lifecycle with AccountMappingRule per category
  • BAS2024 defaults for 8 petanque-specific revenue and expense categories
  • Validation for duplicate codes and numeric Fortnox account numbers

In practice

A Swedish federation treasurer connects Fortnox. The integration wizard creates an AccountingProviderConfig with provider=fortnox, walks them through OAuth, and stores tokens in Key Vault. They open ProviderAccountMapping, accept the BAS2024 defaults (license fees → 3041, sponsor income → 3740, travel costs → 5810), tweak two cost centres, and activate the mapping.

They run a dry-run AccountingSyncJob covering January 2026 — 312 invoices, 298 payments, 47 new customers — review the plan, then run for real with idempotency guarantees. At year-end they generate a SIE4 export for the full fiscal year, download the PC8 file, and import it into their auditor's tool with zero manual intervention.

Features in this subsystem

6
ID Status Features
F14.10.01 Shipped Fortnox API (Sverige) — AccountingProviderConfig (provider=fortnox) med FortnoxConfig (client_id_ref/client_secret_ref/access_token_ref/refresh_token_ref/company_id/default_account_plan BAS2024/auto_create_customers/auto_bookkeep_invoices); AccountingSyncJob för batch-push av fakturor/betalningar/kunder till Fortnox API med idempotent AccountingSyncMapping, hashbaserad ändringsdetektering, dry-run-stöd; AccountingWebhookEvent med HMAC-SHA256-signaturverifiering för Fortnox webhooks ✅ PL-F1410
F14.10.02 Shipped Xero API (internationell) — AccountingProviderConfig (provider=xero) med XeroConfig (client_id_ref/client_secret_ref/access_token_ref/refresh_token_ref/xero_tenant_id/tracking_category_id/auto_create_contacts/branding_theme_id); faktura/betalning/kontakt-sync till Xero REST API, OAuth2-tokenhantering, webhook-mottagning med idempotens ✅ PL-F1410
F14.10.03 Shipped Visma eEkonomi (Sverige) — AccountingProviderConfig (provider=visma) med VismaConfig (client_id_ref/client_secret_ref/access_token_ref/refresh_token_ref/company_id/fiscal_year_id/auto_create_customers); faktura/betalning/kund-sync till Visma eAccountingAPI ✅ PL-F1410
F14.10.04 Shipped QuickBooks (US/UK) — AccountingProviderConfig (provider=quickbooks) med QuickBooksConfig (client_id_ref/client_secret_ref/access_token_ref/refresh_token_ref/realm_id/minor_version/sandbox_mode/auto_create_customers); faktura/betalning/kund-sync till QuickBooks Online API ✅ PL-F1410
F14.10.05 Shipped SIE4-fil-export (svensk standard) — SIE4Export med livscykel (pending→generating→completed/failed), #FLAGGA 0/#PROGRAM/#FORMAT PC8/#GEN/#SIETYP 4/#FNR/#FNAMN/#RAR/#KONTO/#IB/#UB/#VER/#TRANS; konfigurerbar räkenskapsår, datumfilter, öppnings-/stängningssaldon, periodbalans; POST /accounting/sie4-exports/ genererar och returnerar metadata, GET .../download returnerar filinnehåll ✅ PL-F1410
F14.10.06 Shipped Per-tenant kontoplansmappning — ProviderAccountMapping med livscykel (draft→active→archived), AccountMappingRule (internal_category/internal_account_number/provider_account_code/provider_account_name/vat_code/cost_centre), validering (dubbletter, numerisk kontroll för Fortnox), BAS2024-standardmappningar för 8 kategorier (licensavgifter/tävlingsavgifter/klubbavgifter/medlemsavgifter/sponsorintäkter/bidrag/resekostnader/förbrukningsinventarier), sync-to-provider ✅ PL-F1410