Skip to content

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

Use manager from context in order and shop types resolvers

IKarbowiakbb35d5048254
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 010dd51e85..60b09aff19 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -17,7 +17,6 @@ from ...graphql.utils import get_user_or_app_from_context
from ...order import OrderStatus, models
from ...order.models import FulfillmentStatus
from ...order.utils import get_order_country, get_valid_shipping_methods_for_order
-from ...plugins.manager import get_plugins_manager
from ...product.templatetags.product_images import get_product_image_thumbnail
from ...warehouse import models as warehouse_models
from ..account.types import User
@@ -824,12 +823,12 @@ class Order(CountableDjangoObjectType):
@staticmethod
# TODO: We should optimize it in/after PR#5819
- def resolve_available_shipping_methods(root: models.Order, _info):
+ def resolve_available_shipping_methods(root: models.Order, info):
available = get_valid_shipping_methods_for_order(root)
if available is None:
return []
available_shipping_methods = []
- manager = get_plugins_manager()
+ manager = info.context.plugins
display_gross = display_gross_prices()
for shipping_method in available:
# Ignore typing check because it is checked in
diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.py
index 36530897d7..d4521330ef 100644
--- a/saleor/graphql/shop/types.py
+++ b/saleor/graphql/shop/types.py
@@ -10,7 +10,6 @@ from phonenumbers import COUNTRY_CODE_TO_REGION_CODE
from ... import __version__
from ...account import models as account_models
from ...core.permissions import SitePermissions, get_permissions
-from ...plugins.manager import get_plugins_manager
from ...site import models as site_models
from ..account.types import Address, AddressInput, StaffNotificationRecipient
from ..channel import ChannelContext
@@ -209,8 +208,8 @@ class Shop(graphene.ObjectType):
)
@staticmethod
- def resolve_available_payment_gateways(_, _info, currency: Optional[str] = None):
- return get_plugins_manager().list_payment_gateways(currency=currency)
+ def resolve_available_payment_gateways(_, info, currency: Optional[str] = None):
+ return info.context.plugins.list_payment_gateways(currency=currency)
@staticmethod
def resolve_available_external_authentications(_, info):