fix(enable_banking): keep accounts sharing an IBAN distinct

AL
17d ago
+0-0

Enable Banking's primary identification_hash is derived from IBAN + currency, so an ASPSP exposing several products on one IBAN (e.g. a deferred-debit card sharing the current account's IBAN) returns the same hash for each. The accounts were keyed by that hash, so they collapsed into a single account (only the card survived).

Add EnableBankingItem.stable_account_uid: it keeps the primary hash when there is no collision (unchanged for everyone else) and otherwise falls back to a distinguishing identification_hash the sibling does not share (resource_id / card-number based, stable across sessions). Use it at every account create/ lookup site (import_accounts_from_session, importer import_account + session loop + sync_uids), and let upsert_enable_banking_snapshot! accept an explicit uid so it isn't clobbered back to the colliding hash.

Summary by CodeRabbit

  • Bug Fixes
    • Improved account syncing when multiple accounts share the same primary identifier, helping keep their linked records and snapshots distinct.
    • Account matching now uses consistent identifiers across account imports and updates, while continuing to support string-based account IDs.