diff --git a/app/views/subscription_mailer/_header.html.haml b/app/views/subscription_mailer/_header.html.haml
deleted file mode 100644
index 6f7a593669..0000000000
--- a/app/views/subscription_mailer/_header.html.haml
+++ /dev/null
@@ -1,16 +0,0 @@
-%table.social.white-bg{:width => "100%"}
- %tr
- %td
- %table.column{:align => "left"}
- %tr
- %td
- %h3
- = t :email_confirm_customer_greeting, name: @order.bill_address.firstname
- %h4
- = intro
- %table.column{:align => "left"}
- %tr
- %td{:align => "right"}
- - if @order.distributor.logo.variable?
- = image_tag @order.distributor.logo_url(:medium), class: "float-right"
- %span.clear
diff --git a/app/views/subscription_mailer/confirmation_email.html.haml b/app/views/subscription_mailer/confirmation_email.html.haml
index 5a8d4d4ded..3aa9fdaa06 100644
--- a/app/views/subscription_mailer/confirmation_email.html.haml
+++ b/app/views/subscription_mailer/confirmation_email.html.haml
@@ -1,5 +1,13 @@
-- intro_key = @order.paid? ? "email_so_payment_success_intro_html" : "email_so_confirmation_intro_html"
-= render 'header', intro: t(intro_key, distributor: @order.distributor.name)
+- if @order.distributor.logo.variable?
+ - @enterprise_for_logo = @order.distributor
+
+- greeting_key = "mailers_shared.customer_greeting"
+- intro_key = @order.paid? ? ".payment_success_intro_html" : ".confirmation_intro_html"
+
+= render partial: 'shared/mailers/greeting_and_intro',
+ locals: { greeting: t(greeting_key, name: @order.bill_address.firstname),
+ intro: t(intro_key, distributor: @order.distributor.name),
+ enterprise_for_logo: @enterprise_for_logo }
%p.callout
= t("email_so_confirmation_explainer_html")
diff --git a/app/views/subscription_mailer/confirmation_summary_email.html.haml b/app/views/subscription_mailer/confirmation_summary_email.html.haml
index ed53f341a1..f27ce324af 100644
--- a/app/views/subscription_mailer/confirmation_summary_email.html.haml
+++ b/app/views/subscription_mailer/confirmation_summary_email.html.haml
@@ -1,19 +1,13 @@
-%table.social.white-bg{:width => "100%"}
- %tr
- %td
- %table.column{:align => "left"}
- %tr
- %td
- %h3
- = t(".greeting", name: @shop.contact_name)
- %h4
- = t(".intro", shop: @shop.name)
- %table.column{:align => "left"}
- %tr
- %td{:align => "right"}
- - if @shop.logo.variable?
- = image_tag @shop.logo_url(:medium), class: "float-right"
- %span.clear
+- if @shop.logo.variable?
+ - @enterprise_for_logo = @shop
+
+- greeting_key = "mailers_shared.enterprise_greeting"
+- intro_key = ".intro_html"
+
+= render partial: 'shared/mailers/greeting_and_intro',
+ locals: { greeting: t(greeting_key, name: @shop.contact_name),
+ intro: t(intro_key, shop: @shop.name),
+ enterprise_for_logo: @enterprise_for_logo }
= render 'summary_overview', summary: @summary
= render 'summary_detail', summary: @summary
diff --git a/app/views/subscription_mailer/empty_email.html.haml b/app/views/subscription_mailer/empty_email.html.haml
index f80db3cc04..685978324a 100644
--- a/app/views/subscription_mailer/empty_email.html.haml
+++ b/app/views/subscription_mailer/empty_email.html.haml
@@ -1,5 +1,13 @@
-- intro_key = "email_so_empty_intro_html"
-= render 'header', intro: t(intro_key, distributor: @order.distributor.name)
+- if @order.distributor.logo.variable?
+ - @enterprise_for_logo = @order.distributor
+
+- greeting_key = "mailers_shared.customer_greeting"
+- intro_key = ".intro_html"
+
+= render partial: 'shared/mailers/greeting_and_intro',
+ locals: { greeting: t(greeting_key, name: @order.bill_address.firstname),
+ intro: t(intro_key, distributor: @order.distributor.name),
+ enterprise_for_logo: @enterprise_for_logo }
%p.callout
= t("email_so_empty_explainer_html")
diff --git a/app/views/subscription_mailer/failed_payment_email.html.haml b/app/views/subscription_mailer/failed_payment_email.html.haml
index 275c2dbce5..a0810dd564 100644
--- a/app/views/subscription_mailer/failed_payment_email.html.haml
+++ b/app/views/subscription_mailer/failed_payment_email.html.haml
@@ -1,4 +1,13 @@
-= render 'header', intro: t("email_so_failed_payment_intro_html")
+- if @order.distributor.logo.variable?
+ - @enterprise_for_logo = @order.distributor
+
+- greeting_key = "mailers_shared.customer_greeting"
+- intro_key = ".intro_html"
+
+= render partial: 'shared/mailers/greeting_and_intro',
+ locals: { greeting: t(greeting_key, name: @order.bill_address.firstname),
+ intro: t(intro_key, distributor: @order.distributor.name),
+ enterprise_for_logo: @enterprise_for_logo }
%p.callout
= t("email_so_failed_payment_explainer_html", distributor: @order.distributor.name)
diff --git a/app/views/subscription_mailer/placement_email.html.haml b/app/views/subscription_mailer/placement_email.html.haml
index c146935fc3..96702a10ce 100644
--- a/app/views/subscription_mailer/placement_email.html.haml
+++ b/app/views/subscription_mailer/placement_email.html.haml
@@ -1,5 +1,13 @@
-- intro_key = "email_so_placement_intro_html"
-= render 'header', intro: t(intro_key, distributor: @order.distributor.name)
+- if @order.distributor.logo.variable?
+ - @enterprise_for_logo = @order.distributor
+
+- greeting_key = "mailers_shared.customer_greeting"
+- intro_key = ".intro_html"
+
+= render partial: 'shared/mailers/greeting_and_intro',
+ locals: { greeting: t(greeting_key, name: @order.bill_address.firstname),
+ intro: t(intro_key, distributor: @order.distributor.name),
+ enterprise_for_logo: @enterprise_for_logo }
%p.callout
= t("email_so_placement_explainer_html")
diff --git a/app/views/subscription_mailer/placement_summary_email.html.haml b/app/views/subscription_mailer/placement_summary_email.html.haml
index ed53f341a1..f27ce324af 100644
--- a/app/views/subscription_mailer/placement_summary_email.html.haml
+++ b/app/views/subscription_mailer/placement_summary_email.html.haml
@@ -1,19 +1,13 @@
-%table.social.white-bg{:width => "100%"}
- %tr
- %td
- %table.column{:align => "left"}
- %tr
- %td
- %h3
- = t(".greeting", name: @shop.contact_name)
- %h4
- = t(".intro", shop: @shop.name)
- %table.column{:align => "left"}
- %tr
- %td{:align => "right"}
- - if @shop.logo.variable?
- = image_tag @shop.logo_url(:medium), class: "float-right"
- %span.clear
+- if @shop.logo.variable?
+ - @enterprise_for_logo = @shop
+
+- greeting_key = "mailers_shared.enterprise_greeting"
+- intro_key = ".intro_html"
+
+= render partial: 'shared/mailers/greeting_and_intro',
+ locals: { greeting: t(greeting_key, name: @shop.contact_name),
+ intro: t(intro_key, shop: @shop.name),
+ enterprise_for_logo: @enterprise_for_logo }
= render 'summary_overview', summary: @summary
= render 'summary_detail', summary: @summary
diff --git a/config/locales/en.yml b/config/locales/en.yml
index f8942a104c..7ea0e3eacb 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -412,14 +412,17 @@ en:
track_information: "Tracking Information: %{tracking}"
track_link: "Tracking Link: %{url}"
subscription_mailer:
+ placement_email:
+ intro_html: "You have a new order with %{distributor}."
placement_summary_email:
subject: A summary of recently placed subscription orders
- greeting: "Hi %{name},"
- intro: "Below is a summary of the subscription orders that have just been placed for %{shop}."
+ intro_html: "Below is a summary of the subscription orders that have just been placed for %{shop}."
+ confirmation_email:
+ payment_success_intro_html: "An automatic payment has been processed for your order from %{distributor}."
+ confirmation_intro_html: "Your order with %{distributor} is now confirmed."
confirmation_summary_email:
subject: A summary of recently confirmed subscription orders
- greeting: "Hi %{name},"
- intro: "Below is a summary of the subscription orders that have just been finalised for %{shop}."
+ intro_html: "Below is a summary of the subscription orders that have just been finalised for %{shop}."
summary_overview:
total: A total of %{count} subscriptions were marked for automatic processing.
success_zero: Of these, none were processed successfully.
@@ -446,6 +449,10 @@ en:
other:
title: Other Failure (%{count} orders)
explainer: Automatic processing of these orders failed for an unknown reason. This should not occur, please contact us if you are seeing this.
+ empty_email:
+ intro_html: "We tried to place a new order with %{distributor}, but had some problems..."
+ failed_payment_email:
+ intro_html: "We tried to process a payment for %{distributor}, but had some problems..."
provider_settings: "Provider settings"
@@ -2441,22 +2448,17 @@ See the %{link} to find out more about %{sitename}'s features and to start using
email_payment_description: Payment Description at Checkout
email_payment_summary: Payment summary
email_payment_method: "Paying via:"
- email_so_placement_intro_html: "You have a new order with %{distributor}"
email_so_placement_details_html: "Here are the details of your order for %{distributor}:"
email_so_placement_changes: "Unfortunately, not all products that you requested were available. The original quantities that you requested appear crossed-out below."
- email_so_payment_success_intro_html: "An automatic payment has been processed for your order from %{distributor}."
email_so_placement_explainer_html: "This order was automatically created for you."
email_so_edit_true_html: "You can make changes until orders close on %{orders_close_at}."
email_so_edit_false_html: "You can view details of this order at any time."
email_so_contact_distributor_html: "If you have any questions you can contact %{distributor} via %{email}."
email_so_contact_distributor_to_change_order_html: "This order was automatically created for you. You can make changes until orders close on %{orders_close_at} by contacting %{distributor} via %{email}."
- email_so_confirmation_intro_html: "Your order with %{distributor} is now confirmed"
email_so_confirmation_explainer_html: "This order was automatically placed for you, and it has now been finalised."
email_so_confirmation_details_html: "Here's everything you need to know about your order from %{distributor}:"
- email_so_empty_intro_html: "We tried to place a new order with %{distributor}, but had some problems..."
email_so_empty_explainer_html: "Unfortunately, none of products that you ordered were available, so no order has been placed. The original quantities that you requested appear crossed-out below."
email_so_empty_details_html: "Here are the details of the unplaced order for %{distributor}:"
- email_so_failed_payment_intro_html: "We tried to process a payment, but had some problems..."
email_so_failed_payment_explainer_html: "The payment for your subscription with %{distributor} failed because of a problem with your credit card. %{distributor} has been notified of this failed payment."
email_so_failed_payment_details_html: "Here are the details of the failure provided by the payment gateway:"
email_shipping_delivery_details: Delivery details
diff --git a/spec/mailers/subscription_mailer_spec.rb b/spec/mailers/subscription_mailer_spec.rb
index 9653423b9a..a25ef132a9 100644
--- a/spec/mailers/subscription_mailer_spec.rb
+++ b/spec/mailers/subscription_mailer_spec.rb
@@ -201,7 +201,7 @@ RSpec.describe SubscriptionMailer, type: :mailer do
it "sends the email" do
body = strip_tags(SubscriptionMailer.deliveries.last.body.encoded)
- expect(body).to include 'We tried to process a payment, but had some problems...'
+ expect(body).to include 'We tried to process a payment for '
email_so_failed_payment_explainer_html = "The payment for your subscription with %s" \
" failed because of a problem with your " \
"credit card. %s has been " \