internetee-registry/app/mailers/invoice_mailer.rb
2015-12-01 01:17:28 +02:00

17 lines
469 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?(@invoice.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