Binding interface for bank statements

This commit is contained in:
Martin Lensment 2015-04-15 11:32:51 +03:00
parent 2dfa65645b
commit 851e5368eb
15 changed files with 113 additions and 26 deletions

View file

@ -8,10 +8,15 @@ class BankTransaction < ActiveRecord::Base
account_activity.present?
end
def binded_invoice
return unless binded?
account_activity.invoice
end
# For successful binding, reference number, invoice id and sum must match with the invoice
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def bind_with_invoice
def bind_invoice
return if binded?
registrar = Registrar.find_by(reference_no: reference_no)
return unless registrar