Skip to content

budgetTracker: Add onOverspend callback when spending exceeds budget ceiling #704

Description

@Kingsman-99

Description

budgetTracker tracks cumulative spending against a budget but silently exceeds limits. Contributors should add an onOverspend(overspentBy: number, budgetId: string) callback option that fires whenever a new payment pushes the total above the configured budget ceiling, so callers can trigger warnings or block further payments.

Acceptance Criteria

  • An onOverspend callback option is accepted by the tracker's configuration
  • The callback fires exactly once per payment that crosses the budget ceiling (not once per subsequent payment)
  • overspentBy is the positive difference between the new total and the budget limit
  • Existing tests continue to pass

Context

  • Target file: src/lib/budgetTracker.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions