Files
sure/app/models
samuelcseto 83ff095edf Fix provider merchant lookup to handle case variations in names
Problem:
Transactions were silently failing to import when the provider (e.g.,
Lunchflow) returned merchant names with inconsistent casing.

Root cause discovered when:
1. User A connected their account, synced transactions with merchant "JOHN DOE"
2. User A disconnected their account (but ProviderMerchant records persist)
3. User B connected their account
4. User B had a transaction to the same person but provider returned it as
   "John Doe" (different casing)
5. Lookup by (source, name) failed to find existing "JOHN DOE" merchant
6. Tried to create new merchant with same provider_merchant_id (derived from
   MD5 of lowercased name) → unique constraint violation
7. Transaction import failed silently

Impact:
- Missing transactions caused incorrect account balances (showing negative
  when they shouldn't)
- Balance chart displayed incorrect historical data
- Users saw fewer transactions than actually existed in their bank

Solution:
Look up merchants by provider_merchant_id first (the stable, case-insensitive
identifier derived from the normalized merchant name), then fall back to exact
name match for backwards compatibility.
2026-01-09 00:21:22 +01:00
..
2025-10-28 19:32:27 +01:00
2025-03-28 13:08:22 -04:00
2025-10-22 19:14:03 +02:00
2025-12-07 18:11:34 +01:00
2025-11-24 17:54:18 +01:00
2025-09-24 00:19:51 +02:00
2025-11-25 20:21:29 +01:00
2025-11-27 15:24:34 +01:00
2025-10-28 19:32:27 +01:00
2026-01-07 16:16:01 +01:00
2024-02-02 09:05:04 -06:00
2024-10-18 11:26:58 -05:00
2025-10-28 19:32:27 +01:00
2025-11-23 20:43:55 +05:30
2024-10-18 11:26:58 -05:00
2024-11-08 09:58:35 -06:00
2024-08-23 10:06:24 -04:00
2025-05-23 18:58:22 -04:00
2025-11-25 20:21:29 +01:00
2024-08-23 09:33:42 -04:00
2025-11-01 09:12:42 +01:00
2025-10-28 19:32:27 +01:00
2025-11-22 02:14:29 +01:00
2026-01-08 15:20:14 +01:00
2025-12-07 18:11:34 +01:00
2025-11-25 20:21:29 +01:00
2024-05-23 08:09:33 -04:00
2025-03-28 13:08:22 -04:00
2025-07-10 18:40:38 -04:00