mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Invoice forward saves email
This commit is contained in:
parent
5d1f691967
commit
fa7cf13bf4
2 changed files with 4 additions and 3 deletions
|
@ -1,8 +1,9 @@
|
|||
class InvoiceMailer < ApplicationMailer
|
||||
include Que::Mailer
|
||||
|
||||
def invoice_email(invoice_id, html)
|
||||
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)
|
||||
|
||||
|
@ -11,6 +12,6 @@ class InvoiceMailer < ApplicationMailer
|
|||
invoice = @invoice
|
||||
|
||||
attachments[invoice.pdf_name] = pdf
|
||||
mail(to: format(invoice.billing_email), subject: invoice)
|
||||
mail(to: format(billing_email), subject: invoice)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -117,7 +117,7 @@ class Invoice < ActiveRecord::Base
|
|||
return false unless valid?
|
||||
return false unless billing_email.present?
|
||||
|
||||
InvoiceMailer.invoice_email(id, html).deliver
|
||||
InvoiceMailer.invoice_email(id, html, billing_email).deliver
|
||||
true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue