mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
17 lines
469 B
Ruby
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
|