Skip to content

Add invoice payment velocity tracker #143

@Kingsman-99

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

There is no SDK method to analyse how quickly payments are arriving for an invoice. This issue adds trackVelocity(address) that computes payment rate analytics across all invoices for an address, identifying fast-filling and stalled invoices.

Technical Context

Involves a new src/velocityTracker.ts. Fetch all invoices for address. For each, compute paymentsPerDay from payment timestamps. Define VelocityReport = { address: string; invoices: Array<{ invoiceId: string; paymentsPerDay: number; trend: 'accelerating' | 'steady' | 'stalling' }> }. Trend based on comparing first-half vs second-half payment rate.

Acceptance Criteria

  • trackVelocity(address: string): Promise<VelocityReport> exported
  • paymentsPerDay computed from actual payment timestamps
  • trend correctly classified for accelerating, steady, and stalling patterns
  • VelocityReport type exported from src/index.ts
  • Test verifies 'stalling' trend for invoice with decreasing payment rate
  • All existing tests pass
  • TypeScript strict mode — zero any types

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