Skip to content

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

Add missing typing for order utils

IKarbowiakf604ebddc3bc
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index 7078baf8ba..8d2fb14b94 100644
--- a/saleor/order/utils.py
+++ b/saleor/order/utils.py
@@ -11,7 +11,7 @@ from ..account.utils import store_user_address
from ..checkout import AddressType
from ..core.taxes import zero_money
from ..core.weight import zero_weight
-from ..discount.models import NotApplicable, VoucherType
+from ..discount.models import NotApplicable, Voucher, VoucherType
from ..discount.utils import get_products_voucher_discount, validate_voucher_in_order
from ..extensions.manager import get_extensions_manager
from ..order import OrderStatus
@@ -324,7 +324,7 @@ def get_valid_shipping_methods_for_order(order: Order):
)
-def get_products_voucher_discount_for_order(voucher):
+def get_products_voucher_discount_for_order(voucher: Voucher) -> Money:
"""Calculate products discount value for a voucher, depending on its type."""
prices = None
if not prices:
@@ -335,7 +335,7 @@ def get_products_voucher_discount_for_order(voucher):
return get_products_voucher_discount(voucher, prices)
-def get_voucher_discount_for_order(order):
+def get_voucher_discount_for_order(order: Order) -> Money:
"""Calculate discount value depending on voucher and discount types.
Raise NotApplicable if voucher of given type cannot be applied.