Expense Threshold Configuration
Component Detail
Description
Configuration provider for organisation-specific expense thresholds including receipt requirement amount (default 100 kr for HLF) and auto-approval distance limit (default 50 km for HLF). Values are stored in Supabase organisation settings and cached locally.
expense-threshold-config
Summaries
The Expense Threshold Configuration component enforces organisation-specific financial controls that directly reduce reimbursement fraud risk and administrative overhead. By automatically applying rules such as the 100 kr receipt requirement and 50 km auto-approval distance limit, the system eliminates manual policy enforcement, reducing coordinator workload and the likelihood of policy violations slipping through. This translates into measurable cost savings through faster claim processing, fewer compliance errors, and reduced audit exposure. Different organisations can operate under their own rules without custom development, enabling scalable rollout to new clients with minimal incremental cost and a clear competitive advantage in regulated or grant-funded environments.
This component has low implementation complexity and no external dependencies beyond Supabase organisation settings, making it a low-risk, early-deliverable item. It must be completed before validation and submission services are integrated, as those components depend on the config accessors it exposes. Key delivery considerations include setting up the Supabase organisation settings table schema and seeding default threshold values (100 kr receipt, 50 km auto-approval) for HLF. Local caching logic must be tested for offline scenarios to avoid blocking field users.
Test coverage should include multi-organisation isolation to ensure one org's thresholds never bleed into another's validation context.
This component is a lightweight configuration provider running in both mobile and backend execution contexts. It reads organisation-specific threshold values from the Supabase `organisation_settings` table and caches them locally to support offline validation. The public interface exposes typed accessors — `getReceiptThreshold(organizationId)`, `getAutoApprovalDistanceThreshold(organizationId)`, `isReceiptRequired(amount, organizationId)`, and `isAutoApprovalEligible(kilometres, hasExpenseClaim, organizationId)` — which wrap the raw config values in domain-level boolean logic. `refreshConfig(organizationId)` should be called on app resume or after settings updates.
Downstream consumers (expense validation and submission services) must not hardcode threshold values; all policy decisions must route through this component to ensure single-source-of-truth configuration management and easy future threshold changes.
Responsibilities
- Load organisation-specific receipt amount threshold from Supabase
- Load organisation-specific auto-approval distance threshold
- Cache threshold values locally for offline validation
- Expose typed config accessors to validation and submission services
Interfaces
getReceiptThreshold(organizationId)
getAutoApprovalDistanceThreshold(organizationId)
refreshConfig(organizationId)
isReceiptRequired(amount, organizationId)
isAutoApprovalEligible(kilometres, hasExpenseClaim, organizationId)
Related Data Entities (1)
Data entities managed by this component