Skip to content

Invoice Payment Progress Tracker #521

Description

@Kingsman-99

Description

Long-running invoice payments with multiple tranches or async recipient claims have no unified progress representation in the SDK. Callers poll individual operations independently, producing inconsistent UX. A progress tracker should aggregate all per-recipient payment states into a single InvoicePaymentProgress object that can be subscribed to and rendered progressively.

Technical Context

Add src/paymentProgressTracker.ts. Aggregates RecipientPaymentState[] from src/types.ts. Uses src/poller.ts per recipient to fetch operation status. Emits invoiceProgressUpdated events via src/events.ts with { invoiceId, percentComplete, recipientStates } payloads. Integrates with src/trancheProgress.ts for tranche-based invoices. Exposes a subscribe(invoiceId, callback) API.

Acceptance Criteria

  • PaymentProgressTracker.subscribe(invoiceId, onProgress) starts polling all recipient payment legs and calls onProgress on each status change
  • InvoicePaymentProgress.percentComplete is computed as the number of settled legs divided by total legs × 100
  • Each RecipientPaymentState includes accountId, status, settledAmount, and lastUpdatedAt
  • unsubscribe(invoiceId) cancels all underlying pollers for that invoice
  • Unit tests mock per-recipient Horizon responses and assert percentComplete increments correctly as legs settle
  • 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