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

Description

Backend service that orchestrates the lifecycle of expense approvals. Validates admin permissions, applies decision rules, records audit trail, and notifies claimants of approval, rejection, or send-back outcomes.

Feature: Expense Approval Queue

approval-service

Sources & reasoning

The source describes manual attestation for expenses outside auto-approval thresholds, requiring a human-review surface in the admin portal. Placed in Core Product because §5 lists "Reiserefusjonshåndtering (faste valg, terskelbasert godkjenning)" under Fase 2.

Responsibilities

  • Fetch pending claims with computed flags (missing receipt, above threshold, duplicate) for the queue
  • Authorize Organization Admin role and enforce decision permissions
  • Apply approve, reject, and send-back state transitions with reason capture
  • Persist immutable audit history of each decision linked to the claim and admin
  • Trigger notifications to claimants and downstream reimbursement processes on final approval

Interfaces

listPendingClaims(orgId, filters, pagination): PendingClaim[]
getClaimDetail(claimId): ClaimDetail
approveClaim(claimId, adminId): ApprovalResult
rejectClaim(claimId, adminId, reason): ApprovalResult
sendBackClaim(claimId, adminId, reason): ApprovalResult
bulkDecide(claimIds[], decision, adminId, reason?): BulkResult