diff --git a/broker_sync/sinks/wealthfolio.py b/broker_sync/sinks/wealthfolio.py index 426ec52..a7c2654 100644 --- a/broker_sync/sinks/wealthfolio.py +++ b/broker_sync/sinks/wealthfolio.py @@ -126,15 +126,22 @@ class WealthfolioSink: existing = await self.list_accounts() if any(a.get("id") == account.id for a in existing): return + # Wealthfolio 3.2's NewAccount is camelCase with required booleans. + # See apps/server/src/models.rs#NewAccount. resp = await self._request( "POST", _ACCOUNTS_PATH, json={ "id": account.id, "name": account.name, - "account_type": str(account.account_type), + "accountType": str(account.account_type), "currency": account.currency, + "isDefault": False, + "isActive": True, + "isArchived": False, + "trackingMode": "TRANSACTIONS", "provider": account.provider, + "providerAccountId": account.id, }, ) resp.raise_for_status() diff --git a/tests/sinks/test_wealthfolio.py b/tests/sinks/test_wealthfolio.py index d8969f8..049f6aa 100644 --- a/tests/sinks/test_wealthfolio.py +++ b/tests/sinks/test_wealthfolio.py @@ -183,8 +183,10 @@ async def test_ensure_account_creates_if_missing(tmp_path: Path) -> None: await sink.ensure_account(acc) assert len(posted) == 1 assert posted[0]["id"] == "t212-isa" - assert posted[0]["account_type"] == "ISA" + assert posted[0]["accountType"] == "ISA" assert posted[0]["currency"] == "GBP" + assert posted[0]["isActive"] is True + assert posted[0]["isDefault"] is False # -- Activity import --