mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +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
|
@ -112,6 +112,15 @@ class Invoice < ApplicationRecord
|
|||
e_invoice_sent_at.present?
|
||||
end
|
||||
|
||||
def self.create_from_transaction!(transaction)
|
||||
registrar_user = Registrar.find_by(reference_no: transasction.parsed_ref_number)
|
||||
return unless registrar_user
|
||||
|
||||
registrar_user.issue_prepayment_invoice(amount: transaction.sum,
|
||||
description: 'Direct top-up via bank transfer',
|
||||
paid: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def apply_default_buyer_vat_no
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue