internetee-registry/app/mailers/invoice_mailer.rb
2018-09-20 13:47:19 +03:00

17 lines
460 B
Ruby

class InvoiceMailer < ApplicationMailer
include Que::Mailer
def invoice_email(invoice_id, html, billing_email)
@invoice = Invoice.find_by(id: invoice_id)
billing_email ||= @invoice.billing_email
return unless @invoice
return if whitelist_blocked?(billing_email)
kit = PDFKit.new(html)
pdf = kit.to_pdf
invoice = @invoice
attachments[invoice.pdf_name] = pdf
mail(to: format(billing_email), subject: invoice)
end
end