#1069 — Track merchant subfields (officers, bank accounts) in activity diffs

Repo: Twill-AI/facade State: open | Status: open Assignee: sparsh-twillpayments

Created: 2026-02-26 · Updated: 2026-02-26

Description

Summary

Merchant subfields (officers, bank accounts) are not included in the activity diff when a merchant is updated. Only top-level merchant columns are compared and stored in activity.meta_data["changes"]. As a result:

  • Officers: Adding, removing, or editing officers does not appear in the activity feed (no diff entries, and if no other merchant fields change, no activity is created at all).
  • Bank accounts: Same for mutable bank accounts (add/update/remove).
  • MCA: Updates to MCA data in the same update_merchant flow are also not reflected in the diff (only merchant table columns are considered).

Current behavior

In app/api/merchants_helpers.py, update_merchant():

  1. Splits the payload via MerchantUpdate.to_update_dicts() into:
    • merchant_updates (flat dict of merchant columns)
    • officers_dicts, bas_dicts (lists of officer / bank account dicts)
    • mca_data
  2. Updates the DB for merchant (1), then officers (2), then bank accounts (3), then MCA (4).
  3. Activity diff is computed only from merchant_updates (lines 817–838):
if existing_merchant and merchant_updates:
    changes = []
    for key, new_value in merchant_updates.items():
        if not hasattr(existing_merchant, key):
            continue
        old_value = getattr(existing_merchant, key)
        if old_value != new_value:
            changes.append({"field": key, "from": ..., "to": ...})

So:

  • Only keys in merchant_updates (i.e. `

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets