Service Layer medium complexity backend
0
Dependencies
0
Dependents
5
Entities
0
Integrations

Description

Evaluates submitted expense claims against all active auto-approval rules and decides whether a claim is auto-approved or routed to manual review. Also runs simulation passes over historical claims for admin preview before activation.

Feature: Auto-Approval Rules

rules-engine

Sources & reasoning

HLF's detailed reimbursement requirements explicitly call for threshold-based automatic approval. Phase 2 in §5 lists threshold-based approval as part of Reiserefusjonshåndtering, so target_release is Core Product.

  • Automatisk godkjenning under 50 km / uten utlegg, manuell attestering ellers (HLF).
  • Detaljert refusjonsstyring med faste valg som gjør feilkombinasjon teknisk umulig (f.eks. km + bussbillett kan ikke velges samtidig). Automatisk godkjenning under terskel.

Responsibilities

  • Load active rules and evaluate them against each submitted claim
  • Apply combined conditions (amount ceiling, distance ceiling, receipt presence, expense type, claimant history)
  • Mark matching claims as auto-approved and record the rule that fired for audit
  • Pass non-matching claims through to the manual approval queue
  • Execute dry-run simulation of a draft rule across historical claims and return match statistics

Interfaces

evaluateClaim(claim: ExpenseClaim): EvaluationResult
simulate(draft: RuleDraft, since: Date): SimulationResult
validateRule(draft: RuleDraft): ValidationReport