From 20ac1f20b2f210a52a6288683e536fa72b447247 Mon Sep 17 00:00:00 2001 From: drummer83 Date: Fri, 19 Jan 2024 02:49:36 +0100 Subject: [PATCH] Add new partial to payment_mailers and re-organize used translation keys Remaining translation keys for emails will be re-organized in a separate commit --- .../authorization_required.html.haml | 17 +++++++++++++++-- .../payment_mailer/authorize_payment.html.haml | 16 ++++++++++++++-- config/locales/en.yml | 10 ++++++++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/views/payment_mailer/authorization_required.html.haml b/app/views/payment_mailer/authorization_required.html.haml index 080a88de06..9b390627ab 100644 --- a/app/views/payment_mailer/authorization_required.html.haml +++ b/app/views/payment_mailer/authorization_required.html.haml @@ -1,2 +1,15 @@ -= t('spree.payment_mailer.authorization_required.message', order_number: @payment.order.number) -= link_to spree.edit_admin_order_url(@payment.order), spree.edit_admin_order_url(@payment.order) +- if @payment.order.distributor.logo.variable? + - @enterprise_for_logo = @payment.order.distributor + +- greeting_key = "mailers_shared.enterprise_greeting" +- intro_key = ".intro_html" + += render partial: 'shared/mailers/greeting_and_intro', + locals: { greeting: t(greeting_key, name: @payment.order.distributor.contact_name), + intro: t(intro_key, order_number: @payment.order.number, distributor: @payment.order.distributor.name), + enterprise_for_logo: @enterprise_for_logo } + +%p + = t(".instructions") +%p + = link_to spree.edit_admin_order_url(@payment.order), spree.edit_admin_order_url(@payment.order) diff --git a/app/views/payment_mailer/authorize_payment.html.haml b/app/views/payment_mailer/authorize_payment.html.haml index ea25e0e7b4..136f95816a 100644 --- a/app/views/payment_mailer/authorize_payment.html.haml +++ b/app/views/payment_mailer/authorize_payment.html.haml @@ -1,2 +1,14 @@ -= t('spree.payment_mailer.authorize_payment.instructions', distributor: @payment.order.distributor.name, amount: @payment.display_amount) -= link_to main_app.authorize_payment_url(@payment), main_app.authorize_payment_url(@payment) +- if @payment.order.distributor.logo.variable? + - @enterprise_for_logo = @payment.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: @payment.order.bill_address.firstname), + intro: t(intro_key, distributor: @payment.order.distributor.name, amount: @payment.display_amount), + enterprise_for_logo: @enterprise_for_logo } + +%p + = t(".instructions") + = link_to main_app.authorize_payment_url(@payment), main_app.authorize_payment_url(@payment) diff --git a/config/locales/en.yml b/config/locales/en.yml index e0045f4cb4..49c5eb08f3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -369,6 +369,7 @@ en: # mailers_shared: customer_greeting: "Dear %{name}," + enterprise_greeting: "Dear %{name}," general_greeting: "Hello!" enterprise_mailer: confirmation_instructions: @@ -386,6 +387,13 @@ en: manager_invitation: subject: "%{enterprise} has invited you to be a manager" invited_to_manage_html: "You have been invited to manage %{enterprise} on %{instance}." + payment_mailer: + authorize_payment: + intro_html: "Your payment of %{amount} to %{distributor} requires additional authentication." + instructions: "Please visit the following URL to authorize your payment:" + authorization_required: + 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." producer_mailer: order_cycle: subject: "Order cycle report for %{producer}" @@ -4717,10 +4725,8 @@ See the %{link} to find out more about %{sitename}'s features and to start using payment_mailer: authorize_payment: subject: "Please authorize your payment to %{distributor} on OFN" - instructions: "Your payment of %{amount} to %{distributor} requires additional authentication. Please visit the following URL to authorize your payment:" authorization_required: subject: "A payment requires authorization from the customer" - message: "A payment for order %{order_number} requires additional authorization from the customer. The customer has been notified via email and the payment will appear as pending until it is authorized." shipment_mailer: shipped_email: shipment_summary: "Shipment Summary"