Add invoice mailer

This commit is contained in:
Martin Lensment 2015-04-22 12:56:14 +03:00
parent 2bc55e423c
commit 49be49ea63
13 changed files with 60 additions and 12 deletions

View file

@ -22,7 +22,7 @@ class Invoice < ActiveRecord::Base
end
def to_s
I18n.t('invoice_no', no: id)
I18n.t('invoice_no', no: number)
end
def number
@ -46,6 +46,15 @@ class Invoice < ActiveRecord::Base
Country.new(buyer_country_code)
end
def pdf(html)
kit = PDFKit.new(html)
kit.to_pdf
end
def pdf_name
"invoice-#{number}.pdf"
end
def forward
return false unless valid?
return false unless billing_email