Class: StripeInvoice::InvoiceMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/stripe_invoice/invoice_mailer.rb

Instance Method Summary collapse

Instance Method Details

#new_invoice(charge) ⇒ Object

Subject can be set in your I18n file at config/locales/en.yml with the following lookup:

en.invoice_mailer.new_invoice.subject


9
10
11
12
13
14
# File 'app/mailers/stripe_invoice/invoice_mailer.rb', line 9

def new_invoice(charge)
  @charge = charge
  
  
  mail subject: "new #{I18n.t("config.stripe_invoice.app_name")} invoice available", to: @charge.owner.email
end

#refund_invoice(charge) ⇒ Object



16
17
18
19
20
# File 'app/mailers/stripe_invoice/invoice_mailer.rb', line 16

def refund_invoice(charge)
  @charge = charge
  
  mail subject: "We refunded your #{I18n.t("config.stripe_invoice.app_name")} charge", to: @charge.owner.email
end

#tax_report(rendered_pdf) ⇒ Object



23
24
25
26
27
28
29
30
# File 'app/mailers/stripe_invoice/invoice_mailer.rb', line 23

def tax_report(rendered_pdf)
  attachments['income-report.pdf'] = rendered_pdf
  
  # sends the email to the default from address
  addr_to = ActionMailer::Base.default[:from]
  mail subject: "Income report", to: addr_to 
  puts "[InvoiceMailer] income report sent to #{addr_to}"
end