mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
added non canceled method for check paid invoices
This commit is contained in:
parent
8f3f5f7302
commit
40368aaa62
3 changed files with 23 additions and 5 deletions
|
@ -27,6 +27,16 @@ class BankTransaction < ApplicationRecord
|
|||
.find_by(total: sum)
|
||||
end
|
||||
|
||||
def non_canceled?
|
||||
paid_invoices = registrar.invoices
|
||||
.order(created_at: :asc)
|
||||
.non_cancelled
|
||||
.where(total: sum)
|
||||
return true if paid_invoices.any?(&:paid?)
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def registrar
|
||||
@registrar ||= Invoice.find_by(reference_no: parsed_ref_number)&.buyer
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue