Class: BankAccount

Inherits:
ApplicationRecord show all
Defined in:
app/models/bank_account.rb

Instance Method Summary collapse

Instance Method Details

#assign_unlinked_transactionsObject



19
20
21
22
23
24
25
# File 'app/models/bank_account.rb', line 19

def assign_unlinked_transactions
  count = 0
  bank_transactions.without_financial_link.includes(:supplier, :user).find_each do |t|
    count += 1 if t.assign_to_ordergroup || t.assign_to_invoice
  end
  count
end

#find_connectorFunction

Returns Method wich can be called to import transaction from a bank or nil if unsupported.

Returns:

  • (Function)

    Method wich can be called to import transaction from a bank or nil if unsupported



14
15
16
17
# File 'app/models/bank_account.rb', line 14

def find_connector
  klass = BankAccountConnector.find iban
  klass.new self if klass
end

#last_transaction_dateObject



27
28
29
# File 'app/models/bank_account.rb', line 27

def last_transaction_date
  bank_transactions.order(date: :desc).first&.date
end