Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Rename is_fully_paid to can_be_fully_paid
Unknownd24079645e1a
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.pyindex e2b04da2fa..fc9745fe89 100644--- a/saleor/checkout/utils.py+++ b/saleor/checkout/utils.py@@ -880,8 +880,8 @@ def create_order(cart: Cart, tracking_code: str, discounts, taxes):return order-def is_fully_paid(cart: Cart, taxes, discounts):- """Check if checkout is fully paid."""+def can_be_fully_paid(cart: Cart, taxes, discounts):+ """Check if checkout can be fully paid with proper payments."""payments = [payment for payment in cart.payments.all() if payment.is_active]total_paid = sum([p.total for p in payments])@@ -902,7 +902,8 @@ def ready_to_place_order(cart: Cart, taxes, discounts):return False, pgettext_lazy('order placement error','Shipping method is not valid for your shipping address')- if not is_fully_paid(cart, taxes, discounts):+ if not can_be_fully_paid(cart, taxes, discounts):return False, pgettext_lazy(- 'order placement error', 'Checkout is not fully paid')+ 'order placement error',+ 'Checkout can not be fully paid with proper payments')return True, Nonediff --git a/tests/api/test_checkout.py b/tests/api/test_checkout.pyindex bee40a3575..7abb5640e1 100644--- a/tests/api/test_checkout.py+++ b/tests/api/test_checkout.py@@ -6,7 +6,7 @@ import pytestfrom saleor.checkout.models import Cartfrom saleor.checkout.utils import (- add_voucher_to_cart, is_fully_paid, ready_to_place_order)+ add_voucher_to_cart, can_be_fully_paid, ready_to_place_order)from saleor.graphql.core.utils import str_to_enumfrom saleor.order.models import Orderfrom tests.api.utils import get_graphql_content@@ -875,7 +875,8 @@ def test_checkout_complete_no_payment(MUTATION_CHECKOUT_COMPLETE, variables)content = get_graphql_content(response)data = content['data']['checkoutComplete']- assert data['errors'][0]['message'] == 'Checkout is not fully paid'+ assert data['errors'][0]['message'] == \+ 'Checkout can not be fully paid with proper payments'assert orders_count == Order.objects.count()@@ -1145,7 +1146,7 @@ def test_ready_to_place_order_no_payment(checkout.save()ready, error = ready_to_place_order(checkout, None, None)assert not ready- assert error == 'Checkout is not fully paid'+ assert error == 'Checkout can not be fully paid with proper payments'def test_is_fully_paid(cart_with_item, payment_dummy):@@ -1158,7 +1159,7 @@ def test_is_fully_paid(cart_with_item, payment_dummy):payment.currency = total.gross.currencypayment.checkout = checkoutpayment.save()- is_paid = is_fully_paid(checkout, None, None)+ is_paid = can_be_fully_paid(checkout, None, None)assert is_paid@@ -1180,7 +1181,7 @@ def test_is_fully_paid_many_payments(cart_with_item, payment_dummy):payment2.currency = total.gross.currencypayment2.checkout = checkoutpayment2.save()- is_paid = is_fully_paid(checkout, None, None)+ is_paid = can_be_fully_paid(checkout, None, None)assert is_paid@@ -1194,13 +1195,13 @@ def test_is_fully_paid_partially_paid(cart_with_item, payment_dummy):payment.currency = total.gross.currencypayment.checkout = checkoutpayment.save()- is_paid = is_fully_paid(checkout, None, None)+ is_paid = can_be_fully_paid(checkout, None, None)assert not is_paiddef test_is_fully_paid_no_payment(cart_with_item):checkout = cart_with_item- is_paid = is_fully_paid(checkout, None, None)+ is_paid = can_be_fully_paid(checkout, None, None)assert not is_paid