mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
Refactor EveryPay / Banklink processing
This commit is contained in:
parent
cb76a9f962
commit
32d4fc3c83
5 changed files with 55 additions and 28 deletions
|
@ -31,19 +31,13 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
# For successful binding, reference number, invoice id and sum must match with the invoice
|
||||
def autobind_invoice(invoice_no: nil)
|
||||
def autobind_invoice
|
||||
return if binded?
|
||||
return unless registrar
|
||||
return unless invoice
|
||||
return unless invoice.payable?
|
||||
|
||||
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)
|
||||
create_activity(registrar, invoice)
|
||||
end
|
||||
|
||||
def bind_invoice(invoice_no)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue