From f46e284ef01110d338b3966aa614c9e404726bc2 Mon Sep 17 00:00:00 2001 From: drummer83 Date: Sun, 18 Feb 2024 17:09:57 +0100 Subject: [PATCH] Improve payment mails Authorization required mail (to shop): Add order summary table to email. Authorize payment email (to customer): Add order summary table to email. The order summary tables require the checkout_helper in the payment_mailer.rb. Add 'Order summary' string to shared strings, because this will be needed in the order placement mailer for subscriptions as well (instead of 'Order confirmation'). The rest are styling and wording improvements. --- app/mailers/payment_mailer.rb | 1 + .../payment_mailer/authorization_required.html.haml | 13 +++++++++++-- .../payment_mailer/authorize_payment.html.haml | 13 +++++++++++-- config/locales/en.yml | 7 ++++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/mailers/payment_mailer.rb b/app/mailers/payment_mailer.rb index 661f090d0a..8e41a2cb7f 100644 --- a/app/mailers/payment_mailer.rb +++ b/app/mailers/payment_mailer.rb @@ -3,6 +3,7 @@ class PaymentMailer < ApplicationMailer include I18nHelper helper MailerHelper + helper 'checkout' def authorize_payment(payment) @payment = payment diff --git a/app/views/payment_mailer/authorization_required.html.haml b/app/views/payment_mailer/authorization_required.html.haml index 05f7658ffa..ac336f5124 100644 --- a/app/views/payment_mailer/authorization_required.html.haml +++ b/app/views/payment_mailer/authorization_required.html.haml @@ -11,7 +11,16 @@ %p = t(".instructions") -%p - = link_to spree.edit_admin_order_url(@payment.order), spree.edit_admin_order_url(@payment.order) + +%p.callout + = t(".view_order") + %br + %strong + = link_to t(".link_label"), spree.edit_admin_order_url(@payment.order) + +%h3 + = t('mailers_shared.order_summary_html', number: @order.number) + += render 'shared/mailers/order_summary' = render 'shared/mailers/signoff_instance' diff --git a/app/views/payment_mailer/authorize_payment.html.haml b/app/views/payment_mailer/authorize_payment.html.haml index e8c2ec9068..8498f39ee4 100644 --- a/app/views/payment_mailer/authorize_payment.html.haml +++ b/app/views/payment_mailer/authorize_payment.html.haml @@ -9,8 +9,17 @@ intro: t(intro_key, distributor: @payment.order.distributor.name, amount: @payment.display_amount), enterprise_for_logo: @enterprise_for_logo } +%p.callout + = t('.click_link') + %br + %strong + = link_to t('.link_label'), main_app.authorize_payment_url(@payment) + +%h3 + = t('mailers_shared.order_summary_html', number: @order.number) %p - = t(".instructions") - = link_to main_app.authorize_payment_url(@payment), main_app.authorize_payment_url(@payment) + = t('.details_html', distributor: @order.distributor.name) + += render 'shared/mailers/order_summary' = render 'shared/mailers/signoff_distributor' diff --git a/config/locales/en.yml b/config/locales/en.yml index 5135d6d2dd..bddaea79f8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -382,6 +382,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using enterprise_greeting: "Dear %{name}," general_greeting: "Hello!" order_confirmation_html: "Order confirmation #%{number}" + order_summary_html: "Order summary #%{number}" enterprise_mailer: confirmation_instructions: subject: "Please confirm the email address for %{enterprise}" # I don't think this is ever used, because 'confirmation_instructions' is part of user_mailer and has a different subject defined. @@ -405,11 +406,15 @@ See the %{link} to find out more about %{sitename}'s features and to start using authorize_payment: subject: "Please authorize your payment for order %{number} at %{distributor}" intro_html: "Your payment of %{amount} to %{distributor} requires additional authentication." - instructions: "Please visit the following URL to authorize your payment:" + click_link: "Please click the link below to authorize your payment:" + link_label: "Authorize payment »" + details_html: "Here are the details of your order for %{distributor}:" authorization_required: subject: "Authentication from customer required for payment of order %{number} at %{distributor}" intro_html: "A payment for order %{order_number} at %{distributor} requires additional authorization from the customer." instructions: "The customer has been notified via email and the payment will appear as pending until it is authorized." + view_order: "To view the order click the link below." + link_label: "View order »" producer_mailer: order_cycle_report: subject: "Order cycle report from %{coordinator} for %{producer}"