Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Handlebars for templates and custom email template (#6495)

Maciej Korycinski825e0a134415
diff --git a/.isort.cfg b/.isort.cfg
index 98af768127..73ec897917 100644
--- a/.isort.cfg
+++ b/.isort.cfg
@@ -1,2 +1,2 @@
[settings]
-known_third_party = Adyen,PIL,babel,boto3,braintree,celery,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,geolite2,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,markdown,measurement,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sentry_sdk,storages,stripe,templated_email,tqdm,versatileimagefield,weasyprint
+known_third_party = Adyen,PIL,babel,boto3,braintree,celery,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,geolite2,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,markdown,measurement,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sentry_sdk,storages,stripe,tqdm,versatileimagefield,weasyprint
diff --git a/poetry.lock b/poetry.lock
index d396d1f95c..fb4bac45f3 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -249,11 +249,11 @@ vine = ">=5.0.0,<6.0"
[package.extras]
arangodb = ["pyArango (>=1.3.2)"]
auth = ["cryptography"]
-azureblockblob = ["azure-storage (0.36.0)", "azure-common (1.1.5)", "azure-storage-common (1.1.0)"]
+azureblockblob = ["azure-storage (==0.36.0)", "azure-common (==1.1.5)", "azure-storage-common (==1.1.0)"]
brotli = ["brotli (>=1.0.0)", "brotlipy (>=0.7.0)"]
cassandra = ["cassandra-driver (<3.21.0)"]
consul = ["python-consul"]
-cosmosdbsql = ["pydocumentdb (2.3.2)"]
+cosmosdbsql = ["pydocumentdb (==2.3.2)"]
couchbase = ["couchbase (>=3.0.0)"]
couchdb = ["pycouchdb"]
django = ["Django (>=1.11)"]
@@ -273,7 +273,7 @@ s3 = ["boto3 (>=1.9.125)"]
slmq = ["softlayer-messaging (>=1.0.3)"]
solar = ["ephem"]
sqlalchemy = ["sqlalchemy"]
-sqs = ["boto3 (>=1.9.125)", "pycurl (7.43.0.5)"]
+sqs = ["boto3 (>=1.9.125)", "pycurl (==7.43.0.5)"]
tblib = ["tblib (>=1.3.0)", "tblib (>=1.5.0)"]
yaml = ["PyYAML (>=3.10)"]
zookeeper = ["kazoo (>=1.3.1)"]
@@ -995,7 +995,7 @@ six = ">=1.10.0"
unidecode = ">=1.1.1,<2"
[package.extras]
-dev = ["black (19.10b0)", "flake8 (3.7.9)", "flake8-black (0.1.1)", "flake8-bugbear (20.1.4)", "pytest (>=3.6.3)", "pytest-cov", "coveralls", "mock", "pytz", "pytest-django (>=3.3.2)", "djangorestframework (>=3.6.3)", "django-filter (<2)", "django-filter (>=2)"]
+dev = ["black (==19.10b0)", "flake8 (==3.7.9)", "flake8-black (==0.1.1)", "flake8-bugbear (==20.1.4)", "pytest (>=3.6.3)", "pytest-cov", "coveralls", "mock", "pytz", "pytest-django (>=3.3.2)", "djangorestframework (>=3.6.3)", "django-filter (<2)", "django-filter (>=2)"]
rest_framework = ["djangorestframework (>=3.6.3)"]
test = ["pytest (>=3.6.3)", "pytest-cov", "coveralls", "mock", "pytz", "pytest-django (>=3.3.2)", "djangorestframework (>=3.6.3)", "django-filter (<2)", "django-filter (>=2)"]
@@ -1025,7 +1025,7 @@ six = ">=1.10.0"
[package.extras]
gevent = ["gevent (>=1.1)"]
-test = ["six (1.14.0)", "pyannotate (1.2.0)", "pytest (4.6.10)", "pytest-django (3.9.0)", "pytest-cov (2.8.1)", "coveralls (1.11.1)", "cython (0.29.17)", "gevent (1.5.0)", "pytest-benchmark (3.2.3)", "pytest-mock (2.0.0)"]
+test = ["six (==1.14.0)", "pyannotate (==1.2.0)", "pytest (==4.6.10)", "pytest-django (==3.9.0)", "pytest-cov (==2.8.1)", "coveralls (==1.11.1)", "cython (==0.29.17)", "gevent (==1.5.0)", "pytest-benchmark (==3.2.3)", "pytest-mock (==2.0.0)"]
[[package]]
name = "graphql-relay"
@@ -1103,6 +1103,14 @@ lxml = "*"
[package.extras]
dev = ["pre-commit", "mock", "pytest"]
+[[package]]
+name = "html2text"
+version = "2020.1.16"
+description = "Turn HTML into equivalent Markdown-structured text."
+category = "main"
+optional = false
+python-versions = ">=3.5"
+
[[package]]
name = "html5lib"
version = "1.1"
@@ -1177,7 +1185,7 @@ thrift = "*"
tornado = ">=4.3"
[package.extras]
-tests = ["mock (1.0.1)", "pycurl (>=7.43,<8)", "pytest (>=3.7.0,<3.8.0)", "pytest-cov (2.5.1)", "coverage (<4.4)", "pytest-timeout (1.3.1)", "pytest-tornado", "pytest-benchmark[histogram] (>=3.0.0rc1,<3.2)", "pytest-localserver", "flake8", "flake8-quotes", "codecov", "opentracing_instrumentation (>=3,<4)", "prometheus_client (0.3.1)", "tchannel (>=0.27)"]
+tests = ["mock (==1.0.1)", "pycurl (>=7.43,<8)", "pytest (>=3.7.0,<3.8.0)", "pytest-cov (==2.5.1)", "coverage (<4.4)", "pytest-timeout (==1.3.1)", "pytest-tornado", "pytest-benchmark[histogram] (>=3.0.0rc1,<3.2)", "pytest-localserver", "flake8", "flake8-quotes", "codecov", "opentracing_instrumentation (>=3,<4)", "prometheus_client (==0.3.1)", "tchannel (>=0.27)"]
[[package]]
name = "jdcal"
@@ -1243,7 +1251,7 @@ qpid = ["qpid-python (>=0.26)", "qpid-tools (>=0.26)"]
redis = ["redis (>=3.3.11)"]
slmq = ["softlayer-messaging (>=1.0.3)"]
sqlalchemy = ["sqlalchemy"]
-sqs = ["boto3 (>=1.4.4)", "pycurl (7.43.0.2)"]
+sqs = ["boto3 (>=1.4.4)", "pycurl (==7.43.0.2)"]
yaml = ["PyYAML (>=3.10)"]
zookeeper = ["kazoo (>=1.3.1)"]
@@ -1617,6 +1625,17 @@ python-versions = "*"
[package.dependencies]
pyasn1 = ">=0.4.6,<0.5.0"
+[[package]]
+name = "pybars3"
+version = "0.9.7"
+description = "Handlebars.js templating for Python 3 and 2"
+category = "main"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+PyMeta3 = ">=0.5.1"
+
[[package]]
name = "pycodestyle"
version = "2.6.0"
@@ -1720,6 +1739,14 @@ python-versions = "*"
[package.dependencies]
pylint = ">=1.7"
+[[package]]
+name = "pymeta3"
+version = "0.5.1"
+description = "Pattern-matching language based on OMeta for Python 3 and 2"
+category = "main"
+optional = false
+python-versions = "*"
+
[[package]]
name = "pyparsing"
version = "2.4.7"
@@ -1755,7 +1782,7 @@ py = ">=1.8.2"
toml = "*"
[package.extras]
-checkqa_mypy = ["mypy (0.780)"]
+checkqa_mypy = ["mypy (==0.780)"]
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"]
[[package]]
@@ -1782,7 +1809,7 @@ coverage = ">=4.4"
pytest = ">=4.6"
[package.extras]
-testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "pytest-xdist", "virtualenv"]
+testing = ["fields", "hunter", "process-tests (==2.0.2)", "six", "pytest-xdist", "virtualenv"]
[[package]]
name = "pytest-django"
@@ -2000,7 +2027,7 @@ urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26"
[package.extras]
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
-socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
+socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
[[package]]
name = "rsa"
@@ -2293,7 +2320,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"]
-socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
+socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[[package]]
name = "uvicorn"
@@ -2410,7 +2437,7 @@ multidict = ">=4.0"
[metadata]
lock-version = "1.1"
python-versions = "~3.8"
-content-hash = "1fbb9702f0e980e28be32c2a3d343aa1bdb7b9546071a88c35828015f81f8c6a"
+content-hash = "a2477805bec92a2c0ef947ce3e7911278b8b2395be66466e1b3c03c8678aa320"
[metadata.files]
adyen = [
@@ -2867,6 +2894,10 @@ h11 = [
html-to-draftjs = [
{file = "html-to-draftjs-1.0.1.tar.gz", hash = "sha256:2212acf3b063c17b6dc91875f474159e1f730c1a4e5fbf74f9a66250f7040e9a"},
]
+html2text = [
+ {file = "html2text-2020.1.16-py3-none-any.whl", hash = "sha256:c7c629882da0cf377d66f073329ccf34a12ed2adf0169b9285ae4e63ef54c82b"},
+ {file = "html2text-2020.1.16.tar.gz", hash = "sha256:e296318e16b059ddb97f7a8a1d6a5c1d7af4544049a01e261731d2d5cc277bbb"},
+]
html5lib = [
{file = "html5lib-1.1-py2.py3-none-any.whl", hash = "sha256:0d78f8fde1c230e99fe37986a60526d7049ed4bf8a9fadbad5f00e22e58e041d"},
{file = "html5lib-1.1.tar.gz", hash = "sha256:b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f"},
@@ -3202,6 +3233,8 @@ psycopg2-binary = [
{file = "psycopg2_binary-2.8.6-cp39-cp39-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:89705f45ce07b2dfa806ee84439ec67c5d9a0ef20154e0e475e2b2ed392a5b83"},
{file = "psycopg2_binary-2.8.6-cp39-cp39-manylinux1_i686.whl", hash = "sha256:42ec1035841b389e8cc3692277a0bd81cdfe0b65d575a2c8862cec7a80e62e52"},
{file = "psycopg2_binary-2.8.6-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7312e931b90fe14f925729cde58022f5d034241918a5c4f9797cac62f6b3a9dd"},
+ {file = "psycopg2_binary-2.8.6-cp39-cp39-win32.whl", hash = "sha256:6422f2ff0919fd720195f64ffd8f924c1395d30f9a495f31e2392c2efafb5056"},
+ {file = "psycopg2_binary-2.8.6-cp39-cp39-win_amd64.whl", hash = "sha256:15978a1fbd225583dd8cdaf37e67ccc278b5abecb4caf6b2d6b8e2b948e953f6"},
]
purl = [
{file = "purl-1.5-py2.py3-none-any.whl", hash = "sha256:5ac0e85979da0172d80156701cb3eb9b1eff31f3b43e981ef6dc06251c53a3a4"},
@@ -3241,6 +3274,9 @@ pyasn1-modules = [
{file = "pyasn1_modules-0.2.8-py3.6.egg", hash = "sha256:cbac4bc38d117f2a49aeedec4407d23e8866ea4ac27ff2cf7fb3e5b570df19e0"},
{file = "pyasn1_modules-0.2.8-py3.7.egg", hash = "sha256:c29a5e5cc7a3f05926aff34e097e84f8589cd790ce0ed41b67aed6857b26aafd"},
]
+pybars3 = [
+ {file = "pybars3-0.9.7.tar.gz", hash = "sha256:6ac847e905e53b9c5b936af112c910475e27bf767f79f4528c16f9af1ec0e252"},
+]
pycodestyle = [
{file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"},
{file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"},
@@ -3276,6 +3312,9 @@ pylint-plugin-utils = [
{file = "pylint-plugin-utils-0.6.tar.gz", hash = "sha256:57625dcca20140f43731311cd8fd879318bf45a8b0fd17020717a8781714a25a"},
{file = "pylint_plugin_utils-0.6-py3-none-any.whl", hash = "sha256:2f30510e1c46edf268d3a195b2849bd98a1b9433229bb2ba63b8d776e1fc4d0a"},
]
+pymeta3 = [
+ {file = "PyMeta3-0.5.1.tar.gz", hash = "sha256:18bda326d9a9bbf587bfc0ee0bc96864964d78b067288bcf55d4d98681d05bcb"},
+]
pyparsing = [
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
@@ -3494,19 +3533,28 @@ typed-ast = [
{file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"},
{file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"},
{file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"},
+ {file = "typed_ast-1.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:fcf135e17cc74dbfbc05894ebca928ffeb23d9790b3167a674921db19082401f"},
{file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"},
{file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"},
{file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"},
{file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"},
{file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"},
+ {file = "typed_ast-1.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:f208eb7aff048f6bea9586e61af041ddf7f9ade7caed625742af423f6bae3298"},
{file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"},
{file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"},
{file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"},
{file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"},
{file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"},
+ {file = "typed_ast-1.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:7e4c9d7658aaa1fc80018593abdf8598bf91325af6af5cce4ce7c73bc45ea53d"},
{file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"},
{file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"},
{file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"},
+ {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:92c325624e304ebf0e025d1224b77dd4e6393f18aab8d829b5b7e04afe9b7a2c"},
+ {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:d648b8e3bf2fe648745c8ffcee3db3ff903d0817a01a12dd6a6ea7a8f4889072"},
+ {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:fac11badff8313e23717f3dada86a15389d0708275bddf766cca67a84ead3e91"},
+ {file = "typed_ast-1.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:0d8110d78a5736e16e26213114a38ca35cb15b6515d535413b090bd50951556d"},
+ {file = "typed_ast-1.4.1-cp39-cp39-win32.whl", hash = "sha256:b52ccf7cfe4ce2a1064b18594381bccf4179c2ecf7f513134ec2f993dd4ab395"},
+ {file = "typed_ast-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:3742b32cf1c6ef124d57f95be609c473d7ec4c14d0090e5a5e05a15269fb4d0c"},
{file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"},
]
typing-extensions = [
diff --git a/pyproject.toml b/pyproject.toml
index a084caa1ab..2e9185e95a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -69,6 +69,8 @@ Adyen = "^3.0.0"
google-cloud-pubsub = ">=1.7,<3.0"
uvicorn = ">=0.11.8,<0.13.0"
gunicorn = "^20.0.4"
+pybars3 = "^0.9.7"
+html2text = "^2020.1.16"
[tool.poetry.dev-dependencies]
black = "19.10b0"
diff --git a/requirements.txt b/requirements.txt
index c6540b0dd4..b0d5f1b22e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,137 +1,137 @@
adyen==3.0.0
-amqp==5.0.1
+amqp==5.0.1; python_version >= "3.6"
aniso8601==7.0.0
-asgiref==3.2.10
-babel==2.8.0
+asgiref==3.2.10; python_version >= "3.6"
+babel==2.8.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
beautifulsoup4==4.7.1
-billiard==3.6.3.0
-boto3==1.15.11
-botocore==1.18.11
+billiard==3.6.3.0; python_version >= "3.6"
+boto3==1.15.18
+botocore==1.18.18
braintree==4.4.0
-cachetools==4.1.1
-cairocffi==1.1.0
-cairosvg==2.4.2
-celery==5.0.0
-certifi==2020.6.20
-cffi==1.14.2
-chardet==3.0.4
-click==7.1.2
-click-didyoumean==0.0.3
-click-repl==0.1.6
-cssselect2==0.3.0
-defusedxml==0.6.0
+cachetools==4.1.1; python_version >= "3.5" and python_version < "4.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0")
+cairocffi==1.1.0; python_version >= "3.5"
+cairosvg==2.4.2; python_version >= "3.5"
+celery==5.0.1; python_version >= "3.6"
+certifi==2020.6.20; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+cffi==1.14.2; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.5.0"
+chardet==3.0.4; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+click-didyoumean==0.0.3; python_version >= "3.6"
+click-repl==0.1.6; python_version >= "3.6"
+click==7.1.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
+cssselect2==0.3.0; python_version >= "3.5"
+defusedxml==0.6.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
dj-database-url==0.5.0
dj-email-url==1.0.1
-django==3.1.2
django-appconf==1.0.4
django-cache-url==3.1.2
django-countries==6.1.3
-django-filter==2.4.0
-django-js-asset==1.2.2
+django-filter==2.4.0; python_version >= "3.5"
+django-js-asset==1.2.2; python_version >= "3.5"
django-measurement==3.2.3
-django-mptt==0.11.0
-django-phonenumber-field==5.0.0
-django-prices==2.2.0
+django-mptt==0.11.0; python_version >= "3.5"
+django-phonenumber-field==5.0.0; python_version >= "3.5"
django-prices-openexchangerates==1.1.0
django-prices-vatlayer==1.1.0
-django-redis==4.12.1
-django-render-block==0.7
-django-storages==1.10.1
+django-prices==2.2.0
+django-redis==4.12.1; python_version >= "3.5"
+django-render-block==0.7; python_version >= "3.5"
+django-storages==1.10.1; python_version >= "3.5"
django-templated-email==2.3.0
django-versatileimagefield==2.0
+django==3.1.2; python_version >= "3.6"
draftjs-sanitizer==1.0.0
enmerkar==0.7.1
-et-xmlfile==1.0.1
-faker==4.1.3
-freezegun==0.3.15
-google-api-core==1.22.2
-google-auth==1.21.3
-google-cloud-core==1.4.1
-google-cloud-pubsub==2.1.0
-google-cloud-storage==1.31.2
-google-crc32c==1.0.0; python_version >= "3.5"
+et-xmlfile==1.0.1; python_version >= "3.6"
+faker==4.14.0; python_version >= "3.5"
+freezegun==0.3.15; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
+google-api-core==1.22.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+google-auth==1.21.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0"
+google-cloud-core==1.4.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0"
+google-cloud-pubsub==2.1.0; python_version >= "3.6"
+google-cloud-storage==1.31.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+google-crc32c==1.0.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.5.0"
google-i18n-address==2.4.0
google-measurement-protocol==1.1.0
-google-resumable-media==1.0.0
-googleapis-common-protos==1.52.0
-graphene==2.1.8
+google-resumable-media==1.0.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.5.0"
+googleapis-common-protos==1.52.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
graphene-django==2.13.0
graphene-federation==0.1.0
+graphene==2.1.8
graphql-core==2.3.2
graphql-relay==2.0.1
-grpc-google-iam-v1==0.12.3
-grpcio==1.31.0
-gunicorn==20.0.4
+grpc-google-iam-v1==0.12.3; python_version >= "3.6"
+grpcio==1.31.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+gunicorn==20.0.4; python_version >= "3.4"
h11==0.9.0
html-to-draftjs==1.0.1
-html5lib==1.1
-httptools==0.1.1; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
-idna==2.10
+html2text==2020.1.16; python_version >= "3.5"
+html5lib==1.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+idna==2.10; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
jaeger-client==4.3.0
-jdcal==1.4.1
-jmespath==0.10.0
-jsonfield==3.1.0
-kombu==5.0.2
-libcst==0.3.10
-lxml==4.5.2
-markdown==3.2.2
-maxminddb==2.0.2
+jdcal==1.4.1; python_version >= "3.6"
+jmespath==0.10.0; python_version >= "2.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
+jsonfield==3.1.0; python_version >= "3.6"
+kombu==5.0.2; python_version >= "3.6"
+libcst==0.3.10; python_version >= "3.6"
+lxml==4.5.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+markdown==3.3.1; python_version >= "3.6"
maxminddb-geolite2==2018.703
+maxminddb==2.0.3; python_version >= "3.6"
measurement==3.2.0
-mpmath==1.1.0
-mypy-extensions==0.4.3
-oauthlib==3.1.0
-openpyxl==3.0.5
+mpmath==1.1.0; python_version >= "3.5"
+mypy-extensions==0.4.3; python_version >= "3.6"
+oauthlib==3.1.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+openpyxl==3.0.5; python_version >= "3.6"
opentracing==2.3.0
-petl==1.6.7
-phonenumberslite==8.12.10
-pillow==7.2.0
+petl==1.6.8; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+phonenumberslite==8.12.11
+pillow==7.2.0; python_version >= "3.5"
prices==1.1.0
promise==2.3
-prompt-toolkit==3.0.7
-proto-plus==1.9.1
-protobuf==3.13.0
-psycopg2-binary==2.8.6
+prompt-toolkit==3.0.7; python_full_version >= "3.6.1" and python_version >= "3.6"
+proto-plus==1.9.1; python_version >= "3.6"
+protobuf==3.13.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+psycopg2-binary==2.8.6; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
purl==1.5
-pyasn1==0.4.8
-pyasn1-modules==0.2.8
-pycparser==2.20
+pyasn1-modules==0.2.8; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0"
+pyasn1==0.4.8; python_version >= "3.5" and python_full_version < "3.0.0" and python_version < "4" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0") or python_version >= "3.5" and python_full_version >= "3.4.0" and python_version < "4" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0")
+pybars3==0.9.7
+pycparser==2.20; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
pyjwt==1.7.1
-pyphen==0.9.5
-python-dateutil==2.8.1
-python-json-logger==2.0.0
-python-magic==0.4.18
+pymeta3==0.5.1
+pyphen==0.9.5; python_version >= "3.5"
+python-dateutil==2.8.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+python-json-logger==2.0.1; python_version >= "3.4"
python-magic-bin==0.4.14; sys_platform == "win32"
+python-magic==0.4.18; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pytimeparse==1.1.8
-pytz==2020.1
-pyyaml==5.3.1
+pytz==2020.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+pyyaml==5.3.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
razorpay==1.2.0
-redis==3.5.3
-requests==2.24.0
-rsa==4.6; python_version >= "3.5"
+redis==3.5.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
+requests==2.24.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
+rsa==4.6; python_version >= "3.5" and python_version < "4" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0")
rx==1.6.1
s3transfer==0.3.3
sentry-sdk==0.17.3
singledispatch==3.4.0.3
-six==1.15.0
-soupsieve==2.0.1
-sqlparse==0.3.1
-stripe==2.54.0
-sympy==1.6.2
+six==1.15.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+soupsieve==2.0.1; python_version >= "3.5"
+sqlparse==0.3.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+stripe==2.55.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+sympy==1.6.2; python_version >= "3.5"
text-unidecode==1.3
threadloop==1.0.2
thrift==0.13.0
-tinycss2==1.0.2
-tornado==6.0.4
-tqdm==4.50.0
-typing-extensions==3.7.4.3
-typing-inspect==0.6.0
-unidecode==1.1.1
-urllib3==1.25.10
-uvicorn==0.11.8
-uvloop==0.14.0; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
-vine==5.0.0
-wcwidth==0.2.5
-weasyprint==51
-webencodings==0.5.1
-websockets==8.1
+tinycss2==1.0.2; python_version >= "3.5"
+tornado==6.0.4; python_version >= "3.5"
+tqdm==4.50.2; (python_version >= "2.6" and python_full_version < "3.0.0") or (python_full_version >= "3.2.0")
+typing-extensions==3.7.4.3; python_version >= "3.6"
+typing-inspect==0.6.0; python_version >= "3.6"
+unidecode==1.1.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
+urllib3==1.25.10; python_version >= "2.7" and python_full_version < "3.0.0" and python_version != "3.4" or python_full_version >= "3.5.0" and python_version < "4" and python_version != "3.4"
+uvicorn==0.12.1
+vine==5.0.0; python_version >= "3.6"
+wcwidth==0.2.5; python_full_version >= "3.6.1" and python_version >= "3.6"
+weasyprint==51; python_version >= "3.5"
+webencodings==0.5.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
diff --git a/requirements_dev.txt b/requirements_dev.txt
index d704355cbf..f897f8ea48 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -1,204 +1,204 @@
adyen==3.0.0
-amqp==5.0.1
+amqp==5.0.1; python_version >= "3.6"
aniso8601==7.0.0
-apipkg==1.5
-appdirs==1.4.4
-asgiref==3.2.10
-astroid==2.4.2
-atomicwrites==1.4.0; sys_platform == "win32"
-attrs==20.1.0
-babel==2.8.0
+apipkg==1.5; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+appdirs==1.4.4; python_version >= "3.6" and python_full_version >= "3.6.1"
+asgiref==3.2.10; python_version >= "3.6"
+astroid==2.4.2; python_version >= "3.5"
+atomicwrites==1.4.0; python_version >= "3.5" and python_full_version < "3.0.0" and sys_platform == "win32" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") or sys_platform == "win32" and python_version >= "3.5" and python_full_version >= "3.4.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5")
+attrs==20.1.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
+babel==2.8.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
beautifulsoup4==4.7.1
beautifultable==0.7.0
-billiard==3.6.3.0
-black==19.10b0
-boto3==1.15.11
-botocore==1.18.11
+billiard==3.6.3.0; python_version >= "3.6"
+black==19.10b0; python_version >= "3.6"
+boto3==1.15.18
+botocore==1.18.18
braintree==4.4.0
-cachetools==4.1.1
-cairocffi==1.1.0
-cairosvg==2.4.2
-celery==5.0.0
-certifi==2020.6.20
-cffi==1.14.2
-cfgv==3.2.0
-chardet==3.0.4
-click==7.1.2
-click-didyoumean==0.0.3
-click-repl==0.1.6
-codecov==2.1.9
-colorama==0.4.3
-coverage==5.3
-cssselect2==0.3.0
-defusedxml==0.6.0
-distlib==0.3.1
+cachetools==4.1.1; python_version >= "3.5" and python_version < "4.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0")
+cairocffi==1.1.0; python_version >= "3.5"
+cairosvg==2.4.2; python_version >= "3.5"
+celery==5.0.1; python_version >= "3.6"
+certifi==2020.6.20; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+cffi==1.14.2; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.5.0"
+cfgv==3.2.0; python_full_version >= "3.6.1"
+chardet==3.0.4; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+click-didyoumean==0.0.3; python_version >= "3.6"
+click-repl==0.1.6; python_version >= "3.6"
+click==7.1.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
+codecov==2.1.10; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+colorama==0.4.3; python_version >= "3.5" and python_full_version < "3.0.0" and sys_platform == "win32" and platform_system == "Windows" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") or sys_platform == "win32" and python_version >= "3.5" and python_full_version >= "3.5.0" and platform_system == "Windows" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5")
+coverage==5.3; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0" and python_version < "4")
+cssselect2==0.3.0; python_version >= "3.5"
+defusedxml==0.6.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+distlib==0.3.1; python_full_version >= "3.6.1"
dj-database-url==0.5.0
dj-email-url==1.0.1
-django==3.1.2
django-appconf==1.0.4
django-cache-url==3.1.2
django-countries==6.1.3
-django-debug-toolbar==3.1.1
django-debug-toolbar-request-history==0.1.3
-django-extensions==3.0.9
-django-filter==2.4.0
+django-debug-toolbar==3.1.1; python_version >= "3.5"
+django-extensions==3.0.9; python_version >= "3.5"
+django-filter==2.4.0; python_version >= "3.5"
django-graphiql-debug-toolbar==0.1.4
-django-js-asset==1.2.2
+django-js-asset==1.2.2; python_version >= "3.5"
django-measurement==3.2.3
-django-mptt==0.11.0
-django-phonenumber-field==5.0.0
-django-prices==2.2.0
+django-mptt==0.11.0; python_version >= "3.5"
+django-phonenumber-field==5.0.0; python_version >= "3.5"
django-prices-openexchangerates==1.1.0
django-prices-vatlayer==1.1.0
-django-redis==4.12.1
-django-render-block==0.7
-django-storages==1.10.1
-django-stubs==1.2.0
+django-prices==2.2.0
+django-redis==4.12.1; python_version >= "3.5"
+django-render-block==0.7; python_version >= "3.5"
+django-storages==1.10.1; python_version >= "3.5"
+django-stubs==1.2.0; python_version >= "3.6"
django-templated-email==2.3.0
django-versatileimagefield==2.0
+django==3.1.2; python_version >= "3.6"
draftjs-sanitizer==1.0.0
enmerkar==0.7.1
-et-xmlfile==1.0.1
-execnet==1.7.1
-faker==4.1.3
-filelock==3.0.12
-flake8==3.8.4
-freezegun==0.3.15
-gitdb==4.0.5
-gitpython==3.1.7
-google-api-core==1.22.2
-google-auth==1.21.3
-google-cloud-core==1.4.1
-google-cloud-pubsub==2.1.0
-google-cloud-storage==1.31.2
-google-crc32c==1.0.0; python_version >= "3.5"
+et-xmlfile==1.0.1; python_version >= "3.6"
+execnet==1.7.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+faker==4.14.0; python_version >= "3.5"
+filelock==3.0.12; python_full_version >= "3.6.1"
+flake8==3.8.4; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+freezegun==0.3.15; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
+gitdb==4.0.5; python_version >= "3.4" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version < "3.9" and python_version >= "3.4"
+gitpython==3.1.7; python_version >= "3.4" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version < "3.9" and python_version >= "3.4"
+google-api-core==1.22.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+google-auth==1.21.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0"
+google-cloud-core==1.4.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0"
+google-cloud-pubsub==2.1.0; python_version >= "3.6"
+google-cloud-storage==1.31.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+google-crc32c==1.0.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.5.0"
google-i18n-address==2.4.0
google-measurement-protocol==1.1.0
-google-resumable-media==1.0.0
-googleapis-common-protos==1.52.0
-graphene==2.1.8
+google-resumable-media==1.0.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.5.0"
+googleapis-common-protos==1.52.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
graphene-django==2.13.0
graphene-federation==0.1.0
+graphene==2.1.8
graphql-core==2.3.2
graphql-relay==2.0.1
-grpc-google-iam-v1==0.12.3
-grpcio==1.31.0
-gunicorn==20.0.4
+grpc-google-iam-v1==0.12.3; python_version >= "3.6"
+grpcio==1.31.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+gunicorn==20.0.4; python_version >= "3.4"
h11==0.9.0
html-to-draftjs==1.0.1
-html5lib==1.1
-httptools==0.1.1; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
-identify==1.4.30
-idna==2.10
-iniconfig==1.0.1
-isort==4.3.21
+html2text==2020.1.16; python_version >= "3.5"
+html5lib==1.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+identify==1.4.30; python_full_version >= "3.6.1"
+idna==2.10; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
+iniconfig==1.0.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+isort==4.3.21; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
jaeger-client==4.3.0
-jdcal==1.4.1
-jinja2==2.11.2
-jmespath==0.10.0
-jsonfield==3.1.0
-kombu==5.0.2
-lazy-object-proxy==1.4.3
-libcst==0.3.10
-lxml==4.5.2
-markdown==3.2.2
-markupsafe==1.1.1
-maxminddb==2.0.2
+jdcal==1.4.1; python_version >= "3.6"
+jinja2==2.11.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+jmespath==0.10.0; python_version >= "2.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
+jsonfield==3.1.0; python_version >= "3.6"
+kombu==5.0.2; python_version >= "3.6"
+lazy-object-proxy==1.4.3; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
+libcst==0.3.10; python_version >= "3.6"
+lxml==4.5.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+markdown==3.3.1; python_version >= "3.6"
+markupsafe==1.1.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
maxminddb-geolite2==2018.703
-mccabe==0.6.1
+maxminddb==2.0.3; python_version >= "3.6"
+mccabe==0.6.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
measurement==3.2.0
-mpmath==1.1.0
+mpmath==1.1.0; python_version >= "3.5"
multidict==4.7.6; python_version >= "3.6"
-mypy==0.740
-mypy-extensions==0.4.3
-nodeenv==1.5.0
-oauthlib==3.1.0
-openpyxl==3.0.5
+mypy-extensions==0.4.3; python_version >= "3.6"
+mypy==0.740; python_version >= "3.5"
+nodeenv==1.5.0; python_full_version >= "3.6.1"
+oauthlib==3.1.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+openpyxl==3.0.5; python_version >= "3.6"
opentracing==2.3.0
-packaging==20.4
-pathspec==0.8.0
-petl==1.6.7
-phonenumberslite==8.12.10
-pillow==7.2.0
-pluggy==0.13.1
-pre-commit==2.7.1
+packaging==20.4; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+pathspec==0.8.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
+petl==1.6.8; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+phonenumberslite==8.12.11
+pillow==7.2.0; python_version >= "3.5"
+pluggy==0.13.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+pre-commit==2.7.1; python_full_version >= "3.6.1"
prices==1.1.0
promise==2.3
-prompt-toolkit==3.0.7
-proto-plus==1.9.1
-protobuf==3.13.0
-psycopg2-binary==2.8.6
+prompt-toolkit==3.0.7; python_full_version >= "3.6.1" and python_version >= "3.6"
+proto-plus==1.9.1; python_version >= "3.6"
+protobuf==3.13.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+psycopg2-binary==2.8.6; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
purl==1.5
-py==1.9.0
-pyasn1==0.4.8
-pyasn1-modules==0.2.8
-pycodestyle==2.6.0
-pycparser==2.20
-pydocstyle==5.1.1
-pyflakes==2.2.0
+py==1.9.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+pyasn1-modules==0.2.8; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0"
+pyasn1==0.4.8; python_version >= "3.5" and python_full_version < "3.0.0" and python_version < "4" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0") or python_version >= "3.5" and python_full_version >= "3.4.0" and python_version < "4" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0")
+pybars3==0.9.7
+pycodestyle==2.6.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+pycparser==2.20; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
+pydocstyle==5.1.1; python_version >= "3.5"
+pyflakes==2.2.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
pyjwt==1.7.1
-pylint==2.6.0
pylint-celery==0.3
pylint-django==2.3.0
pylint-plugin-utils==0.6
-pyparsing==2.4.7
-pyphen==0.9.5
-pytest==6.1.1
+pylint==2.6.0; python_version >= "3.5"
+pymeta3==0.5.1
+pyparsing==2.4.7; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
+pyphen==0.9.5; python_version >= "3.5"
pytest-celery==0.0.0a1
-pytest-cov==2.10.1
-pytest-django==3.10.0
+pytest-cov==2.10.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
pytest-django-queries==1.1.0
-pytest-forked==1.3.0
-pytest-mock==3.3.1
+pytest-django==4.0.0; python_version >= "3.5"
+pytest-forked==1.3.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+pytest-mock==3.3.1; python_version >= "3.5"
pytest-vcr==1.0.2
-pytest-xdist==1.34.0
-python-dateutil==2.8.1
-python-json-logger==2.0.0
-python-magic==0.4.18
+pytest-xdist==1.34.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
+pytest==6.1.1; python_version >= "3.5"
+python-dateutil==2.8.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+python-json-logger==2.0.1; python_version >= "3.4"
python-magic-bin==0.4.14; sys_platform == "win32"
-python-slugify==4.0.1
+python-magic==0.4.18; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
+python-slugify==4.0.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version < "3.9"
pytimeparse==1.1.8
-pytz==2020.1
+pytz==2020.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
pywatchman==1.4.1
-pyyaml==5.3.1
+pyyaml==5.3.1; python_full_version >= "3.6.1" and python_version >= "3.6" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5")
razorpay==1.2.0
-redis==3.5.3
-regex==2020.7.14
-requests==2.24.0
-rsa==4.6; python_version >= "3.5"
+redis==3.5.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
+regex==2020.7.14; python_version >= "3.6"
+requests==2.24.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
+rsa==4.6; python_version >= "3.5" and python_version < "4" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.4.0")
rx==1.6.1
s3transfer==0.3.3
sentry-sdk==0.17.3
singledispatch==3.4.0.3
-six==1.15.0
-smmap==3.0.4
-snowballstemmer==2.0.0
-soupsieve==2.0.1
-sqlparse==0.3.1
-stripe==2.54.0
-sympy==1.6.2
+six==1.15.0; python_full_version >= "3.6.1" and python_version < "3.9" and python_version >= "3.6" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6")
+smmap==3.0.4; python_version >= "3.4" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version < "3.9" and python_version >= "3.4"
+snowballstemmer==2.0.0; python_version >= "3.5"
+soupsieve==2.0.1; python_version >= "3.5"
+sqlparse==0.3.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
+stripe==2.55.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
+sympy==1.6.2; python_version >= "3.5"
text-unidecode==1.3
threadloop==1.0.2
thrift==0.13.0
-tinycss2==1.0.2
-toml==0.10.1
-tornado==6.0.4
-tox==3.20.0
-tqdm==4.50.0
-transifex-client==0.13.12
-typed-ast==1.4.1
-typing-extensions==3.7.4.3
-typing-inspect==0.6.0
-unidecode==1.1.1
-urllib3==1.25.10
-uvicorn==0.11.8
-uvloop==0.14.0; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
-vcrpy==4.1.0
-vine==5.0.0
-virtualenv==20.0.31
-wcwidth==0.2.5
-weasyprint==51
-webencodings==0.5.1
-websockets==8.1
-wrapt==1.12.1
+tinycss2==1.0.2; python_version >= "3.5"
+toml==0.10.1; python_version >= "3.6" and python_full_version >= "3.6.1" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5")
+tornado==6.0.4; python_version >= "3.5"
+tox==3.20.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
+tqdm==4.50.2; (python_version >= "2.6" and python_full_version < "3.0.0") or (python_full_version >= "3.2.0")
+transifex-client==0.13.12; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0" and python_version < "3.9")
+typed-ast==1.4.1; python_version >= "3.6"
+typing-extensions==3.7.4.3; python_version >= "3.6"
+typing-inspect==0.6.0; python_version >= "3.6"
+unidecode==1.1.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
+urllib3==1.25.10; python_version >= "2.7" and python_full_version < "3.0.0" and python_version != "3.4" or python_full_version >= "3.5.0" and python_version < "3.9" and python_version != "3.4"
+uvicorn==0.12.1
+vcrpy==4.1.0; python_version >= "3.5"
+vine==5.0.0; python_version >= "3.6"
+virtualenv==20.0.31; python_full_version >= "3.6.1"
+wcwidth==0.2.5; python_full_version >= "3.6.1" and python_version >= "3.6"
+weasyprint==51; python_version >= "3.5"
+webencodings==0.5.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
+wrapt==1.12.1; python_version >= "3.5"
yarl==1.5.1; python_version >= "3.6"
diff --git a/saleor/account/notifications.py b/saleor/account/notifications.py
index 3cafc1764f..6367bc82ff 100644
--- a/saleor/account/notifications.py
+++ b/saleor/account/notifications.py
@@ -1,6 +1,10 @@
+from urllib.parse import urlencode
+
from django.contrib.auth.tokens import default_token_generator
+from ..core.notifications import get_site_context
from ..core.notify_events import NotifyEventType
+from ..core.utils.url import prepare_url
from .models import User
@@ -19,23 +23,31 @@ def get_default_user_payload(user: User):
def send_user_password_reset_notification(redirect_url, user, manager):
"""Trigger sending a password reset notification for the given user."""
+ token = default_token_generator.make_token(user)
+ params = urlencode({"email": user.email, "token": token})
+ reset_url = prepare_url(params, redirect_url)
+
user_payload = {
"user": get_default_user_payload(user),
"recipient_email": user.email,
- "token": default_token_generator.make_token(user),
- "redirect_url": redirect_url,
+ "token": token,
+ "reset_url": reset_url,
+ **get_site_context(),
}
manager.notify(NotifyEventType.ACCOUNT_PASSWORD_RESET, payload=user_payload)
def send_account_confirmation(user, redirect_url, manager):
"""Trigger sending an account confirmation notification for the given user."""
-
+ token = default_token_generator.make_token(user)
+ params = urlencode({"email": user.email, "token": token})
+ confirm_url = prepare_url(params, redirect_url)
payload = {
"user": get_default_user_payload(user),
"recipient_email": user.email,
"token": default_token_generator.make_token(user),
- "redirect_url": redirect_url,
+ "confirm_url": confirm_url,
+ **get_site_context(),
}
manager.notify(NotifyEventType.ACCOUNT_CONFIRMATION, payload=payload)
@@ -44,13 +56,16 @@ def send_request_user_change_email_notification(
redirect_url, user, new_email, token, manager
):
"""Trigger sending a notification change email for the given user."""
+ params = urlencode({"token": token})
+ redirect_url = prepare_url(params, redirect_url)
payload = {
"user": get_default_user_payload(user),
"recipient_email": new_email,
"old_email": user.email,
"new_email": new_email,
- "redirect_url": redirect_url,
"token": token,
+ "redirect_url": redirect_url,
+ **get_site_context(),
}
manager.notify(NotifyEventType.ACCOUNT_CHANGE_EMAIL_REQUEST, payload=payload)
@@ -60,28 +75,37 @@ def send_user_change_email_notification(recipient_email, user, manager):
payload = {
"user": get_default_user_payload(user),
"recipient_email": recipient_email,
+ **get_site_context(),
}
manager.notify(NotifyEventType.ACCOUNT_CHANGE_EMAIL_CONFIRM, payload=payload)
def send_account_delete_confirmation_notification(redirect_url, user, manager):
"""Trigger sending a account delete notification for the given user."""
+ token = default_token_generator.make_token(user)
+ params = urlencode({"token": token})
+ delete_url = prepare_url(params, redirect_url)
payload = {
"user": get_default_user_payload(user),
"recipient_email": user.email,
- "token": default_token_generator.make_token(user),
- "redirect_url": redirect_url,
+ "token": token,
+ "delete_url": delete_url,
+ **get_site_context(),
}
manager.notify(NotifyEventType.ACCOUNT_DELETE, payload=payload)
def send_set_password_notification(redirect_url, user, manager, staff=False):
"""Trigger sending a set password notification for the given customer/staff."""
+ token = default_token_generator.make_token(user)
+ params = urlencode({"email": user.email, "token": token})
+ password_set_url = prepare_url(params, redirect_url)
user_payload = {
"user": get_default_user_payload(user),
"token": default_token_generator.make_token(user),
- "redirect_url": redirect_url,
"recipient_email": user.email,
+ "password_set_url": password_set_url,
+ **get_site_context(),
}
if staff:
event = NotifyEventType.ACCOUNT_SET_STAFF_PASSWORD
diff --git a/saleor/account/tests/test_notifications.py b/saleor/account/tests/test_notifications.py
index 34c022631e..c6afe5ee0b 100644
--- a/saleor/account/tests/test_notifications.py
+++ b/saleor/account/tests/test_notifications.py
@@ -12,7 +12,7 @@ from ..notifications import get_default_user_payload
@mock.patch("saleor.plugins.manager.PluginsManager.notify")
def test_send_email_request_change(mocked_notify, site_settings, customer_user):
new_email = "[email protected]"
- redirect_url = "localhost"
+ redirect_url = "http://localhost:8000/redirect"
token = "token_example"
manager = get_plugins_manager()
@@ -22,11 +22,13 @@ def test_send_email_request_change(mocked_notify, site_settings, customer_user):
expected_payload = {
"user": get_default_user_payload(customer_user),
- "old_email": customer_user.email,
- "new_email": new_email,
- "redirect_url": redirect_url,
"recipient_email": new_email,
"token": token,
+ "redirect_url": f"{redirect_url}?token={token}",
+ "old_email": customer_user.email,
+ "new_email": new_email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -45,6 +47,8 @@ def test_send_email_changed_notification(mocked_notify, site_settings, customer_
expected_payload = {
"user": get_default_user_payload(customer_user),
"recipient_email": old_email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
diff --git a/saleor/core/emails.py b/saleor/core/emails.py
deleted file mode 100644
index 54303a41a9..0000000000
--- a/saleor/core/emails.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from django.contrib.sites.models import Site
-
-
-def get_email_context():
- site: Site = Site.objects.get_current()
- send_email_kwargs = {"from_email": site.settings.default_from_email}
- email_template_context = {
- "domain": site.domain,
- "site_name": site.name,
- }
- return send_email_kwargs, email_template_context
diff --git a/saleor/core/notifications.py b/saleor/core/notifications.py
new file mode 100644
index 0000000000..75a151f552
--- /dev/null
+++ b/saleor/core/notifications.py
@@ -0,0 +1,10 @@
+from django.contrib.sites.models import Site
+
+
+def get_site_context():
+ site: Site = Site.objects.get_current()
+ site_context = {
+ "domain": site.domain,
+ "site_name": site.name,
+ }
+ return site_context
diff --git a/saleor/core/tests/test_emails.py b/saleor/core/tests/test_emails.py
deleted file mode 100644
index 5798e82e2a..0000000000
--- a/saleor/core/tests/test_emails.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import pytest
-from django.core.exceptions import ImproperlyConfigured
-
-from ..emails import get_email_context
-
-
-def test_get_email_context(site_settings):
- site = site_settings.site
-
- expected_send_kwargs = {"from_email": site_settings.default_from_email}
- proper_context = {
- "domain": site.domain,
- "site_name": site.name,
- }
-
- send_kwargs, received_context = get_email_context()
- assert send_kwargs == expected_send_kwargs
- assert proper_context == received_context
-
-
-def test_email_having_display_name_in_settings(customer_user, site_settings, settings):
- expected_from_email = "Info <[email protected]>"
-
- site_settings.default_mail_sender_name = None
- site_settings.default_mail_sender_address = None
-
- settings.DEFAULT_FROM_EMAIL = expected_from_email
-
- assert site_settings.default_from_email == expected_from_email
-
-
-def test_email_with_email_not_configured_raises_error(settings, site_settings):
- """Ensure an exception is thrown when not default sender is set;
- both missing in the settings.py and in the site settings table.
- """
- site_settings.default_mail_sender_address = None
- settings.DEFAULT_FROM_EMAIL = None
-
- with pytest.raises(ImproperlyConfigured) as exc:
- _ = site_settings.default_from_email
-
- assert exc.value.args == ("No sender email address has been set-up",)
diff --git a/saleor/csv/notifications.py b/saleor/csv/notifications.py
index ba4b7a24da..4e6cb169c9 100644
--- a/saleor/csv/notifications.py
+++ b/saleor/csv/notifications.py
@@ -1,5 +1,6 @@
from typing import TYPE_CHECKING
+from ..core.notifications import get_site_context
from ..core.notify_events import NotifyEventType
from ..core.utils import build_absolute_uri
from ..plugins.manager import get_plugins_manager
@@ -30,10 +31,11 @@ def send_export_download_link_notification(export_file: "ExportFile"):
"export": get_default_export_payload(export_file),
"csv_link": build_absolute_uri(export_file.content_file.url),
"recipient_email": export_file.user.email if export_file.user else None,
+ **get_site_context(),
}
manager = get_plugins_manager()
- manager.notify(NotifyEventType.CSV_PRODUCT_EXPORT_SUCCESS, payload)
+ manager.notify(NotifyEventType.CSV_PRODUCT_EXPORT_SUCCESS, payload) # type: ignore
events.export_file_sent_event(export_file=export_file, user=export_file.user)
@@ -42,7 +44,8 @@ def send_export_failed_info(export_file: "ExportFile"):
payload = {
"export": get_default_export_payload(export_file),
"recipient_email": export_file.user.email if export_file.user else None,
+ **get_site_context(),
}
manager = get_plugins_manager()
- manager.notify(NotifyEventType.CSV_EXPORT_FAILED, payload)
+ manager.notify(NotifyEventType.CSV_EXPORT_FAILED, payload) # type: ignore
events.export_failed_info_sent_event(export_file=export_file, user=export_file.user)
diff --git a/saleor/csv/tests/test_notifications.py b/saleor/csv/tests/test_notifications.py
index 94fe53727c..58036969ed 100644
--- a/saleor/csv/tests/test_notifications.py
+++ b/saleor/csv/tests/test_notifications.py
@@ -3,6 +3,7 @@ from unittest import mock
from django.core.files import File
from freezegun import freeze_time
+from ...core.notifications import get_site_context
from ...core.notify_events import AdminNotifyEvent
from ...core.utils import build_absolute_uri
from .. import ExportEvents, notifications
@@ -30,6 +31,7 @@ def test_send_export_download_link_notification(
"export": get_default_export_payload(user_export_file),
"csv_link": build_absolute_uri(user_export_file.content_file.url),
"recipient_email": user_export_file.user.email,
+ **get_site_context(),
}
mocked_notify.assert_called_once_with(
@@ -62,6 +64,7 @@ def test_send_export_failed_info(
expected_payload = {
"export": get_default_export_payload(user_export_file),
"recipient_email": user_export_file.user.email,
+ **get_site_context(),
}
mocked_notify.assert_called_once_with(
diff --git a/saleor/graphql/account/tests/test_account.py b/saleor/graphql/account/tests/test_account.py
index 9359c50802..1a8d9e8ec7 100644
--- a/saleor/graphql/account/tests/test_account.py
+++ b/saleor/graphql/account/tests/test_account.py
@@ -3,6 +3,7 @@ import uuid
from collections import defaultdict
from datetime import timedelta
from unittest.mock import MagicMock, Mock, patch
+from urllib.parse import urlencode
import graphene
import pytest
@@ -22,6 +23,7 @@ from ....checkout import AddressType
from ....core.jwt import create_token
from ....core.notify_events import NotifyEventType
from ....core.permissions import AccountPermissions, OrderPermissions
+from ....core.utils.url import prepare_url
from ....order.models import FulfillmentStatus, Order
from ....product.tests.utils import create_image
from ...core.utils import str_to_enum
@@ -714,10 +716,11 @@ ACCOUNT_REGISTER_MUTATION = """
def test_customer_register(mocked_notify, mocked_generator, api_client):
mocked_generator.return_value = "token"
+ redirect_url = "http://localhost:3000"
variables = {
"email": email,
"password": "Password",
- "redirectUrl": "http://localhost:3000",
+ "redirectUrl": redirect_url,
}
query = ACCOUNT_REGISTER_MUTATION
mutation_name = "accountRegister"
@@ -727,12 +730,15 @@ def test_customer_register(mocked_notify, mocked_generator, api_client):
new_user = User.objects.get(email=email)
content = get_graphql_content(response)
data = content["data"][mutation_name]
-
+ params = urlencode({"email": email, "token": "token"})
+ confirm_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(new_user),
"token": "token",
- "redirect_url": "http://localhost:3000",
+ "confirm_url": confirm_url,
"recipient_email": new_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
assert not data["accountErrors"]
@@ -831,7 +837,7 @@ def test_customer_create(
last_name = "api_last_name"
note = "Test user"
address_data = convert_dict_keys_to_camel_case(address.as_data())
-
+ redirect_url = "https://www.example.com"
variables = {
"email": email,
"firstName": first_name,
@@ -839,7 +845,7 @@ def test_customer_create(
"note": note,
"shipping": address_data,
"billing": address_data,
- "redirect_url": "https://www.example.com",
+ "redirect_url": redirect_url,
}
response = staff_api_client.post_graphql(
@@ -867,11 +873,15 @@ def test_customer_create(
assert data["user"]["isActive"]
new_user = User.objects.get(email=email)
+ params = urlencode({"email": new_user.email, "token": "token"})
+ password_set_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(new_user),
"token": "token",
- "redirect_url": "https://www.example.com",
+ "password_set_url": password_set_url,
"recipient_email": new_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
NotifyEventType.ACCOUNT_SET_CUSTOMER_PASSWORD, payload=expected_payload
@@ -900,12 +910,16 @@ def test_customer_create_send_password_with_url(
new_customer = User.objects.get(email=email)
assert new_customer
-
+ redirect_url = "https://www.example.com"
+ params = urlencode({"email": email, "token": "token"})
+ password_set_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(new_customer),
- "redirect_url": "https://www.example.com",
+ "password_set_url": password_set_url,
"token": "token",
"recipient_email": new_customer.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
NotifyEventType.ACCOUNT_SET_CUSTOMER_PASSWORD, payload=expected_payload
@@ -1240,18 +1254,23 @@ ACCOUNT_REQUEST_DELETION_MUTATION = """
def test_account_request_deletion(mocked_notify, mocked_token, user_api_client):
mocked_token.return_value = "token"
user = user_api_client.user
- variables = {"redirectUrl": "https://www.example.com"}
+ redirect_url = "https://www.example.com"
+ variables = {"redirectUrl": redirect_url}
response = user_api_client.post_graphql(
ACCOUNT_REQUEST_DELETION_MUTATION, variables
)
content = get_graphql_content(response)
data = content["data"]["accountRequestDeletion"]
assert not data["errors"]
+ params = urlencode({"token": "token"})
+ delete_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(user),
- "redirect_url": "https://www.example.com",
+ "delete_url": delete_url,
"token": "token",
"recipient_email": user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -1264,19 +1283,23 @@ def test_account_request_deletion(mocked_notify, mocked_token, user_api_client):
def test_account_request_deletion_token_validation(mocked_notify, user_api_client):
user = user_api_client.user
token = default_token_generator.make_token(user)
- variables = {"redirectUrl": "https://www.example.com"}
+ redirect_url = "https://www.example.com"
+ variables = {"redirectUrl": redirect_url}
response = user_api_client.post_graphql(
ACCOUNT_REQUEST_DELETION_MUTATION, variables
)
content = get_graphql_content(response)
data = content["data"]["accountRequestDeletion"]
assert not data["errors"]
-
+ params = urlencode({"token": token})
+ delete_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(user),
- "redirect_url": "https://www.example.com",
+ "delete_url": delete_url,
"token": token,
"recipient_email": user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -1318,7 +1341,8 @@ def test_account_request_deletion_all_storefront_hosts_allowed(
user = user_api_client.user
token = default_token_generator.make_token(user)
settings.ALLOWED_CLIENT_HOSTS = ["*"]
- variables = {"redirectUrl": "https://www.test.com"}
+ redirect_url = "https://www.test.com"
+ variables = {"redirectUrl": redirect_url}
response = user_api_client.post_graphql(
ACCOUNT_REQUEST_DELETION_MUTATION, variables
)
@@ -1326,11 +1350,15 @@ def test_account_request_deletion_all_storefront_hosts_allowed(
data = content["data"]["accountRequestDeletion"]
assert not data["errors"]
+ params = urlencode({"token": token})
+ delete_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(user),
- "redirect_url": "https://www.test.com",
+ "delete_url": delete_url,
"token": token,
"recipient_email": user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -1344,18 +1372,23 @@ def test_account_request_deletion_subdomain(mocked_notify, user_api_client, sett
user = user_api_client.user
token = default_token_generator.make_token(user)
settings.ALLOWED_CLIENT_HOSTS = [".example.com"]
- variables = {"redirectUrl": "https://sub.example.com"}
+ redirect_url = "https://sub.example.com"
+ variables = {"redirectUrl": redirect_url}
response = user_api_client.post_graphql(
ACCOUNT_REQUEST_DELETION_MUTATION, variables
)
content = get_graphql_content(response)
data = content["data"]["accountRequestDeletion"]
assert not data["errors"]
+ params = urlencode({"token": token})
+ delete_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(user),
- "redirect_url": "https://sub.example.com",
+ "delete_url": delete_url,
"token": token,
"recipient_email": user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -1545,9 +1578,10 @@ def test_staff_create(
group.permissions.add(permission_manage_products)
staff_user.user_permissions.add(permission_manage_products, permission_manage_users)
+ redirect_url = "https://www.example.com"
variables = {
"email": email,
- "redirect_url": "https://www.example.com",
+ "redirect_url": redirect_url,
"add_groups": [graphene.Node.to_global_id("Group", group.pk)],
}
@@ -1581,11 +1615,15 @@ def test_staff_create(
assert {perm["code"].lower() for perm in groups[0]["permissions"]} == expected_perms
token = default_token_generator.make_token(staff_user)
+ params = urlencode({"email": email, "token": token})
+ password_set_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(staff_user),
- "redirect_url": "https://www.example.com",
+ "password_set_url": password_set_url,
"token": token,
"recipient_email": staff_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -1637,9 +1675,10 @@ def test_staff_create_out_of_scope_group(
group2 = Group.objects.create(name="second group")
group2.permissions.add(permission_manage_staff)
+ redirect_url = "https://www.example.com"
variables = {
"email": email,
- "redirect_url": "https://www.example.com",
+ "redirect_url": redirect_url,
"add_groups": [
graphene.Node.to_global_id("Group", gr.pk) for gr in [group, group2]
],
@@ -1704,13 +1743,16 @@ def test_staff_create_out_of_scope_group(
assert len(groups) == 2
for group in expected_groups:
assert group in groups
-
token = default_token_generator.make_token(staff_user)
+ params = urlencode({"email": email, "token": token})
+ password_set_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(staff_user),
- "redirect_url": "https://www.example.com",
+ "password_set_url": password_set_url,
"token": token,
"recipient_email": staff_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -1724,7 +1766,8 @@ def test_staff_create_send_password_with_url(
mocked_notify, staff_api_client, media_root, permission_manage_staff,
):
- variables = {"email": email, "redirect_url": "https://www.example.com"}
+ redirect_url = "https://www.example.com"
+ variables = {"email": email, "redirect_url": redirect_url}
response = staff_api_client.post_graphql(
STAFF_CREATE_MUTATION, variables, permissions=[permission_manage_staff]
@@ -1737,11 +1780,15 @@ def test_staff_create_send_password_with_url(
assert staff_user.is_staff
token = default_token_generator.make_token(staff_user)
+ params = urlencode({"email": email, "token": token})
+ password_set_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(staff_user),
- "redirect_url": "https://www.example.com",
+ "password_set_url": password_set_url,
"token": token,
"recipient_email": staff_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -3025,17 +3072,22 @@ CONFIRM_ACCOUNT_MUTATION = """
@freeze_time("2018-05-31 12:00:01")
@patch("saleor.plugins.manager.PluginsManager.notify")
def test_account_reset_password(mocked_notify, user_api_client, customer_user):
- variables = {"email": customer_user.email, "redirectUrl": "https://www.example.com"}
+ redirect_url = "https://www.example.com"
+ variables = {"email": customer_user.email, "redirectUrl": redirect_url}
response = user_api_client.post_graphql(REQUEST_PASSWORD_RESET_MUTATION, variables)
content = get_graphql_content(response)
data = content["data"]["requestPasswordReset"]
assert not data["errors"]
token = default_token_generator.make_token(customer_user)
+ params = urlencode({"email": customer_user.email, "token": token})
+ reset_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(customer_user),
- "redirect_url": "https://www.example.com",
+ "reset_url": reset_url,
"token": token,
"recipient_email": customer_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -3108,11 +3160,15 @@ def test_request_password_reset_email_for_staff(mocked_notify, staff_api_client)
data = content["data"]["requestPasswordReset"]
assert not data["errors"]
token = default_token_generator.make_token(staff_api_client.user)
+ params = urlencode({"email": staff_api_client.user.email, "token": token})
+ reset_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(staff_api_client.user),
- "redirect_url": "https://www.example.com",
+ "reset_url": reset_url,
"token": token,
"recipient_email": staff_api_client.user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -3152,18 +3208,23 @@ def test_account_reset_password_all_storefront_hosts_allowed(
mocked_notify, user_api_client, customer_user, settings
):
settings.ALLOWED_CLIENT_HOSTS = ["*"]
- variables = {"email": customer_user.email, "redirectUrl": "https://www.test.com"}
+ redirect_url = "https://www.test.com"
+ variables = {"email": customer_user.email, "redirectUrl": redirect_url}
response = user_api_client.post_graphql(REQUEST_PASSWORD_RESET_MUTATION, variables)
content = get_graphql_content(response)
data = content["data"]["requestPasswordReset"]
assert not data["errors"]
token = default_token_generator.make_token(customer_user)
+ params = urlencode({"email": customer_user.email, "token": token})
+ reset_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(customer_user),
- "redirect_url": "https://www.test.com",
+ "reset_url": reset_url,
"token": token,
"recipient_email": customer_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -3177,18 +3238,23 @@ def test_account_reset_password_subdomain(
mocked_notify, user_api_client, customer_user, settings
):
settings.ALLOWED_CLIENT_HOSTS = [".example.com"]
- variables = {"email": customer_user.email, "redirectUrl": "https://sub.example.com"}
+ redirect_url = "https://sub.example.com"
+ variables = {"email": customer_user.email, "redirectUrl": redirect_url}
response = user_api_client.post_graphql(REQUEST_PASSWORD_RESET_MUTATION, variables)
content = get_graphql_content(response)
data = content["data"]["requestPasswordReset"]
assert not data["errors"]
token = default_token_generator.make_token(customer_user)
+ params = urlencode({"email": customer_user.email, "token": token})
+ reset_url = prepare_url(params, redirect_url)
expected_payload = {
"user": get_default_user_payload(customer_user),
- "redirect_url": "https://sub.example.com",
+ "reset_url": reset_url,
"token": token,
"recipient_email": customer_user.email,
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
diff --git a/saleor/graphql/invoice/tests/test_send_invoice_notification.py b/saleor/graphql/invoice/tests/test_send_invoice_notification.py
index 3f1bbfe9c2..e9aa1a680b 100644
--- a/saleor/graphql/invoice/tests/test_send_invoice_notification.py
+++ b/saleor/graphql/invoice/tests/test_send_invoice_notification.py
@@ -40,6 +40,8 @@ def test_invoice_send_notification(
expected_payload = {
"invoice": get_invoice_payload(invoice),
"recipient_email": invoice.order.get_customer_email(),
+ "domain": "mirumee.com",
+ "site_name": "mirumee.com",
}
mock_notify.assert_called_once_with(NotifyEventType.INVOICE_READY, expected_payload)
diff --git a/saleor/invoice/notifications.py b/saleor/invoice/notifications.py
index 73e246644f..6198b1aec2 100644
--- a/saleor/invoice/notifications.py
+++ b/saleor/invoice/notifications.py
@@ -1,4 +1,5 @@
from ..account.models import User
+from ..core.notifications import get_site_context
from ..core.notify_events import NotifyEventType
from ..invoice import events
from ..plugins.manager import PluginsManager
@@ -18,7 +19,8 @@ def send_invoice(invoice: "Invoice", staff_user: "User", manager: "PluginsManage
payload = {
"invoice": get_invoice_payload(invoice),
"recipient_email": invoice.order.get_customer_email(), # type: ignore
+ **get_site_context(),
}
- manager.notify(NotifyEventType.INVOICE_READY, payload)
+ manager.notify(NotifyEventType.INVOICE_READY, payload) # type: ignore
manager.invoice_sent(invoice, invoice.order.get_customer_email()) # type: ignore
events.invoice_sent_event(user=staff_user, invoice=invoice)
diff --git a/saleor/order/notifications.py b/saleor/order/notifications.py
index 035be791e8..5a27604a8e 100644
--- a/saleor/order/notifications.py
+++ b/saleor/order/notifications.py
@@ -4,6 +4,7 @@ from urllib.parse import urlencode
from django.forms import model_to_dict
from ..account.models import StaffNotificationRecipient
+from ..core.notifications import get_site_context
from ..core.notify_events import NotifyEventType
from ..core.utils.url import prepare_url
from ..product.models import DigitalContentUrl
@@ -116,6 +117,8 @@ def get_default_order_payload(order: "Order", redirect_url: str = ""):
"shipping_method_name": order.shipping_method_name,
}
)
+ if not order.discount_amount:
+ order_payload["discount_amount"] = 0
return order_payload
@@ -145,6 +148,7 @@ def get_default_fulfillment_payload(order, fulfillment):
get_default_fulfillment_line_payload(line) for line in digital_lines
],
"recipient_email": order.get_customer_email(),
+ **get_site_context(),
}
return payload
@@ -159,6 +163,7 @@ def send_order_confirmation(order, redirect_url, user, manager):
payload = {
"order": get_default_order_payload(order, redirect_url),
"recipient_email": order.get_customer_email(),
+ **get_site_context(),
}
manager.notify(NotifyEventType.ORDER_CONFIRMATION, payload)
events.email_sent_event(
@@ -181,6 +186,7 @@ def send_staff_order_confirmation(order, redirect_url, manager):
payload = {
"order": get_default_order_payload(order, redirect_url),
"recipient_list": recipient_emails,
+ **get_site_context(),
}
manager.notify(NotifyEventType.STAFF_ORDER_CONFIRMATION, payload=payload)
@@ -220,6 +226,7 @@ def send_payment_confirmation(order, manager):
"captured_amount": payment.captured_amount,
"currency": payment.currency,
},
+ **get_site_context(),
}
manager.notify(NotifyEventType.ORDER_PAYMENT_CONFIRMATION, payload)
@@ -228,6 +235,7 @@ def send_order_canceled_confirmation(order: "Order", user: Optional["User"], man
payload = {
"order": get_default_order_payload(order),
"recipient_email": order.get_customer_email(),
+ **get_site_context(),
}
manager.notify(NotifyEventType.ORDER_CANCELED, payload)
events.email_sent_event(
@@ -243,6 +251,7 @@ def send_order_refunded_confirmation(
"recipient_email": order.get_customer_email(),
"amount": amount,
"currency": currency,
+ **get_site_context(),
}
manager.notify(NotifyEventType.ORDER_REFUND_CONFIRMATION, payload)
events.email_sent_event(
diff --git a/saleor/order/tests/test_notifications.py b/saleor/order/tests/test_notifications.py
index 2f5cc548d7..896a1c26c5 100644
--- a/saleor/order/tests/test_notifications.py
+++ b/saleor/order/tests/test_notifications.py
@@ -125,6 +125,8 @@ def test_get_default_fulfillment_payload(
"physical_lines": [get_default_fulfillment_line_payload(physical_line)],
"digital_lines": [get_default_fulfillment_line_payload(digital_line)],
"recipient_email": order.get_customer_email(),
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
@@ -143,6 +145,8 @@ def test_send_email_payment_confirmation(mocked_notify, site_settings, payment_d
"captured_amount": payment_dummy.captured_amount,
"currency": payment_dummy.currency,
},
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
notifications.send_payment_confirmation(order, manager)
mocked_notify.assert_called_once_with(
@@ -171,6 +175,8 @@ def test_send_staff_emails(
expected_payload = {
"order": get_default_order_payload(order, redirect_url),
"recipient_list": [staff_notification_recipient.get_email()],
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
NotifyEventType.STAFF_ORDER_CONFIRMATION, payload=expected_payload
@@ -187,6 +193,8 @@ def test_send_email_order_confirmation(mocked_notify, order, site_settings):
expected_payload = {
"order": get_default_order_payload(order, redirect_url),
"recipient_email": order.get_customer_email(),
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
NotifyEventType.ORDER_CONFIRMATION, expected_payload
@@ -223,6 +231,8 @@ def test_send_confirmation_emails_without_addresses_for_payment(
"captured_amount": payment_dummy.captured_amount,
"currency": payment_dummy.currency,
},
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
NotifyEventType.ORDER_PAYMENT_CONFIRMATION, expected_payload
@@ -254,6 +264,8 @@ def test_send_confirmation_emails_without_addresses_for_order(
expected_payload = {
"order": get_default_order_payload(order, redirect_url),
"recipient_email": order.get_customer_email(),
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
@@ -312,6 +324,8 @@ def test_send_email_order_canceled(mocked_notify, order, site_settings):
expected_payload = {
"order": get_default_order_payload(order),
"recipient_email": order.get_customer_email(),
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
NotifyEventType.ORDER_CANCELED, expected_payload
@@ -335,6 +349,8 @@ def test_send_email_order_refunded(mocked_notify, order, site_settings):
"amount": amount,
"currency": order.currency,
"recipient_email": order.get_customer_email(),
+ "site_name": "mirumee.com",
+ "domain": "mirumee.com",
}
mocked_notify.assert_called_once_with(
diff --git a/saleor/plugins/admin_email/constants.py b/saleor/plugins/admin_email/constants.py
new file mode 100644
index 0000000000..9ddfcf24c6
--- /dev/null
+++ b/saleor/plugins/admin_email/constants.py
@@ -0,0 +1,24 @@
+STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD = "staff_order_confirmation_template"
+SET_STAFF_PASSWORD_TEMPLATE_FIELD = "set_staff_password_template"
+CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD = "csv_product_export_success_template"
+CSV_EXPORT_FAILED_TEMPLATE_FIELD = "csv_export_failed_template"
+
+
+SET_STAFF_PASSWORD_DEFAULT_TEMPLATE = "set_password.html"
+CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TEMPLATE = "export_products_file.html"
+CSV_EXPORT_FAILED_TEMPLATE_DEFAULT_TEMPLATE = "export_failed.html"
+STAFF_ORDER_CONFIRMATION_DEFAULT_TEMPLATE = "staff_confirm_order.html"
+
+STAFF_ORDER_CONFIRMATION_TITLE_FIELD = "staff_order_confirmation_title"
+SET_STAFF_PASSWORD_TITLE_FIELD = "set_staff_password_title"
+CSV_PRODUCT_EXPORT_SUCCESS_TITLE_FIELD = "csv_product_export_success_title"
+CSV_EXPORT_FAILED_TITLE_FIELD = "csv_export_failed_title"
+
+
+STAFF_ORDER_CONFIRMATION_DEFAULT_TITLE = "Order {{ order.id }} details"
+SET_STAFF_PASSWORD_DEFAULT_TITLE = "Password reset e-mail"
+CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TITLE = "Export products data"
+CSV_EXPORT_FAILED_DEFAULT_TITLE = "Export products data"
+
+
+PLUGIN_ID = "mirumee.notifications.admin_email"
diff --git a/saleor/plugins/admin_email/emails.py b/saleor/plugins/admin_email/emails.py
deleted file mode 100644
index 5512876105..0000000000
--- a/saleor/plugins/admin_email/emails.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from .tasks import (
- send_email_with_link_to_download_file_task,
- send_export_failed_email_task,
- send_set_staff_password_email_task,
- send_staff_order_confirmation_email_task,
-)
-
-
-def send_set_staff_password_email(payload):
- recipient_email = payload["recipient_email"]
- send_set_staff_password_email_task.delay(
- recipient_email, payload["redirect_url"], payload["token"]
- )
-
-
-def send_csv_product_export_success(payload: dict):
- recipient_email = payload.get("recipient_email")
- if recipient_email:
- send_email_with_link_to_download_file_task.delay(
- recipient_email, payload["csv_link"]
- )
-
-
-def send_staff_order_confirmation(payload: dict):
- send_staff_order_confirmation_email_task.delay(payload)
-
-
-def send_csv_export_failed(payload: dict):
- recipient_email = payload.get("recipient_email")
- if recipient_email:
- send_export_failed_email_task.delay(recipient_email)
diff --git a/saleor/plugins/admin_email/notify_events.py b/saleor/plugins/admin_email/notify_events.py
index d3b85f831d..6c42a80716 100644
--- a/saleor/plugins/admin_email/notify_events.py
+++ b/saleor/plugins/admin_email/notify_events.py
@@ -9,7 +9,7 @@ from .tasks import (
def send_set_staff_password_email(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
send_set_staff_password_email_task.delay(
- recipient_email, payload["redirect_url"], payload["token"], config
+ recipient_email, payload, config,
)
@@ -17,15 +17,16 @@ def send_csv_product_export_success(payload: dict, config: dict):
recipient_email = payload.get("recipient_email")
if recipient_email:
send_email_with_link_to_download_file_task.delay(
- recipient_email, payload["csv_link"], config
+ recipient_email, payload, config
)
def send_staff_order_confirmation(payload: dict, config: dict):
- send_staff_order_confirmation_email_task.delay(payload, config)
+ recipient_list = payload.get("recipient_list")
+ send_staff_order_confirmation_email_task.delay(recipient_list, payload, config)
def send_csv_export_failed(payload: dict, config: dict):
recipient_email = payload.get("recipient_email")
if recipient_email:
- send_export_failed_email_task.delay(recipient_email, config)
+ send_export_failed_email_task.delay(recipient_email, payload, config)
diff --git a/saleor/plugins/admin_email/plugin.py b/saleor/plugins/admin_email/plugin.py
index 6c69822f18..5a43d13c1b 100644
--- a/saleor/plugins/admin_email/plugin.py
+++ b/saleor/plugins/admin_email/plugin.py
@@ -1,17 +1,36 @@
import logging
-from dataclasses import asdict
+from dataclasses import asdict, dataclass
+from typing import Optional
from django.conf import settings
from ...core.notify_events import AdminNotifyEvent, NotifyEventType
-from ..base_plugin import BasePlugin
+from ..base_plugin import BasePlugin, ConfigurationTypeField
from ..email_common import (
DEFAULT_EMAIL_CONFIG_STRUCTURE,
DEFAULT_EMAIL_CONFIGURATION,
+ DEFAULT_EMAIL_VALUE,
+ DEFAULT_SUBJECT_MESSAGE,
+ DEFAULT_TEMPLATE_MESSAGE,
EmailConfig,
validate_default_email_configuration,
)
from ..models import PluginConfiguration
+from .constants import (
+ CSV_EXPORT_FAILED_DEFAULT_TITLE,
+ CSV_EXPORT_FAILED_TEMPLATE_FIELD,
+ CSV_EXPORT_FAILED_TITLE_FIELD,
+ CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TITLE,
+ CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD,
+ CSV_PRODUCT_EXPORT_SUCCESS_TITLE_FIELD,
+ PLUGIN_ID,
+ SET_STAFF_PASSWORD_DEFAULT_TITLE,
+ SET_STAFF_PASSWORD_TEMPLATE_FIELD,
+ SET_STAFF_PASSWORD_TITLE_FIELD,
+ STAFF_ORDER_CONFIRMATION_DEFAULT_TITLE,
+ STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ STAFF_ORDER_CONFIRMATION_TITLE_FIELD,
+)
from .notify_events import (
send_csv_export_failed,
send_csv_product_export_success,
@@ -22,6 +41,25 @@ from .notify_events import (
logger = logging.getLogger(__name__)
+@dataclass
+class AdminTemplate:
+ staff_order_confirmation: Optional[str]
+ set_staff_password_email: Optional[str]
+ csv_product_export_success: Optional[str]
+ csv_export_failed: Optional[str]
+
+
+def get_admin_template_map(templates: AdminTemplate):
+ return {
+ AdminNotifyEvent.STAFF_ORDER_CONFIRMATION: templates.staff_order_confirmation,
+ AdminNotifyEvent.ACCOUNT_SET_STAFF_PASSWORD: templates.set_staff_password_email,
+ AdminNotifyEvent.CSV_PRODUCT_EXPORT_SUCCESS: (
+ templates.csv_product_export_success
+ ),
+ AdminNotifyEvent.CSV_EXPORT_FAILED: templates.csv_export_failed,
+ }
+
+
def get_admin_event_map():
return {
AdminNotifyEvent.STAFF_ORDER_CONFIRMATION: send_staff_order_confirmation,
@@ -32,12 +70,78 @@ def get_admin_event_map():
class AdminEmailPlugin(BasePlugin):
- PLUGIN_ID = "mirumee.notifications.admin_email"
+ PLUGIN_ID = PLUGIN_ID
PLUGIN_NAME = "Admin emails"
DEFAULT_ACTIVE = True
- DEFAULT_CONFIGURATION = [] + DEFAULT_EMAIL_CONFIGURATION # type: ignore
- CONFIG_STRUCTURE = {}
+ DEFAULT_CONFIGURATION = [
+ {
+ "name": STAFF_ORDER_CONFIRMATION_TITLE_FIELD,
+ "value": STAFF_ORDER_CONFIRMATION_DEFAULT_TITLE,
+ },
+ {"name": STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD, "value": DEFAULT_EMAIL_VALUE},
+ {
+ "name": SET_STAFF_PASSWORD_TITLE_FIELD,
+ "value": SET_STAFF_PASSWORD_DEFAULT_TITLE,
+ },
+ {"name": SET_STAFF_PASSWORD_TEMPLATE_FIELD, "value": DEFAULT_EMAIL_VALUE},
+ {
+ "name": CSV_PRODUCT_EXPORT_SUCCESS_TITLE_FIELD,
+ "value": CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TITLE,
+ },
+ {
+ "name": CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": CSV_EXPORT_FAILED_TITLE_FIELD,
+ "value": CSV_EXPORT_FAILED_DEFAULT_TITLE,
+ },
+ {"name": CSV_EXPORT_FAILED_TEMPLATE_FIELD, "value": DEFAULT_EMAIL_VALUE},
+ ] + DEFAULT_EMAIL_CONFIGURATION # type: ignore
+
+ CONFIG_STRUCTURE = {
+ STAFF_ORDER_CONFIRMATION_TITLE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Staff order confirmation subject",
+ },
+ STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Staff order confirmation template",
+ },
+ SET_STAFF_PASSWORD_TITLE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Set staff password subject",
+ },
+ SET_STAFF_PASSWORD_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Set staff password email template",
+ },
+ CSV_PRODUCT_EXPORT_SUCCESS_TITLE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "CSV product export success subject",
+ },
+ CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "CSV product export success template",
+ },
+ CSV_EXPORT_FAILED_TITLE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "CSV export failed template",
+ },
+ CSV_EXPORT_FAILED_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "CSV export failed template",
+ },
+ }
CONFIG_STRUCTURE.update(DEFAULT_EMAIL_CONFIG_STRUCTURE)
def __init__(self, *args, **kwargs):
@@ -51,8 +155,18 @@ class AdminEmailPlugin(BasePlugin):
password=configuration["password"] or settings.EMAIL_HOST_PASSWORD,
sender_name=configuration["sender_name"],
sender_address=configuration["sender_address"],
- use_tls=configuration["use_tls"],
- use_ssl=configuration["use_ssl"],
+ use_tls=configuration["use_tls"] or settings.EMAIL_USE_TLS,
+ use_ssl=configuration["use_ssl"] or settings.EMAIL_USE_SSL,
+ )
+ self.templates = AdminTemplate(
+ csv_export_failed=configuration[CSV_EXPORT_FAILED_TEMPLATE_FIELD],
+ csv_product_export_success=configuration[
+ CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD
+ ],
+ set_staff_password_email=configuration[SET_STAFF_PASSWORD_TEMPLATE_FIELD],
+ staff_order_confirmation=configuration[
+ STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD
+ ],
)
def notify(self, event: NotifyEventType, payload: dict, previous_value):
@@ -64,6 +178,9 @@ class AdminEmailPlugin(BasePlugin):
if event not in event_map:
logger.warning(f"Missing handler for event {event}")
return previous_value
+ template_map = get_admin_template_map(self.templates)
+ if not template_map.get(event):
+ return previous_value
event_map[event](payload, asdict(self.config)) # type: ignore
@classmethod
diff --git a/saleor/plugins/admin_email/tasks.py b/saleor/plugins/admin_email/tasks.py
index 3684c58a82..4779f03747 100644
--- a/saleor/plugins/admin_email/tasks.py
+++ b/saleor/plugins/admin_email/tasks.py
@@ -1,67 +1,100 @@
-from urllib.parse import urlencode
-
from ...celeryconf import app
-from ...core.emails import get_email_context
-from ...core.utils.url import prepare_url
-from ..email_common import EmailConfig, send_email
+from ..email_common import (
+ EmailConfig,
+ get_email_subject,
+ get_email_template_or_default,
+ send_email,
+)
+from . import constants
@app.task
-def send_set_staff_password_email_task(
- recipient_email, redirect_url, token, config: dict
-):
+def send_set_staff_password_email_task(recipient_email, payload, config: dict):
email_config = EmailConfig(**config)
- params = urlencode({"email": recipient_email, "token": token})
- password_set_url = prepare_url(params, redirect_url)
- _send_set_password_email(recipient_email, password_set_url, email_config)
-
-
-def _send_set_password_email(recipient_email, password_set_url, config: EmailConfig):
- send_kwargs, ctx = get_email_context()
- ctx["password_set_url"] = password_set_url
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.SET_STAFF_PASSWORD_TEMPLATE_FIELD,
+ constants.SET_STAFF_PASSWORD_DEFAULT_TEMPLATE,
+ )
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.SET_STAFF_PASSWORD_TITLE_FIELD,
+ constants.SET_STAFF_PASSWORD_DEFAULT_TITLE,
+ )
send_email(
- config=config,
+ config=email_config,
recipient_list=[recipient_email],
- template_name="dashboard/staff/set_password",
- context=ctx,
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
def send_email_with_link_to_download_file_task(
- recipient_email: str, csv_link: str, config: dict
+ recipient_email: str, payload, config: dict
):
email_config = EmailConfig(**config)
- send_kwargs, ctx = get_email_context()
- ctx["csv_link"] = csv_link
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD,
+ constants.CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TEMPLATE,
+ )
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.CSV_PRODUCT_EXPORT_SUCCESS_TITLE_FIELD,
+ constants.CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TITLE,
+ )
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="csv/export_products_file",
- context=ctx,
+ subject=subject,
+ template_str=email_template_str,
+ context=payload,
)
@app.task
-def send_export_failed_email_task(recipient_email: str, config: dict):
+def send_export_failed_email_task(recipient_email: str, payload: dict, config: dict):
email_config = EmailConfig(**config)
- send_kwargs, ctx = get_email_context()
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.CSV_EXPORT_FAILED_TEMPLATE_FIELD,
+ constants.CSV_EXPORT_FAILED_TEMPLATE_DEFAULT_TEMPLATE,
+ )
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.CSV_EXPORT_FAILED_TITLE_FIELD,
+ constants.CSV_EXPORT_FAILED_DEFAULT_TITLE,
+ )
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="csv/export_failed",
- context=ctx,
+ subject=subject,
+ template_str=email_template_str,
+ context=payload,
)
@app.task
-def send_staff_order_confirmation_email_task(payload, config: dict):
+def send_staff_order_confirmation_email_task(
+ recipient_list: str, payload: dict, config: dict
+):
email_config = EmailConfig(**config)
- send_kwargs, ctx = get_email_context()
- payload.update(ctx)
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ constants.STAFF_ORDER_CONFIRMATION_DEFAULT_TEMPLATE,
+ )
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.STAFF_ORDER_CONFIRMATION_TITLE_FIELD,
+ constants.STAFF_ORDER_CONFIRMATION_DEFAULT_TITLE,
+ )
send_email(
config=email_config,
- recipient_list=payload["recipient_list"],
- template_name="order/staff_confirm_order",
- context=ctx,
+ recipient_list=recipient_list,
+ subject=subject,
+ template_str=email_template_str,
+ context=payload,
)
diff --git a/saleor/plugins/admin_email/tests/conftest.py b/saleor/plugins/admin_email/tests/conftest.py
index d52e7525ad..c08571fceb 100644
--- a/saleor/plugins/admin_email/tests/conftest.py
+++ b/saleor/plugins/admin_email/tests/conftest.py
@@ -2,10 +2,37 @@ from unittest.mock import patch
import pytest
+from ...email_common import DEFAULT_EMAIL_VALUE
from ...manager import get_plugins_manager
+from ..constants import (
+ CSV_EXPORT_FAILED_DEFAULT_TITLE,
+ CSV_EXPORT_FAILED_TEMPLATE_FIELD,
+ CSV_EXPORT_FAILED_TITLE_FIELD,
+ CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TITLE,
+ CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD,
+ CSV_PRODUCT_EXPORT_SUCCESS_TITLE_FIELD,
+ SET_STAFF_PASSWORD_DEFAULT_TITLE,
+ SET_STAFF_PASSWORD_TEMPLATE_FIELD,
+ SET_STAFF_PASSWORD_TITLE_FIELD,
+ STAFF_ORDER_CONFIRMATION_DEFAULT_TITLE,
+ STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ STAFF_ORDER_CONFIRMATION_TITLE_FIELD,
+)
from ..plugin import AdminEmailPlugin
+def email_dict_config():
+ return {
+ "host": "localhost",
+ "port": "1025",
+ "username": None,
+ "password": None,
+ "use_ssl": False,
+ "use_tls": False,
+ }
+
+
@pytest.fixture
def admin_email_plugin(settings):
def fun(
@@ -18,6 +45,14 @@ def admin_email_plugin(settings):
use_tls=False,
use_ssl=False,
active=True,
+ set_staff_password_template=DEFAULT_EMAIL_VALUE,
+ staff_order_confirmation=DEFAULT_EMAIL_VALUE,
+ csv_product_export=DEFAULT_EMAIL_VALUE,
+ csv_product_export_failed=DEFAULT_EMAIL_VALUE,
+ set_staff_password_title=STAFF_ORDER_CONFIRMATION_DEFAULT_TITLE,
+ staff_order_confirmation_title=SET_STAFF_PASSWORD_DEFAULT_TITLE,
+ csv_product_export_title=CSV_PRODUCT_EXPORT_SUCCESS_DEFAULT_TITLE,
+ csv_product_export_failed_title=CSV_EXPORT_FAILED_DEFAULT_TITLE,
):
settings.PLUGINS = ["saleor.plugins.admin_email.plugin.AdminEmailPlugin"]
manager = get_plugins_manager()
@@ -37,6 +72,38 @@ def admin_email_plugin(settings):
{"name": "sender_address", "value": sender_address},
{"name": "use_tls", "value": use_tls},
{"name": "use_ssl", "value": use_ssl},
+ {
+ "name": SET_STAFF_PASSWORD_TEMPLATE_FIELD,
+ "value": set_staff_password_template,
+ },
+ {
+ "name": STAFF_ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ "value": staff_order_confirmation,
+ },
+ {
+ "name": CSV_PRODUCT_EXPORT_SUCCESS_TEMPLATE_FIELD,
+ "value": csv_product_export,
+ },
+ {
+ "name": CSV_EXPORT_FAILED_TEMPLATE_FIELD,
+ "value": csv_product_export_failed,
+ },
+ {
+ "name": STAFF_ORDER_CONFIRMATION_TITLE_FIELD,
+ "value": staff_order_confirmation_title,
+ },
+ {
+ "name": SET_STAFF_PASSWORD_TITLE_FIELD,
+ "value": set_staff_password_title,
+ },
+ {
+ "name": CSV_PRODUCT_EXPORT_SUCCESS_TITLE_FIELD,
+ "value": csv_product_export_title,
+ },
+ {
+ "name": CSV_EXPORT_FAILED_TITLE_FIELD,
+ "value": csv_product_export_failed_title,
+ },
],
},
)
diff --git a/saleor/plugins/admin_email/tests/test_csv_emails.py b/saleor/plugins/admin_email/tests/test_csv_emails.py
deleted file mode 100644
index 754ec83cdf..0000000000
--- a/saleor/plugins/admin_email/tests/test_csv_emails.py
+++ /dev/null
@@ -1,91 +0,0 @@
-from unittest import mock
-
-import pytest
-
-
[email protected]("saleor.csv.emails.send_templated_mail")
-def test_send_email_with_link_to_download_file(
- mocked_templated_email, site_settings, user_export_file, tmpdir, media_root
-):
- # given
- file_mock = mock.MagicMock(spec=File) # noqa: F821
- file_mock.name = "temp_file.csv"
-
- user_export_file.content_file = file_mock
- user_export_file.save()
-
- # when
- emails.send_email_with_link_to_download_file_task(user_export_file) # noqa: F821
-
- # then
- template = emails.EXPORT_TEMPLATES["export_products_success"] # noqa: F821
- ctx = {
- "csv_link": f"http://mirumee.com/media/export_files/{file_mock.name}",
- "domain": "mirumee.com",
- "site_name": "mirumee.com",
- }
- recipients = [user_export_file.user.email]
- expected_call_kwargs = {
- "context": ctx,
- "from_email": site_settings.default_from_email,
- "template_name": template,
- }
-
- mocked_templated_email.assert_called_once_with(
- recipient_list=recipients, **expected_call_kwargs
- )
-
- # Render the email to ensure there is no error
- email_connection = get_connection() # noqa: F821
- email_connection.get_email_message(to=recipients, **expected_call_kwargs)
-
- assert ExportEvent.objects.filter( # noqa: F821
- export_file=user_export_file,
- user=user_export_file.user,
- type=ExportEvents.EXPORTED_FILE_SENT, # noqa: F821
- ).exists()
-
-
[email protected]("saleor.csv.emails.send_templated_mail")
-def test_send_export_failed_info(
- mocked_templated_email, site_settings, user_export_file, tmpdir, media_root
-):
- # given
- file_mock = mock.MagicMock(spec=File) # noqa: F821
- file_mock.name = "temp_file.csv"
-
- user_export_file.content_file = file_mock
- user_export_file.save()
- expected_recipients = [user_export_file.user.email]
-
- # when
- emails.send_export_failed_email_task(user_export_file) # noqa: F821
-
- # then
- template = emails.EXPORT_TEMPLATES["export_failed"] # noqa: F821
- ctx = {
- "domain": "mirumee.com",
- "site_name": "mirumee.com",
- }
-
- expected_call_kwargs = {
- "context": ctx,
- "from_email": site_settings.default_from_email,
- "template_name": template,
- }
-
- mocked_templated_email.assert_called_once_with(
- recipient_list=expected_recipients, **expected_call_kwargs
- )
-
- # Render the email to ensure there is no error
- email_connection = get_connection() # noqa: F821
- email_connection.get_email_message(to=expected_recipients, **expected_call_kwargs)
-
- assert ExportEvent.objects.filter( # noqa: F821
- export_file=user_export_file,
- user=user_export_file.user,
- type=ExportEvents.EXPORT_FAILED_INFO_SENT, # noqa: F821
- )
diff --git a/saleor/plugins/admin_email/tests/test_notify_events.py b/saleor/plugins/admin_email/tests/test_notify_events.py
new file mode 100644
index 0000000000..474d6342a4
--- /dev/null
+++ b/saleor/plugins/admin_email/tests/test_notify_events.py
@@ -0,0 +1,73 @@
+from unittest import mock
+
+from saleor.order.notifications import get_default_order_payload
+
+from ..notify_events import (
+ send_csv_export_failed,
+ send_csv_product_export_success,
+ send_set_staff_password_email,
+ send_staff_order_confirmation,
+)
+
+
+ "saleor.plugins.admin_email.notify_events.send_set_staff_password_email_task.delay"
+)
+def test_send_set_staff_password_email(mocked_email_task):
+ payload = {
+ "recipient_email": "[email protected]",
+ "redirect_url": "http://127.0.0.1:8000/redirect",
+ "token": "token123",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_set_staff_password_email(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.admin_email.notify_events."
+ "send_email_with_link_to_download_file_task.delay"
+)
+def test_send_csv_product_export_success(mocked_email_task):
+ payload = {
+ "recipient_email": "[email protected]",
+ "csv_link": "http://127.0.0.1:8000/download/csv",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_csv_product_export_success(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.admin_email.notify_events."
+ "send_staff_order_confirmation_email_task.delay"
+)
+def test_send_staff_order_confirmation(mocked_email_task, order):
+ order_payload = get_default_order_payload(order)
+ payload = {
+ "order": order_payload,
+ "recipient_list": ["[email protected]"],
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_staff_order_confirmation(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_list"], payload, config)
+
+
+ "saleor.plugins.admin_email.notify_events." "send_export_failed_email_task.delay"
+)
+def test_send_csv_export_failed(mocked_email_task):
+ payload = {
+ "recipient_email": "[email protected]",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_csv_export_failed(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
diff --git a/saleor/plugins/admin_email/tests/test_tasks.py b/saleor/plugins/admin_email/tests/test_tasks.py
new file mode 100644
index 0000000000..2625d22caf
--- /dev/null
+++ b/saleor/plugins/admin_email/tests/test_tasks.py
@@ -0,0 +1,227 @@
+from unittest import mock
+
+from ....account.notifications import get_default_user_payload
+from ....csv.notifications import get_default_export_payload
+from ....order.notifications import get_default_order_payload
+from ...email_common import EmailConfig
+from ..tasks import (
+ send_email_with_link_to_download_file_task,
+ send_export_failed_email_task,
+ send_set_staff_password_email_task,
+ send_staff_order_confirmation_email_task,
+)
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_set_staff_password_email_task_default_template(
+ mocked_send_mail, email_dict_config, customer_user
+):
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "password_set_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_set_staff_password_email_task(recipient_email, payload, email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.admin_email.tasks.send_email")
+def test_send_set_staff_password_email_task_custom_template(
+ mocked_send_email, email_dict_config, admin_email_plugin, customer_user
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ admin_email_plugin(
+ set_staff_password_template=expected_template_str,
+ set_staff_password_title=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "password_set_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_set_staff_password_email_task(recipient_email, payload, email_dict_config)
+
+ email_config = EmailConfig(**email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_email_with_link_to_download_file_task_default_template(
+ mocked_send_mail, email_dict_config, customer_user, user_export_file
+):
+ recipient_email = "[email protected]"
+ csv_url = "http://127.0.0.1:8000"
+
+ payload = {
+ "export": get_default_export_payload(user_export_file),
+ "csv_link": csv_url,
+ "recipient_email": user_export_file.user.email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ send_email_with_link_to_download_file_task(
+ recipient_email, payload, email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.admin_email.tasks.send_email")
+def test_send_email_with_link_to_download_file_task_custom_template(
+ mocked_send_email, email_dict_config, admin_email_plugin, user_export_file
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ admin_email_plugin(
+ csv_product_export=expected_template_str,
+ csv_product_export_title=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ csv_url = "http://127.0.0.1:8000"
+
+ payload = {
+ "export": get_default_export_payload(user_export_file),
+ "csv_link": csv_url,
+ "recipient_email": user_export_file.user.email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_email_with_link_to_download_file_task(
+ recipient_email, payload, email_dict_config
+ )
+
+ email_config = EmailConfig(**email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_export_failed_email_task_default_template(
+ mocked_send_mail, email_dict_config, user_export_file
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "export": get_default_export_payload(user_export_file),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_export_failed_email_task(recipient_email, payload, email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.admin_email.tasks.send_email")
+def test_send_export_failed_email_task_custom_template(
+ mocked_send_email, email_dict_config, admin_email_plugin, user_export_file
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ admin_email_plugin(
+ csv_product_export_failed=expected_template_str,
+ csv_product_export_failed_title=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "export": get_default_export_payload(user_export_file),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_export_failed_email_task(recipient_email, payload, email_dict_config)
+
+ email_config = EmailConfig(**email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_staff_order_confirmation_email_task_default_template(
+ mocked_send_mail, email_dict_config, order_with_lines
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(
+ order_with_lines, "http://localhost:8000/redirect"
+ ),
+ "recipient_list": [recipient_email],
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_staff_order_confirmation_email_task(
+ [recipient_email], payload, email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.admin_email.tasks.send_email")
+def test_send_staff_order_confirmation_email_task_custom_template(
+ mocked_send_email, order_with_lines, email_dict_config, admin_email_plugin
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ admin_email_plugin(
+ staff_order_confirmation=expected_template_str,
+ staff_order_confirmation_title=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(
+ order_with_lines, "http://localhost:8000/redirect"
+ ),
+ "recipient_list": [recipient_email],
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_staff_order_confirmation_email_task(
+ [recipient_email], payload, email_dict_config
+ )
+
+ email_config = EmailConfig(**email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
diff --git a/saleor/plugins/email_common.py b/saleor/plugins/email_common.py
index 76813a4ce8..24a4d19a2b 100644
--- a/saleor/plugins/email_common.py
+++ b/saleor/plugins/email_common.py
@@ -1,13 +1,22 @@
import logging
+import os
+import re
from dataclasses import dataclass
+from decimal import Decimal, InvalidOperation
from email.headerregistry import Address
from typing import Optional
+import html2text
+import i18naddress
+import pybars
+from babel.numbers import format_currency
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
+from django.core.mail import send_mail
from django.core.mail.backends.smtp import EmailBackend
-from templated_email import TemplateBackend
+from django.utils.translation import pgettext
+from django_prices.utils.locale import get_locale_data
from .base_plugin import ConfigurationTypeField
from .error_codes import PluginErrorCode
@@ -16,6 +25,15 @@ from .models import PluginConfiguration
logger = logging.getLogger(__name__)
+DEFAULT_TEMPLATE_MESSAGE = (
+ "An HTML template built with handlebars template language. Leave it "
+ "blank if you don't want to send an email for this action. Use the "
+ "default Saleor template by providing DEFAULT value."
+)
+DEFAULT_SUBJECT_MESSAGE = "An email subject built with handlebars template language."
+DEFAULT_EMAIL_VALUE = "DEFAULT"
+
+
@dataclass
class EmailConfig:
host: Optional[str] = None
@@ -87,7 +105,8 @@ DEFAULT_EMAIL_CONFIG_STRUCTURE = {
"Whether to use a TLS (secure) connection when talking to the SMTP "
"server. This is used for explicit TLS connections, generally on port "
"587. Use TLS/Use SSL are mutually exclusive, so only set one of those"
- " settings to True."
+ " settings to True. Leave it blank if you want to use system environment"
+ " - EMAIL_USE_TLS"
),
"label": "Use TLS",
},
@@ -98,19 +117,62 @@ DEFAULT_EMAIL_CONFIG_STRUCTURE = {
"the SMTP server. In most email documentation this type of TLS "
"connection is referred to as SSL. It is generally used on port 465. "
"Use TLS/Use SSL are mutually exclusive, so only set one of those"
- " settings to True."
+ " settings to True. Leave it blank if you want to use system environment"
+ " - EMAIL_USE_SSL"
),
"label": "Use SSL",
},
}
-def send_email(config: EmailConfig, recipient_list, template_name, context):
+def block_trans(this, options, *args, **kwargs):
+ # TODO add translation here
+ return options["fn"](this)
+
+
+def format_address(this, address, include_phone=True, inline=False, latin=False):
+ address["name"] = pgettext("Address data", "%(first_name)s %(last_name)s") % address
+ address["country_code"] = address["country"]
+ address["street_address"] = pgettext(
+ "Address data", "%(street_address_1)s\n" "%(street_address_2)s" % address
+ )
+ address_lines = i18naddress.format_address(address, latin).split("\n")
+ phone = address.get("phone")
+ if include_phone and phone:
+ address_lines.append(phone)
+ if inline is True:
+ return pybars.strlist([", ".join(address_lines)])
+ return pybars.strlist(["<br>".join(address_lines)])
+
+
+def price(this, net_amount, gross_amount, currency, display_gross=False):
+ amount = net_amount
+ if display_gross:
+ amount = gross_amount
+ try:
+ value = Decimal(amount)
+ except (TypeError, InvalidOperation):
+ return ""
+
+ locale, locale_code = get_locale_data()
+ pattern = locale.currency_formats.get("standard").pattern
+
+ pattern = re.sub("(\xa4+)", '<span class="currency">\\1</span>', pattern)
+
+ formatted_price = format_currency(
+ value, currency, format=pattern, locale=locale_code
+ )
+ return pybars.strlist([formatted_price])
+
+
+def send_email(
+ config: EmailConfig, recipient_list, context, subject="", template_str=""
+):
sender_name = config.sender_name
sender_address = config.sender_address
if not sender_address or not sender_name:
# TODO when we deprecate the default mail config from Site, we can drop this if
- # and require the sender's data as a plugin input.
+ # and require the sender's data as a plugin input or take it from settings file.
site = Site.objects.get_current()
sender_name = sender_name or site.settings.default_mail_sender_name
sender_address = sender_address or site.settings.default_mail_sender_address
@@ -125,24 +187,24 @@ def send_email(config: EmailConfig, recipient_list, template_name, context):
use_ssl=config.use_ssl,
use_tls=config.use_tls,
)
- template_backend = TemplateBackend()
- template_backend.send(
- from_email=from_email,
+ compiler = pybars.Compiler()
+ template = compiler.compile(template_str)
+ subject_template = compiler.compile(subject)
+ helpers = {
+ "blocktrans": block_trans,
+ "format_address": format_address,
+ "price": price,
+ }
+ message = template(context, helpers=helpers)
+ subject_message = subject_template(context, helpers)
+ send_mail(
+ subject_message,
+ html2text.html2text(message),
+ from_email,
+ recipient_list,
+ html_message=message,
connection=email_backend,
- template_name=template_name,
- recipient_list=recipient_list,
- context=context,
)
- # TODO the template mail will be replaced by the send_mail whith rendered msg by
- # staff user
-
- # send_mail(
- # subject,
- # message,
- # from_email,
- # recipient_list,
- # connection=email_backend
- # )
def validate_email_config(config: EmailConfig):
@@ -187,7 +249,16 @@ def validate_default_email_configuration(plugin_configuration: "PluginConfigurat
),
}
)
- config = EmailConfig(**configuration)
+ config = EmailConfig(
+ host=configuration["host"] or settings.EMAIL_HOST,
+ port=configuration["port"] or settings.EMAIL_PORT,
+ username=configuration["username"] or settings.EMAIL_HOST_USER,
+ password=configuration["password"] or settings.EMAIL_HOST_PASSWORD,
+ sender_name=configuration["sender_name"],
+ sender_address=configuration["sender_address"],
+ use_tls=configuration["use_tls"],
+ use_ssl=configuration["use_ssl"],
+ )
try:
validate_email_config(config)
except Exception as e:
@@ -204,3 +275,59 @@ def validate_default_email_configuration(plugin_configuration: "PluginConfigurat
for c in configuration.keys()
}
)
+
+
+def get_email_template(
+ plugin_identifier: str, template_field_name: str, default: str
+) -> str:
+ """Get email template from plugin configuration."""
+ plugin_configuration = PluginConfiguration.objects.filter(
+ identifier=plugin_identifier
+ ).first()
+ if not plugin_configuration:
+ return default
+ configuration = plugin_configuration.configuration
+ for config_field in configuration:
+ if config_field["name"] == template_field_name:
+ return config_field["value"] or default
+ return default
+
+
+def get_email_template_or_default(
+ plugin_identifier: str, template_field_name: str, default_template_file_name: str
+):
+ email_template_str = get_email_template(
+ plugin_identifier=plugin_identifier,
+ template_field_name=template_field_name,
+ default=DEFAULT_EMAIL_VALUE,
+ )
+ if email_template_str == DEFAULT_EMAIL_VALUE:
+ email_template_str = get_default_email_template(default_template_file_name)
+ return email_template_str
+
+
+def get_email_subject(
+ plugin_identifier: str, subject_field_name: str, default: str
+) -> str:
+ """Get email subject from plugin configuration."""
+ plugin_configuration = PluginConfiguration.objects.filter(
+ identifier=plugin_identifier
+ ).first()
+ if not plugin_configuration:
+ return default
+ configuration = plugin_configuration.configuration
+ for config_field in configuration:
+ if config_field["name"] == subject_field_name:
+ return config_field["value"] or default
+ return default
+
+
+def get_default_email_template(template_file_name: str) -> str:
+ """Get default template."""
+ default_template_path = os.path.join(
+ settings.TEMPLATES_DIR, "templated_email/compiled/"
+ )
+ default_template_path = os.path.join(default_template_path, template_file_name)
+ with open(default_template_path) as f:
+ template_str = f.read()
+ return template_str
diff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.py
index a7b9271437..572a52ac7e 100644
--- a/saleor/plugins/manager.py
+++ b/saleor/plugins/manager.py
@@ -19,7 +19,6 @@ from .models import PluginConfiguration
if TYPE_CHECKING:
# flake8: noqa
from .base_plugin import BasePlugin
- from .notify_events import NotifyEvent
from ..checkout.models import Checkout, CheckoutLine
from ..product.models import Product, ProductType
from ..account.models import Address, User
@@ -32,6 +31,7 @@ if TYPE_CHECKING:
CustomerSource,
PaymentGateway,
)
+NotifyEventTypeChoice = str
class PluginsManager(PaymentInterface):
@@ -514,7 +514,7 @@ class PluginsManager(PaymentInterface):
plugin, "webhook", default_value, request, path
)
- def notify(self, event: "NotifyEvent", payload: dict):
+ def notify(self, event: "NotifyEventTypeChoice", payload: dict):
default_value = None
return self.__run_method_on_plugins("notify", default_value, event, payload)
diff --git a/saleor/plugins/user_email/constants.py b/saleor/plugins/user_email/constants.py
new file mode 100644
index 0000000000..c67a5d7e31
--- /dev/null
+++ b/saleor/plugins/user_email/constants.py
@@ -0,0 +1,63 @@
+PLUGIN_ID = "mirumee.notifications.user_email"
+
+
+ACCOUNT_CONFIRMATION_TEMPLATE_FIELD = "account_confirmation"
+ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD = "account_set_customer_password"
+ACCOUNT_DELETE_TEMPLATE_FIELD = "account_delete"
+ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD = "account_change_email_confirm"
+ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD = "account_change_email_request"
+ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD = "account_password_reset"
+INVOICE_READY_TEMPLATE_FIELD = "invoice_ready"
+ORDER_CONFIRMATION_TEMPLATE_FIELD = "order_confirmation"
+ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD = "order_fulfillment_confirmation"
+ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD = "order_fulfillment_update"
+ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD = "order_payment_confirmation"
+ORDER_CANCELED_TEMPLATE_FIELD = "order_canceled"
+ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD = "order_refund_confirmation"
+
+
+ACCOUNT_CONFIRMATION_DEFAULT_TEMPLATE = "confirm.html"
+ACCOUNT_SET_CUSTOMER_PASSWORD_DEFAULT_TEMPLATE = "set_customer_password.html"
+ACCOUNT_DELETE_DEFAULT_TEMPLATE = "account_delete.html"
+ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_TEMPLATE = "email_changed_notification.html"
+ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_TEMPLATE = "request_email_change.html"
+ACCOUNT_PASSWORD_RESET_DEFAULT_TEMPLATE = "password_reset.html"
+INVOICE_READY_DEFAULT_TEMPLATE = "send_invoice.html"
+ORDER_CONFIRMATION_DEFAULT_TEMPLATE = "confirm_order.html"
+ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_TEMPLATE = "confirm_fulfillment.html"
+ORDER_FULFILLMENT_UPDATE_DEFAULT_TEMPLATE = "update_fulfillment.html"
+ORDER_PAYMENT_CONFIRMATION_DEFAULT_TEMPLATE = "confirm_payment.html"
+ORDER_CANCELED_DEFAULT_TEMPLATE = "order_cancel.html"
+ORDER_REFUND_CONFIRMATION_DEFAULT_TEMPLATE = "order_refund.html"
+
+
+ACCOUNT_CONFIRMATION_SUBJECT_FIELD = "account_confirmation_subject"
+ACCOUNT_SET_CUSTOMER_PASSWORD_SUBJECT_FIELD = "account_set_customer_password_subject"
+ACCOUNT_DELETE_SUBJECT_FIELD = "account_delete_subject"
+ACCOUNT_CHANGE_EMAIL_CONFIRM_SUBJECT_FIELD = "account_change_email_confirm_subject"
+ACCOUNT_CHANGE_EMAIL_REQUEST_SUBJECT_FIELD = "account_change_email_request_subject"
+ACCOUNT_PASSWORD_RESET_SUBJECT_FIELD = "account_password_reset_subject"
+INVOICE_READY_SUBJECT_FIELD = "invoice_ready_subject"
+ORDER_CONFIRMATION_SUBJECT_FIELD = "order_confirmation_subject"
+ORDER_FULFILLMENT_CONFIRMATION_SUBJECT_FIELD = "order_fulfillment_confirmation_subject"
+ORDER_FULFILLMENT_UPDATE_SUBJECT_FIELD = "order_fulfillment_update_subject"
+ORDER_PAYMENT_CONFIRMATION_SUBJECT_FIELD = "order_payment_confirmation_subject"
+ORDER_CANCELED_SUBJECT_FIELD = "order_canceled_subject"
+ORDER_REFUND_CONFIRMATION_SUBJECT_FIELD = "order_refund_confirmation_subject"
+
+
+ACCOUNT_CONFIRMATION_DEFAULT_SUBJECT = "Account confirmation e-mail"
+ACCOUNT_SET_CUSTOMER_PASSWORD_DEFAULT_SUBJECT = "Hello from {{ site_name }}!"
+ACCOUNT_DELETE_DEFAULT_SUBJECT = "Delete your account"
+ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_SUBJECT = "Email change e-mail"
+ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_SUBJECT = "Email change e-mail"
+ACCOUNT_PASSWORD_RESET_DEFAULT_SUBJECT = "Password reset e-mail"
+INVOICE_READY_DEFAULT_SUBJECT = "Invoice"
+ORDER_CONFIRMATION_DEFAULT_SUBJECT = "Order #{{ order.id }} details"
+ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_SUBJECT = (
+ "Your order {{ id }} has been fulfilled"
+)
+ORDER_FULFILLMENT_UPDATE_DEFAULT_SUBJECT = "Shipping update for order {{ order.id }}"
+ORDER_PAYMENT_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.id }} payment details"
+ORDER_CANCELED_DEFAULT_SUBJECT = "Order {{ order.id }} canceled"
+ORDER_REFUND_CONFIRMATION_DEFAULT_SUBJECT = "Order {{ order.id }} refunded"
diff --git a/saleor/plugins/user_email/emails.py b/saleor/plugins/user_email/emails.py
deleted file mode 100644
index 5d4446f785..0000000000
--- a/saleor/plugins/user_email/emails.py
+++ /dev/null
@@ -1,94 +0,0 @@
-from .tasks import (
- send_account_confirmation_email_task,
- send_account_delete_confirmation_email_task,
- send_fulfillment_confirmation_email_task,
- send_fulfillment_update_email_task,
- send_invoice_email_task,
- send_order_canceled_email_task,
- send_order_confirmation_email_task,
- send_order_refund_email_task,
- send_password_reset_email_task,
- send_payment_confirmation_email_task,
- send_request_email_change_email_task,
- send_set_user_password_email_task,
- send_user_change_email_notification_task,
-)
-
-
-def send_account_password_reset_event(payload):
- recipient_email = payload["recipient_email"]
- user_payload = payload.get("user")
- send_password_reset_email_task.delay(
- recipient_email, payload["redirect_url"], user_payload["id"], payload["token"],
- )
-
-
-def send_account_confirmation(payload):
- recipient_email = payload["recipient_email"]
- send_account_confirmation_email_task.delay(
- recipient_email, payload["token"], payload["redirect_url"]
- )
-
-
-def send_account_change_email_request(payload):
- recipient_email = payload["recipient_email"]
- user_payload = payload.get("user")
- send_request_email_change_email_task.delay(
- recipient_email,
- payload["old_email"],
- payload["redirect_url"],
- user_payload["id"],
- payload["token"],
- )
-
-
-def send_account_change_email_confirm(payload):
- recipient_email = payload["recipient_email"]
- send_user_change_email_notification_task.delay(recipient_email)
-
-
-def send_account_delete(payload):
- recipient_email = payload["recipient_email"]
- send_account_delete_confirmation_email_task.delay(
- recipient_email, payload["redirect_url"], payload["token"]
- )
-
-
-def send_account_set_customer_password(payload):
- recipient_email = payload["recipient_email"]
- send_set_user_password_email_task.delay(
- recipient_email, payload["redirect_url"], payload["token"]
- )
-
-
-def send_invoice(payload):
- recipient_email = payload["recipient_email"]
- send_invoice_email_task.delay(
- recipient_email=recipient_email,
- invoice_number=payload["number"],
- invoice_download_url=payload["download_url"],
- )
-
-
-def send_order_confirmation(payload):
- send_order_confirmation_email_task(payload=payload)
-
-
-def send_fulfillment_confirmation(payload):
- send_fulfillment_confirmation_email_task(payload)
-
-
-def send_fulfillment_update(payload):
- send_fulfillment_update_email_task(payload)
-
-
-def send_payment_confirmation(payload):
- send_payment_confirmation_email_task(payload)
-
-
-def send_order_canceled(payload):
- send_order_canceled_email_task.delay(payload)
-
-
-def send_order_refund(payload):
- send_order_refund_email_task.delay(payload)
diff --git a/saleor/plugins/user_email/notify_events.py b/saleor/plugins/user_email/notify_events.py
index ffaabb58a5..bfdbdaa720 100644
--- a/saleor/plugins/user_email/notify_events.py
+++ b/saleor/plugins/user_email/notify_events.py
@@ -17,84 +17,70 @@ from .tasks import (
def send_account_password_reset_event(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
- user_payload = payload["user"]
send_password_reset_email_task.delay(
- recipient_email,
- payload["redirect_url"],
- user_payload["id"],
- payload["token"],
- config,
+ recipient_email, payload, config,
)
def send_account_confirmation(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
- send_account_confirmation_email_task.delay(
- recipient_email, payload["token"], payload["redirect_url"], config
- )
+ send_account_confirmation_email_task.delay(recipient_email, payload, config)
def send_account_change_email_request(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
- user_payload = payload["user"]
send_request_email_change_email_task.delay(
- recipient_email,
- payload["old_email"],
- payload["redirect_url"],
- user_payload["id"],
- payload["token"],
- config,
+ recipient_email, payload, config,
)
def send_account_change_email_confirm(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
- send_user_change_email_notification_task.delay(recipient_email, config)
+ send_user_change_email_notification_task.delay(recipient_email, payload, config)
def send_account_delete(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
- send_account_delete_confirmation_email_task.delay(
- recipient_email, payload["redirect_url"], payload["token"], config
- )
+ send_account_delete_confirmation_email_task.delay(recipient_email, payload, config)
def send_account_set_customer_password(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
- send_set_user_password_email_task.delay(
- recipient_email, payload["redirect_url"], payload["token"], config
- )
+ send_set_user_password_email_task.delay(recipient_email, payload, config)
def send_invoice(payload: dict, config: dict):
recipient_email = payload["recipient_email"]
send_invoice_email_task.delay(
- recipient_email=recipient_email,
- invoice_number=payload["number"],
- invoice_download_url=payload["download_url"],
- config=config,
+ recipient_email, payload, config,
)
def send_order_confirmation(payload: dict, config: dict):
- send_order_confirmation_email_task(payload=payload, config=config)
+ recipient_email = payload["recipient_email"]
+ send_order_confirmation_email_task.delay(recipient_email, payload, config)
def send_fulfillment_confirmation(payload: dict, config: dict):
- send_fulfillment_confirmation_email_task(payload, config)
+ recipient_email = payload["recipient_email"]
+ send_fulfillment_confirmation_email_task.delay(recipient_email, payload, config)
def send_fulfillment_update(payload: dict, config: dict):
- send_fulfillment_update_email_task(payload, config)
+ recipient_email = payload["recipient_email"]
+ send_fulfillment_update_email_task.delay(recipient_email, payload, config)
def send_payment_confirmation(payload: dict, config: dict):
- send_payment_confirmation_email_task(payload, config)
+ recipient_email = payload["recipient_email"]
+ send_payment_confirmation_email_task.delay(recipient_email, payload, config)
def send_order_canceled(payload: dict, config: dict):
- send_order_canceled_email_task.delay(payload, config)
+ recipient_email = payload["recipient_email"]
+ send_order_canceled_email_task.delay(recipient_email, payload, config)
def send_order_refund(payload: dict, config: dict):
- send_order_refund_email_task.delay(payload, config)
+ recipient_email = payload["recipient_email"]
+ send_order_refund_email_task.delay(recipient_email, payload, config)
diff --git a/saleor/plugins/user_email/plugin.py b/saleor/plugins/user_email/plugin.py
index 059e6a3168..527353c05a 100644
--- a/saleor/plugins/user_email/plugin.py
+++ b/saleor/plugins/user_email/plugin.py
@@ -1,15 +1,20 @@
import logging
-from dataclasses import asdict
+from dataclasses import asdict, dataclass
+from typing import Optional
from ...core.notify_events import NotifyEventType, UserNotifyEvent
-from ..base_plugin import BasePlugin
+from ..base_plugin import BasePlugin, ConfigurationTypeField
from ..email_common import (
DEFAULT_EMAIL_CONFIG_STRUCTURE,
DEFAULT_EMAIL_CONFIGURATION,
+ DEFAULT_EMAIL_VALUE,
+ DEFAULT_SUBJECT_MESSAGE,
+ DEFAULT_TEMPLATE_MESSAGE,
EmailConfig,
validate_default_email_configuration,
)
from ..models import PluginConfiguration
+from . import constants
from .notify_events import (
send_account_change_email_confirm,
send_account_change_email_request,
@@ -29,6 +34,51 @@ from .notify_events import (
logger = logging.getLogger(__name__)
+@dataclass
+class UserTemplate:
+ account_confirmation: Optional[str]
+ account_set_customer_password: Optional[str]
+ account_delete: Optional[str]
+ account_change_email_confirm: Optional[str]
+ account_change_email_request: Optional[str]
+ account_password_reset: Optional[str]
+ invoice_ready: Optional[str]
+ order_confirmation: Optional[str]
+ order_fulfillment_confirmation: Optional[str]
+ order_fulfillment_update: Optional[str]
+ order_payment_confirmation: Optional[str]
+ order_canceled: Optional[str]
+ order_refund_confirmation: Optional[str]
+
+
+def get_user_template_map(templates: UserTemplate):
+ return {
+ UserNotifyEvent.ACCOUNT_CONFIRMATION: templates.account_confirmation,
+ UserNotifyEvent.ACCOUNT_SET_CUSTOMER_PASSWORD: (
+ templates.account_set_customer_password
+ ),
+ UserNotifyEvent.ACCOUNT_DELETE: templates.account_delete,
+ UserNotifyEvent.ACCOUNT_CHANGE_EMAIL_CONFIRM: (
+ templates.account_change_email_confirm
+ ),
+ UserNotifyEvent.ACCOUNT_CHANGE_EMAIL_REQUEST: (
+ templates.account_change_email_request
+ ),
+ UserNotifyEvent.ACCOUNT_PASSWORD_RESET: templates.account_password_reset,
+ UserNotifyEvent.INVOICE_READY: templates.invoice_ready,
+ UserNotifyEvent.ORDER_CONFIRMATION: templates.order_confirmation,
+ UserNotifyEvent.ORDER_FULFILLMENT_CONFIRMATION: (
+ templates.order_fulfillment_confirmation
+ ),
+ UserNotifyEvent.ORDER_FULFILLMENT_UPDATE: templates.order_fulfillment_update,
+ UserNotifyEvent.ORDER_PAYMENT_CONFIRMATION: (
+ templates.order_payment_confirmation
+ ),
+ UserNotifyEvent.ORDER_CANCELED: templates.order_canceled,
+ UserNotifyEvent.ORDER_REFUND_CONFIRMATION: templates.order_refund_confirmation,
+ }
+
+
def get_user_event_map():
return {
UserNotifyEvent.ACCOUNT_CONFIRMATION: send_account_confirmation,
@@ -50,18 +100,290 @@ def get_user_event_map():
class UserEmailPlugin(BasePlugin):
- PLUGIN_ID = "mirumee.notifications.user_email"
+ PLUGIN_ID = constants.PLUGIN_ID
PLUGIN_NAME = "User emails"
# TODO the configuration will be implemented in separate pull request
- DEFAULT_CONFIGURATION = [] + DEFAULT_EMAIL_CONFIGURATION # type: ignore
- CONFIG_STRUCTURE = {}
+ DEFAULT_CONFIGURATION = [
+ {
+ "name": constants.ACCOUNT_CONFIRMATION_SUBJECT_FIELD,
+ "value": constants.ACCOUNT_CONFIRMATION_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ACCOUNT_CONFIRMATION_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ACCOUNT_SET_CUSTOMER_PASSWORD_SUBJECT_FIELD,
+ "value": constants.ACCOUNT_SET_CUSTOMER_PASSWORD_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ACCOUNT_DELETE_SUBJECT_FIELD,
+ "value": constants.ACCOUNT_DELETE_DEFAULT_SUBJECT,
+ },
+ {"name": constants.ACCOUNT_DELETE_TEMPLATE_FIELD, "value": DEFAULT_EMAIL_VALUE},
+ {
+ "name": constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_SUBJECT_FIELD,
+ "value": constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ACCOUNT_CHANGE_EMAIL_REQUEST_SUBJECT_FIELD,
+ "value": constants.ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ACCOUNT_PASSWORD_RESET_SUBJECT_FIELD,
+ "value": constants.ACCOUNT_PASSWORD_RESET_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.INVOICE_READY_SUBJECT_FIELD,
+ "value": constants.INVOICE_READY_DEFAULT_SUBJECT,
+ },
+ {"name": constants.INVOICE_READY_TEMPLATE_FIELD, "value": DEFAULT_EMAIL_VALUE},
+ {
+ "name": constants.ORDER_CONFIRMATION_SUBJECT_FIELD,
+ "value": constants.ORDER_CONFIRMATION_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ORDER_FULFILLMENT_CONFIRMATION_SUBJECT_FIELD,
+ "value": constants.ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ORDER_FULFILLMENT_UPDATE_SUBJECT_FIELD,
+ "value": constants.ORDER_FULFILLMENT_UPDATE_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ORDER_PAYMENT_CONFIRMATION_SUBJECT_FIELD,
+ "value": constants.ORDER_PAYMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ {
+ "name": constants.ORDER_CANCELED_SUBJECT_FIELD,
+ "value": constants.ORDER_CANCELED_DEFAULT_SUBJECT,
+ },
+ {"name": constants.ORDER_CANCELED_TEMPLATE_FIELD, "value": DEFAULT_EMAIL_VALUE},
+ {
+ "name": constants.ORDER_REFUND_CONFIRMATION_SUBJECT_FIELD,
+ "value": constants.ORDER_REFUND_CONFIRMATION_DEFAULT_SUBJECT,
+ },
+ {
+ "name": constants.ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD,
+ "value": DEFAULT_EMAIL_VALUE,
+ },
+ ] + DEFAULT_EMAIL_CONFIGURATION # type: ignore
+
+ CONFIG_STRUCTURE = {
+ constants.ACCOUNT_CONFIRMATION_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Account confirmation - subject",
+ },
+ constants.ACCOUNT_CONFIRMATION_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Account confirmation - template",
+ },
+ constants.ACCOUNT_SET_CUSTOMER_PASSWORD_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Set customer password - subject",
+ },
+ constants.ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Set customer password - template",
+ },
+ constants.ACCOUNT_DELETE_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Account delete - subject",
+ },
+ constants.ACCOUNT_DELETE_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Account delete - template",
+ },
+ constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Account change email confirm - subject",
+ },
+ constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Account change email confirm - template",
+ },
+ constants.ACCOUNT_CHANGE_EMAIL_REQUEST_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Account change email request - subject",
+ },
+ constants.ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Account change email request - template",
+ },
+ constants.ACCOUNT_PASSWORD_RESET_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Account password reset - subject",
+ },
+ constants.ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Account password reset - template",
+ },
+ constants.INVOICE_READY_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Invoice ready - subject",
+ },
+ constants.INVOICE_READY_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Invoice ready - template",
+ },
+ constants.ORDER_CONFIRMATION_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Order confirmation - subject",
+ },
+ constants.ORDER_CONFIRMATION_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Order confirmation - template",
+ },
+ constants.ORDER_FULFILLMENT_CONFIRMATION_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Order fulfillment confirmation - subject",
+ },
+ constants.ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Order fulfillment confirmation - template",
+ },
+ constants.ORDER_FULFILLMENT_UPDATE_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Order fulfillment update - subject",
+ },
+ constants.ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Order fulfillment update - template",
+ },
+ constants.ORDER_PAYMENT_CONFIRMATION_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Payment confirmation - subject",
+ },
+ constants.ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Payment confirmation - template",
+ },
+ constants.ORDER_CANCELED_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Order canceled - subject",
+ },
+ constants.ORDER_CANCELED_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Order canceled - template",
+ },
+ constants.ORDER_REFUND_CONFIRMATION_SUBJECT_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_SUBJECT_MESSAGE,
+ "label": "Order refund - subject",
+ },
+ constants.ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD: {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": DEFAULT_TEMPLATE_MESSAGE,
+ "label": "Order refund - template",
+ },
+ }
CONFIG_STRUCTURE.update(DEFAULT_EMAIL_CONFIG_STRUCTURE)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
configuration = {item["name"]: item["value"] for item in self.configuration}
- self.config = EmailConfig(**configuration)
+ self.config = EmailConfig(
+ host=configuration["host"],
+ port=configuration["port"],
+ username=configuration["username"],
+ password=configuration["password"],
+ sender_name=configuration["sender_name"],
+ sender_address=configuration["sender_address"],
+ use_tls=configuration["use_tls"],
+ use_ssl=configuration["use_ssl"],
+ )
+ self.templates = UserTemplate(
+ account_confirmation=configuration[
+ constants.ACCOUNT_CONFIRMATION_TEMPLATE_FIELD
+ ],
+ account_set_customer_password=configuration[
+ constants.ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD
+ ],
+ account_delete=configuration[constants.ACCOUNT_DELETE_TEMPLATE_FIELD],
+ account_change_email_confirm=configuration[
+ constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD
+ ],
+ account_change_email_request=configuration[
+ constants.ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD
+ ],
+ account_password_reset=configuration[
+ constants.ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD
+ ],
+ invoice_ready=configuration[constants.INVOICE_READY_TEMPLATE_FIELD],
+ order_confirmation=configuration[
+ constants.ORDER_CONFIRMATION_TEMPLATE_FIELD
+ ],
+ order_fulfillment_confirmation=configuration[
+ constants.ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD
+ ],
+ order_fulfillment_update=configuration[
+ constants.ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD
+ ],
+ order_payment_confirmation=configuration[
+ constants.ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD
+ ],
+ order_canceled=configuration[constants.ORDER_CANCELED_TEMPLATE_FIELD],
+ order_refund_confirmation=configuration[
+ constants.ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD
+ ],
+ )
def notify(self, event: NotifyEventType, payload: dict, previous_value):
if not self.active:
@@ -72,6 +394,9 @@ class UserEmailPlugin(BasePlugin):
if event not in event_map:
logger.warning(f"Missing handler for event {event}")
return previous_value
+ template_map = get_user_template_map(self.templates)
+ if not template_map.get(event):
+ return previous_value
event_map[event](payload, asdict(self.config)) # type: ignore
@classmethod
diff --git a/saleor/plugins/user_email/tasks.py b/saleor/plugins/user_email/tasks.py
index 15d6fc6f34..287d27d63f 100644
--- a/saleor/plugins/user_email/tasks.py
+++ b/saleor/plugins/user_email/tasks.py
@@ -1,219 +1,342 @@
-from urllib.parse import urlencode
-
from ...account import events as account_events
from ...celeryconf import app
-from ...core.emails import get_email_context
-from ...core.utils.url import prepare_url
-from ..email_common import EmailConfig, send_email
+from ..email_common import (
+ EmailConfig,
+ get_email_subject,
+ get_email_template_or_default,
+ send_email,
+)
+from . import constants
@app.task
-def send_account_confirmation_email_task(email, token, redirect_url, config):
+def send_account_confirmation_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- params = urlencode({"email": email, "token": token})
- confirm_url = prepare_url(params, redirect_url)
- send_kwargs, ctx = get_email_context()
- ctx["confirm_url"] = confirm_url
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_CONFIRMATION_TEMPLATE_FIELD,
+ constants.ACCOUNT_CONFIRMATION_DEFAULT_TEMPLATE,
+ )
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_CONFIRMATION_SUBJECT_FIELD,
+ constants.ACCOUNT_CONFIRMATION_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
- recipient_list=[email],
- template_name="account/confirm",
- context=ctx,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_password_reset_email_task(
- recipient_email, redirect_url, user_id, token, config
-):
+def send_password_reset_email_task(recipient_email, payload, config):
+ user_id = payload.get("user", {}).get("id")
email_config = EmailConfig(**config)
- params = urlencode({"email": recipient_email, "token": token})
- reset_url = prepare_url(params, redirect_url)
- _send_password_reset_email(recipient_email, reset_url, user_id, email_config)
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD,
+ constants.ACCOUNT_PASSWORD_RESET_DEFAULT_TEMPLATE,
+ )
-def _send_password_reset_email(recipient_email, reset_url, user_id, email_config):
- send_kwargs, ctx = get_email_context()
- ctx["reset_url"] = reset_url
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_PASSWORD_RESET_SUBJECT_FIELD,
+ constants.ACCOUNT_PASSWORD_RESET_DEFAULT_SUBJECT,
+ )
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="account/password_reset",
- context=ctx,
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
account_events.customer_password_reset_link_sent_event(user_id=user_id)
@app.task
-def send_request_email_change_email_task(
- new_email, old_email, redirect_url, user_id, token, config
-):
+def send_request_email_change_email_task(recipient_email, payload, config):
+ user_id = payload.get("user", {}).get("id")
email_config = EmailConfig(**config)
- params = urlencode({"token": token})
- redirect_url = prepare_url(params, redirect_url)
- send_kwargs, ctx = get_email_context()
- ctx["redirect_url"] = redirect_url
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD,
+ constants.ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_CHANGE_EMAIL_REQUEST_SUBJECT_FIELD,
+ constants.ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
- recipient_list=[new_email],
- template_name="account/request_email_change",
- context=ctx,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
account_events.customer_email_change_request_event(
- user_id=user_id, parameters={"old_email": old_email, "new_email": new_email}
+ user_id=user_id,
+ parameters={
+ "old_email": payload.get("old_email"),
+ "new_email": recipient_email,
+ },
)
@app.task
-def send_user_change_email_notification_task(recipient_email, config):
+def send_user_change_email_notification_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- send_kwargs, ctx = get_email_context()
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD,
+ constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_SUBJECT_FIELD,
+ constants.ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="account/email_changed_notification",
- context=ctx,
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_account_delete_confirmation_email_task(
- recipient_email, redirect_url, token, config
-):
+def send_account_delete_confirmation_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- params = urlencode({"token": token})
- delete_url = prepare_url(params, redirect_url)
- _send_delete_confirmation_email(recipient_email, delete_url, email_config)
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_DELETE_TEMPLATE_FIELD,
+ constants.ACCOUNT_DELETE_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_DELETE_SUBJECT_FIELD,
+ constants.ACCOUNT_DELETE_DEFAULT_SUBJECT,
+ )
-def _send_delete_confirmation_email(recipient_email, delete_url, email_config):
- send_kwargs, ctx = get_email_context()
- ctx["delete_url"] = delete_url
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="account/account_delete",
- context=ctx,
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_set_user_password_email_task(recipient_email, redirect_url, token, config):
+def send_set_user_password_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- params = urlencode({"email": recipient_email, "token": token})
- password_set_url = prepare_url(params, redirect_url)
- _send_set_password_email(recipient_email, password_set_url, email_config)
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD,
+ constants.ACCOUNT_SET_CUSTOMER_PASSWORD_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ACCOUNT_SET_CUSTOMER_PASSWORD_SUBJECT_FIELD,
+ constants.ACCOUNT_SET_CUSTOMER_PASSWORD_DEFAULT_SUBJECT,
+ )
-def _send_set_password_email(recipient_email, password_set_url, email_config):
- send_kwargs, ctx = get_email_context()
- ctx["password_set_url"] = password_set_url
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="dashboard/customer/set_password",
- context=ctx,
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_invoice_email_task(
- recipient_email, invoice_number, invoice_download_url, config
-):
+def send_invoice_email_task(recipient_email, payload, config):
"""Send an invoice to user of related order with URL to download it."""
email_config = EmailConfig(**config)
- send_kwargs, ctx = get_email_context()
- ctx["number"] = invoice_number
- ctx["download_url"] = invoice_download_url
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.INVOICE_READY_TEMPLATE_FIELD,
+ constants.INVOICE_READY_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.INVOICE_READY_SUBJECT_FIELD,
+ constants.INVOICE_READY_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="order/send_invoice",
- context=ctx,
+ context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_order_confirmation_email_task(payload, config):
+def send_order_confirmation_email_task(recipient_email, payload, config):
"""Send order confirmation email."""
email_config = EmailConfig(**config)
- recipient_email = payload["recipient_email"]
- send_kwargs, ctx = get_email_context()
- payload.update(ctx)
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ constants.ORDER_CONFIRMATION_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ORDER_CONFIRMATION_SUBJECT_FIELD,
+ constants.ORDER_CONFIRMATION_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="order/confirm_fulfillment",
context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_fulfillment_confirmation_email_task(payload, config):
+def send_fulfillment_confirmation_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- recipient_email = payload["recipient_email"]
- send_kwargs, ctx = get_email_context()
- payload.update(ctx)
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD,
+ constants.ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ORDER_FULFILLMENT_CONFIRMATION_SUBJECT_FIELD,
+ constants.ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="order/confirm_fulfillment",
context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_fulfillment_update_email_task(payload, config):
+def send_fulfillment_update_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- recipient_email = payload["recipient_email"]
- send_kwargs, ctx = get_email_context()
- payload.update(ctx)
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD,
+ constants.ORDER_FULFILLMENT_UPDATE_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ORDER_FULFILLMENT_UPDATE_SUBJECT_FIELD,
+ constants.ORDER_FULFILLMENT_UPDATE_DEFAULT_SUBJECT,
+ )
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="order/update_fulfillment",
context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_payment_confirmation_email_task(payload, config):
+def send_payment_confirmation_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- send_kwargs, ctx = get_email_context()
- payload.update(ctx)
- recipient_email = payload["recipient_email"]
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD,
+ constants.ORDER_PAYMENT_CONFIRMATION_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ORDER_PAYMENT_CONFIRMATION_SUBJECT_FIELD,
+ constants.ORDER_PAYMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="order/payment/confirm_payment",
context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_order_canceled_email_task(payload, config):
+def send_order_canceled_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- recipient_email = payload["recipient_email"]
- send_kwargs, ctx = get_email_context()
- payload.update(ctx)
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ORDER_CANCELED_TEMPLATE_FIELD,
+ constants.ORDER_CANCELED_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ORDER_CANCELED_SUBJECT_FIELD,
+ constants.ORDER_CANCELED_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="order/order_cancel",
context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
@app.task
-def send_order_refund_email_task(payload, config):
+def send_order_refund_email_task(recipient_email, payload, config):
email_config = EmailConfig(**config)
- recipient_email = payload["recipient_email"]
- # TODO when we replace template define if this context is required
- send_kwargs, ctx = get_email_context()
- payload.update(ctx)
+
+ email_template_str = get_email_template_or_default(
+ constants.PLUGIN_ID,
+ constants.ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD,
+ constants.ORDER_REFUND_CONFIRMATION_DEFAULT_TEMPLATE,
+ )
+
+ subject = get_email_subject(
+ constants.PLUGIN_ID,
+ constants.ORDER_REFUND_CONFIRMATION_SUBJECT_FIELD,
+ constants.ORDER_REFUND_CONFIRMATION_DEFAULT_SUBJECT,
+ )
+
send_email(
config=email_config,
recipient_list=[recipient_email],
- template_name="order/order_refund",
context=payload,
+ subject=subject,
+ template_str=email_template_str,
)
diff --git a/saleor/plugins/user_email/tests/conftest.py b/saleor/plugins/user_email/tests/conftest.py
index c787c588ba..218e62332f 100644
--- a/saleor/plugins/user_email/tests/conftest.py
+++ b/saleor/plugins/user_email/tests/conftest.py
@@ -2,10 +2,64 @@ from unittest.mock import patch
import pytest
+from ...email_common import DEFAULT_EMAIL_VALUE
from ...manager import get_plugins_manager
+from ..constants import (
+ ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_SUBJECT,
+ ACCOUNT_CHANGE_EMAIL_CONFIRM_SUBJECT_FIELD,
+ ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD,
+ ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_SUBJECT,
+ ACCOUNT_CHANGE_EMAIL_REQUEST_SUBJECT_FIELD,
+ ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD,
+ ACCOUNT_CONFIRMATION_DEFAULT_SUBJECT,
+ ACCOUNT_CONFIRMATION_SUBJECT_FIELD,
+ ACCOUNT_CONFIRMATION_TEMPLATE_FIELD,
+ ACCOUNT_DELETE_DEFAULT_SUBJECT,
+ ACCOUNT_DELETE_SUBJECT_FIELD,
+ ACCOUNT_DELETE_TEMPLATE_FIELD,
+ ACCOUNT_PASSWORD_RESET_DEFAULT_SUBJECT,
+ ACCOUNT_PASSWORD_RESET_SUBJECT_FIELD,
+ ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD,
+ ACCOUNT_SET_CUSTOMER_PASSWORD_DEFAULT_SUBJECT,
+ ACCOUNT_SET_CUSTOMER_PASSWORD_SUBJECT_FIELD,
+ ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD,
+ INVOICE_READY_DEFAULT_SUBJECT,
+ INVOICE_READY_SUBJECT_FIELD,
+ INVOICE_READY_TEMPLATE_FIELD,
+ ORDER_CANCELED_DEFAULT_SUBJECT,
+ ORDER_CANCELED_SUBJECT_FIELD,
+ ORDER_CANCELED_TEMPLATE_FIELD,
+ ORDER_CONFIRMATION_DEFAULT_SUBJECT,
+ ORDER_CONFIRMATION_SUBJECT_FIELD,
+ ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ ORDER_FULFILLMENT_CONFIRMATION_SUBJECT_FIELD,
+ ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD,
+ ORDER_FULFILLMENT_UPDATE_DEFAULT_SUBJECT,
+ ORDER_FULFILLMENT_UPDATE_SUBJECT_FIELD,
+ ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD,
+ ORDER_PAYMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ ORDER_PAYMENT_CONFIRMATION_SUBJECT_FIELD,
+ ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD,
+ ORDER_REFUND_CONFIRMATION_DEFAULT_SUBJECT,
+ ORDER_REFUND_CONFIRMATION_SUBJECT_FIELD,
+ ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD,
+)
from ..plugin import UserEmailPlugin
+def user_email_dict_config():
+ return {
+ "host": "localhost",
+ "port": "1025",
+ "username": None,
+ "password": None,
+ "use_ssl": False,
+ "use_tls": False,
+ }
+
+
@pytest.fixture
def user_email_plugin(settings):
def fun(
@@ -18,6 +72,32 @@ def user_email_plugin(settings):
use_tls=False,
use_ssl=False,
active=True,
+ account_confirmation_template=DEFAULT_EMAIL_VALUE,
+ account_confirmation_subject=ACCOUNT_CONFIRMATION_DEFAULT_SUBJECT,
+ password_reset_template=DEFAULT_EMAIL_VALUE,
+ password_reset_subject=ACCOUNT_PASSWORD_RESET_DEFAULT_SUBJECT,
+ email_change_request_template=DEFAULT_EMAIL_VALUE,
+ email_change_request_subject=ACCOUNT_CHANGE_EMAIL_REQUEST_DEFAULT_SUBJECT,
+ email_change_confirm_template=DEFAULT_EMAIL_VALUE,
+ email_change_confirm_subject=ACCOUNT_CHANGE_EMAIL_CONFIRM_DEFAULT_SUBJECT,
+ account_delete_template=DEFAULT_EMAIL_VALUE,
+ account_delete_subject=ACCOUNT_DELETE_DEFAULT_SUBJECT,
+ account_set_password_template=DEFAULT_EMAIL_VALUE,
+ account_set_password_subject=ACCOUNT_SET_CUSTOMER_PASSWORD_DEFAULT_SUBJECT,
+ invoice_ready_template=DEFAULT_EMAIL_VALUE,
+ invoice_ready_subject=INVOICE_READY_DEFAULT_SUBJECT,
+ order_confirmation_template=DEFAULT_EMAIL_VALUE,
+ order_confirmation_subject=ORDER_CONFIRMATION_DEFAULT_SUBJECT,
+ fulfillment_confirmation_template=DEFAULT_EMAIL_VALUE,
+ fulfillment_confirmation_subject=ORDER_FULFILLMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ fulfillment_update_template=DEFAULT_EMAIL_VALUE,
+ fulfillment_update_subject=ORDER_FULFILLMENT_UPDATE_DEFAULT_SUBJECT,
+ payment_confirmation_template=DEFAULT_EMAIL_VALUE,
+ payment_confirmation_subject=ORDER_PAYMENT_CONFIRMATION_DEFAULT_SUBJECT,
+ order_cancel_template=DEFAULT_EMAIL_VALUE,
+ order_cancel_subject=ORDER_CANCELED_DEFAULT_SUBJECT,
+ order_refund_template=DEFAULT_EMAIL_VALUE,
+ order_refund_subject=ORDER_REFUND_CONFIRMATION_DEFAULT_SUBJECT,
):
settings.PLUGINS = ["saleor.plugins.user_email.plugin.UserEmailPlugin"]
@@ -38,6 +118,110 @@ def user_email_plugin(settings):
{"name": "sender_address", "value": sender_address},
{"name": "use_tls", "value": use_tls},
{"name": "use_ssl", "value": use_ssl},
+ {
+ "name": ACCOUNT_CONFIRMATION_TEMPLATE_FIELD,
+ "value": account_confirmation_template,
+ },
+ {
+ "name": ACCOUNT_CONFIRMATION_SUBJECT_FIELD,
+ "value": account_confirmation_subject,
+ },
+ {
+ "name": ACCOUNT_PASSWORD_RESET_TEMPLATE_FIELD,
+ "value": password_reset_template,
+ },
+ {
+ "name": ACCOUNT_PASSWORD_RESET_SUBJECT_FIELD,
+ "value": password_reset_subject,
+ },
+ {
+ "name": ACCOUNT_CHANGE_EMAIL_REQUEST_TEMPLATE_FIELD,
+ "value": email_change_request_template,
+ },
+ {
+ "name": ACCOUNT_CHANGE_EMAIL_REQUEST_SUBJECT_FIELD,
+ "value": email_change_request_subject,
+ },
+ {
+ "name": ACCOUNT_CHANGE_EMAIL_CONFIRM_TEMPLATE_FIELD,
+ "value": email_change_confirm_template,
+ },
+ {
+ "name": ACCOUNT_CHANGE_EMAIL_CONFIRM_SUBJECT_FIELD,
+ "value": email_change_confirm_subject,
+ },
+ {
+ "name": ACCOUNT_DELETE_TEMPLATE_FIELD,
+ "value": account_delete_template,
+ },
+ {
+ "name": ACCOUNT_DELETE_SUBJECT_FIELD,
+ "value": account_delete_subject,
+ },
+ {
+ "name": ACCOUNT_SET_CUSTOMER_PASSWORD_TEMPLATE_FIELD,
+ "value": account_set_password_template,
+ },
+ {
+ "name": ACCOUNT_SET_CUSTOMER_PASSWORD_SUBJECT_FIELD,
+ "value": account_set_password_subject,
+ },
+ {
+ "name": INVOICE_READY_TEMPLATE_FIELD,
+ "value": invoice_ready_template,
+ },
+ {
+ "name": INVOICE_READY_SUBJECT_FIELD,
+ "value": invoice_ready_subject,
+ },
+ {
+ "name": ORDER_CONFIRMATION_TEMPLATE_FIELD,
+ "value": order_confirmation_template,
+ },
+ {
+ "name": ORDER_CONFIRMATION_SUBJECT_FIELD,
+ "value": order_confirmation_subject,
+ },
+ {
+ "name": ORDER_FULFILLMENT_CONFIRMATION_TEMPLATE_FIELD,
+ "value": fulfillment_confirmation_template,
+ },
+ {
+ "name": ORDER_FULFILLMENT_CONFIRMATION_SUBJECT_FIELD,
+ "value": fulfillment_confirmation_subject,
+ },
+ {
+ "name": ORDER_FULFILLMENT_UPDATE_TEMPLATE_FIELD,
+ "value": fulfillment_update_template,
+ },
+ {
+ "name": ORDER_FULFILLMENT_UPDATE_SUBJECT_FIELD,
+ "value": fulfillment_update_subject,
+ },
+ {
+ "name": ORDER_PAYMENT_CONFIRMATION_TEMPLATE_FIELD,
+ "value": payment_confirmation_template,
+ },
+ {
+ "name": ORDER_PAYMENT_CONFIRMATION_SUBJECT_FIELD,
+ "value": payment_confirmation_subject,
+ },
+ {
+ "name": ORDER_CANCELED_TEMPLATE_FIELD,
+ "value": order_cancel_template,
+ },
+ {
+ "name": ORDER_CANCELED_SUBJECT_FIELD,
+ "value": order_cancel_subject,
+ },
+ {
+ "name": ORDER_REFUND_CONFIRMATION_TEMPLATE_FIELD,
+ "value": order_refund_template,
+ },
+ {
+ "name": ORDER_REFUND_CONFIRMATION_SUBJECT_FIELD,
+ "value": order_refund_subject,
+ },
],
},
)
diff --git a/saleor/plugins/user_email/tests/test_notify_events.py b/saleor/plugins/user_email/tests/test_notify_events.py
new file mode 100644
index 0000000000..d7e53a875b
--- /dev/null
+++ b/saleor/plugins/user_email/tests/test_notify_events.py
@@ -0,0 +1,265 @@
+from unittest import mock
+
+from ....account.notifications import get_default_user_payload
+from ....order.notifications import (
+ get_default_fulfillment_payload,
+ get_default_order_payload,
+)
+from ..notify_events import (
+ send_account_change_email_confirm,
+ send_account_change_email_request,
+ send_account_confirmation,
+ send_account_delete,
+ send_account_password_reset_event,
+ send_account_set_customer_password,
+ send_fulfillment_confirmation,
+ send_fulfillment_update,
+ send_invoice,
+ send_order_canceled,
+ send_order_confirmation,
+ send_order_refund,
+ send_payment_confirmation,
+)
+
+
+ "saleor.plugins.user_email.notify_events.send_password_reset_email_task.delay"
+)
+def test_send_account_password_reset_event(mocked_email_task, customer_user):
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": "[email protected]",
+ "token": token,
+ "reset_url": f"http://localhost:8000/redirect{token}",
+ "domain": "localhost:8000",
+ "site_name": "Saleor",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_account_password_reset_event(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_account_confirmation_email_task.delay"
+)
+def test_send_account_confirmation(mocked_email_task, customer_user):
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": "[email protected]",
+ "token": token,
+ "confirm_url": f"http://localhost:8000/redirect{token}",
+ "domain": "localhost:8000",
+ "site_name": "Saleor",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_account_confirmation(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_request_email_change_email_task.delay"
+)
+def test_send_account_change_email_request(mocked_email_task, customer_user):
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": "[email protected]",
+ "token": token,
+ "redirect_url": f"http://localhost:8000/redirect{token}",
+ "old_email": "[email protected]",
+ "new_email": "[email protected]",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_account_change_email_request(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_user_change_email_notification_task."
+ "delay"
+)
+def test_send_account_change_email_confirm(mocked_email_task, customer_user):
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": "[email protected]",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_account_change_email_confirm(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events."
+ "send_account_delete_confirmation_email_task.delay"
+)
+def test_send_account_delete(mocked_email_task, customer_user):
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": "[email protected]",
+ "token": token,
+ "delete_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_account_delete(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_set_user_password_email_task.delay"
+)
+def test_send_account_set_customer_password(mocked_email_task, customer_user):
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": "[email protected]",
+ "token": token,
+ "password_set_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_account_set_customer_password(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
[email protected]("saleor.plugins.user_email.notify_events.send_invoice_email_task.delay")
+def test_send_invoice(mocked_email_task,):
+ payload = {
+ "invoice": {
+ "id": 1,
+ "number": 999,
+ "download_url": "http://localhost:8000/download",
+ },
+ "recipient_email": "[email protected]",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_invoice(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_order_confirmation_email_task.delay"
+)
+def test_send_order_confirmation(mocked_email_task, order):
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": "[email protected]",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_order_confirmation(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_fulfillment_confirmation_email_task."
+ "delay"
+)
+def test_send_fulfillment_confirmation(mocked_email_task, order, fulfillment):
+ payload = get_default_fulfillment_payload(order, fulfillment)
+ config = {"host": "localhost", "port": "1025"}
+ send_fulfillment_confirmation(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_fulfillment_update_email_task.delay"
+)
+def test_send_fulfillment_update(mocked_email_task, order, fulfillment):
+ payload = get_default_fulfillment_payload(order, fulfillment)
+ config = {"host": "localhost", "port": "1025"}
+ send_fulfillment_update(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_payment_confirmation_email_task.delay"
+)
+def test_send_payment_confirmation(mocked_email_task, order, payment_dummy):
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": "[email protected]",
+ "payment": {
+ "created": payment_dummy.created,
+ "modified": payment_dummy.modified,
+ "charge_status": payment_dummy.charge_status,
+ "total": payment_dummy.total,
+ "captured_amount": payment_dummy.captured_amount,
+ "currency": payment_dummy.currency,
+ },
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_payment_confirmation(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_order_canceled_email_task.delay"
+)
+def test_send_order_canceled(mocked_email_task, order):
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": "[email protected]",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_order_canceled(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
+
+
+ "saleor.plugins.user_email.notify_events.send_order_refund_email_task.delay"
+)
+def test_send_order_refund(mocked_email_task, order):
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": "[email protected]",
+ "amount": order.total_gross_amount,
+ "currency": order.currency,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ config = {"host": "localhost", "port": "1025"}
+ send_order_refund(
+ payload=payload, config=config,
+ )
+ mocked_email_task.assert_called_with(payload["recipient_email"], payload, config)
diff --git a/saleor/plugins/user_email/tests/test_tasks.py b/saleor/plugins/user_email/tests/test_tasks.py
new file mode 100644
index 0000000000..85387710e1
--- /dev/null
+++ b/saleor/plugins/user_email/tests/test_tasks.py
@@ -0,0 +1,708 @@
+from unittest import mock
+
+from saleor.account.notifications import get_default_user_payload
+from saleor.order.notifications import (
+ get_default_fulfillment_payload,
+ get_default_order_payload,
+)
+from saleor.plugins.email_common import EmailConfig
+from saleor.plugins.user_email.tasks import (
+ send_account_confirmation_email_task,
+ send_account_delete_confirmation_email_task,
+ send_fulfillment_confirmation_email_task,
+ send_fulfillment_update_email_task,
+ send_invoice_email_task,
+ send_order_canceled_email_task,
+ send_order_confirmation_email_task,
+ send_order_refund_email_task,
+ send_password_reset_email_task,
+ send_payment_confirmation_email_task,
+ send_request_email_change_email_task,
+ send_set_user_password_email_task,
+ send_user_change_email_notification_task,
+)
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_account_confirmation_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, customer_user
+):
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "reset_url": f"http://localhost:8000/redirect{token}",
+ "domain": "localhost:8000",
+ "site_name": "Saleor",
+ }
+
+ send_account_confirmation_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_account_confirmation_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, customer_user
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ account_confirmation_template=expected_template_str,
+ account_confirmation_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": "[email protected]",
+ "token": token,
+ "reset_url": f"http://localhost:8000/redirect{token}",
+ "domain": "localhost:8000",
+ "site_name": "Saleor",
+ }
+
+ send_account_confirmation_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_password_reset_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, customer_user
+):
+ token = "token123"
+ recipient_email = "[email protected]"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "reset_url": f"http://localhost:8000/redirect{token}",
+ "domain": "localhost:8000",
+ "site_name": "Saleor",
+ }
+
+ send_password_reset_email_task(recipient_email, payload, user_email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_password_reset_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, customer_user
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ password_reset_template=expected_template_str,
+ password_reset_subject=expected_subject,
+ )
+ token = "token123"
+ recipient_email = "[email protected]"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "reset_url": f"http://localhost:8000/redirect{token}",
+ "domain": "localhost:8000",
+ "site_name": "Saleor",
+ }
+
+ send_password_reset_email_task(recipient_email, payload, user_email_dict_config)
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_request_email_change_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, customer_user
+):
+ token = "token123"
+ recipient_email = "[email protected]"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "redirect_url": f"http://localhost:8000/redirect{token}",
+ "old_email": "[email protected]",
+ "new_email": "[email protected]",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_request_email_change_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_request_email_change_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, customer_user
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ email_change_request_template=expected_template_str,
+ email_change_request_subject=expected_subject,
+ )
+ token = "token123"
+ recipient_email = "[email protected]"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "redirect_url": f"http://localhost:8000/redirect{token}",
+ "old_email": "[email protected]",
+ "new_email": "[email protected]",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_request_email_change_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_user_change_email_notification_task_default_template(
+ mocked_send_mail, user_email_dict_config, customer_user
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_user_change_email_notification_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_user_change_email_notification_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, customer_user
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ email_change_confirm_template=expected_template_str,
+ email_change_confirm_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_user_change_email_notification_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_account_delete_confirmation_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, customer_user
+):
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "delete_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_account_delete_confirmation_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_account_delete_confirmation_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, customer_user
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ account_delete_template=expected_template_str,
+ account_delete_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "delete_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_account_delete_confirmation_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_set_user_password_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, customer_user
+):
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "password_set_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_set_user_password_email_task(recipient_email, payload, user_email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_set_user_password_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, customer_user
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ account_set_password_template=expected_template_str,
+ account_set_password_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ token = "token123"
+ payload = {
+ "user": get_default_user_payload(customer_user),
+ "recipient_email": recipient_email,
+ "token": token,
+ "password_set_url": f"http://localhost:8000/redirect{token}",
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_set_user_password_email_task(recipient_email, payload, user_email_dict_config)
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_invoice_email_task_default_template(
+ mocked_send_mail, user_email_dict_config,
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "invoice": {
+ "id": 1,
+ "number": 999,
+ "download_url": "http://localhost:8000/download",
+ },
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_invoice_email_task(recipient_email, payload, user_email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_invoice_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin,
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ invoice_ready_template=expected_template_str,
+ invoice_ready_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "invoice": {
+ "id": 1,
+ "number": 999,
+ "download_url": "http://localhost:8000/download",
+ },
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_invoice_email_task(recipient_email, payload, user_email_dict_config)
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_order_confirmation_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, order
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_order_confirmation_email_task(recipient_email, payload, user_email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_order_confirmation_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, order
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ order_confirmation_template=expected_template_str,
+ order_confirmation_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_order_confirmation_email_task(recipient_email, payload, user_email_dict_config)
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_fulfillment_confirmation_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, order, fulfillment
+):
+ payload = get_default_fulfillment_payload(order, fulfillment)
+
+ send_fulfillment_confirmation_email_task(
+ payload["recipient_email"], payload, user_email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_fulfillment_confirmation_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, order, fulfillment
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ fulfillment_confirmation_template=expected_template_str,
+ fulfillment_confirmation_subject=expected_subject,
+ )
+ payload = get_default_fulfillment_payload(order, fulfillment)
+ recipient_email = payload["recipient_email"]
+ send_fulfillment_confirmation_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_fulfillment_update_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, order, fulfillment
+):
+ payload = get_default_fulfillment_payload(order, fulfillment)
+
+ send_fulfillment_update_email_task(
+ payload["recipient_email"], payload, user_email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_fulfillment_update_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, order, fulfillment
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ fulfillment_update_template=expected_template_str,
+ fulfillment_update_subject=expected_subject,
+ )
+ payload = get_default_fulfillment_payload(order, fulfillment)
+ recipient_email = payload["recipient_email"]
+ send_fulfillment_update_email_task(recipient_email, payload, user_email_dict_config)
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_payment_confirmation_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, order, payment_dummy
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "payment": {
+ "created": payment_dummy.created,
+ "modified": payment_dummy.modified,
+ "charge_status": payment_dummy.charge_status,
+ "total": payment_dummy.total,
+ "captured_amount": payment_dummy.captured_amount,
+ "currency": payment_dummy.currency,
+ },
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_payment_confirmation_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_payment_confirmation_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, order, payment_dummy
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ payment_confirmation_template=expected_template_str,
+ payment_confirmation_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "payment": {
+ "created": payment_dummy.created,
+ "modified": payment_dummy.modified,
+ "charge_status": payment_dummy.charge_status,
+ "total": payment_dummy.total,
+ "captured_amount": payment_dummy.captured_amount,
+ "currency": payment_dummy.currency,
+ },
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ send_payment_confirmation_email_task(
+ recipient_email, payload, user_email_dict_config
+ )
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_order_canceled_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, order
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_order_canceled_email_task(recipient_email, payload, user_email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_order_canceled_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, order
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ order_cancel_template=expected_template_str,
+ order_cancel_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ send_order_canceled_email_task(recipient_email, payload, user_email_dict_config)
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
+
+
[email protected]("saleor.plugins.email_common.send_mail")
+def test_send_order_refund_email_task_default_template(
+ mocked_send_mail, user_email_dict_config, order
+):
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "amount": order.total_gross_amount,
+ "currency": order.currency,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+
+ send_order_refund_email_task(recipient_email, payload, user_email_dict_config)
+
+ # confirm that mail has correct structure and email was sent
+ assert mocked_send_mail.called
+
+
[email protected]("saleor.plugins.user_email.tasks.send_email")
+def test_send_order_refund_email_task_custom_template(
+ mocked_send_email, user_email_dict_config, user_email_plugin, order
+):
+ expected_template_str = "<html><body>Template body</body></html>"
+ expected_subject = "Test Email Subject"
+ user_email_plugin(
+ order_refund_template=expected_template_str,
+ order_refund_subject=expected_subject,
+ )
+ recipient_email = "[email protected]"
+ payload = {
+ "order": get_default_order_payload(order, "http://localhost:8000/redirect"),
+ "recipient_email": recipient_email,
+ "amount": order.total_gross_amount,
+ "currency": order.currency,
+ "site_name": "Saleor",
+ "domain": "localhost:8000",
+ }
+ send_order_refund_email_task(recipient_email, payload, user_email_dict_config)
+
+ email_config = EmailConfig(**user_email_dict_config)
+ mocked_send_email.assert_called_with(
+ config=email_config,
+ recipient_list=[recipient_email],
+ context=payload,
+ subject=expected_subject,
+ template_str=expected_template_str,
+ )
diff --git a/saleor/settings.py b/saleor/settings.py
index afd42fe47c..c725751cd5 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -185,10 +185,11 @@ loaders = [
"django.template.loaders.app_directories.Loader",
]
+TEMPLATES_DIR = os.path.join(PROJECT_ROOT, "templates")
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
- "DIRS": [os.path.join(PROJECT_ROOT, "templates")],
+ "DIRS": [TEMPLATES_DIR],
"OPTIONS": {
"debug": DEBUG,
"context_processors": context_processors,
diff --git a/templates/templated_email/account/account_delete.email b/templates/templated_email/account/account_delete.email
deleted file mode 100644
index d80e42baac..0000000000
--- a/templates/templated_email/account/account_delete.email
+++ /dev/null
@@ -1,23 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Delete your account" context "Account delete reset e-mail subject" %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Account delete reset e-mail text" %}
-You're receiving this e-mail because you or someone else has requested a deletion of your user account at {{ site_name }}.
-Click the link below to delete your account.
-
-Please note that this action is permanent and cannot be reversed.
-{% endblocktrans %}
-
-{{ delete_url }}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/account_delete.html' %}
-{% endblock %}
diff --git a/templates/templated_email/account/confirm.email b/templates/templated_email/account/confirm.email
deleted file mode 100644
index 003943c823..0000000000
--- a/templates/templated_email/account/confirm.email
+++ /dev/null
@@ -1,21 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Account confirmation e-mail" context "Account confirmation e-mail subject" %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Account confirmation e-mail text" %}
-In order to log into {{ site_name }}, you have to confirm your email address first.
-Please click the link below to do so and log into your account.
-{% endblocktrans %}
-
-{{ confirm_url | safe }}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/confirm.html' %}
-{% endblock %}
diff --git a/templates/templated_email/account/email_changed_notification.email b/templates/templated_email/account/email_changed_notification.email
deleted file mode 100644
index b3aafaeeaf..0000000000
--- a/templates/templated_email/account/email_changed_notification.email
+++ /dev/null
@@ -1,20 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Email change e-mail" context "Email change e-mail subject" %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Email change e-mail text" %}
-
-You're receiving this e-mail because you or someone else has changed email for your user account at {{ site_name }}.
-If you didn't request this change, please contact the administrator.
-{% endblocktrans %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/email_changed_notification.html' %}
-{% endblock %}
diff --git a/templates/templated_email/account/password_reset.email b/templates/templated_email/account/password_reset.email
deleted file mode 100644
index 7133399220..0000000000
--- a/templates/templated_email/account/password_reset.email
+++ /dev/null
@@ -1,21 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Password reset e-mail" context "Password reset e-mail subject" %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Password reset e-mail text" %}
-You're receiving this e-mail because you or someone else has requested a password for your user account at {{ site_name }}.
-It can be safely ignored if you did not request a password reset. Click the link below to reset your password.
-{% endblocktrans %}
-
-{{ reset_url }}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/password_reset.html' %}
-{% endblock %}
diff --git a/templates/templated_email/account/request_email_change.email b/templates/templated_email/account/request_email_change.email
deleted file mode 100644
index dc91eb9091..0000000000
--- a/templates/templated_email/account/request_email_change.email
+++ /dev/null
@@ -1,22 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Email change e-mail" context "Email change e-mail subject" %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Email change e-mail text" %}
-
-You're receiving this e-mail because you or someone else has requested an email change for your user account at {{ site_name }}.
-It can be safely ignored if you did not request an email change. Click the link below to confirm new email address.
-{% endblocktrans %}
-
-{{ redirect_url }}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/request_email_change.html' %}
-{% endblock %}
diff --git a/templates/templated_email/compiled/account_delete.html b/templates/templated_email/compiled/account_delete.html
index 95f26b7072..53862f2438 100644
--- a/templates/templated_email/compiled/account_delete.html
+++ b/templates/templated_email/compiled/account_delete.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,12 +105,12 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Account delete e-mail text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Account delete e-mail text" }}
You're receiving this e-mail because you or someone else has requested a deletion of your user account at {{ site_name }}.<br>
Click the link below to delete your account.
Please note that this action is permanent and cannot be reversed.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -176,9 +178,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -238,9 +240,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -300,9 +302,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/confirm.html b/templates/templated_email/compiled/confirm.html
index ddd9f1f58c..1dcdc7bd02 100644
--- a/templates/templated_email/compiled/confirm.html
+++ b/templates/templated_email/compiled/confirm.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Account confirmation e-mail text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Account confirmation e-mail text" }}
In order to log into {{ site_name }}, you have to confirm your email address first.
Please click the link below to do so and log into your account.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -114,8 +116,8 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ confirm_url | safe }}">
- {{ confirm_url | safe }}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ confirm_url }}">
+ {{ confirm_url }}
</a></div>
</td>
@@ -176,9 +178,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -238,9 +240,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -300,9 +302,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/confirm_fulfillment.html b/templates/templated_email/compiled/confirm_fulfillment.html
index 833136f367..71fcef4028 100644
--- a/templates/templated_email/compiled/confirm_fulfillment.html
+++ b/templates/templated_email/compiled/confirm_fulfillment.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,20 +105,20 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Fulfillment confirmation email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Fulfillment confirmation email text"}}
Thank you for your order. Below is the list of fulfilled products.
- {% endblocktrans %}
- {% if fulfillment.tracking_number %}
- {% if fulfillment.is_tracking_number_url %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with <a href="{{ tracking_number }}">{{ tracking_number }}</a> link.
- {% endblocktrans %}
- {% else %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with {{ tracking_number }} code.
- {% endblocktrans %}
- {% endif %}
- {% endif %}</div>
+ {{/blocktrans}}
+ {{#if fulfillment.tracking_number}}
+ {{#if fulfillment.is_tracking_number_url}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with <a href="{{fulfillment.tracking_number}}">{{fulfillment.tracking_number}}</a> link.
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with {{fulfillment.tracking_number}} code.
+ {{/blocktrans}}
+ {{/if}}
+ {{/if}}</div>
</td>
</tr>
@@ -124,11 +126,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if digital_lines %}
- {% blocktrans trimmed context "Fulfillment digital products email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if digital_lines}}
+ {{#blocktrans "Fulfillment digital products email text"}}
You can download your digital products by clicking in download link(s).
- {% endblocktrans %}
- {% endif %}</div>
+ {{/blocktrans}}
+ {{/if}}</div>
</td>
</tr>
@@ -156,11 +158,7 @@
</td>
</tr>
</table>
- <![endif]-->
-
- {% load display_translated_order_line_name from order_lines %}
- <!--[if mso | IE]>
<table
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
>
@@ -192,52 +190,68 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if physical_lines %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if physical_lines}}
<table style="width:100%">
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px; text-align: left;" align="left">{% trans "Item" context "Ordered item name" %}</th>
- <th style="padding: 5px; text-align: right;" align="right">{% trans "Quantity" context "Quantity ordered of a product" %}</th>
+ <th style="padding: 5px; text-align: left;" align="left">
+ {{#blocktrans "Ordered item name"}}
+ Item
+ {{/blocktrans}}
+ </th>
+ <th style="padding: 5px; text-align: right;" align="right">
+ {{#blocktrans "Quantity ordered of a product"}}
+ Quantity
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
- {% for line in physical_lines %}
+ {{#each physical_lines}}
<tr class="table-item-row" style="border-bottom: 1px solid #D3D1D0;">
- {% if line.order_line.variant_name %}
- <td style="padding: 5px;">{{ line.order_line.product_name }} ({{line.order_line.variant_name }})</td>
- {% else %}
- <td style="padding: 5px;">{{ line.order_line.product_name }}</td>
- {% endif %}
- <td style="padding: 5px; text-align: right;" align="right">{{ line.quantity }}</td>
+ {{#if order_line.variant_name}}
+ <td style="padding: 5px;">{{order_line.product_name}} ({{order_line.variant_name}})</td>
+ {{else}}
+ <td style="padding: 5px;">{{order_line.product_name}}</td>
+ {{/if}}
+ <td style="padding: 5px; text-align: right;" align="right">{{quantity}}</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
- {% endif %}
- {% if digital_lines %}
+ {{/if}}
+ {{#if digital_lines}}
<table style="width:100%">
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px; text-align: left;" align="left">{% trans "Item" context "Ordered item name" %}</th>
- <th style="padding: 5px; text-align: right;" align="right">{% trans "Download Link" context "Ordered item download links" %}</th>
+ <th style="padding: 5px; text-align: left;" align="left">
+ {{#blocktrans "Ordered item name"}}
+ Item
+ {{/blocktrans}}
+ </th>
+ <th style="padding: 5px; text-align: right;" align="right">
+ {{#blocktrans "Ordered item download links"}}
+ Download Link
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
- {% for line in digital_lines %}
+ {{#each digital_lines}}
<tr class="table-item-row" style="border-bottom: 1px solid #D3D1D0;">
- {% if line.order_line.variant_name %}
- <td style="padding: 5px;">{{ line.order_line.product_name }} ({{line.order_line.variant_name }})</td>
- {% else %}
- <td style="padding: 5px;">{{ line.order_line.product_name }}</td>
- {% endif %}
+ {{#if order_line.variant_name}}
+ <td style="padding: 5px;">{{order_line.product_name}} ({{order_line.variant_name}})</td>
+ {{else}}
+ <td style="padding: 5px;">{{order_line.product_name}}</td>
+ {{/if}}
<td style="padding: 5px; text-align: right;" align="right">
- <a href="{{ line.order_line.digital_url }}">Link</a>
+ <a href="{{order_line.digital_url}}">Link</a>
</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
- {% endif %}</div>
+ {{/if}}</div>
</td>
</tr>
@@ -297,9 +311,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -359,9 +373,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -421,9 +435,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/confirm_order.html b/templates/templated_email/compiled/confirm_order.html
index 84c349e060..5b8d6bb9a4 100644
--- a/templates/templated_email/compiled/confirm_order.html
+++ b/templates/templated_email/compiled/confirm_order.html
@@ -61,8 +61,7 @@
<div style>
- {% load i18n %}
- {% load i18n_address_tags %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -96,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -104,15 +105,15 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if order_details_url %}
- {% blocktrans trimmed context "Order confirmation e-mail text with payment details" %}
- Thank you for your order. Below is the list of ordered products. To see your payment details please visit: <a href="{{ order_details_url }}">{{ order_details_url }}</a>
- {% endblocktrans %}
- {% else %}
- {% blocktrans trimmed context "Order confirmation e-mail text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order_details_url}}
+ {{#blocktrans "Order confirmation e-mail text with payment details"}}
+ Thank you for your order. Below is the list of ordered products. To see your payment details please visit: <a href="{{order_details_url}}">{{order_details_url}}</a>
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}
Thank you for your order. Below is the list of ordered products.
- {% endblocktrans %}
- {% endif %}</div>
+ {{/blocktrans}}
+ {{/if}}</div>
</td>
</tr>
@@ -140,14 +141,7 @@
</td>
</tr>
</table>
- <![endif]-->
-
- {% load display_translated_order_line_name from order_lines %}
- {% load price from taxed_prices %}
- {% load price_amount from taxed_prices %}
- {% load voucher %}
- <!--[if mso | IE]>
<table
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
>
@@ -183,74 +177,91 @@
<tfoot>
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% trans "Subtotal" context "E-mail order lines summary table" %}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Subtotal
+ {{/blocktrans}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% trans "Shipping" context "E-mail order lines summary table" %}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Shipping
+ {{/blocktrans}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% if order.display_gross_prices %}
- {% trans "Taxes (included)" context "E-mail order lines summary table" %}
- {% else %}
- {% trans "Taxes" context "E-mail order lines summary table" %}
- {% endif %}
+ {{#if order.display_gross_prices}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Taxes (included)
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Taxes
+ {{/blocktrans}}
+ {{/if}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount order.tax_amount order.tax_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.tax_amount order.tax_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
- {% if order.discount_amount %}
+ {{#if order.discount_amount}}
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% trans "Discount" context "E-mail order lines summary table" %}
+ {{order.discount_amount}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Discount
+ {{/blocktrans}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% discount_as_negative order.discount html=True %}
+ {{price order.discount_amount order.discount_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
- {% endif %}
+ {{/if}}
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- <strong>{% trans "Total" context "E-mail order lines summary table" %}</strong>
+ <strong>
+ {{#blocktrans "E-mail order lines summary table"}}Total{{/blocktrans}}
+ </strong>
</td>
<td style="padding: 5px; text-align: right;" align="right">
- <strong>{% price_amount order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}</strong>
+ <strong>
+ {{price order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices}}
+ </strong>
</td>
</tr>
</tfoot>
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px;">{% trans "Item" context "Ordered item name" %}</th>
- <th style="padding: 5px;">{% trans "Quantity" context "Quantity ordered of a product" %}</th>
- <th style="padding: 5px;">{% trans "Per unit" context "Unit price of a product" %}</th>
- <th style="padding: 5px;">{% trans "Subtotal" context "Ordered item subtotal (unit price * quantity)" %}</th>
+ <th style="padding: 5px;">{{#blocktrans "Ordered item name"}}Item{{/blocktrans}}</th>
+ <th style="padding: 5px;">{{#blocktrans "Quantity ordered of a product"}}Quantity{{/blocktrans}}</th>
+ <th style="padding: 5px;">{{#blocktrans "Unit price of a product"}}Per unit{{/blocktrans}}</th>
+ <th style="padding: 5px;">{{#blocktrans "Ordered item subtotal (unit price * quantity)"}}Subtotal{{/blocktrans}}</th>
</tr>
</thead>
<tbody>
- {% for line in order.lines %}
+ {{#each order.lines}}
<tr class="table-item-row" style="border-bottom: 1px solid #D3D1D0;">
- {% if line.variant_name %}
- <td style="padding: 5px;">{{ line.product_name }} ({{line.variant_name }})</td>
- {% else %}
- <td style="padding: 5px;">{{ line.product_name }}</td>
- {% endif %}
- <td style="padding: 5px; text-align: right;" align="right">{{ line.quantity }}</td>
+ {{#if variant_name}}
+ <td style="padding: 5px;">{{product_name}} ({{variant_name}})</td>
+ {{else}}
+ <td style="padding: 5px;">{{product_name}}</td>
+ {{/if}}
+ <td style="padding: 5px; text-align: right;" align="right">{{quantity}}</td>
+ <td style="padding: 5px; text-align: right;" align="right">
+ {{price unit_price_net_amount unit_price_gross_amount ../order.currency display_gross=../order.display_gross_prices}}
+ </td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount line.unit_price_net_amount line.unit_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price total_net_amount total_gross_amount ../order.currency display_gross=../order.display_gross_prices}}
</td>
- <td style="padding: 5px; text-align: right;" align="right">{% price_amount line.total_net_amount line.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
@@ -315,25 +326,33 @@
<table cellpadding="0" cellspacing="0" width="100%" border="0" style="color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;table-layout:auto;width:100%;border:none;">
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px;">{% trans "Billing address" context "Order confirmation e-mail billing address" %}</th>
- <th style="padding: 5px;">{% trans "Shipping address" context "Order confirmation e-mail shipping address" %}</th>
+ <th style="padding: 5px;">
+ {{#blocktrans "Order confirmation e-mail billing address"}}
+ Billing address
+ {{/blocktrans}}
+ </th>
+ <th style="padding: 5px;">
+ {{#blocktrans "Order confirmation e-mail shipping address"}}
+ Shipping address
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
<tr>
<td class="address" style="padding: 5px;">
- {% if order.billing_address %}
- {% format_address order.billing_address %}
- {% else %}
- {% trans "No billing address" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.billing_address}}
+ {{format_address order.billing_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No billing address{{/blocktrans}}
+ {{/if}}
</td>
<td css-class="address" style="padding: 5px;">
- {% if order.shipping_address %}
- {% format_address order.shipping_address %}
- {% else %}
- {% trans "No shipping required" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.shipping_address}}
+ {{format_address order.shipping_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No shipping required{{/blocktrans}}
+ {{/if}}
</td>
</tr>
</tbody>
@@ -397,9 +416,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -459,9 +478,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -521,9 +540,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/confirm_payment.html b/templates/templated_email/compiled/confirm_payment.html
index f3a543652a..80560878ca 100644
--- a/templates/templated_email/compiled/confirm_payment.html
+++ b/templates/templated_email/compiled/confirm_payment.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Payment confirmation e-mail text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Payment confirmation e-mail text"}}
Thank you for your payment.
Your payment was successfully processed.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -166,9 +168,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -228,9 +230,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -290,9 +292,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/email_changed_notification.html b/templates/templated_email/compiled/email_changed_notification.html
index 63e4016971..ae9f7624c9 100644
--- a/templates/templated_email/compiled/email_changed_notification.html
+++ b/templates/templated_email/compiled/email_changed_notification.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Email change e-mail text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Email change e-mail text"}}
You're receiving this e-mail because you or someone else has changed email for your user account at {{ site_name }}.<br>
If you didn't request this change, please contact the administrator.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -166,9 +168,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -228,9 +230,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -290,9 +292,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/export_failed.html b/templates/templated_email/compiled/export_failed.html
index 0f483c74fd..3d2776dcec 100644
--- a/templates/templated_email/compiled/export_failed.html
+++ b/templates/templated_email/compiled/export_failed.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Export products e-mail text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Export products e-mail text"}}
Sorry, we couldn't finish exporting products, some unexpected errors occurred.
Please try again.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -166,9 +168,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -228,9 +230,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -290,9 +292,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/export_products_file.html b/templates/templated_email/compiled/export_products_file.html
index 294440b16d..bf7b222c01 100644
--- a/templates/templated_email/compiled/export_products_file.html
+++ b/templates/templated_email/compiled/export_products_file.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,9 +105,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Export products e-mail text" %}
- Your file with products data is ready to download: <a href="{{ csv_link }}">{{ csv_link }}</a>
- {% endblocktrans %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Export products e-mail text"}}
+ Your file with products data is ready to download: <a href="{{csv_link}}">{{csv_link}}</a>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -165,9 +167,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -227,9 +229,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -289,9 +291,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/order_cancel.html b/templates/templated_email/compiled/order_cancel.html
index 216422a585..88e46b3ccf 100644
--- a/templates/templated_email/compiled/order_cancel.html
+++ b/templates/templated_email/compiled/order_cancel.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,9 +105,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed with id=order.id context "Order cancel e-mail text" %}
- Your order #{{ id }} has been canceled.
- {% endblocktrans %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Order cancel e-mail text"}}
+ Your order #{{order.id}} has been canceled.
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -165,9 +167,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -227,9 +229,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -289,9 +291,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/order_refund.html b/templates/templated_email/compiled/order_refund.html
index 786bd9e835..979310abab 100644
--- a/templates/templated_email/compiled/order_refund.html
+++ b/templates/templated_email/compiled/order_refund.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,9 +105,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Order refund e-mail text" %}
- A payment of {{ amount }} {{ currency }} has been refunded for your order.
- {% endblocktrans %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Order refund e-mail text"}}
+ A payment of {{amount}} {{currency}} has been refunded for your order.
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -165,9 +167,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -227,9 +229,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -289,9 +291,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/password_reset.html b/templates/templated_email/compiled/password_reset.html
index a4c2929d33..7f6559bc12 100644
--- a/templates/templated_email/compiled/password_reset.html
+++ b/templates/templated_email/compiled/password_reset.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Password reset e-mail text" %}
- You're receiving this e-mail because you or someone else has requested a password for your user account at {{ site_name }}.<br>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Password reset e-mail text"}}
+ You're receiving this e-mail because you or someone else has requested a password for your user account at {{site_name}}.<br>
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -114,8 +116,8 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ reset_url }}">
- {{ reset_url }}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{reset_url}}">
+ {{reset_url}}
</a></div>
</td>
@@ -176,9 +178,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -238,9 +240,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -300,9 +302,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/request_email_change.html b/templates/templated_email/compiled/request_email_change.html
index 2e54b89483..9810ff162b 100644
--- a/templates/templated_email/compiled/request_email_change.html
+++ b/templates/templated_email/compiled/request_email_change.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Email change e-mail text" %}
- You're receiving this e-mail because you or someone else has requested an email change for your user account at {{ site_name }}.<br>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Email change e-mail text"}}
+ You're receiving this e-mail because you or someone else has requested an email change for your user account at {{site_name}}.<br>
It can be safely ignored if you did not request an email change. Click the link below to confirm new email address.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -114,8 +116,8 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ redirect_url }}">
- {{ redirect_url }}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{redirect_url}}">
+ {{redirect_url}}
</a></div>
</td>
@@ -176,9 +178,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -238,9 +240,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -300,9 +302,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/send_invoice.html b/templates/templated_email/compiled/send_invoice.html
index b4c0274721..88a744d6c8 100644
--- a/templates/templated_email/compiled/send_invoice.html
+++ b/templates/templated_email/compiled/send_invoice.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,9 +105,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Send invoice e-mail text" %}
- In order to download invoice {{ number }}, click the link below.
- {% endblocktrans %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Send invoice e-mail text"}}
+ In order to download invoice {{number}}, click the link below.
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -113,8 +115,8 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ download_url | safe }}">
- {{ download_url | safe }}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{download_url}}">
+ {{invoice.download_url}}
</a></div>
</td>
@@ -175,9 +177,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -237,9 +239,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -299,9 +301,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/set_customer_password.html b/templates/templated_email/compiled/set_customer_password.html
index 810cea461c..da9e889264 100644
--- a/templates/templated_email/compiled/set_customer_password.html
+++ b/templates/templated_email/compiled/set_customer_password.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Set password for customer e-mail text" %}
- You're receiving this e-mail because you have to set password for your customer account at {{ site_name }}.<br>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Set password for customer e-mail text"}}
+ You're receiving this e-mail because you have to set password for your customer account at {{site_name}}.<br>
Click the link below to set up your password.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -114,8 +116,8 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ password_set_url }}">
- {{ password_set_url }}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{password_set_url}}">
+ {{password_set_url}}
</a></div>
</td>
@@ -176,9 +178,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -238,9 +240,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -300,9 +302,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/set_password.html b/templates/templated_email/compiled/set_password.html
index b3f8d73190..144c2b77a3 100644
--- a/templates/templated_email/compiled/set_password.html
+++ b/templates/templated_email/compiled/set_password.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,10 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Set password for staff member e-mail text" %}
- You're receiving this e-mail because you have to set password for your staff member account at {{ site_name }}.<br>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Set password for staff member e-mail text"}}
+ You're receiving this e-mail because you have to set password for your staff member account at {{site_name}}.<br>
Click the link below to set up your password.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -114,8 +116,8 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ password_set_url }}">
- {{ password_set_url }}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"><a href="{{ password_set_url}}">
+ {{password_set_url}}
</a></div>
</td>
@@ -176,9 +178,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -238,9 +240,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -300,9 +302,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/staff_confirm_order.html b/templates/templated_email/compiled/staff_confirm_order.html
index a25640b94b..3eef64b194 100644
--- a/templates/templated_email/compiled/staff_confirm_order.html
+++ b/templates/templated_email/compiled/staff_confirm_order.html
@@ -61,8 +61,7 @@
<div style>
- {% load i18n %}
- {% load i18n_address_tags %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -96,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -104,9 +105,10 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed with order_details_url=order.order_details_url context "Order confirmation staff e-mail text" %}
- Someone placed a new order in your store. To see order details please visit: <a href="{{ order_details_url }}">{{ order_details_url }}</a>
- {% endblocktrans %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Order confirmation staff e-mail text"}}
+ Someone placed a new order in your store. To see order details please visit:
+ <a href="{{order.order_details_url}}">{{order.order_details_url}}</a>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -134,14 +136,7 @@
</td>
</tr>
</table>
- <![endif]-->
-
- {% load display_translated_order_line_name from order_lines %}
- {% load price from taxed_prices %}
- {% load price_amount from taxed_prices %}
- {% load voucher %}
- <!--[if mso | IE]>
<table
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
>
@@ -177,74 +172,91 @@
<tfoot>
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% trans "Subtotal" context "E-mail order lines summary table" %}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Subtotal
+ {{/blocktrans}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% trans "Shipping" context "E-mail order lines summary table" %}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Shipping
+ {{/blocktrans}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% if order.display_gross_prices %}
- {% trans "Taxes (included)" context "E-mail order lines summary table" %}
- {% else %}
- {% trans "Taxes" context "E-mail order lines summary table" %}
- {% endif %}
+ {{#if order.display_gross_prices}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Taxes (included)
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Taxes
+ {{/blocktrans}}
+ {{/if}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount order.tax_amount order.tax_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.tax_amount order.tax_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
- {% if order.discount_amount %}
+ {{#if order.discount_amount}}
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- {% trans "Discount" context "E-mail order lines summary table" %}
+ {{order.discount_amount}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Discount
+ {{/blocktrans}}
</td>
<td style="padding: 5px; text-align: right;" align="right">
- {% discount_as_negative order.discount html=True %}
+ {{price order.discount_amount order.discount_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
- {% endif %}
+ {{/if}}
<tr>
<td colspan="3" style="padding: 5px; text-align: right;" align="right">
- <strong>{% trans "Total" context "E-mail order lines summary table" %}</strong>
+ <strong>
+ {{#blocktrans "E-mail order lines summary table"}}Total{{/blocktrans}}
+ </strong>
</td>
<td style="padding: 5px; text-align: right;" align="right">
- <strong>{% price_amount order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}</strong>
+ <strong>
+ {{price order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices}}
+ </strong>
</td>
</tr>
</tfoot>
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px;">{% trans "Item" context "Ordered item name" %}</th>
- <th style="padding: 5px;">{% trans "Quantity" context "Quantity ordered of a product" %}</th>
- <th style="padding: 5px;">{% trans "Per unit" context "Unit price of a product" %}</th>
- <th style="padding: 5px;">{% trans "Subtotal" context "Ordered item subtotal (unit price * quantity)" %}</th>
+ <th style="padding: 5px;">{{#blocktrans "Ordered item name"}}Item{{/blocktrans}}</th>
+ <th style="padding: 5px;">{{#blocktrans "Quantity ordered of a product"}}Quantity{{/blocktrans}}</th>
+ <th style="padding: 5px;">{{#blocktrans "Unit price of a product"}}Per unit{{/blocktrans}}</th>
+ <th style="padding: 5px;">{{#blocktrans "Ordered item subtotal (unit price * quantity)"}}Subtotal{{/blocktrans}}</th>
</tr>
</thead>
<tbody>
- {% for line in order.lines %}
+ {{#each order.lines}}
<tr class="table-item-row" style="border-bottom: 1px solid #D3D1D0;">
- {% if line.variant_name %}
- <td style="padding: 5px;">{{ line.product_name }} ({{line.variant_name }})</td>
- {% else %}
- <td style="padding: 5px;">{{ line.product_name }}</td>
- {% endif %}
- <td style="padding: 5px; text-align: right;" align="right">{{ line.quantity }}</td>
+ {{#if variant_name}}
+ <td style="padding: 5px;">{{product_name}} ({{variant_name}})</td>
+ {{else}}
+ <td style="padding: 5px;">{{product_name}}</td>
+ {{/if}}
+ <td style="padding: 5px; text-align: right;" align="right">{{quantity}}</td>
+ <td style="padding: 5px; text-align: right;" align="right">
+ {{price unit_price_net_amount unit_price_gross_amount ../order.currency display_gross=../order.display_gross_prices}}
+ </td>
<td style="padding: 5px; text-align: right;" align="right">
- {% price_amount line.unit_price_net_amount line.unit_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price total_net_amount total_gross_amount ../order.currency display_gross=../order.display_gross_prices}}
</td>
- <td style="padding: 5px; text-align: right;" align="right">{% price_amount line.total_net_amount line.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
@@ -309,25 +321,25 @@
<table cellpadding="0" cellspacing="0" width="100%" border="0" style="color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;table-layout:auto;width:100%;border:none;">
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px;">{% trans "Billing address" context "Order confirmation e-mail billing address" %}</th>
- <th style="padding: 5px;">{% trans "Shipping address" context "Order confirmation e-mail shipping address" %}</th>
+ <th style="padding: 5px;">{{#blocktrans "Order confirmation e-mail billing address"}}Billing address{{/blocktrans}}</th>
+ <th style="padding: 5px;">{{#blocktrans "Order confirmation e-mail shipping address"}}Shipping address{{/blocktrans}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="address" style="padding: 5px;">
- {% if order.billing_address %}
- {% format_address order.billing_address %}
- {% else %}
- {% trans "No billing address" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.billing_address}}
+ {{format_address order.billing_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No billing address{{/blocktrans}}
+ {{/if}}
</td>
<td css-class="address" style="padding: 5px;">
- {% if order.shipping_address %}
- {% format_address order.shipping_address %}
- {% else %}
- {% trans "No shipping required" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.shipping_address}}
+ {{format_address order.shipping_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No shipping required{{/blocktrans}}
+ {{/if}}
</td>
</tr>
</tbody>
@@ -391,9 +403,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -453,9 +465,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -515,9 +527,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/compiled/update_fulfillment.html b/templates/templated_email/compiled/update_fulfillment.html
index 8386981ce6..391a5696d7 100644
--- a/templates/templated_email/compiled/update_fulfillment.html
+++ b/templates/templated_email/compiled/update_fulfillment.html
@@ -61,7 +61,7 @@
<div style>
- {% load i18n %}{% load static %}
+
<!--[if mso | IE]>
<table
@@ -95,7 +95,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{% trans "Hi!" context "Standard e-mail greeting" %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -103,20 +105,20 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Fulfillment update email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Fulfillment update email text"}}
Your shipping status has been updated. Below is the list of ordered products that have been updated with new tracking number.
- {% endblocktrans %}
- {% if fulfillment.tracking_number %}
- {% if fulfillment.is_tracking_number_url %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with <a href="{{ tracking_number }}">{{ tracking_number }}</a> link.
- {% endblocktrans %}
- {% else %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with {{ tracking_number }} code.
- {% endblocktrans %}
- {% endif %}
- {% endif %}</div>
+ {{/blocktrans}}
+ {{#if fulfillment.tracking_number}}
+ {{#if fulfillment.is_tracking_number_url}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with <a href="{{ fulfillment.tracking_number }}">{{ fulfillment.tracking_number }}</a> link.
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with {{ fulfillment.tracking_number }} code.
+ {{/blocktrans}}
+ {{/if}}
+ {{/if}}</div>
</td>
</tr>
@@ -144,11 +146,7 @@
</td>
</tr>
</table>
- <![endif]-->
-
- {% load display_translated_order_line_name from order_lines %}
- <!--[if mso | IE]>
<table
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
>
@@ -180,52 +178,68 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if physical_lines %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if physical_lines}}
<table style="width:100%">
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px; text-align: left;" align="left">{% trans "Item" context "Ordered item name" %}</th>
- <th style="padding: 5px; text-align: right;" align="right">{% trans "Quantity" context "Quantity ordered of a product" %}</th>
+ <th style="padding: 5px; text-align: left;" align="left">
+ {{#blocktrans "Ordered item name"}}
+ Item
+ {{/blocktrans}}
+ </th>
+ <th style="padding: 5px; text-align: right;" align="right">
+ {{#blocktrans "Quantity ordered of a product"}}
+ Quantity
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
- {% for line in physical_lines %}
+ {{#each physical_lines}}
<tr class="table-item-row" style="border-bottom: 1px solid #D3D1D0;">
- {% if line.order_line.variant_name %}
- <td style="padding: 5px;">{{ line.order_line.product_name }} ({{line.order_line.variant_name }})</td>
- {% else %}
- <td style="padding: 5px;">{{ line.order_line.product_name }}</td>
- {% endif %}
- <td style="padding: 5px; text-align: right;" align="right">{{ line.quantity }}</td>
+ {{#if order_line.variant_name}}
+ <td style="padding: 5px;">{{order_line.product_name}} ({{order_line.variant_name}})</td>
+ {{else}}
+ <td style="padding: 5px;">{{order_line.product_name}}</td>
+ {{/if}}
+ <td style="padding: 5px; text-align: right;" align="right">{{quantity}}</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
- {% endif %}
- {% if digital_lines %}
+ {{/if}}
+ {{#if digital_lines}}
<table style="width:100%">
<thead class="table-header-row" style="border-bottom: 2px solid #000;">
<tr>
- <th style="padding: 5px; text-align: left;" align="left">{% trans "Item" context "Ordered item name" %}</th>
- <th style="padding: 5px; text-align: right;" align="right">{% trans "Download Link" context "Ordered item download links" %}</th>
+ <th style="padding: 5px; text-align: left;" align="left">
+ {{#blocktrans "Ordered item name"}}
+ Item
+ {{/blocktrans}}
+ </th>
+ <th style="padding: 5px; text-align: right;" align="right">
+ {{#blocktrans "Ordered item download links"}}
+ Download Link
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
- {% for line in digital_lines %}
+ {{#each digital_lines}}
<tr class="table-item-row" style="border-bottom: 1px solid #D3D1D0;">
- {% if line.order_line.variant_name %}
- <td style="padding: 5px;">{{ line.order_line.product_name }} ({{line.order_line.variant_name }})</td>
- {% else %}
- <td style="padding: 5px;">{{ line.order_line.product_name }}</td>
- {% endif %}
+ {{#if order_line.variant_name}}
+ <td style="padding: 5px;">{{order_line.product_name}} ({{order_line.variant_name}})</td>
+ {{else}}
+ <td style="padding: 5px;">{{order_line.product_name}}</td>
+ {{/if}}
<td style="padding: 5px; text-align: right;" align="right">
- <a href="{{ line.order_line.digital_url }}">Link</a>
+ <a href="{{order_line.digital_url}}">Link</a>
</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
- {% endif %}</div>
+ {{/if}}</div>
</td>
</tr>
@@ -285,9 +299,9 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% blocktrans trimmed context "Base email text" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -347,9 +361,9 @@
<tr>
<td align="center" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{% blocktrans trimmed context "Base email footer" %}
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#000000;">{{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}</div>
+ {{/blocktrans}}</div>
</td>
</tr>
@@ -409,9 +423,11 @@
<tr>
<td align="left" style="font-size: 0px; padding: 10px 25px; word-break: break-word;">
- <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}</div>
+ <div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">{{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}</div>
</td>
</tr>
diff --git a/templates/templated_email/csv/export_failed.email b/templates/templated_email/csv/export_failed.email
deleted file mode 100644
index 3769f385cc..0000000000
--- a/templates/templated_email/csv/export_failed.email
+++ /dev/null
@@ -1,20 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Export products data" context "Export products e-mail subject" %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-
-{% blocktrans trimmed context "Export products e-mail text" %}
-Sorry, we cannot finish product export, some unexpected errors occurred.
-Please try again.
-{% endblocktrans %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/export_failed.html' %}
-{% endblock %}
diff --git a/templates/templated_email/csv/export_products_file.email b/templates/templated_email/csv/export_products_file.email
deleted file mode 100644
index edddde1313..0000000000
--- a/templates/templated_email/csv/export_products_file.email
+++ /dev/null
@@ -1,19 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Export products data" context "Export products e-mail subject" %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-
-{% blocktrans trimmed context "Export products e-mail text" %}
-Your file with products data is ready to download: {{ csv_link }}
-{% endblocktrans %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/export_products_file.html' %}
-{% endblock %}
diff --git a/templates/templated_email/dashboard/customer/set_password.email b/templates/templated_email/dashboard/customer/set_password.email
deleted file mode 100644
index 2b6262ca2d..0000000000
--- a/templates/templated_email/dashboard/customer/set_password.email
+++ /dev/null
@@ -1,18 +0,0 @@
-{% load i18n %}
-{% block subject %}{% blocktrans context "Set password for customer e-mail title" %}Hello from {{ site_name }}!{% endblocktrans %}{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Set password for customer e-mail text" %}
-You're receiving this e-mail because you have to set a password for your customer account at {{ site_name }}.
-Click the link below to reset your password.
-{% endblocktrans %}
-
-{{ password_set_url }}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/set_customer_password.html' %}
-{% endblock %}
diff --git a/templates/templated_email/dashboard/staff/set_password.email b/templates/templated_email/dashboard/staff/set_password.email
deleted file mode 100644
index d6de5045f3..0000000000
--- a/templates/templated_email/dashboard/staff/set_password.email
+++ /dev/null
@@ -1,18 +0,0 @@
-{% load i18n %}
-{% block subject %}{% blocktrans context "Set password for staff member e-mail title" %}Hello from {{ site_name }}!{% endblocktrans %}{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Set password for staff member e-mail text" %}
-You're receiving this e-mail because you have to set a password for your staff member account at {{ site_name }}.
-Click the link below to reset your password.
-{% endblocktrans %}
-
-{{ password_set_url }}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/set_password.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/confirm_fulfillment.email b/templates/templated_email/order/confirm_fulfillment.email
deleted file mode 100644
index 419171f60c..0000000000
--- a/templates/templated_email/order/confirm_fulfillment.email
+++ /dev/null
@@ -1,33 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% blocktrans trimmed with id=order.id context "Fulfillment confirmation email subject" %}
- Your order {{ id }} has been fulfilled
- {% endblocktrans %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Fulfillment confirmation email text" %}
-Thank you for your order. Below is the list of fulfilled products.
-{% endblocktrans %}
-{% if fulfillment.tracking_number %}
-{% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
-You can track your shipment with {{ tracking_number }} code.
-{% endblocktrans %}
-{% endif %}
-
-{% for line in physical_lines %}
-{{ line.quantity }} x {{ line.order_line.product_name }} {{line.order_line.variant_name }}
-{% endfor %}
-
-{% for line in digital_lines %}
-{{ line.quantity }} x {{ line.order_line.digital_url }}
-{% endfor %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/confirm_fulfillment.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/confirm_order.email b/templates/templated_email/order/confirm_order.email
deleted file mode 100644
index d61e4f5c74..0000000000
--- a/templates/templated_email/order/confirm_order.email
+++ /dev/null
@@ -1,44 +0,0 @@
-{% load i18n %}
-{% load price_amount from taxed_prices %}
-{% load price from taxed_prices %}
-{% load voucher %}
-
-{% block subject %}
- {% blocktrans trimmed with id=order.id context "Order confirmation e-mail subject" %}
- Order #{{ id }} details
- {% endblocktrans %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Order confirmation e-mail text" %}
-Thank you for your order. Below is the list of ordered products.
-{% endblocktrans %}
-{% if order_details_url %}
-{% blocktrans context "Order confirmation e-mail payment details" %}
-To see your payment details please visit:
-{{ order_details_url }}
-{% endblocktrans %}
-{% endif %}
-{% for line in order.lines %}
-{{ line.quantity }} x {{ line.product_name }}, {% price_amount line.unit_price_net_amount line.unit_price_gross_amount currency display_gross=display_gross_prices html=False %}
-{% endfor %}
-{% trans "Order summary" context "Order confirmation e-mail table header" %}:
-{% trans "Subtotal" context "Order confirmation e-mail table header" %}: {% price_amount order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
-{% trans "Shipping" context "Order confirmation e-mail table header" %}: {% price_amount order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
-{% if order.display_gross_prices %}{% trans "Taxes (included)" context "Order confirmation e-mail table header" %}{% else %}{% trans "Taxes" context "Order confirmation e-mail table header" %}{% endif %}: {% price_amount order.tax_amount order.tax_amount currency display_gross=order.display_gross_prices html=False %}
-{% if order.discount_amount %}{% trans "Discount:" context "Order confirmation e-mail table header" %} {% discount_as_negative order.discount %}{% endif %}
-{% trans "Total" context "Order confirmation e-mail table header" %}: {% price_amount order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
-
-{% trans "Billing address" context "Order confirmation e-mail billing address" %}
-{% if order.billing_address %}{{ order.billing_address.first_name }}, {{ order.billing_address.last_name }}, {{ order.billing_address.company_name }}, {{ order.billing_address.street_address_1 }}, {{ order.billing_address.street_address_2 }}, {{ order.billing_address.city }}, {{ order.billing_address.city_area }}, {{ order.billing_address.postal_code }}, {{ order.billing_address.country }}, {{ order.billing_address.country_area }}, {{ order.billing_address.phone }}{% else %}{% trans "No billing address" context "Order confirmation e-mail text" %}{% endif %}
-
-{% trans "Shipping address" context "Order confirmation e-mail shipping address" %}
-{% if order.shipping_address %}{{ order.shipping_address.first_name }}, {{ order.shipping_address.last_name }}, {{ order.shipping_address.company_name }}, {{ order.shipping_address.street_address_1 }}, {{ order.shipping_address.street_address_2 }}, {{ order.shipping_address.city }}, {{ order.shipping_address.city_area }}, {{ order.shipping_address.postal_code }}, {{ order.shipping_address.country }}, {{ order.shipping_address.country_area }}, {{ order.shipping_address.phone }}{% else %}{% trans "No shipping required" context "Order confirmation e-mail text" %}{% endif %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/confirm_order.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/order_cancel.email b/templates/templated_email/order/order_cancel.email
deleted file mode 100644
index 132dc5e13b..0000000000
--- a/templates/templated_email/order/order_cancel.email
+++ /dev/null
@@ -1,20 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% blocktrans trimmed with id=order.id context "Order cancel e-mail subject" %}
- Order {{ id }} canceled
- {% endblocktrans %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans trimmed with id=order.id context "Order cancel e-mail text" %}
-Your order #{{ id }} has been canceled.
-{% endblocktrans %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/order_cancel.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/order_refund.email b/templates/templated_email/order/order_refund.email
deleted file mode 100644
index 88031dfbf7..0000000000
--- a/templates/templated_email/order/order_refund.email
+++ /dev/null
@@ -1,20 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% blocktrans trimmed with id=order.id context "Order refund e-mail subject" %}
- Order {{ id }} refunded
- {% endblocktrans %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Order refund e-mail text" %}
-A payment of {{ amount }} {{ currency }} has been refunded for your order.
-{% endblocktrans %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/order_refund.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/payment/confirm_payment.email b/templates/templated_email/order/payment/confirm_payment.email
deleted file mode 100644
index 24e2743ea8..0000000000
--- a/templates/templated_email/order/payment/confirm_payment.email
+++ /dev/null
@@ -1,20 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% blocktrans trimmed with id=order.id context "Payment confirmation subject" %}
- Order {{ id }} payment details
- {% endblocktrans %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Payment confirmation email text" %}
-Thank you for your payment.
-Your payment was successfully processed.
-{% endblocktrans %}
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/confirm_payment.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/send_invoice.email b/templates/templated_email/order/send_invoice.email
deleted file mode 100644
index 72b5058a82..0000000000
--- a/templates/templated_email/order/send_invoice.email
+++ /dev/null
@@ -1,20 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% trans "Invoice" context "Invoice email subject" %} {{ number }} {{ site_name }}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Send invoice e-mail text" %}
-In order to download invoice {{ number }}, click the link below.
-{% endblocktrans %}
-
-{{ download_url | safe }}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/send_invoice.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/staff_confirm_order.email b/templates/templated_email/order/staff_confirm_order.email
deleted file mode 100644
index ee235599a2..0000000000
--- a/templates/templated_email/order/staff_confirm_order.email
+++ /dev/null
@@ -1,43 +0,0 @@
-{% load i18n %}
-{% load price from taxed_prices %}
-{% load price_amount from taxed_prices %}
-{% load voucher %}
-
-{% block subject %}
- {% blocktrans trimmed with id=order.id context "Order confirmation e-mail subject" %}
- Order {{ id }} details
- {% endblocktrans %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Order confirmation staff e-mail text" %}
-Below is the list of ordered products.
-{% endblocktrans %}
-{% if order.order_details_url %}
-{% blocktrans trimmed with order_details_url=order.order_details_url context "Order confirmation staff e-mail text" %}
-Someone placed a new order in your store. To see order details please visit: {{ order_details_url }}
-{% endblocktrans %}
-{% endif %}
-{% for line in order.lines %}
-{{ line.quantity }} x {{ line.product_name }}, {% price_amount line.unit_price_net_amount line.unit_price_gross_amount order.currency display_gross=display_gross_prices html=False %}
-{% endfor %}
-{% trans "Order summary" context "Order confirmation e-mail table header" %}:
-{% trans "Subtotal" context "Order confirmation e-mail table header" %}: {% price_amount order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
-{% trans "Shipping" context "Order confirmation e-mail table header" %}: {% price_amount order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
-{% if order.display_gross_prices %}{% trans "Taxes (included)" context "Order confirmation e-mail table header" %}{% else %}{% trans "Taxes" context "Order confirmation e-mail table header" %}{% endif %}: {% price_amount order.tax_amount order.tax_amount order.currency display_gross=order.display_gross_prices html=False %}
-{% if order.discount_amount %}{% trans "Discount:" context "Order confirmation e-mail table header" %} {% discount_as_negative order.discount %}{% endif %}
-{% trans "Total" context "Order confirmation e-mail table header" %}: {% price_amount order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
-
-{% trans "Billing address" context "Order confirmation e-mail billing address" %}
-{% if order.billing_address %}{{ order.billing_address.first_name }}, {{ order.billing_address.last_name }}, {{ order.billing_address.company_name }}, {{ order.billing_address.street_address_1 }}, {{ order.billing_address.street_address_2 }}, {{ order.billing_address.city }}, {{ order.billing_address.city_area }}, {{ order.billing_address.postal_code }}, {{ order.billing_address.country }}, {{ order.billing_address.country_area }}, {{ order.billing_address.phone }}{% else %}{% trans "No billing address" context "Order confirmation e-mail text" %}{% endif %}
-
-{% trans "Shipping address" context "Order confirmation e-mail shipping address" %}
-{% if order.shipping_address %}{{ order.shipping_address.first_name }}, {{ order.shipping_address.last_name }}, {{ order.shipping_address.company_name }}, {{ order.shipping_address.street_address_1 }}, {{ order.shipping_address.street_address_2 }}, {{ order.shipping_address.city }}, {{ order.shipping_address.city_area }}, {{ order.shipping_address.postal_code }}, {{ order.shipping_address.country }}, {{ order.shipping_address.country_area }}, {{ order.shipping_address.phone }}{% else %}{% trans "No shipping required" context "Order confirmation e-mail text" %}{% endif %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/staff_confirm_order.html' %}
-{% endblock %}
diff --git a/templates/templated_email/order/update_fulfillment.email b/templates/templated_email/order/update_fulfillment.email
deleted file mode 100644
index a4e1e4c7fb..0000000000
--- a/templates/templated_email/order/update_fulfillment.email
+++ /dev/null
@@ -1,29 +0,0 @@
-{% load i18n %}
-
-{% block subject %}
- {% blocktrans trimmed with id=order.id context "Fulfillment update email subject" %}
- Shipping update for order {{ id }}
- {% endblocktrans %}
-{% endblock %}
-
-{% block plain %}
-{% include 'templated_email/shared/_header.email' %}
-{% blocktrans context "Fulfillment update email text" %}
-Your shipping status has been updated. Below is the list of ordered products that have been updated with new tracking number.
-{% endblocktrans %}
-{% if fulfillment.tracking_number %}
-{% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment update email text" %}
-You can track your shipment with the following code: {{ tracking_number }}.
-{% endblocktrans %}
-{% endif %}
-
-{% for line in physical_lines %}
-{{ line.quantity }} x {{ line.order_line.product_name }} {{line.order_line.variant_name }}
-{% endfor %}
-
-{% include 'templated_email/shared/_footer.email' %}
-{% endblock %}
-
-{% block html %}
-{% include 'templated_email/compiled/update_fulfillment.html' %}
-{% endblock %}
diff --git a/templates/templated_email/shared/_footer.email b/templates/templated_email/shared/_footer.email
deleted file mode 100644
index 71d1b51d2e..0000000000
--- a/templates/templated_email/shared/_footer.email
+++ /dev/null
@@ -1,7 +0,0 @@
-{% load i18n %}
-{% blocktrans trimmed context "Base email text" %}
-This is an automatically generated e-mail, please do not reply.
-{% endblocktrans %}
-{% blocktrans trimmed context "Base email footer" %}
-Sincerely, {{ site_name }}
-{% endblocktrans %}
\ No newline at end of file
diff --git a/templates/templated_email/shared/_header.email b/templates/templated_email/shared/_header.email
deleted file mode 100644
index 6b27723796..0000000000
--- a/templates/templated_email/shared/_header.email
+++ /dev/null
@@ -1,2 +0,0 @@
-{% load i18n %}
-{% trans "Hi!" context "Standard e-mail greeting" %}
\ No newline at end of file
diff --git a/templates/templated_email/source/account_delete.mjml b/templates/templated_email/source/account_delete.mjml
index 9e273d9c43..691d94cb2c 100644
--- a/templates/templated_email/source/account_delete.mjml
+++ b/templates/templated_email/source/account_delete.mjml
@@ -2,23 +2,22 @@
<mj-head>
<mj-include path="./shared/styles.mjml" />
</mj-head>
- <mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
+ <mj-body>>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Account delete e-mail text" %}
+ {{#blocktrans "Account delete e-mail text" }}
You're receiving this e-mail because you or someone else has requested a deletion of your user account at {{ site_name }}.<br/>
Click the link below to delete your account.
Please note that this action is permanent and cannot be reversed.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
<mj-text>
<a href="{{ delete_url }}">{{ delete_url }}</a>
diff --git a/templates/templated_email/source/confirm.mjml b/templates/templated_email/source/confirm.mjml
index 833373dc54..fef97c4a64 100644
--- a/templates/templated_email/source/confirm.mjml
+++ b/templates/templated_email/source/confirm.mjml
@@ -3,24 +3,23 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Account confirmation e-mail text" %}
+ {{#blocktrans "Account confirmation e-mail text" }}
In order to log into {{ site_name }}, you have to confirm your email address first.
Please click the link below to do so and log into your account.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
<mj-text>
- <a href="{{ confirm_url | safe }}">
- {{ confirm_url | safe }}
+ <a href="{{ confirm_url }}">
+ {{ confirm_url }}
</a>
</mj-text>
</mj-column>
diff --git a/templates/templated_email/source/confirm_fulfillment.mjml b/templates/templated_email/source/confirm_fulfillment.mjml
index a1b661dd6f..ecbc6ebb6d 100644
--- a/templates/templated_email/source/confirm_fulfillment.mjml
+++ b/templates/templated_email/source/confirm_fulfillment.mjml
@@ -3,37 +3,36 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Fulfillment confirmation email text" %}
+ {{#blocktrans "Fulfillment confirmation email text"}}
Thank you for your order. Below is the list of fulfilled products.
- {% endblocktrans %}
- {% if fulfillment.tracking_number %}
- {% if fulfillment.is_tracking_number_url %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with <a href="{{ tracking_number }}">{{ tracking_number }}</a> link.
- {% endblocktrans %}
- {% else %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with {{ tracking_number }} code.
- {% endblocktrans %}
- {% endif %}
- {% endif %}
+ {{/blocktrans}}
+ {{#if fulfillment.tracking_number}}
+ {{#if fulfillment.is_tracking_number_url}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with <a href="{{fulfillment.tracking_number}}">{{fulfillment.tracking_number}}</a> link.
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with {{fulfillment.tracking_number}} code.
+ {{/blocktrans}}
+ {{/if}}
+ {{/if}}
</mj-text>
<mj-text>
- {% if digital_lines %}
- {% blocktrans trimmed context "Fulfillment digital products email text" %}
+ {{#if digital_lines}}
+ {{#blocktrans "Fulfillment digital products email text"}}
You can download your digital products by clicking in download link(s).
- {% endblocktrans %}
- {% endif %}
+ {{/blocktrans}}
+ {{/if}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/confirm_order.mjml b/templates/templated_email/source/confirm_order.mjml
index 0291f7d618..9cde261188 100644
--- a/templates/templated_email/source/confirm_order.mjml
+++ b/templates/templated_email/source/confirm_order.mjml
@@ -3,26 +3,24 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- {% load i18n_address_tags %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% if order_details_url %}
- {% blocktrans trimmed context "Order confirmation e-mail text with payment details" %}
- Thank you for your order. Below is the list of ordered products. To see your payment details please visit: <a href="{{ order_details_url }}">{{ order_details_url }}</a>
- {% endblocktrans %}
- {% else %}
- {% blocktrans trimmed context "Order confirmation e-mail text" %}
+ {{#if order_details_url}}
+ {{#blocktrans "Order confirmation e-mail text with payment details"}}
+ Thank you for your order. Below is the list of ordered products. To see your payment details please visit: <a href="{{order_details_url}}">{{order_details_url}}</a>
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}
Thank you for your order. Below is the list of ordered products.
- {% endblocktrans %}
- {% endif %}
+ {{/blocktrans}}
+ {{/if}}
</mj-text>
</mj-column>
</mj-section>
@@ -32,25 +30,33 @@
<mj-table>
<thead class="table-header-row">
<tr>
- <th>{% trans "Billing address" context "Order confirmation e-mail billing address" %}</th>
- <th>{% trans "Shipping address" context "Order confirmation e-mail shipping address" %}</th>
+ <th>
+ {{#blocktrans "Order confirmation e-mail billing address"}}
+ Billing address
+ {{/blocktrans}}
+ </th>
+ <th>
+ {{#blocktrans "Order confirmation e-mail shipping address"}}
+ Shipping address
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
<tr>
<td class="address">
- {% if order.billing_address %}
- {% format_address order.billing_address %}
- {% else %}
- {% trans "No billing address" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.billing_address}}
+ {{format_address order.billing_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No billing address{{/blocktrans}}
+ {{/if}}
</td>
<td css-class="address">
- {% if order.shipping_address %}
- {% format_address order.shipping_address %}
- {% else %}
- {% trans "No shipping required" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.shipping_address}}
+ {{format_address order.shipping_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No shipping required{{/blocktrans}}
+ {{/if}}
</td>
</tr>
</tbody>
diff --git a/templates/templated_email/source/confirm_payment.mjml b/templates/templated_email/source/confirm_payment.mjml
index 02f67161ee..503fa6e305 100644
--- a/templates/templated_email/source/confirm_payment.mjml
+++ b/templates/templated_email/source/confirm_payment.mjml
@@ -3,20 +3,19 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Payment confirmation e-mail text" %}
+ {{#blocktrans "Payment confirmation e-mail text"}}
Thank you for your payment.
Your payment was successfully processed.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/email_changed_notification.mjml b/templates/templated_email/source/email_changed_notification.mjml
index 8aecd97c98..c6b70b2cb6 100644
--- a/templates/templated_email/source/email_changed_notification.mjml
+++ b/templates/templated_email/source/email_changed_notification.mjml
@@ -3,20 +3,19 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Email change e-mail text" %}
+ {{#blocktrans "Email change e-mail text"}}
You're receiving this e-mail because you or someone else has changed email for your user account at {{ site_name }}.<br />
If you didn't request this change, please contact the administrator.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/export_failed.mjml b/templates/templated_email/source/export_failed.mjml
index 2a58e51051..1b28f1ac93 100644
--- a/templates/templated_email/source/export_failed.mjml
+++ b/templates/templated_email/source/export_failed.mjml
@@ -3,20 +3,19 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Export products e-mail text" %}
+ {{#blocktrans "Export products e-mail text"}}
Sorry, we couldn't finish exporting products, some unexpected errors occurred.
Please try again.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/export_products_file.mjml b/templates/templated_email/source/export_products_file.mjml
index 9a0aefe698..c597554850 100644
--- a/templates/templated_email/source/export_products_file.mjml
+++ b/templates/templated_email/source/export_products_file.mjml
@@ -3,19 +3,18 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Export products e-mail text" %}
- Your file with products data is ready to download: <a href="{{ csv_link }}">{{ csv_link }}</a>
- {% endblocktrans %}
+ {{#blocktrans "Export products e-mail text"}}
+ Your file with products data is ready to download: <a href="{{csv_link}}">{{csv_link}}</a>
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/order_cancel.mjml b/templates/templated_email/source/order_cancel.mjml
index 85f41c4ff3..7bfc0d1210 100644
--- a/templates/templated_email/source/order_cancel.mjml
+++ b/templates/templated_email/source/order_cancel.mjml
@@ -3,19 +3,18 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed with id=order.id context "Order cancel e-mail text" %}
- Your order #{{ id }} has been canceled.
- {% endblocktrans %}
+ {{#blocktrans "Order cancel e-mail text"}}
+ Your order #{{order.id}} has been canceled.
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/order_refund.mjml b/templates/templated_email/source/order_refund.mjml
index e3e75bb028..29f3149f26 100644
--- a/templates/templated_email/source/order_refund.mjml
+++ b/templates/templated_email/source/order_refund.mjml
@@ -3,19 +3,18 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Order refund e-mail text" %}
- A payment of {{ amount }} {{ currency }} has been refunded for your order.
- {% endblocktrans %}
+ {{#blocktrans "Order refund e-mail text"}}
+ A payment of {{amount}} {{currency}} has been refunded for your order.
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/partials/_fulfillment_lines.mjml b/templates/templated_email/source/partials/_fulfillment_lines.mjml
index 96822f8ddb..30dcd7a11d 100644
--- a/templates/templated_email/source/partials/_fulfillment_lines.mjml
+++ b/templates/templated_email/source/partials/_fulfillment_lines.mjml
@@ -1,55 +1,68 @@
-<mj-raw>
- {% load display_translated_order_line_name from order_lines %}
-</mj-raw>
<mj-section>
<mj-column>
<mj-text>
- {% if physical_lines %}
+ {{#if physical_lines}}
<table style="width:100%">
<thead class="table-header-row">
<tr>
- <th style="text-align: left;">{% trans "Item" context "Ordered item name" %}</th>
- <th style="text-align: right;">{% trans "Quantity" context "Quantity ordered of a product" %}</th>
+ <th style="text-align: left;">
+ {{#blocktrans "Ordered item name"}}
+ Item
+ {{/blocktrans}}
+ </th>
+ <th style="text-align: right;">
+ {{#blocktrans "Quantity ordered of a product"}}
+ Quantity
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
- {% for line in physical_lines %}
+ {{#each physical_lines}}
<tr class="table-item-row">
- {% if line.order_line.variant_name %}
- <td>{{ line.order_line.product_name }} ({{line.order_line.variant_name }})</td>
- {% else %}
- <td>{{ line.order_line.product_name }}</td>
- {% endif %}
- <td style="text-align: right;">{{ line.quantity }}</td>
+ {{#if order_line.variant_name}}
+ <td>{{order_line.product_name}} ({{order_line.variant_name}})</td>
+ {{else}}
+ <td>{{order_line.product_name}}</td>
+ {{/if}}
+ <td style="text-align: right;">{{quantity}}</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
- {% endif %}
- {% if digital_lines %}
+ {{/if}}
+ {{#if digital_lines}}
<table style="width:100%">
<thead class="table-header-row">
<tr>
- <th style="text-align: left;">{% trans "Item" context "Ordered item name" %}</th>
- <th style="text-align: right;">{% trans "Download Link" context "Ordered item download links" %}</th>
+ <th style="text-align: left;">
+ {{#blocktrans "Ordered item name"}}
+ Item
+ {{/blocktrans}}
+ </th>
+ <th style="text-align: right;">
+ {{#blocktrans "Ordered item download links"}}
+ Download Link
+ {{/blocktrans}}
+ </th>
</tr>
</thead>
<tbody>
- {% for line in digital_lines %}
+ {{#each digital_lines}}
<tr class="table-item-row">
- {% if line.order_line.variant_name %}
- <td>{{ line.order_line.product_name }} ({{line.order_line.variant_name }})</td>
- {% else %}
- <td>{{ line.order_line.product_name }}</td>
- {% endif %}
+ {{#if order_line.variant_name}}
+ <td>{{order_line.product_name}} ({{order_line.variant_name}})</td>
+ {{else}}
+ <td>{{order_line.product_name}}</td>
+ {{/if}}
<td style="text-align: right;">
- <a href={{ line.order_line.digital_url }}>Link</a>
+ <a href={{order_line.digital_url}}>Link</a>
</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</table>
- {% endif %}
+ {{/if}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/partials/_order_lines.mjml b/templates/templated_email/source/partials/_order_lines.mjml
index da6dae2bad..e0fdcc66bd 100644
--- a/templates/templated_email/source/partials/_order_lines.mjml
+++ b/templates/templated_email/source/partials/_order_lines.mjml
@@ -1,83 +1,94 @@
-<mj-raw>
- {% load display_translated_order_line_name from order_lines %}
- {% load price from taxed_prices %}
- {% load price_amount from taxed_prices %}
- {% load voucher %}
-</mj-raw>
<mj-section>
<mj-column>
<mj-table>
<tfoot>
<tr>
<td colspan="3" style="text-align: right;">
- {% trans "Subtotal" context "E-mail order lines summary table" %}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Subtotal
+ {{/blocktrans}}
</td>
<td style="text-align: right;">
- {% price_amount order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.subtotal_net_amount order.subtotal_gross_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
<tr>
<td colspan="3" style="text-align: right;">
- {% trans "Shipping" context "E-mail order lines summary table" %}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Shipping
+ {{/blocktrans}}
</td>
<td style="text-align: right;">
- {% price_amount order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.shipping_price_net_amount order.shipping_price_gross_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
<tr>
<td colspan="3" style="text-align: right;">
- {% if order.display_gross_prices %}
- {% trans "Taxes (included)" context "E-mail order lines summary table" %}
- {% else %}
- {% trans "Taxes" context "E-mail order lines summary table" %}
- {% endif %}
+ {{#if order.display_gross_prices}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Taxes (included)
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Taxes
+ {{/blocktrans}}
+ {{/if}}
</td>
<td style="text-align: right;">
- {% price_amount order.tax_amount order.tax_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price order.tax_amount order.tax_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
- {% if order.discount_amount %}
+ {{#if order.discount_amount}}
<tr>
<td colspan="3" style="text-align: right;">
- {% trans "Discount" context "E-mail order lines summary table" %}
+ {{order.discount_amount}}
+ {{#blocktrans "E-mail order lines summary table"}}
+ Discount
+ {{/blocktrans}}
</td>
<td style="text-align: right;">
- {% discount_as_negative order.discount html=True %}
+ {{price order.discount_amount order.discount_amount order.currency display_gross=order.display_gross_prices}}
</td>
</tr>
- {% endif %}
+ {{/if}}
<tr>
<td colspan="3" style="text-align: right;">
- <strong>{% trans "Total" context "E-mail order lines summary table" %}</strong>
+ <strong>
+ {{#blocktrans "E-mail order lines summary table"}}Total{{/blocktrans}}
+ </strong>
</td>
<td style="text-align: right;">
- <strong>{% price_amount order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}</strong>
+ <strong>
+ {{price order.total_net_amount order.total_gross_amount order.currency display_gross=order.display_gross_prices}}
+ </strong>
</td>
</tr>
</tfoot>
<thead class="table-header-row">
<tr>
- <th>{% trans "Item" context "Ordered item name" %}</th>
- <th>{% trans "Quantity" context "Quantity ordered of a product" %}</th>
- <th>{% trans "Per unit" context "Unit price of a product" %}</th>
- <th>{% trans "Subtotal" context "Ordered item subtotal (unit price * quantity)" %}</th>
+ <th>{{#blocktrans "Ordered item name"}}Item{{/blocktrans}}</th>
+ <th>{{#blocktrans "Quantity ordered of a product"}}Quantity{{/blocktrans}}</th>
+ <th>{{#blocktrans "Unit price of a product"}}Per unit{{/blocktrans}}</th>
+ <th>{{#blocktrans "Ordered item subtotal (unit price * quantity)"}}Subtotal{{/blocktrans}}</th>
</tr>
</thead>
<tbody>
- {% for line in order.lines %}
+ {{#each order.lines}}
<tr class="table-item-row">
- {% if line.variant_name %}
- <td>{{ line.product_name }} ({{line.variant_name }})</td>
- {% else %}
- <td>{{ line.product_name }}</td>
- {% endif %}
- <td style="text-align: right;">{{ line.quantity }}</td>
+ {{#if variant_name}}
+ <td>{{product_name}} ({{variant_name}})</td>
+ {{else}}
+ <td>{{product_name}}</td>
+ {{/if}}
+ <td style="text-align: right;">{{quantity}}</td>
<td style="text-align: right;">
- {% price_amount line.unit_price_net_amount line.unit_price_gross_amount order.currency display_gross=order.display_gross_prices html=False %}
+ {{price unit_price_net_amount unit_price_gross_amount ../order.currency display_gross=../order.display_gross_prices}}
+ </td>
+ <td style="text-align: right;">
+ {{price total_net_amount total_gross_amount ../order.currency display_gross=../order.display_gross_prices}}
</td>
- <td style="text-align: right;">{% price_amount line.total_net_amount line.total_gross_amount order.currency display_gross=order.display_gross_prices html=False %}</td>
</tr>
- {% endfor %}
+ {{/each}}
</tbody>
</mj-table>
</mj-column>
diff --git a/templates/templated_email/source/password_reset.mjml b/templates/templated_email/source/password_reset.mjml
index c2b45c9df3..df3b8b18a8 100644
--- a/templates/templated_email/source/password_reset.mjml
+++ b/templates/templated_email/source/password_reset.mjml
@@ -3,24 +3,23 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Password reset e-mail text" %}
- You're receiving this e-mail because you or someone else has requested a password for your user account at {{ site_name }}.<br/>
+ {{#blocktrans "Password reset e-mail text"}}
+ You're receiving this e-mail because you or someone else has requested a password for your user account at {{site_name}}.<br/>
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
<mj-text>
- <a href="{{ reset_url }}">
- {{ reset_url }}
+ <a href="{{reset_url}}">
+ {{reset_url}}
</a>
</mj-text>
</mj-column>
diff --git a/templates/templated_email/source/request_email_change.mjml b/templates/templated_email/source/request_email_change.mjml
index 1512a39eb2..17f22d1de1 100644
--- a/templates/templated_email/source/request_email_change.mjml
+++ b/templates/templated_email/source/request_email_change.mjml
@@ -3,24 +3,23 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Email change e-mail text" %}
- You're receiving this e-mail because you or someone else has requested an email change for your user account at {{ site_name }}.<br />
+ {{#blocktrans "Email change e-mail text"}}
+ You're receiving this e-mail because you or someone else has requested an email change for your user account at {{site_name}}.<br />
It can be safely ignored if you did not request an email change. Click the link below to confirm new email address.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
<mj-text>
- <a href="{{ redirect_url }}">
- {{ redirect_url }}
+ <a href="{{redirect_url}}">
+ {{redirect_url}}
</a>
</mj-text>
</mj-column>
diff --git a/templates/templated_email/source/send_invoice.mjml b/templates/templated_email/source/send_invoice.mjml
index cb8ece817d..1dba0b28c6 100644
--- a/templates/templated_email/source/send_invoice.mjml
+++ b/templates/templated_email/source/send_invoice.mjml
@@ -3,23 +3,22 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Send invoice e-mail text" %}
- In order to download invoice {{ number }}, click the link below.
- {% endblocktrans %}
+ {{#blocktrans "Send invoice e-mail text"}}
+ In order to download invoice {{number}}, click the link below.
+ {{/blocktrans}}
</mj-text>
<mj-text>
- <a href="{{ download_url | safe }}">
- {{ download_url | safe }}
+ <a href="{{download_url}}">
+ {{invoice.download_url}}
</a>
</mj-text>
</mj-column>
diff --git a/templates/templated_email/source/set_customer_password.mjml b/templates/templated_email/source/set_customer_password.mjml
index 5cf115f819..fd4c51fb3b 100644
--- a/templates/templated_email/source/set_customer_password.mjml
+++ b/templates/templated_email/source/set_customer_password.mjml
@@ -3,24 +3,23 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Set password for customer e-mail text" %}
- You're receiving this e-mail because you have to set password for your customer account at {{ site_name }}.<br/>
+ {{#blocktrans "Set password for customer e-mail text"}}
+ You're receiving this e-mail because you have to set password for your customer account at {{site_name}}.<br/>
Click the link below to set up your password.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
<mj-text>
- <a href="{{ password_set_url }}">
- {{ password_set_url }}
+ <a href="{{password_set_url}}">
+ {{password_set_url}}
</a>
</mj-text>
</mj-column>
diff --git a/templates/templated_email/source/set_password.mjml b/templates/templated_email/source/set_password.mjml
index 7dd3d62e17..4c5e93fcaf 100644
--- a/templates/templated_email/source/set_password.mjml
+++ b/templates/templated_email/source/set_password.mjml
@@ -3,24 +3,22 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
- <mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Set password for staff member e-mail text" %}
- You're receiving this e-mail because you have to set password for your staff member account at {{ site_name }}.<br/>
+ {{#blocktrans "Set password for staff member e-mail text"}}
+ You're receiving this e-mail because you have to set password for your staff member account at {{site_name}}.<br/>
Click the link below to set up your password.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
<mj-text>
- <a href="{{ password_set_url }}">
- {{ password_set_url }}
+ <a href="{{ password_set_url}}">
+ {{password_set_url}}
</a>
</mj-text>
</mj-column>
diff --git a/templates/templated_email/source/shared/footer.mjml b/templates/templated_email/source/shared/footer.mjml
index e415e61138..a76c7f12b5 100644
--- a/templates/templated_email/source/shared/footer.mjml
+++ b/templates/templated_email/source/shared/footer.mjml
@@ -1,27 +1,29 @@
<mj-section>
<mj-column>
<mj-text>
- {% blocktrans trimmed context "Base email text" %}
+ {{#blocktrans "Base email text" }}
This is an automatically generated e-mail, please do not reply.
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
<mj-section background-color="#F2F2F2">
<mj-column>
<mj-text align="center">
- {% blocktrans trimmed context "Base email footer" %}
+ {{#blocktrans "Base email footer" }}
Sincerely, {{ site_name }}
- {% endblocktrans %}
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
<mj-section css-class="no-display">
<mj-column>
<mj-text>
- {% if schema_markup %}
- <script type="application/ld+json">{{ schema_markup|safe }}</script>
- {% endif %}
+ {{#if order}}
+ <script type="application/ld+json">
+ {{{{raw}}}}{{schema_markup}}{{{{/raw}}}}
+ </script>
+ {{/if}}
</mj-text>
</mj-column>
</mj-section>
diff --git a/templates/templated_email/source/shared/header.mjml b/templates/templated_email/source/shared/header.mjml
index 5d6857919a..cf652df52c 100644
--- a/templates/templated_email/source/shared/header.mjml
+++ b/templates/templated_email/source/shared/header.mjml
@@ -1,3 +1 @@
-<mj-raw>
- {% load static %}
-</mj-raw>
+<mj-raw></mj-raw>
diff --git a/templates/templated_email/source/staff_confirm_order.mjml b/templates/templated_email/source/staff_confirm_order.mjml
index f68df260a6..f6680ceb73 100644
--- a/templates/templated_email/source/staff_confirm_order.mjml
+++ b/templates/templated_email/source/staff_confirm_order.mjml
@@ -3,20 +3,19 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- {% load i18n_address_tags %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed with order_details_url=order.order_details_url context "Order confirmation staff e-mail text" %}
- Someone placed a new order in your store. To see order details please visit: <a href="{{ order_details_url }}">{{ order_details_url }}</a>
- {% endblocktrans %}
+ {{#blocktrans "Order confirmation staff e-mail text"}}
+ Someone placed a new order in your store. To see order details please visit:
+ <a href="{{order.order_details_url}}">{{order.order_details_url}}</a>
+ {{/blocktrans}}
</mj-text>
</mj-column>
</mj-section>
@@ -26,25 +25,25 @@
<mj-table>
<thead class="table-header-row">
<tr>
- <th>{% trans "Billing address" context "Order confirmation e-mail billing address" %}</th>
- <th>{% trans "Shipping address" context "Order confirmation e-mail shipping address" %}</th>
+ <th>{{#blocktrans "Order confirmation e-mail billing address"}}Billing address{{/blocktrans}}</th>
+ <th>{{#blocktrans "Order confirmation e-mail shipping address"}}Shipping address{{/blocktrans}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="address">
- {% if order.billing_address %}
- {% format_address order.billing_address %}
- {% else %}
- {% trans "No billing address" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.billing_address}}
+ {{format_address order.billing_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No billing address{{/blocktrans}}
+ {{/if}}
</td>
<td css-class="address">
- {% if order.shipping_address %}
- {% format_address order.shipping_address %}
- {% else %}
- {% trans "No shipping required" context "Order confirmation e-mail text" %}
- {% endif %}
+ {{#if order.shipping_address}}
+ {{format_address order.shipping_address}}
+ {{else}}
+ {{#blocktrans "Order confirmation e-mail text"}}No shipping required{{/blocktrans}}
+ {{/if}}
</td>
</tr>
</tbody>
diff --git a/templates/templated_email/source/update_fulfillment.mjml b/templates/templated_email/source/update_fulfillment.mjml
index f7729abce9..3b1f0e2d43 100644
--- a/templates/templated_email/source/update_fulfillment.mjml
+++ b/templates/templated_email/source/update_fulfillment.mjml
@@ -3,30 +3,29 @@
<mj-include path="./shared/styles.mjml" />
</mj-head>
<mj-body>
- <mj-raw>
- {% load i18n %}
- </mj-raw>
<mj-include path="./shared/header.mjml" />
<mj-section>
<mj-column>
<mj-text font-size="16px">
- {% trans "Hi!" context "Standard e-mail greeting" %}
+ {{#blocktrans "Standard e-mail greeting"}}
+ Hi!
+ {{/blocktrans}}
</mj-text>
<mj-text>
- {% blocktrans trimmed context "Fulfillment update email text" %}
+ {{#blocktrans "Fulfillment update email text"}}
Your shipping status has been updated. Below is the list of ordered products that have been updated with new tracking number.
- {% endblocktrans %}
- {% if fulfillment.tracking_number %}
- {% if fulfillment.is_tracking_number_url %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with <a href="{{ tracking_number }}">{{ tracking_number }}</a> link.
- {% endblocktrans %}
- {% else %}
- {% blocktrans trimmed with tracking_number=fulfillment.tracking_number context "Fulfillment confirmation email text" %}
- You can track your shipment with {{ tracking_number }} code.
- {% endblocktrans %}
- {% endif %}
- {% endif %}
+ {{/blocktrans}}
+ {{#if fulfillment.tracking_number}}
+ {{#if fulfillment.is_tracking_number_url}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with <a href="{{ fulfillment.tracking_number }}">{{ fulfillment.tracking_number }}</a> link.
+ {{/blocktrans}}
+ {{else}}
+ {{#blocktrans "Fulfillment confirmation email text"}}
+ You can track your shipment with {{ fulfillment.tracking_number }} code.
+ {{/blocktrans}}
+ {{/if}}
+ {{/if}}
</mj-text>
</mj-column>
</mj-section>