You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.tsonLegSettled 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
Description
src/auditLogger.tslogs 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. ReadsSplitLegandSplitResultfromsrc/types.ts. Hooks intosrc/paymentProgressTracker.tsonLegSettledcallback. WritesSplitAuditEntryrecords to the configured audit sink (file, remote endpoint, or in-memory store). Integrates withsrc/complianceExporter.tsfor export. AddsSplitAuditEntrytosrc/types.ts.Acceptance Criteria
SplitAuditEntrywith fields:invoiceId,legIndex,recipientId,assetCode,amount,operationId,ledgerSequence,settledAtSplitAuditEntryrecords are written to the audit sink immediately upon leg settlement, not batchedAuditLogger.exportSplitAuditTrail(invoiceId): Promise<SplitAuditEntry[]>returns all recorded entries for an invoicesrc/complianceExporter.tsso audit entries appear in compliance reportsSplitAuditEntryrecords with correct field values