#843 — Track Merchant Processing Lifecycle

Repo: Twill-AI/facade State: open | Status: open Assignee: nadddder, Ahmad1809

Created: 2025-12-18 · Updated: 2026-03-20

Description

We need to display a label in the merchant table that reflects their current processing health, by adding a new field processing_status to the DbMerchantKPI table. This field should be refreshed automatically in the nightly job and exposed to the frontend. Assign the status based on the following priority:

  • activation_overdue:
    • Merchant approved > 14 days ago.
    • Has never processed a transaction (lifetime volume = 0).
  • dormant:
    • Merchant has processed in the past (lifetime volume > 0).
    • Has had zero transactions in the last 14 days.
  • churned:
    • Prerequisite: Merchant has > 6 weeks of transaction history.
    • Logic: Compare the Recent Average (last 2 weeks) vs. Baseline Average (all time, excluding last 2 weeks).
    • Trigger: If BOTH transaction count AND volume have dropped by >90% in the recent period compared to baseline.
  • null: Healthy (does not fit the above criteria)

AC:

  • processing_status field is added to DbMerchantKPI.
  • The field is refreshed automatically in the nightly job.
  • The field is included in List merchant endpoints.
  • Merchant with non-null processing_status are included in Action required filter and count.
  • Share this value for all approved/active merchants in staging below.

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets