Service Layer high complexity backend
3
Dependencies
1
Dependents
4
Entities
0
Integrations

Description

Event-driven service that listens for expense approval events and orchestrates delivery to the configured accounting system. Implements at-least-once delivery with idempotency keys, exponential backoff retry for transient failures, and writes every sync attempt and outcome to audit_logs.

Feature: Accounting API

accounting-sync-service

Responsibilities

  • Subscribe to expense approval events and trigger accounting sync per organization config
  • Generate and attach idempotency keys to prevent duplicate postings
  • Execute retry logic with exponential backoff for transient API failures
  • Write sync attempt, outcome, and provider reference to audit_logs
  • Emit sync failure alerts when retry budget is exhausted

Interfaces

onExpenseApproved(expenseId, orgId): void
syncExpense(expenseId, orgId): SyncResult
retryFailedSync(syncRecordId): SyncResult
getIdempotencyKey(expenseId, orgId): string
recordSyncAttempt(expenseId, outcome, reference): void