Class: RmaMailer
- Inherits:
-
InternalNotificationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- InternalNotificationMailer
- RmaMailer
- Defined in:
- app/mailers/rma_mailer.rb
Overview
RMA lifecycle, inspection, credit-memo, and shipping-error notifications.
Extracted from the former InternalMailer god object.
Instance Method Summary collapse
- #email_rmas_report(start_date, end_date) ⇒ Object
- #refurb_item_received(rma, item) ⇒ Object
- #rma_needs_inspection(rma) ⇒ Object
- #rma_needs_review_notification(rma) ⇒ Object
- #rma_with_shipping_error_notification(rma) ⇒ Object
- #rmas_in_auto_return_review ⇒ Object
- #rmas_in_awaiting_inspection ⇒ Object
- #rmas_returned_and_need_attention_immediately ⇒ Object
- #rmas_with_credit_memos_not_transmitted_and_are_not_fullyoffset ⇒ Object
- #rmas_with_credit_memos_transmitted_and_are_not_fullyoffset ⇒ Object
- #unable_to_deliver_rma_reminder(rma, communication) ⇒ Object
Methods inherited from InternalNotificationMailer
Methods included from SendgridSmtpApi::InternalMailerHeaders
Methods inherited from ApplicationMailer
Instance Method Details
#email_rmas_report(start_date, end_date) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/mailers/rma_mailer.rb', line 29 def email_rmas_report(start_date, end_date) = {} [:period1_gteq] = start_date [:period1_lteq] = end_date [:company_id] = [] [:customer_ids] = [] [:product_lines] = [] [:report_groupings] = [] [:is_email] = true @result = Report::RmasReport::RmasReport.result() mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'jbillen@warmlyyours.com', cc: 'srosenbaum@warmlyyours.com;heatwaveteam@warmlyyours.com', subject: 'RMAs monthly report') end |
#refurb_item_received(rma, item) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/mailers/rma_mailer.rb', line 19 def refurb_item_received(rma, item) @rma = rma @item = item mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: 'techteam@warmlyyours.com', cc: 'ar@warmlyyours.com', subject: "Refurb Item #{item.sku} Received on RMA #{@rma.rma_number}") end |
#rma_needs_inspection(rma) ⇒ Object
99 100 101 102 103 104 105 106 |
# File 'app/mailers/rma_mailer.rb', line 99 def rma_needs_inspection(rma) @rma = rma @customer = @rma.customer mail(from: @rma.rma_inspect_email, to: @rma.rma_inspect_email, subject: "#{@rma.rma_number} needs to be inspected and received") end |
#rma_needs_review_notification(rma) ⇒ Object
90 91 92 93 94 95 96 97 |
# File 'app/mailers/rma_mailer.rb', line 90 def rma_needs_review_notification(rma) @rma = rma @customer = @rma.customer mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: ACCOUNTS_PAYABLE_EMAIL.to_s, subject: "#{@rma.rma_number} needs to be reviewed") end |
#rma_with_shipping_error_notification(rma) ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'app/mailers/rma_mailer.rb', line 108 def rma_with_shipping_error_notification(rma) @rma = rma @customer = @rma.customer mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: ACCOUNTS_PAYABLE_EMAIL.to_s, subject: "#{@rma.rma_number} needs to be reviewed") end |
#rmas_in_auto_return_review ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/mailers/rma_mailer.rb', line 47 def rmas_in_auto_return_review @rmas_list = Rma.in_auto_return_review mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, subject: 'RMAs under auto return review state') end |
#rmas_in_awaiting_inspection ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'app/mailers/rma_mailer.rb', line 55 def rmas_in_awaiting_inspection @rmas_list = Rma.in_awaiting_inspection mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.first, cc: 'warehouseusa@warmlyyours.com;heidegw@warmlyyours.com', subject: 'RMAs that are awaiting inspection') end |
#rmas_returned_and_need_attention_immediately ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'app/mailers/rma_mailer.rb', line 64 def rmas_returned_and_need_attention_immediately @rmas_list = Rma.returned_and_need_attention_immediately mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, cc: 'vadepu@warmlyyours.com', subject: 'RMAs under returned state') end |
#rmas_with_credit_memos_not_transmitted_and_are_not_fullyoffset ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'app/mailers/rma_mailer.rb', line 73 def rmas_with_credit_memos_not_transmitted_and_are_not_fullyoffset @rmas_list = Rma.with_credit_memos_not_transmitted_and_are_not_fullyoffset mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, cc: 'vadepu@warmlyyours.com', subject: 'RMAs need to be refunded') end |
#rmas_with_credit_memos_transmitted_and_are_not_fullyoffset ⇒ Object
82 83 84 85 86 87 88 |
# File 'app/mailers/rma_mailer.rb', line 82 def rmas_with_credit_memos_transmitted_and_are_not_fullyoffset @rmas_list = Rma.with_credit_memos_transmitted_and_are_not_fullyoffset mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: Rma::EMAILS_FOR_NOTIFICATIONS.second, subject: 'Check the status of the credit memos') end |
#unable_to_deliver_rma_reminder(rma, communication) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/mailers/rma_mailer.rb', line 9 def unable_to_deliver_rma_reminder(rma, communication) @rma = rma @communication = communication mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: rma.customer.try(:primary_sales_rep).try(:email) || 'ar@warmlyyours.com', cc: 'ar@warmlyyours.com', subject: "Unable to send RMA reminder for #{@rma.rma_number}") end |