Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Extend the amount of data in the email payload
Maciej Korycinskicafb853cc8cb
diff --git a/saleor/invoice/notifications.py b/saleor/invoice/notifications.pyindex b7258fa7ad..76770b4d26 100644--- a/saleor/invoice/notifications.py+++ b/saleor/invoice/notifications.py@@ -10,7 +10,7 @@ def get_invoice_payload(invoice):"id": invoice.id,"number": invoice.number,"download_url": invoice.url,- "order_id": invoice.order.id,+ "order_id": invoice.order_id,}diff --git a/saleor/order/notifications.py b/saleor/order/notifications.pyindex 0c69746f81..d429e6adea 100644--- a/saleor/order/notifications.py+++ b/saleor/order/notifications.py@@ -17,28 +17,26 @@ if TYPE_CHECKING:def get_order_line_payload(line: "OrderLine"):- unit_tax_amount = line.unit_price_gross_amount - line.unit_price_net_amount- total_gross = line.unit_price_gross * line.quantity- total_net = line.unit_price_net * line.quantity- total_tax = total_gross - total_netdigital_url = ""if line.is_digital:content = DigitalContentUrl.objects.filter(line=line).first()digital_url = content.get_absolute_url() if content else None # type: ignorereturn {"id": line.id,- "product_name": line.translated_product_name or line.product_name,- "variant_name": line.translated_variant_name or line.variant_name,+ "product_name": line.product_name,+ "translated_product_name": line.translated_product_name or line.product_name,+ "variant_name": line.variant_name,+ "translated_variant_name": line.translated_variant_name or line.variant_name,"product_sku": line.product_sku,"quantity": line.quantity,"quantity_fulfilled": line.quantity_fulfilled,"currency": line.currency,- "unit_price_net_amount": line.unit_price_net_amount,- "unit_price_gross_amount": line.unit_price_gross_amount,- "unit_tax_amount": unit_tax_amount,- "total_gross_amount": total_gross.amount,- "total_net_amount": total_net.amount,- "total_tax_amount": total_tax.amount,+ "unit_price_net_amount": line.unit_price.net.amount,+ "unit_price_gross_amount": line.unit_price.gross.amount,+ "unit_tax_amount": line.unit_price.tax.amount,+ "total_gross_amount": line.total_price.gross.amount,+ "total_net_amount": line.total_price.net.amount,+ "total_tax_amount": line.total_price.tax.amount,"tax_rate": line.tax_rate,"is_shipping_required": line.is_shipping_required,"is_digital": line.is_digital,@@ -102,6 +100,7 @@ def get_default_order_payload(order: "Order", redirect_url: str = ""):order_payload = model_to_dict(order, fields=ORDER_MODEL_FIELDS)order_payload.update({+ "channel_slug": order.channel.slug,"created": order.created,"shipping_price_net_amount": order.shipping_price_net_amount,"shipping_price_gross_amount": order.shipping_price_gross_amount,diff --git a/saleor/order/tests/test_notifications.py b/saleor/order/tests/test_notifications.pyindex ba35eecd50..f6f1f2501e 100644--- a/saleor/order/tests/test_notifications.py+++ b/saleor/order/tests/test_notifications.py@@ -23,9 +23,13 @@ def test_get_order_line_payload(order_line):total_net = order_line.unit_price_net * order_line.quantitytotal_tax = total_gross - total_netassert payload == {+ "translated_product_name": order_line.translated_product_name+ or order_line.product_name,+ "translated_variant_name": order_line.translated_variant_name+ or order_line.variant_name,"id": order_line.id,- "product_name": order_line.translated_product_name or order_line.product_name,- "variant_name": order_line.translated_variant_name or order_line.variant_name,+ "product_name": order_line.product_name,+ "variant_name": order_line.variant_name,"product_sku": order_line.product_sku,"is_shipping_required": order_line.is_shipping_required,"quantity": order_line.quantity,@@ -69,6 +73,7 @@ def test_get_default_order_payload(order_line):subtotal = order.get_subtotal()tax = order.total_gross_amount - order.total_net_amountassert payload == {+ "channel_slug": order.channel.slug,"id": order.id,"token": order.token,"created": order.created,