Class: DeliveryMailer
- Inherits:
-
InternalNotificationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- InternalNotificationMailer
- DeliveryMailer
- Defined in:
- app/mailers/delivery_mailer.rb
Overview
Delivery / shipping ops: dropship, pre-pack, release, carrier, CI.
Extracted from the former InternalMailer god object.
Instance Method Summary collapse
- #address_type_issue_notification(delivery) ⇒ Object
- #commercial_invoice_to_carrier(delivery) ⇒ Object
- #delivery_automatic_release_failed_notification(delivery) ⇒ Object
- #delivery_automatically_released_notification(delivery) ⇒ Object
- #delivery_pre_pack_cancelled_notification(delivery, cancelled_by: nil) ⇒ Object
- #delivery_pre_packed_notification(delivery) ⇒ Object
- #dropship_delivery_notification(delivery) ⇒ Object
- #manual_release_delivery_due_notification(delivery) ⇒ Object
- #new_delivery_notification(delivery) ⇒ Object
- #request_carrier_assignment_notification(order) ⇒ Object
Methods inherited from InternalNotificationMailer
Methods included from SendgridSmtpApi::InternalMailerHeaders
Methods inherited from ApplicationMailer
Instance Method Details
#address_type_issue_notification(delivery) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/mailers/delivery_mailer.rb', line 31 def address_type_issue_notification(delivery) @delivery = delivery @order = @delivery.order @address = @delivery.destination_address @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: ADMINISTRATOR_EMAIL, to: @rep.present? ? @rep.email_with_name : @customer.customer_service_manager.email_with_name, cc: delivery.customer.primary_sales_rep.try(:email), subject: "Order with a drop ship delivery awaiting PO transmission #{delivery.name}") end |
#commercial_invoice_to_carrier(delivery) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'app/mailers/delivery_mailer.rb', line 134 def commercial_invoice_to_carrier(delivery) # RlCarriers # On Tue, Dec 5, 2023 at 10:29 AM Dejanah Cassell <dejanah.cassell@rlcarriers.com> wrote: # I would say email them to transbordersolutiongroup@rlcarriers.com Thank you,Dejanah CassellTransborder/Partner RelationsR&L Carriers, Inc600 Gillam RdWilmington OH 45177888-575-2632 3290Fax : 937-655-3178 # Polaris Transport # On Sat, May 24, 2025 at 5:36AM Dennis Dmitrovic <DDmitrovic@polaristransport.com> wrote: # Hello, # Yes, send docs, in .PDF, under 5mb, with the P# in the subject line to # "Customs" <customs@polaristransport.com>. Ensure the broker is listed on the # docs and our OCR will read the docs and send the PARS package to the broker. # I will only contact if an issue. # Dennis Dmitrovic Customs Clerk # TF: 1‑800‑409‑2269 # 7099 Torbram Road, Mississauga, Ontario, Canada L4T 1G7 # polaristransport.com @delivery = delivery @primary_rep = @delivery.order&.primary_sales_rep to = delivery.carrier_customs_email return if to.blank? identifiers = [] identifiers << "Pro Number: #{delivery.ltl_pro_number}" if delivery.ltl_pro_number.present? if delivery.freight_load_number.present? identifiers << "Load Number: #{delivery.freight_load_number}" elsif delivery.carrier_bol.present? identifiers << "BOL ID: #{delivery.carrier_bol}" end @identifier_string = identifiers.join(', ') ship_ci_pdf = delivery.ship_ci_pdf return if ship_ci_pdf.blank? || ship_ci_pdf..blank? [ship_ci_pdf..to_s] = ship_ci_pdf..data mail(from: 'WarmlyYours Shipping <api.shipping@warmlyyours.com>', to: to, cc: [delivery.customer.primary_sales_rep.try(:email), 'hwinings@warmlyyours.com ', 'vadepu@warmlyyours.com', 'api.shipping@warmlyyours.com'].compact.join(';'), subject: "Customs documents for #{@identifier_string}") end |
#delivery_automatic_release_failed_notification(delivery) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 |
# File 'app/mailers/delivery_mailer.rb', line 122 def delivery_automatic_release_failed_notification(delivery) @delivery = delivery @order = delivery.order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : 'orders@warmlyyours.com', cc: 'orders@warmlyyours.com, heatwaveteam@warmlyyours.com', subject: "Order #{@order.reference_number} Delivery #{@delivery.id} automatic release FAILED") end |
#delivery_automatically_released_notification(delivery) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 |
# File 'app/mailers/delivery_mailer.rb', line 110 def delivery_automatically_released_notification(delivery) @delivery = delivery @order = delivery.order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : 'orders@warmlyyours.com', cc: 'orders@warmlyyours.com', subject: "Future Ship RELEASED #{@order.reference_number} - #{@customer}") end |
#delivery_pre_pack_cancelled_notification(delivery, cancelled_by: nil) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'app/mailers/delivery_mailer.rb', line 73 def delivery_pre_pack_cancelled_notification(delivery, cancelled_by: nil) @delivery = delivery @quote_or_order = @delivery.order || @delivery.quote @customer = @quote_or_order.customer @cancelled_by = cancelled_by @primary_rep = @quote_or_order.primary_sales_rep warehouse_email = case @delivery.store&.id when 1 then 'warehouseusa@warmlyyours.com' when 2 then 'warehousecanada@warmlyyours.com' end recipients = [warehouse_email] if @primary_rep recipients << "#{@primary_rep.full_name} <#{@primary_rep.email}>" elsif @delivery.prepack_requester recipients << "#{@delivery.prepack_requester.try(:name)} <#{@delivery.prepack_requester.try(:email)}>" end recipients << 'Orders <orders@warmlyyours.com>' if recipients.compact_blank.empty? mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: recipients.compact_blank.join(', '), subject: "CANCELLED: Pre-pack for Delivery #{@delivery.name}") end |
#delivery_pre_packed_notification(delivery) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/mailers/delivery_mailer.rb', line 54 def delivery_pre_packed_notification(delivery) @delivery = delivery @quote_or_order = @delivery.order || @delivery.quote @customer = @quote_or_order.customer @rma = @delivery.order&.rma @primary_rep = @quote_or_order.primary_sales_rep to = if @primary_rep "#{@primary_rep.full_name} <#{@primary_rep.email}>" elsif @delivery.prepack_requester "#{@delivery.prepack_requester.try(:name)} <#{@delivery.prepack_requester.try(:email)}>" else 'Orders <orders@warmlyyours.com>' end mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: to, subject: "Delivery #{@delivery.name} packaging has been estimated by warehouse") end |
#dropship_delivery_notification(delivery) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/mailers/delivery_mailer.rb', line 11 def dropship_delivery_notification(delivery) @order = delivery.order @delivery = delivery mail(from: ADMINISTRATOR_EMAIL, to: ORDERS_EMAIL, cc: delivery.customer.primary_sales_rep.try(:email), subject: "Order with a drop ship delivery awaiting PO transmission #{delivery.name}") end |
#manual_release_delivery_due_notification(delivery) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 |
# File 'app/mailers/delivery_mailer.rb', line 98 def manual_release_delivery_due_notification(delivery) @delivery = delivery @order = delivery.order @customer = @order.customer @rep = @customer.primary_sales_rep mail(from: 'Heatwave Team <heatwaveteam@warmlyyours.com>', to: @rep.present? ? @rep.email_with_name : 'orders@warmlyyours.com', cc: 'orders@warmlyyours.com', subject: "Future Ship PAST DUE #{@order.reference_number} - #{@customer}") end |
#new_delivery_notification(delivery) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/mailers/delivery_mailer.rb', line 20 def new_delivery_notification(delivery) @store = delivery.store @delivery = delivery emails = @store.order_notification_emails.map(&:presence).uniq.compact return if emails.blank? mail(from: ORDERS_EMAIL, to: emails, subject: "Order with a drop ship delivery awaiting PO transmission #{delivery.name}") end |
#request_carrier_assignment_notification(order) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'app/mailers/delivery_mailer.rb', line 44 def request_carrier_assignment_notification(order) @order = order @customer = @order.customer mail(from: 'Orders <orders@warmlyyours.com>', to: 'Orders <orders@warmlyyours.com>', bcc: 'cbillen@warmlyyours.com', subject: "Order #{@order.reference_number} requires carrier assignment") end |