mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Send invoice to Registrar's billing email after topup
This commit is contained in:
parent
33c14fb957
commit
b3fd31f679
2 changed files with 7 additions and 4 deletions
|
@ -82,7 +82,7 @@ class Invoice < ApplicationRecord
|
|||
end
|
||||
|
||||
def vat_amount
|
||||
(subtotal * vat_rate / 100)
|
||||
subtotal * vat_rate / 100
|
||||
end
|
||||
|
||||
def total
|
||||
|
@ -117,9 +117,8 @@ class Invoice < ApplicationRecord
|
|||
return unless registrar_user
|
||||
|
||||
vat = VatRateCalculator.new(registrar: registrar_user).calculate
|
||||
wo_vat = (transaction.sum / (1 + (vat / 100)))
|
||||
registrar_user.issue_prepayment_invoice(wo_vat, 'Direct top-up via bank transfer',
|
||||
payable: false)
|
||||
net = (transaction.sum / (1 + (vat / 100)))
|
||||
registrar_user.issue_prepayment_invoice(net, 'Direct top-up via bank transfer', payable: false)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -101,6 +101,10 @@ class Registrar < ApplicationRecord
|
|||
)
|
||||
SendEInvoiceJob.enqueue(invoice.id, payable: payable)
|
||||
|
||||
unless payable
|
||||
InvoiceMailer.invoice_email(invoice: invoice, recipient: billing_email).deliver_now
|
||||
end
|
||||
|
||||
invoice
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue