Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Unify url field names in context for easier handling
Jakub Draganeked156f33f14f
diff --git a/saleor/order/emails.py b/saleor/order/emails.pyindex 94efe7230a..a78db590be 100644--- a/saleor/order/emails.py+++ b/saleor/order/emails.py@@ -7,17 +7,17 @@ CONFIRM_ORDER_TEMPLATE = 'order/confirm_order'CONFIRM_PAYMENT_TEMPLATE = 'order/payment/confirm_payment'-def __send_confirmation(address, url, url_name, template):+def __send_confirmation(address, url, template):send_templated_mail(from_email=settings.ORDER_FROM_EMAIL,recipient_list=[address],context={'site_name': get_site_name(),- url_name: url},+ 'url': url},template_name=template)def send_order_confirmation(address, url):- __send_confirmation(address, url, 'order_url', CONFIRM_ORDER_TEMPLATE)+ __send_confirmation(address, url, CONFIRM_ORDER_TEMPLATE)def send_payment_confirmation(address, url):- __send_confirmation(address, url, 'payment_url', CONFIRM_PAYMENT_TEMPLATE)+ __send_confirmation(address, url, CONFIRM_PAYMENT_TEMPLATE)diff --git a/saleor/order/models.py b/saleor/order/models.pyindex b283bd64c7..d772361866 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -16,14 +16,12 @@ from payments import PaymentStatus, PurchasedItemfrom payments.models import BasePaymentfrom prices import Price, FixedDiscountfrom satchless.item import ItemLine, ItemSet-from templated_email import send_templated_mailfrom ..core.utils import build_absolute_urifrom ..discount.models import Voucherfrom ..product.models import Productfrom ..userprofile.models import Addressfrom ..search import index-from ..site.utils import get_site_namefrom . import OrderStatusfrom . import emailsdiff --git a/templates/templated_email/order/confirm_order.email b/templates/templated_email/order/confirm_order.emailindex 7bdede0e73..2b174f6387 100644--- a/templates/templated_email/order/confirm_order.email+++ b/templates/templated_email/order/confirm_order.email@@ -9,7 +9,7 @@Hi!Thank you for your order. To see your payment details please visit:-{{ payment_url }}+{{ url }}Sincerely,{{ site_name }}diff --git a/templates/templated_email/order/payment/confirm_payment.email b/templates/templated_email/order/payment/confirm_payment.emailindex 94a60037af..f890526d6c 100644--- a/templates/templated_email/order/payment/confirm_payment.email+++ b/templates/templated_email/order/payment/confirm_payment.email@@ -9,7 +9,7 @@Hi!Thank you for your payment. To see your payment details please visit:-{{ order_url }}+{{ url }}Sincerely,{{ site_name }}diff --git a/tests/test_emails.py b/tests/test_emails.pyindex 69df7152a7..9ad43d9879 100644--- a/tests/test_emails.py+++ b/tests/test_emails.py@@ -17,7 +17,7 @@ EMAIL_FROM = settings.ORDER_FROM_EMAILdef test_send_confirmation_using_templated_email(mocked_templated_email,mocked_get_site_name):emails.send_order_confirmation(EMAIL, URL)- context = {'site_name': SITE_NAME, 'order_url': URL}+ context = {'site_name': SITE_NAME, 'url': URL}mocked_templated_email.assert_called_once_with(recipient_list=[EMAIL], context=context, from_email=EMAIL_FROM,template_name=emails.CONFIRM_ORDER_TEMPLATE)@@ -28,7 +28,7 @@ def test_send_confirmation_using_templated_email(mocked_templated_email,def test_send_order_payment_confirmation(mocked_templated_email,mocked_get_site_name):emails.send_payment_confirmation(EMAIL, URL)- context = {'site_name': SITE_NAME, 'payment_url': URL}+ context = {'site_name': SITE_NAME, 'url': URL}mocked_templated_email.assert_called_once_with(recipient_list=[EMAIL], context=context, from_email=EMAIL_FROM,template_name=emails.CONFIRM_PAYMENT_TEMPLATE)