mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
EveryPay/BankLink: Select specific Invoice to mark as paid
This commit is contained in:
parent
53fbd2f50c
commit
7033d91227
3 changed files with 15 additions and 7 deletions
|
@ -24,15 +24,20 @@ class BankTransaction < ApplicationRecord
|
|||
@registrar ||= Invoice.find_by(reference_no: parsed_ref_number)&.buyer
|
||||
end
|
||||
|
||||
|
||||
# For successful binding, reference number, invoice id and sum must match with the invoice
|
||||
def autobind_invoice
|
||||
def autobind_invoice(invoice_no: nil)
|
||||
return if binded?
|
||||
return unless registrar
|
||||
return unless invoice
|
||||
return unless invoice.payable?
|
||||
|
||||
create_activity(registrar, invoice)
|
||||
inv = if invoice_no.nil?
|
||||
invoice
|
||||
else
|
||||
Invoice.find_by(number: invoice_no)
|
||||
end
|
||||
return unless inv
|
||||
return unless inv.payable?
|
||||
|
||||
create_activity(registrar, inv)
|
||||
end
|
||||
|
||||
def bind_invoice(invoice_no)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue