mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Refactor email sending, tests
This commit is contained in:
parent
d3c17ce4e3
commit
12e32af524
3 changed files with 24 additions and 7 deletions
|
@ -20,9 +20,7 @@ class Registrar::InvoicesController < RegistrarController
|
|||
|
||||
@invoice.billing_email = params[:invoice][:billing_email]
|
||||
|
||||
if @invoice.forward
|
||||
pdf = @invoice.pdf(render_to_string('pdf', layout: false))
|
||||
InvoiceMailer.invoice_email(@invoice, pdf).deliver_now
|
||||
if @invoice.forward(render_to_string('pdf', layout: false))
|
||||
flash[:notice] = t('invoice_forwared')
|
||||
redirect_to([:registrar, @invoice])
|
||||
else
|
||||
|
|
|
@ -55,11 +55,11 @@ class Invoice < ActiveRecord::Base
|
|||
"invoice-#{number}.pdf"
|
||||
end
|
||||
|
||||
def forward
|
||||
def forward(html)
|
||||
return false unless valid?
|
||||
return false unless billing_email
|
||||
return false unless billing_email.present?
|
||||
|
||||
# TODO: forward invoice
|
||||
InvoiceMailer.invoice_email(self, pdf(html)).deliver_now
|
||||
true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue