ExpenseService
Component Detail
Service Layer
medium complexity
mobilebackend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Orchestrates expense submission logic including threshold-based automatic approval and routing of larger claims to the manual coordinator attestation queue. Applies organisation-configured reimbursement rates for kilometer calculations and delegates persistence and sync to ExpenseRepository.
expense-service
Sources & reasoning
Lines 66 and 341 explicitly describe the expense registration need for HLF and Blindeforbundet. The priority matrix at line 148 places the parent area as SHOULD HAVE Fase 2, which maps to v1.0 by ordinal phase position.
-
docs/source/likeperson.md · line 66Begge organisasjoner har behov for registrering av kilometergodtgjørelse, bompenger, parkering og kollektivt. Behovene er like, men HLF har mest detaljert krav:
-
docs/source/likeperson.md · line 148Reiserefusjon / utleggsregistrering | - | - | ✓ | ✓ | ✓ | SHOULD HAVE | 2
-
docs/source/likeperson.md · line 341Reiserefusjonshåndtering (faste valg, terskelbasert godkjenning)
Responsibilities
- Evaluate submitted expense against organisation threshold and apply auto-approval when eligible
- Route claims exceeding the threshold to the coordinator attestation queue
- Calculate kilometer reimbursement amounts using configured rates
- Coordinate offline queue management and connectivity-triggered sync
- Validate expense type and amount combinations before persistence
Interfaces
submitExpense(draft: ExpenseDraft): Promise<ExpenseRecord>
evaluateApproval(expense: ExpenseRecord): ApprovalDecision
calculateKilometerReimbursement(km: number): number
syncPendingExpenses(): Promise<SyncResult>
getExpensesByActivity(activityId: string): Promise<ExpenseRecord[]>