BBackend CourseLeroy Labs
0/0
Search the course

Approval workflows with policies, delegation, escalation & maker-checker

Segregation of duties, who approves what, approval policies by amount or type, delegation while away, scheduled escalation, and hierarchical (unit-tree) approvers.

● advancedReport-Manager-2SperoTek (in dev)

The concept

Maker-checker / four-eyes principle: the person who creates a financial record must not be the one who approves it. This is a core internal control (SOX, IFRS audits) against both fraud and mistakes.

A workflow engine for approvals needs:

Piece Question it answers
Policy Does this item need approval? (e.g. journals over GHS 10,000, or all manual journals to Equity)
Approver resolution Who can approve? (a role, a specific user, the unit head, the next level up the tree)
Self-approval rule The maker can never approve their own item
Delegation Approver on leave, so a deputy approves for a date range
Escalation Not decided in N hours, so notify a higher level or reassign
Decision record Who, when, approve or reject, comment (immutable audit)
public ApprovalRequirement check(JournalEntry je, Actor maker) {
    Policy p = policies.forCompany(je.companyId());
    if (!p.requiresApproval(je)) return ApprovalRequirement.none();
    Set<UUID> approvers = resolver.approversFor(je, p)
        .stream().filter(id -> !id.equals(maker.userId()))   // no self-approval
        .map(delegations::effectiveApprover)                  // apply active delegation
        .collect(toSet());
    if (approvers.isEmpty()) throw new ApiException(ErrorCode.NO_ELIGIBLE_APPROVER);
    return ApprovalRequirement.of(approvers);
}

In your projects

SperoTek (in dev)approvals/* · ApprovalGateway · ApprovalController (approvals, approval-policy, approval-delegations) · ApprovalEscalator · ApprovalDecided event
  • An approval policy per company.
  • Delegations for absent approvers.
  • Escalation every 15 minutes (ApprovalEscalator).
  • Integrated with journal submit and withdraw; /approval-check previews whether approval is needed.
  • The decision publishes an ApprovalDecided event, and the ledger module listens and posts. Approvals know nothing about ledger internals.
Report-Manager-2approvalassignment/* · ApproversAssignedEvent · ApprovalsFollowTheUnitIntegrationTest · PendingBacklogNotifier · ReportSubmissionSpecs.isPendingApproval

Hierarchical approvals follow the ReportUnit tree: a department’s reports are approved by its faculty, and so on. ApprovalsFollowTheUnitIntegrationTest proves that approvers follow the unit when it is moved. Assignments publish ApproversAssignedEvent, and PendingBacklogNotifier (after commit) emails approvers. Approvers see only items they can approve (isAccessibleBy + isPendingApproval).

Alternatives

  • BPMN workflow engines (Camunda, Flowable): visual processes, timers, human tasks. Powerful, but heavy for one approval step.
  • Temporal: durable code-first workflows with timers (“escalate after 48 h”).
  • Simple status + role check: fine for a single fixed approver.
  • Segregation of duties (SoD) is broader than approvals: e.g. the person who creates vendors shouldn’t pay them.
  • Notification fatigue. Batch reminders (RM’s monthly reminder scheduler) instead of one email per item.
  • Thresholds in base currency. Convert before comparing with policy limits.
  • Re-approval on change. Editing an approved-but-unposted item should reset its approval.

Check yourself

1. Maker-checker principle means…
2. Approver is on leave for 2 weeks. Feature?