I'm trying to find failed debits originating from a Bank Account. Like so:
failed_debits = Balanced::Debit.where(status: 'failed')
failed_debits.each do |d|
if d.source._type == 'bank_account'
p "#{d.created_at} #{d.amount} #{d.customer.name} #{d.appears_on_statement_as}"
end
end
The problem here is that the debit source class is sometimes:
Balanced::Card
Balanced::BankAccount
Hash
Why would it return a hash? Shouldn't it always return either a Card or BankAccount object? I'm using 0.7.4 version of the gem.