mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 12:32:18 +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
|
# Get and save balances
|
||||||
balances = await self.gocardless.get_account_balances(account_id)
|
balances = await self.gocardless.get_account_balances(account_id)
|
||||||
if balances:
|
if balances and account_details:
|
||||||
await self.database.persist_balance(account_id, balances)
|
# 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", []))
|
balances_updated += len(balances.get("balances", []))
|
||||||
|
|
||||||
# Get and save transactions
|
# Get and save transactions
|
||||||
|
|||||||
Reference in New Issue
Block a user