Files
openfoodnetwork/app/mailers/subscription_mailer.rb
Maikel Linke a971b62068 Emphasise ways to get help in user emails
We had a very prominent footer showing how to get in contact with the
local instance people but most users need to get in contact with the
enterprise they are buying from. So removing all those details and
replacing them by a simple "powered by" line will hopefully direct
attention to the shop's contact details.
2021-02-23 11:24:55 +11:00

63 lines
1.6 KiB
Ruby

class SubscriptionMailer < Spree::BaseMailer
helper CheckoutHelper
helper MailerHelper
helper ShopMailHelper
helper OrderHelper
helper Spree::Admin::PaymentsHelper
include I18nHelper
def confirmation_email(order)
@type = 'confirmation'
@order = order
send_mail(order)
end
def empty_email(order, changes)
@type = 'empty'
@changes = changes
@order = order
send_mail(order)
end
def placement_email(order, changes)
@type = 'placement'
@changes = changes
@order = order
send_mail(order)
end
def failed_payment_email(order)
@order = order
send_mail(order)
end
def placement_summary_email(summary)
@shop = Enterprise.find(summary.shop_id)
@summary = summary
mail(to: @shop.contact.email,
from: from_address,
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.placement_summary_email.subject')}")
end
def confirmation_summary_email(summary)
@shop = Enterprise.find(summary.shop_id)
@summary = summary
mail(to: @shop.contact.email,
from: from_address,
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.confirmation_summary_email.subject')}")
end
private
def send_mail(order)
I18n.with_locale valid_locale(order.user) do
confirm_email_subject = t('spree.order_mailer.confirm_email.subject')
subject = "#{Spree::Config[:site_name]} #{confirm_email_subject} ##{order.number}"
mail(to: order.email,
from: from_address,
subject: subject,
reply_to: order.distributor.contact.email)
end
end
end