Class: Transactionable::BankAccount
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Transactionable::BankAccount
- Defined in:
- app/models/transactionable/bank_account.rb
Instance Method Summary collapse
Instance Method Details
#amount_in_cents(amount) ⇒ Object
31 32 33 |
# File 'app/models/transactionable/bank_account.rb', line 31 def amount_in_cents(amount) (amount * 100).to_i end |
#credit!(amount) ⇒ Object
25 26 27 28 29 |
# File 'app/models/transactionable/bank_account.rb', line 25 def credit!(amount) remote_credit = remote.credit(amount: amount_in_cents(amount)) transaction = Credit.create_from_remote(remote_credit) credits << transaction end |
#remote ⇒ Object
9 10 11 12 13 |
# File 'app/models/transactionable/bank_account.rb', line 9 def remote if remote_bank_account && remote_bank_account.synced? remote_bank_account.fetch end end |
#sync ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/models/transactionable/bank_account.rb', line 15 def sync balanced_bank_account = remote self.bank_name = balanced_bank_account.bank_name self.description = balanced_bank_account.account_number self.name = balanced_bank_account.name self.can_debit = balanced_bank_account.can_debit self.account_type = balanced_bank_account.type save end |