Class: OrdersMailer
- Inherits:
-
InternalNotificationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- InternalNotificationMailer
- OrdersMailer
- Defined in:
- app/mailers/orders_mailer.rb
Overview
Order lifecycle: online/Amazon orders, profit review, payment auth.
Extracted from the former InternalMailer god object.
Instance Method Summary collapse
- #amazon_seller_central_fba_ci_invoices_notification(invoices) ⇒ Object
- #back_order_notification(order) ⇒ Object
- #online_order_notification(order) ⇒ Object
- #order_profit_review_notification(order) ⇒ Object
- #order_with_insuficient_payment(order) ⇒ Object
- #payment_automatically_authorized(order) ⇒ Object
- #quote_profit_review_notification(quote) ⇒ Object
- #release_authorization_required(order) ⇒ Object
Methods inherited from InternalNotificationMailer
Methods included from SendgridSmtpApi::InternalMailerHeaders
Methods inherited from ApplicationMailer
Instance Method Details
#amazon_seller_central_fba_ci_invoices_notification(invoices) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/mailers/orders_mailer.rb', line 55 def amazon_seller_central_fba_ci_invoices_notification(invoices) return null_mail if invoices.blank? @invoices = invoices subject = "Amazon FBA Draft Invoices Created: #{@invoices.map(&:reference_number).join(', ')}" mail(from: 'Accounts Payable <ap@warmlyyours.com>', to: 'orders@warmlyyours.com, ap@warmlyyours.com', cc: 'ediadmin@warmlyyours.com', subject: subject) end |
#back_order_notification(order) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/mailers/orders_mailer.rb', line 9 def back_order_notification(order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: "#{ACCOUNTS_RECEIVABLE_EMAIL}, backorders@warmlyyours.com, ordernotifications@warmlyyours.com", cc: @rep&.email_with_name, subject: "Order #{@order.reference_number} went to back order state") end |
#online_order_notification(order) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/mailers/orders_mailer.rb', line 38 def online_order_notification(order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep subject = if @order.in_cr_hold? || @order. || @order.in_management_hold? "Online Order On Hold #{@order.reference_number}" else "Online Order Confirmation #{@order.reference_number}" end mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: 'ordernotifications@warmlyyours.com', cc: @rep&.email_with_name, subject: subject) end |
#order_profit_review_notification(order) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/mailers/orders_mailer.rb', line 20 def order_profit_review_notification(order) @order = order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave <salesmanagers@warmlyyours.com>', to: 'Sales Managers <salesmanagers@warmlyyours.com>, AR <ar@warmlyyours.com>', subject: "Order #{@order.reference_number} requires profit margin review") end |
#order_with_insuficient_payment(order) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'app/mailers/orders_mailer.rb', line 89 def order_with_insuficient_payment(order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep subject = "Order with pending balance #{@order.reference_number}" email_cc = 'orders@warmlyyours.com' email = @rep&.email_with_name email ||= @customer.customer_service_manager&.email_with_name if email.nil? email = 'orders@warmlyyours.com' email_cc = nil end mail(from: 'Orders <orders@warmlyyours.com>', to: email, cc: email_cc, subject: subject) end |
#payment_automatically_authorized(order) ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'app/mailers/orders_mailer.rb', line 79 def (order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep mail(from: 'Orders <orders@warmlyyours.com>', to: 'orders@warmlyyours.com', subject: "Payment automatically authorized for #{@order.reference_number}") end |
#quote_profit_review_notification(quote) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/mailers/orders_mailer.rb', line 29 def quote_profit_review_notification(quote) @quote = quote @customer = @quote.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave <salesmanagers@warmlyyours.com>', to: 'Sales Managers <salesmanagers@warmlyyours.com>, AR <ar@warmlyyours.com>', subject: "Quote #{@quote.reference_number} requires profit margin review") end |
#release_authorization_required(order) ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'app/mailers/orders_mailer.rb', line 68 def (order) @order = order @customer = @order.customer @rep = @order.customer.primary_sales_rep mail(from: 'Order Notifications <ordernotifications@warmlyyours.com>', to: 'ordernotifications@warmlyyours.com', cc: @rep&.email_with_name, subject: "Order #{@order.reference_number} needs release authorization") end |