class InvoiceMailer

Public Instance Methods

billing_reminder(tutoring_session_id) click to toggle source

Reminder email for invoice payment.

# File app/mailers/invoice_mailer.rb, line 67
def billing_reminder(tutoring_session_id)
  tutoring_session = TutoringSession.find(tutoring_session_id)
  @tutoring_session = tutoring_session
  @student = tutoring_session.student
  @tutor = tutoring_session.tutor
  mail(to: @student.email, bcc: Configurations::General.bcc_list, subject: "Billing reminder.") do |format|
    format.html { render :layout => 'mailer' }
  end
end
create_email(invoice) click to toggle source

Send email when invoice is generated.

# File app/mailers/invoice_mailer.rb, line 10
def create_email(invoice)
  @invoice = invoice
  @tutor = invoice.tutor
  @student = invoice.student
  @invoiceable = invoice.invoiceable
  @invoiceable_url = invoices_url @invoiceable
  mail(to: @student.email, bcc: Configurations::General.bcc_list, subject: "New invoice request") do |format|
    format.html { render :layout => 'mailer' }
  end
end
paid_email(invoice) click to toggle source

Send email when invoice paid.

paid_email_tutor(invoice) click to toggle source

Send email to tutor when invoice paid.

past_due_email(invoice_id) click to toggle source

Send mail to initimate user the due invoice.

# File app/mailers/invoice_mailer.rb, line 54
def past_due_email(invoice_id)
  invoice = Invoice.find(invoice_id)
  @invoice = invoice
  @tutor = invoice.tutor
  @student = invoice.student
  @tutoring_session = invoice.invoiceable
  @tutoring_session_url = invoices_url @tutoring_session
  mail(to: @student.email, bcc: Configurations::General.bcc_list, subject: "Past due invoice.") do |format|
    format.html { render :layout => 'mailer' }
  end
end
setup_invoices_attachments() click to toggle source

Sets the invoice confirmed and cancel images in attachment.

# File app/mailers/invoice_mailer.rb, line 4
def setup_invoices_attachments
  attachments.inline['confirm.png'] = File.read(File.join(Rails.root, 'app/assets/images/confirm.png'))
  attachments.inline['cancel.png'] = File.read(File.join(Rails.root, 'app/assets/images/cancel.png'))
end
update_email(invoice) click to toggle source

Sends update email invoice to student when invoice is updated.

# File app/mailers/invoice_mailer.rb, line 42
def update_email(invoice)
  @invoice = invoice
  @tutor = invoice.tutor
  @student = invoice.student
  @invoiceable = invoice.invoiceable
  @invoiceable_url = invoices_url @invoiceable
  mail(to: @student.email, bcc: Configurations::General.bcc_list, subject: "Updated invoice request")  do |format|
    format.html { render :layout => 'mailer' }
  end
end