Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove incorrect call to logic that is supposed run when manually (#18028)
Marcin Wcisło1c69de025034
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2b1fdd2be7..eaeb7bc871 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,9 @@ All notable, unreleased changes to this project will be documented in this file.# 3.22.0 [Unreleased]### Breaking changes+- The following changes were implemented to orders with a zero total amount:+ - No manual charge (`Transaction` or `Payment`) object will be created.+ - The `OrderEvents.ORDER_MARKED_AS_PAID` event will no longer be emitted.### GraphQL API- You can now filter and search orders using the new `where` and `search` fields on the `pages` query.diff --git a/saleor/checkout/complete_checkout.py b/saleor/checkout/complete_checkout.pyindex 603ccd074d..4150138561 100644--- a/saleor/checkout/complete_checkout.py+++ b/saleor/checkout/complete_checkout.py@@ -41,7 +41,7 @@ from ..graphql.checkout.utils import (prepare_insufficient_stock_checkout_validation_error,)from ..order import OrderOrigin, OrderStatus-from ..order.actions import mark_order_as_paid_with_payment, order_created+from ..order.actions import order_createdfrom ..order.fetch import OrderInfo, OrderLineInfofrom ..order.models import Order, OrderLinefrom ..order.notifications import send_order_confirmation@@ -1201,14 +1201,6 @@ def complete_checkout_post_payment_part()raise ValidationError(code=e.code, message=e.message) from e- # if the order total value is 0 it is paid from the definition- if order.total.net.amount == 0:- if (- order.channel.order_mark_as_paid_strategy- == MarkAsPaidStrategy.PAYMENT_FLOW- ):- mark_order_as_paid_with_payment(order, user, app, manager)-return order, action_required, action_datadiff --git a/saleor/checkout/tests/test_checkout_complete.py b/saleor/checkout/tests/test_checkout_complete.pyindex 957d6cf55e..5d73158ef0 100644--- a/saleor/checkout/tests/test_checkout_complete.py+++ b/saleor/checkout/tests/test_checkout_complete.py@@ -1313,8 +1313,9 @@ def test_complete_checkout_0_total_captured_payment_creates_expected_events()order.refresh_from_db()+ assert order.charge_status == OrderChargeStatus.FULL+ assert order.authorize_status == OrderAuthorizeStatus.FULL(- order_marked_as_paid,order_placed_event,order_fully_paid,order_confirmed_event,@@ -1332,18 +1333,6 @@ def test_complete_checkout_0_total_captured_payment_creates_expected_events(# should not have any additional parametersassert not order_placed_event.parameters- # Ensure the correct order event was created- # is the event the expected type- assert order_marked_as_paid.type == OrderEvents.ORDER_MARKED_AS_PAID- # is the user anonymous/ the customer- assert order_marked_as_paid.user == checkout_user- # is the associated backref order valid- assert order_marked_as_paid.order is order- # ensure a date was set- assert order_marked_as_paid.date- # should not have any additional parameters- assert not order_marked_as_paid.parameters-expected_order_payload = {"order": get_default_order_payload(order, checkout.redirect_url),"recipient_email": order.get_customer_email(),