Skip to content

Add invoice payment SLA tracker #243

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

Creators offering invoices with implicit payment SLAs (e.g. "paid within 24h of creation") need a way to track compliance across their invoice history for reporting purposes.

Technical Context

New src/slaTracker.ts. Computes timeToFirstPayment and timeToFullFunding per invoice from Invoice.payments timestamps (requires ledger-time correlation, reuse src/timeMachine.ts's getInvoiceAtTime pattern).

Acceptance Criteria

  • computeSlaReport(invoices: Invoice[], slaMs: number) returns { withinSla: number, breached: number, avgTimeToFund: number }
  • Excludes invoices with zero payments from time-to-fund averages (NaN-safe)
  • Exported from src/index.ts
  • Tests: mixed compliant/breached set computes correct aggregate; empty input returns zeroed report

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions