mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Process payments: Create new invoice by transaction to allow direct top ups
This commit is contained in:
parent
39a21cb790
commit
be960457e6
4 changed files with 23 additions and 6 deletions
|
@ -31,12 +31,18 @@ class BankTransaction < ApplicationRecord
|
|||
@registrar ||= Invoice.find_by(reference_no: parsed_ref_number)&.buyer
|
||||
end
|
||||
|
||||
def autobindable?
|
||||
return false if binded?
|
||||
return false unless registrar
|
||||
return false unless invoice
|
||||
return false unless invoice.payable?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
# For successful binding, reference number, invoice id and sum must match with the invoice
|
||||
def autobind_invoice(manual: false)
|
||||
return if binded?
|
||||
return unless registrar
|
||||
return unless invoice
|
||||
return unless invoice.payable?
|
||||
return unless autobindable?
|
||||
|
||||
channel = if manual
|
||||
'admin_payment'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue