whisper-money/tests/Feature/OpenBanking
Víctor Falcón c3ff4c684a
feat: store invested_amount in user currency instead of account currency (#262)
## Summary

- **Store `invested_amount` in user's currency** (e.g. EUR) instead of
the account's currency (e.g. BTC), since it represents "how much of my
money did I put in" — a concept tied to the user's home currency.
- **Flip `display_invested_amount`** in API responses: now converts from
user currency → account currency (previously account → user), for the
chart's account-currency toggle mode.
- **Remove redundant conversions** in `AccountMetricsService` since
invested amounts are already in user currency after sync.

## Changes

### Backend (5 files)
- **BinanceBalanceSyncService** — convert to
`$account->user->currency_code` instead of `$account->currency_code`
- **BitpandaBalanceSyncService** — same currency target change
- **IndexaCapitalBalanceSyncService** — inject
`CurrencyConversionService`, convert invested amount float to user
currency before storing as cents
- **DashboardAnalyticsController** — flip `display_invested_amount`
conversion direction (user→account) in both monthly and daily endpoints
- **AccountMetricsService** — remove 4 now-redundant invested_amount
conversion spots (values already in user currency)

### Frontend (6 files)
- **update-balance-dialog.tsx** — invested amount input uses user
currency
- **balances-modal.tsx** — invested amount display and edit uses user
currency
- **account-balance-chart.tsx** — currency toggle: user-currency mode
keeps invested_amount as-is; account-currency mode swaps to
`display_invested_amount`
- **import-balances-drawer.tsx** — passes `investedAmountCurrencyCode`
(user currency) to sub-components
- **import-balance-step-mapping.tsx** /
**import-balance-step-preview.tsx** — format invested amounts in user
currency

### Tests (2 files)
- **IndexaCapitalBalanceSyncTest** — use `app()` instead of `new`
(constructor now has DI), pin account currency to USD for deterministic
assertions
- **DashboardAnalyticsTest** — add EUR-based exchange rate, flip
assertion from `/ 0.90` to `* 0.90`
2026-04-06 12:48:13 +02:00
..
AccountMappingTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
AuthorizationControllerTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
BalanceSyncServiceTest.php feat: Integrate EnableBanking as open banking provider (#106) 2026-02-12 09:09:28 +01:00
BinanceBalanceSyncTest.php feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
BinanceControllerTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
BitpandaBalanceSyncTest.php feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
BitpandaControllerTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
ConnectionControllerTest.php feat(connections): filter already-connected institutions from connect bank dialog (#217) 2026-03-11 12:06:49 +00:00
IndexaCapitalBalanceSyncTest.php feat: store invested_amount in user currency instead of account currency (#262) 2026-04-06 12:48:13 +02:00
IndexaCapitalControllerTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
InstitutionControllerTest.php feat: Integrate EnableBanking as open banking provider (#106) 2026-02-12 09:09:28 +01:00
OpenBankingFeatureFlagTest.php fix(onboarding): gate connect bank option behind open-banking feature flag (#197) 2026-03-03 20:49:27 +00:00
SyncBankingConnectionJobTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
SyncBinanceHistoricalBalancesJobTest.php chore: upgrade Laravel 12 to 13 (#242) 2026-03-25 12:56:33 +00:00
SyncRetryAndLoggingTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
TransactionSyncServiceTest.php feat: Add per-bank description formatter for bank-synced transactions (#120) 2026-02-13 09:54:58 +01:00