mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
fix: Properly compute credit card balance for Enable Banking accounts (#663)
* fix: Properly compute credit card balance for Enable Banking accounts * fix: Use right balance type codes * fix: Update comment
This commit is contained in:
@@ -134,9 +134,11 @@ class EnableBankingItem::Importer
|
||||
balances = balance_data[:balances] || []
|
||||
return if balances.empty?
|
||||
|
||||
# Find the most relevant balance (prefer "closingBooked" or "expected")
|
||||
balance = balances.find { |b| b[:balance_type] == "closingBooked" } ||
|
||||
balances.find { |b| b[:balance_type] == "expected" } ||
|
||||
# Find the most relevant balance (prefer "ITAV" or "CLAV" types)
|
||||
balance = balances.find { |b| b[:balance_type] == "ITAV" } ||
|
||||
balances.find { |b| b[:balance_type] == "CLAV" } ||
|
||||
balances.find { |b| b[:balance_type] == "ITBD" } ||
|
||||
balances.find { |b| b[:balance_type] == "CLBD" } ||
|
||||
balances.first
|
||||
|
||||
if balance.present?
|
||||
|
||||
Reference in New Issue
Block a user