Skip to content

Vendor credit alert workflow #19

Description

@dotnetspark

Summary

Add a non-blocking vendor credit alert workflow for invoice create and approve actions.

Scope

  • Pre-create a CreditCheckRecord with a deterministic credit_check_id
  • Run the credit evaluation after the response using FastAPI BackgroundTasks
  • Compute outstanding AP from invoices in PENDING, MATCHED, and APPROVED
  • Persist a single active vendor-level CreditAlert when the credit limit is exceeded
  • Expose GET /credit-checks/{id} from the invoices routing surface
  • Extend GET /vendors/{id}/exposure to include the active alert when present
  • Preserve idempotent replay so the same logical request returns the same credit_check_id without duplicate background work

Constraints

  • The triggering create and approve responses remain otherwise unchanged except for top-level credit_check_id
  • Credit-risk signaling is advisory only and must never block the triggering action
  • Background task exceptions are caught and logged silently

References

  • specs/018-vendor-credit-alert/spec.md
  • specs/018-vendor-credit-alert/plan.md
  • specs/018-vendor-credit-alert/tasks.md

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

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions