mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
This includes the following emails: Manager invitation email: reply to inviting enterprise Authorize payment email: reply to distributor Order cancellation email: reply to distributor Shipment notification email: reply to distributor
23 lines
644 B
Ruby
23 lines
644 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Spree
|
|
class ShipmentMailer < ApplicationMailer
|
|
def shipped_email(shipment, delivery:)
|
|
@shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment)
|
|
@delivery = delivery
|
|
@order = @shipment.order
|
|
subject = base_subject
|
|
mail(to: @order.email,
|
|
subject:,
|
|
reply_to: @order.distributor.contact.email)
|
|
end
|
|
|
|
private
|
|
|
|
def base_subject
|
|
default_subject = @delivery ? default_i18n_subject : t('.picked_up_subject')
|
|
"#{@shipment.order.distributor.name} #{default_subject} ##{@shipment.order.number}"
|
|
end
|
|
end
|
|
end
|