internetee-registry/app/mailers/invoice_mailer.rb
Stas 2dddace1b8 Merge branch 'staging' of github.com:internetee/registry into staging
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2015-11-17 16:51:46 +02:00

16 lines
417 B
Ruby

class InvoiceMailer < ApplicationMailer
include Que::Mailer
def invoice_email(invoice_id, html)
@invoice = Invoice.find_by(id: invoice_id)
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(invoice.billing_email), subject: invoice)
end
end