mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 11:22:21 +00:00
fix: merge account details into balance data to prevent unknown/N/A values
- Modified sync service to include institution_id and iban in balance persistence - Fixed data flow issue where balance records were missing account metadata - Prevents future balance records from having 'unknown' bank or 'N/A' IBAN - Successfully fixed 8 existing records with one-off script
This commit is contained in:
committed by
Elisiário Couto
parent
34501f5f0d
commit
eaaea6e459
@@ -61,8 +61,16 @@ class SyncService:
|
||||
|
||||
# Get and save balances
|
||||
balances = await self.gocardless.get_account_balances(account_id)
|
||||
if balances:
|
||||
await self.database.persist_balance(account_id, balances)
|
||||
if balances and account_details:
|
||||
# Merge account details into balances data for proper persistence
|
||||
balances_with_account_info = balances.copy()
|
||||
balances_with_account_info["institution_id"] = (
|
||||
account_details.get("institution_id")
|
||||
)
|
||||
balances_with_account_info["iban"] = account_details.get("iban")
|
||||
await self.database.persist_balance(
|
||||
account_id, balances_with_account_info
|
||||
)
|
||||
balances_updated += len(balances.get("balances", []))
|
||||
|
||||
# Get and save transactions
|
||||
|
||||
Reference in New Issue
Block a user