Keep contribution-labelled deposits on bank accounts out of investment contributions
Problem
SnapTrade labels every deposit on a Wealthsimple cash (chequing) account as CONTRIBUTION, and SnaptradeAccount::ActivitiesProcessor maps that to the Contribution activity label. Account::ProviderImportAdapter#import_transaction turns any Contribution label into kind: "investment_contribution" with the Investment Contributions category, regardless of account type.
On a depository account that is a paycheque or another inflow, not money moving into an investment. The result: salary on a linked chequing account is excluded from income, and income reports undercount.
Fix
Only classify a Contribution label as an investment contribution on investment and crypto accounts. On other accounts the label is still stored, but the transaction keeps its own kind (standard, or a kind the provider passed) and gets no automatic category.
This matches what the Trade Republic processor already does for its cash accounts (activity_label_for / reset_legacy_cash_kind!), but in the adapter, so every provider gets it.
Rows imported before this change keep their stored kind; the adapter only sets a kind when it derives one.
Tests
- New: a
Contribution-labelled deposit on a depository account staysstandardwith no category. - Existing: the investment-account contribution tests are unchanged. The Trade Republic test that seeds a legacy contribution row on a cash (depository) account now sets that kind and category explicitly instead of relying on the adapter.
Related: #5729 (same Wealthsimple feed, card activities; fixed in #5730).
Summary by CodeRabbit
- Bug Fixes
- Deposits labeled as investment contributions on bank accounts retain the standard transaction classification and are not assigned an investment category.
- Investment contribution labels are classified as investment contributions, with the associated category, for investment and crypto accounts.
- For other account types, the label no longer automatically sets a transaction kind or category; the provider-supplied transaction kind is used as the fallback.