Skip to content

Per-Split Audit Log Emitter #531

Description

@Kingsman-99

Description

src/auditLogger.ts logs aggregate invoice-level events but does not emit a granular per-split-leg audit record with the exact amount, recipient, operation ID, and ledger sequence for each leg of a multi-recipient payment. Without per-leg records, compliance and dispute resolution require reconstructing individual payments from raw Horizon data. A per-split audit emitter should write a structured record for each leg at the moment it settles.

Technical Context

Extend src/auditLogger.ts. Reads SplitLeg and SplitResult from src/types.ts. Hooks into src/paymentProgressTracker.ts onLegSettled callback. Writes SplitAuditEntry records to the configured audit sink (file, remote endpoint, or in-memory store). Integrates with src/complianceExporter.ts for export. Adds SplitAuditEntry to src/types.ts.

Acceptance Criteria

  • Each settled split leg produces a SplitAuditEntry with fields: invoiceId, legIndex, recipientId, assetCode, amount, operationId, ledgerSequence, settledAt
  • SplitAuditEntry records are written to the audit sink immediately upon leg settlement, not batched
  • AuditLogger.exportSplitAuditTrail(invoiceId): Promise<SplitAuditEntry[]> returns all recorded entries for an invoice
  • Integrates with src/complianceExporter.ts so audit entries appear in compliance reports
  • Unit tests assert a two-recipient split produces exactly two SplitAuditEntry records with correct field values
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions