Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove payments from checkout in graphQL API
fowczarek3497f494a403
diff --git a/saleor/graphql/checkout/types.py b/saleor/graphql/checkout/types.pyindex fc9a2f2297..7543485ccf 100644--- a/saleor/graphql/checkout/types.py+++ b/saleor/graphql/checkout/types.py@@ -6,7 +6,6 @@ from ...core.utils.taxes import get_taxes_for_addressfrom ..core.types.common import CountableDjangoObjectTypefrom ..core.types.money import TaxedMoneyfrom ..order.resolvers import resolve_shipping_methods-from ..payment.types import Paymentfrom ..shipping.types import ShippingMethod@@ -45,10 +44,6 @@ class Checkout(CountableDjangoObjectType):'A list of checkout lines, each containing information about ''an item in the checkout.')),model_field='lines')- payments = gql_optimizer.field(- graphene.List(- Payment, description='List of payments for the checkout'),- model_field='payments')shipping_price = graphene.Field(TaxedMoney,description='The price of the shipping, with all the taxes included.')@@ -63,14 +58,12 @@ class Checkout(CountableDjangoObjectType):'shipping costs, and discounts included.'))class Meta:+ exclude_fields = ['payments']description = 'Checkout object'model = models.Cartinterfaces = [graphene.relay.Node]filter_fields = ['token']- def resolve_payments(self, info):- return self.payments.all()-def resolve_total_price(self, info):taxes = get_taxes_for_address(self.shipping_address)return self.get_total(taxes=taxes)diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 7076174265..30d929d2f8 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -284,7 +284,6 @@ type Checkout implements Node {translatedDiscountName: StringvoucherCode: Stringlines: [CheckoutLine]- payments: [Payment]id: ID!availableShippingMethods: [ShippingMethod]isShippingRequired: Booleandiff --git a/tests/api/test_checkout.py b/tests/api/test_checkout.pyindex fe9f91e89f..1c29a02466 100644--- a/tests/api/test_checkout.py+++ b/tests/api/test_checkout.py@@ -554,9 +554,6 @@ def test_query_checkouts(edges {node {token- payments{- id- }}}}@@ -568,7 +565,6 @@ def test_query_checkouts(content = get_graphql_content(response)received_checkout = content['data']['checkouts']['edges'][0]['node']assert str(checkout.token) == received_checkout['token']- assert len(received_checkout['payments']) == checkout.payments.count()def test_query_checkout_lines(