Skip to content

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

Refactor checkout_total function into calculcate_checkout_total. (#17999)

Marcin Wcisło8a03c74411d7
diff --git a/saleor/checkout/calculations.py b/saleor/checkout/calculations.py
index ebbcea119d..b747c226cb 100644
--- a/saleor/checkout/calculations.py
+++ b/saleor/checkout/calculations.py
@@ -135,9 +135,14 @@ def calculate_checkout_total_with_gift_cards(
force_update: bool = False,
allow_sync_webhooks: bool = True,
) -> "TaxedMoney":
+ """Return the total cost of the checkout taking into account gift cards total.
+
+ Gift cards total is subtracted from total gross amount and subtracted proportionally
+ from total net amount.
+ """
if pregenerated_subscription_payloads is None:
pregenerated_subscription_payloads = {}
- total = checkout_total(
+ total = calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -168,7 +173,7 @@ def calculate_checkout_total_with_gift_cards(
return total
-def checkout_total(
+def calculate_checkout_total(
*,
manager: "PluginsManager",
checkout_info: "CheckoutInfo",
diff --git a/saleor/checkout/complete_checkout.py b/saleor/checkout/complete_checkout.py
index 2e50ac937a..603ccd074d 100644
--- a/saleor/checkout/complete_checkout.py
+++ b/saleor/checkout/complete_checkout.py
@@ -730,7 +730,7 @@ def _prepare_order_data(
order_data.update(_process_voucher_data_for_order(checkout_info))
- order_data["total_price_left"] = calculations.checkout_total(
+ order_data["total_price_left"] = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -1530,7 +1530,7 @@ def _create_order_from_checkout(
)
# giftcards
- total_without_giftcard = calculations.checkout_total(
+ total_without_giftcard = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=checkout_lines_info,
diff --git a/saleor/checkout/tests/fixtures/checkout_with_payment.py b/saleor/checkout/tests/fixtures/checkout_with_payment.py
index c0ab588f7c..85fcc6076b 100644
--- a/saleor/checkout/tests/fixtures/checkout_with_payment.py
+++ b/saleor/checkout/tests/fixtures/checkout_with_payment.py
@@ -29,7 +29,7 @@ def checkout_with_charged_payment(checkout_with_billing_address):
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -64,7 +64,7 @@ def checkout_with_charged_payment_for_cc(checkout_with_billing_address_for_cc):
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
manager = get_plugins_manager(allow_replica=False)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -107,7 +107,7 @@ def checkout_preorder_with_charged_payment(
lines, _ = fetch_checkout_lines(checkout)
manager = get_plugins_manager(allow_replica=False)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -151,7 +151,7 @@ def checkout_with_digital_line_with_charged_payment(
add_variant_to_checkout(checkout_info, variant, 1)
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/checkout/tests/test_checkout.py b/saleor/checkout/tests/test_checkout.py
index cb5455c1f3..ee350ca5bd 100644
--- a/saleor/checkout/tests/test_checkout.py
+++ b/saleor/checkout/tests/test_checkout.py
@@ -1664,7 +1664,7 @@ def test_recalculate_checkout_discount_with_promotion(
checkout.price_expiration = timezone.now()
checkout.save()
assert (
- calculations.checkout_total(
+ calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -1852,7 +1852,7 @@ def test_recalculate_checkout_discount_free_shipping_subtotal_less_than_shipping
assert checkout.discount == channel_listing.price
assert checkout.discount_name == "Free shipping"
- checkout_total = calculations.checkout_total(
+ checkout_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -1890,7 +1890,7 @@ def test_recalculate_checkout_discount_free_shipping_subtotal_bigger_than_shippi
assert checkout.discount == channel_listing.price
assert checkout.discount_name == "Free shipping"
- checkout_total = calculations.checkout_total(
+ checkout_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2289,7 +2289,7 @@ def test_is_fully_paid(checkout_with_item, payment_dummy):
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2311,7 +2311,7 @@ def test_is_fully_paid_mg_payments(checkout_with_item, payment_dummy):
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2341,7 +2341,7 @@ def test_is_fully_paid_partially_paid(checkout_with_item, payment_dummy):
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/checkout/tests/test_checkout_complete.py b/saleor/checkout/tests/test_checkout_complete.py
index d75bc58cfe..957d6cf55e 100644
--- a/saleor/checkout/tests/test_checkout_complete.py
+++ b/saleor/checkout/tests/test_checkout_complete.py
@@ -738,7 +738,7 @@ def test_create_order_with_gift_card_partial_use(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- price_without_gift_card = calculations.checkout_total(
+ price_without_gift_card = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -797,7 +797,7 @@ def test_create_order_with_many_gift_cards(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- price_without_gift_card = calculations.checkout_total(
+ price_without_gift_card = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/checkout/tests/test_order_from_checkout.py b/saleor/checkout/tests/test_order_from_checkout.py
index e7820301b2..099be3d072 100644
--- a/saleor/checkout/tests/test_order_from_checkout.py
+++ b/saleor/checkout/tests/test_order_from_checkout.py
@@ -123,7 +123,7 @@ def test_create_order_with_gift_card_partial_use(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- price_without_gift_card = calculations.checkout_total(
+ price_without_gift_card = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -177,7 +177,7 @@ def test_create_order_with_many_gift_cards_worth_more_than_total(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- price_without_gift_card = calculations.checkout_total(
+ price_without_gift_card = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -247,7 +247,7 @@ def test_create_order_with_many_gift_cards(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- price_without_gift_card = calculations.checkout_total(
+ price_without_gift_card = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/checkout/tests/test_tasks.py b/saleor/checkout/tests/test_tasks.py
index d1845fa5d6..81c2001d35 100644
--- a/saleor/checkout/tests/test_tasks.py
+++ b/saleor/checkout/tests/test_tasks.py
@@ -862,7 +862,7 @@ def test_automatic_checkout_completion_task_checkout_error_task_retried(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -941,7 +941,7 @@ def test_automatic_checkout_completion_task_checkout_deleted_in_meantime(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py
index 961a43bbb8..c4d8184651 100644
--- a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py
+++ b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py
@@ -1450,7 +1450,7 @@ def test_checkout_payment_charge(
lines, _ = fetch_checkout_lines(checkout_with_billing_address)
checkout_info = fetch_checkout_info(checkout_with_billing_address, lines, manager)
manager = get_plugins_manager(allow_replica=False)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py b/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py
index 50fa85efdf..747073daa4 100644
--- a/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py
+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py
@@ -99,7 +99,7 @@ def test_checkout_add_voucher_for_entire_order(api_client, checkout_with_item, v
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -949,7 +949,7 @@ def test_checkout_get_total_with_gift_card(api_client, checkout_with_item, gift_
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete.py
index 35c0b035e5..38e67f08ef 100644
--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete.py
+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete.py
@@ -217,7 +217,7 @@ def test_checkout_complete_0_total_value_no_payment(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
orders_count = Order.objects.count()
diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py
index 70b4c3547b..f8aa6ae651 100644
--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py
+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py
@@ -972,7 +972,7 @@ def test_checkout_with_voucher_complete(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -1084,7 +1084,7 @@ def test_checkout_with_order_promotion_complete(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -1209,7 +1209,7 @@ def test_checkout_complete_with_voucher_apply_once_per_order(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -1358,7 +1358,7 @@ def test_checkout_with_voucher_complete_product_on_promotion(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -1488,7 +1488,7 @@ def test_checkout_with_voucher_on_specific_product_complete(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -1602,7 +1602,7 @@ def test_checkout_complete_with_voucher_single_use(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -1827,7 +1827,7 @@ def test_checkout_complete_with_voucher_paid_by_gift_card(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total_without_gc = calculations.checkout_total(
+ total_without_gc = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -2092,7 +2092,7 @@ def test_checkout_complete_product_on_promotion(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2236,7 +2236,7 @@ def test_checkout_complete_product_on_promotion_deleted_promotion_instance(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2467,7 +2467,7 @@ def test_checkout_complete_product_on_old_sale(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2644,7 +2644,7 @@ def test_checkout_with_voucher_on_specific_product_complete_with_product_on_prom
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2815,7 +2815,7 @@ def test_checkout_complete_without_inventory_tracking(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -3032,7 +3032,7 @@ def test_checkout_complete_does_not_delete_checkout_after_unsuccessful_payment(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -3130,7 +3130,7 @@ def test_checkout_complete_confirmation_needed(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -3193,7 +3193,7 @@ def test_checkout_confirm(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_txn_to_confirm
@@ -3240,7 +3240,7 @@ def test_checkout_complete_insufficient_stock(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -3291,7 +3291,7 @@ def test_checkout_complete_insufficient_stock_payment_refunded(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -3353,7 +3353,7 @@ def test_checkout_complete_insufficient_stock_payment_voided(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -3429,7 +3429,7 @@ def test_checkout_complete_insufficient_stock_reserved_by_other_user(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -3485,7 +3485,7 @@ def test_checkout_complete_own_reservation(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -3616,7 +3616,7 @@ def test_checkout_complete_payment_payment_total_different_than_checkout(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -3739,7 +3739,7 @@ def test_checkout_complete_with_digital(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -3785,7 +3785,7 @@ def test_checkout_complete_with_digital_and_shipping_address(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -3844,7 +3844,7 @@ def test_checkout_complete_with_digital_saving_addresses_off(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -3909,7 +3909,7 @@ def test_checkout_complete_0_total_value(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -3986,7 +3986,7 @@ def test_complete_checkout_for_local_click_and_collect(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -4055,7 +4055,7 @@ def test_complete_checkout_for_global_click_and_collect(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -4167,7 +4167,7 @@ def test_comp_checkout_builds_order_for_all_warehouse_even_if_not_available_loca
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -4221,7 +4221,7 @@ def test_checkout_complete_raises_InsufficientStock_when_quantity_above_stock_su
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -4268,7 +4268,7 @@ def test_checkout_complete_raises_InvalidShippingMethod_when_warehouse_disabled(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -4429,7 +4429,7 @@ def test_checkout_complete_with_click_collect_preorder_fails_for_disabled_wareho
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -5126,7 +5126,7 @@ def test_checkout_complete_check_reservations_create(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -5620,7 +5620,7 @@ def test_checkout_complete_with_invalid_address(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -5674,7 +5674,7 @@ def test_checkout_complete_log_unknown_discount_reason(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -5920,7 +5920,7 @@ def test_checkout_complete_with_different_email_than_user_email(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
@@ -5967,7 +5967,7 @@ def test_checkout_complete_sets_product_type_id_for_all_order_lines(
line.variant.id: line.product_type.id for line in lines
}
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
payment = payment_dummy
diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py
index 49466fec15..8b3e418af2 100644
--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py
+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py
@@ -2022,7 +2022,7 @@ def test_checkout_with_voucher_complete(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -2118,7 +2118,7 @@ def test_checkout_with_order_promotion_complete(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -2308,7 +2308,7 @@ def test_checkout_complete_with_voucher_paid_with_gift_card(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total_without_gc = calculations.checkout_total(
+ total_without_gc = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -2439,7 +2439,7 @@ def test_checkout_complete_with_voucher_apply_once_per_order(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -2639,7 +2639,7 @@ def test_checkout_complete_with_voucher_single_use(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -2881,7 +2881,7 @@ def test_checkout_with_voucher_complete_product_on_sale(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2980,7 +2980,7 @@ def test_checkout_with_voucher_on_specific_product_complete(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -3210,7 +3210,7 @@ def test_checkout_complete_product_on_promotion(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3367,7 +3367,7 @@ def test_checkout_complete_multiple_rules_applied(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3477,7 +3477,7 @@ def test_checkout_with_voucher_on_specific_product_complete_with_product_on_prom
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py b/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py
index 173e864c5f..49d5ff69d7 100644
--- a/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py
+++ b/saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py
@@ -1570,7 +1570,7 @@ def test_order_from_checkout_without_inventory_tracking(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -1939,7 +1939,7 @@ def test_order_from_checkout_0_total_value(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
diff --git a/saleor/graphql/checkout/tests/test_checkout.py b/saleor/graphql/checkout/tests/test_checkout.py
index 6df579bebd..92b4c845f2 100644
--- a/saleor/graphql/checkout/tests/test_checkout.py
+++ b/saleor/graphql/checkout/tests/test_checkout.py
@@ -2045,7 +2045,7 @@ def test_checkout_prices(user_api_client, checkout_with_item):
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2238,7 +2238,7 @@ def test_checkout_prices_with_promotion(
assert data["token"] == str(checkout.token)
assert len(data["lines"]) == checkout.lines.count()
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2717,7 +2717,7 @@ def test_checkout_prices_with_promotion_line_deleted_in_meantime(
# as the values cannot be fetched for deleted line
lines[0].rules_info = []
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2778,7 +2778,7 @@ def test_checkout_prices_with_promotion_one_line_deleted_in_meantime(
line_count = checkout.lines.count()
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2898,7 +2898,7 @@ def test_checkout_prices_with_specific_voucher(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -2983,7 +2983,7 @@ def test_checkout_prices_with_specific_voucher_when_line_without_listing(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3057,7 +3057,7 @@ def test_checkout_prices_with_voucher_once_per_order(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3146,7 +3146,7 @@ def test_checkout_prices_with_voucher_once_per_order_when_line_without_listing(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3222,7 +3222,7 @@ def test_checkout_prices_with_voucher(user_api_client, checkout_with_item_and_vo
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3311,7 +3311,7 @@ def test_checkout_prices_with_voucher_when_line_without_listing(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3390,7 +3390,7 @@ def test_checkout_prices_with_voucher_code_that_doesnt_exist(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3481,7 +3481,7 @@ def test_checkout_prices_voucher_code_that_doesnt_exist_when_line_without_listin
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3576,7 +3576,7 @@ def test_checkout_prices_variant_listing_price_changed(
assert data["token"] == str(checkout_with_item.token)
assert len(data["lines"]) == checkout_with_item.lines.count()
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -3658,7 +3658,7 @@ def test_checkout_prices_expired_variant_listing_price_changed(
assert len(data["lines"]) == checkout_with_item.lines.count()
checkout_info.checkout.refresh_from_db()
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
@@ -4136,7 +4136,7 @@ def test_clean_checkout(checkout_with_item, payment_dummy, address, shipping_met
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout, lines, manager)
manager = get_plugins_manager(allow_replica=False)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
diff --git a/saleor/graphql/checkout/tests/test_checkout_promo_codes.py b/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
index cb780c0d1e..549a56ad7b 100644
--- a/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
+++ b/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
@@ -44,7 +44,7 @@ def test_checkout_totals_use_discounts(api_client, checkout_with_item, channel_U
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- taxed_total = calculations.checkout_total(
+ taxed_total = calculations.calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/graphql/payment/tests/deprecated/test_checkout_payment_create.py b/saleor/graphql/payment/tests/deprecated/test_checkout_payment_create.py
index c8caaa10e1..4580927bed 100644
--- a/saleor/graphql/payment/tests/deprecated/test_checkout_payment_create.py
+++ b/saleor/graphql/payment/tests/deprecated/test_checkout_payment_create.py
@@ -38,7 +38,7 @@ def test_checkout_add_payment_by_checkout_id(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -80,7 +80,7 @@ def test_checkout_add_payment_neither_token_and_id_given(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -114,7 +114,7 @@ def test_checkout_add_payment_both_token_and_id_given(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
diff --git a/saleor/graphql/payment/tests/mutations/test_checkout_payment_create.py b/saleor/graphql/payment/tests/mutations/test_checkout_payment_create.py
index c03323a89e..566b379777 100644
--- a/saleor/graphql/payment/tests/mutations/test_checkout_payment_create.py
+++ b/saleor/graphql/payment/tests/mutations/test_checkout_payment_create.py
@@ -53,7 +53,7 @@ def test_checkout_add_payment_without_shipping_method_and_not_shipping_required(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -96,7 +96,7 @@ def test_checkout_add_payment_without_shipping_method_with_shipping_required(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -132,7 +132,7 @@ def test_checkout_add_payment_with_shipping_method_and_shipping_required(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -177,7 +177,7 @@ def test_checkout_add_payment(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
return_url = "https://www.example.com"
@@ -224,7 +224,7 @@ def test_checkout_add_payment_default_amount(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -260,7 +260,7 @@ def test_checkout_add_payment_bad_amount(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -295,7 +295,7 @@ def test_checkout_add_payment_no_checkout_email(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
return_url = "https://www.example.com"
@@ -406,7 +406,7 @@ def test_use_checkout_billing_address_as_payment_billing(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -459,7 +459,7 @@ def test_create_payment_for_checkout_with_active_payments(
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -512,7 +512,7 @@ def test_create_payment_with_store(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -546,7 +546,7 @@ def test_create_payment_with_store_as_none(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -582,7 +582,7 @@ def test_create_payment_with_metadata(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -620,7 +620,7 @@ def test_checkout_add_payment_no_variant_channel_listings(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
return_url = "https://www.example.com"
@@ -666,7 +666,7 @@ def test_checkout_add_payment_no_product_channel_listings(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
return_url = "https://www.example.com"
@@ -711,7 +711,7 @@ def test_checkout_add_payment_checkout_without_lines(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
return_url = "https://www.example.com"
@@ -749,7 +749,7 @@ def test_checkout_add_payment_run_multiple_times(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
variables = {
@@ -827,7 +827,7 @@ def test_checkout_payment_create_checkout_locked(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
return_url = "https://www.example.com"
@@ -867,7 +867,7 @@ def test_checkout_payment_create_checkout_locked_time_pass(
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout)
checkout_info = fetch_checkout_info(checkout, lines, manager)
- total = calculations.checkout_total(
+ total = calculations.calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
return_url = "https://www.example.com"
diff --git a/saleor/payment/gateways/adyen/utils/common.py b/saleor/payment/gateways/adyen/utils/common.py
index 97d7d00dfc..7f8c38864f 100644
--- a/saleor/payment/gateways/adyen/utils/common.py
+++ b/saleor/payment/gateways/adyen/utils/common.py
@@ -11,9 +11,9 @@ from django_countries.fields import Country
from requests.exceptions import ConnectTimeout
from .....checkout.calculations import (
+ calculate_checkout_total,
checkout_line_unit_price,
checkout_shipping_price,
- checkout_total,
)
from .....checkout.fetch import (
CheckoutInfo,
@@ -345,7 +345,7 @@ def request_data_for_gateway_config(
checkout = checkout_info.checkout
address = checkout_info.shipping_address or checkout_info.billing_address
lines = lines or []
- total = checkout_total(
+ total = calculate_checkout_total(
manager=manager,
checkout_info=checkout_info,
lines=lines,
diff --git a/saleor/payment/tests/test_payment.py b/saleor/payment/tests/test_payment.py
index 7c1fd55f45..95928bd1bf 100644
--- a/saleor/payment/tests/test_payment.py
+++ b/saleor/payment/tests/test_payment.py
@@ -4,7 +4,7 @@ from unittest.mock import Mock, patch
import pytest
-from ...checkout.calculations import checkout_total
+from ...checkout.calculations import calculate_checkout_total
from ...checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ...core.prices import quantize_price
from ...plugins.manager import PluginsManager, get_plugins_manager
@@ -119,7 +119,7 @@ def test_create_payment(checkout_with_item, address):
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- total = checkout_total(
+ total = calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -160,7 +160,7 @@ def test_create_payment_from_checkout_requires_billing_address(checkout_with_ite
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- total = checkout_total(
+ total = calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=None
)
@@ -202,7 +202,7 @@ def test_create_payment_information_for_checkout_payment(address, checkout_with_
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- total = checkout_total(
+ total = calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -338,7 +338,7 @@ def test_create_payment_information_store(checkout_with_item, address, store):
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- total = checkout_total(
+ total = calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
@@ -373,7 +373,7 @@ def test_create_payment_information_metadata(checkout_with_item, address, metada
manager = get_plugins_manager(allow_replica=False)
lines, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines, manager)
- total = checkout_total(
+ total = calculate_checkout_total(
manager=manager, checkout_info=checkout_info, lines=lines, address=address
)
diff --git a/saleor/tax/tests/test_checkout_calculations.py b/saleor/tax/tests/test_checkout_calculations.py
index 2c756db7bd..619a5e23ee 100644
--- a/saleor/tax/tests/test_checkout_calculations.py
+++ b/saleor/tax/tests/test_checkout_calculations.py
@@ -52,7 +52,7 @@ def _enable_flat_rates(
("30.00", "36.00", "12.00", "20", "24.00"), # tax rate = 20%
],
)
[email protected]("saleor.checkout.calculations.checkout_total")
[email protected]("saleor.checkout.calculations.calculate_checkout_total")
def test_calculate_checkout_total_with_gift_cards(
checkout_total_mock,
checkout_total_net,