prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Expose in API list of supported payment gateways
  In API we expose the `GatewaysEnum` enum which contains all the available payment gateways, but there is no way for the Storefront 2.0 to determine which of them are actually enabled (currently Braintree is hardcoded over there). We should expose a field that would provide this information, e.g:
  ```
  type Shop {
    enabledGateways: [GatewaysEnum]
  }
  ```
  
  A resolver function should take into account gateways enabled in `CHECKOUT_PAYMENT_GATEWAYS` setting.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `saleor/graphql/checkout/types.py`
  Content:
  ```
  1 import graphene
  2 import graphene_django_optimizer as gql_optimizer
  3 
  4 from ...checkout import models
  5 from ...core.utils.taxes import get_taxes_for_address
  6 from ..core.connection import CountableDjangoObjectType
  7 from ..core.types.money import TaxedMoney
  8 from ..order.utils import applicable_shipping_methods
  9 from ..shipping.types import ShippingMethod
  10 
  11 
  12 class CheckoutLine(CountableDjangoObjectType):
  13     total_price = graphene.Field(
  14         TaxedMoney,
  15         description=(
  16             'The sum of the checkout line price, taxes and discounts.'))
  17     requires_shipping = graphene.Boolean(
  18         description='Indicates whether the item need to be delivered.')
  19 
  20     class Meta:
  21         exclude_fields = ['cart', 'data']
  22         description = 'Represents an item in the checkout.'
  23         interfaces = [graphene.relay.Node]
  24         model = models.CartLine
  25         filter_fields = ['id']
  26 
  27     def resolve_total_price(self, info):
  28         taxes = get_taxes_for_address(self.cart.shipping_address)
  29         return self.get_total(taxes=taxes)
  30 
  31     def resolve_requires_shipping(self, info):
  32         return self.is_shipping_required()
  33 
  34 
  35 class Checkout(CountableDjangoObjectType):
  36     available_shipping_methods = graphene.List(
  37         ShippingMethod, required=False,
  38         description='Shipping methods that can be used with this order.')
  39     is_shipping_required = graphene.Boolean(
  40         description='Returns True, if checkout requires shipping.',
  41         required=True)
  42     lines = gql_optimizer.field(
  43         graphene.List(
  44             CheckoutLine, description=(
  45                 'A list of checkout lines, each containing information about '
  46                 'an item in the checkout.')),
  47         model_field='lines')
  48     shipping_price = graphene.Field(
  49         TaxedMoney,
  50         description='The price of the shipping, with all the taxes included.')
  51     subtotal_price = graphene.Field(
  52         TaxedMoney,
  53         description=(
  54             'The price of the checkout before shipping, with taxes included.'))
  55     total_price = graphene.Field(
  56         TaxedMoney,
  57         description=(
  58             'The sum of the the checkout line prices, with all the taxes,'
  59             'shipping costs, and discounts included.'))
  60 
  61     class Meta:
  62         exclude_fields = ['payments']
  63         description = 'Checkout object'
  64         model = models.Cart
  65         interfaces = [graphene.relay.Node]
  66         filter_fields = ['token']
  67 
  68     def resolve_total_price(self, info):
  69         taxes = get_taxes_for_address(self.shipping_address)
  70         return self.get_total(taxes=taxes)
  71 
  72     def resolve_subtotal_price(self, info):
  73         taxes = get_taxes_for_address(self.shipping_address)
  74         return self.get_subtotal(taxes=taxes)
  75 
  76     def resolve_shipping_price(self, info):
  77         taxes = get_taxes_for_address(self.shipping_address)
  78         return self.get_shipping_price(taxes=taxes)
  79 
  80     def resolve_lines(self, info):
  81         return self.lines.prefetch_related('variant')
  82 
  83     def resolve_available_shipping_methods(self, info):
  84         taxes = get_taxes_for_address(self.shipping_address)
  85         price = self.get_subtotal(
  86             taxes=taxes, discounts=info.context.discounts)
  87         return applicable_shipping_methods(self, info, price.gross.amount)
  88 
  89     def resolve_is_shipping_required(self, info):
  90         return self.is_shipping_required()
  91
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/saleor/graphql/checkout/types.py b/saleor/graphql/checkout/types.py
  --- a/saleor/graphql/checkout/types.py
  +++ b/saleor/graphql/checkout/types.py
  @@ -1,11 +1,13 @@
   import graphene
   import graphene_django_optimizer as gql_optimizer
  +from django.conf import settings
   
   from ...checkout import models
   from ...core.utils.taxes import get_taxes_for_address
   from ..core.connection import CountableDjangoObjectType
   from ..core.types.money import TaxedMoney
   from ..order.utils import applicable_shipping_methods
  +from ..payment.enums import PaymentGatewayEnum
   from ..shipping.types import ShippingMethod
   
   
  @@ -36,6 +38,9 @@
       available_shipping_methods = graphene.List(
           ShippingMethod, required=False,
           description='Shipping methods that can be used with this order.')
  +    available_payment_gateways = graphene.List(
  +        PaymentGatewayEnum, description='List of available payment gateways.',
  +        required=True)
       is_shipping_required = graphene.Boolean(
           description='Returns True, if checkout requires shipping.',
           required=True)
  @@ -86,5 +91,8 @@
               taxes=taxes, discounts=info.context.discounts)
           return applicable_shipping_methods(self, info, price.gross.amount)
   
  +    def resolve_available_payment_gateways(self, info):
  +        return settings.CHECKOUT_PAYMENT_GATEWAYS.keys()
  +
       def resolve_is_shipping_required(self, info):
           return self.is_shipping_required()
  
verification_info: {"golden_diff": "diff --git a/saleor/graphql/checkout/types.py b/saleor/graphql/checkout/types.py\n--- a/saleor/graphql/checkout/types.py\n+++ b/saleor/graphql/checkout/types.py\n@@ -1,11 +1,13 @@\n import graphene\n import graphene_django_optimizer as gql_optimizer\n+from django.conf import settings\n \n from ...checkout import models\n from ...core.utils.taxes import get_taxes_for_address\n from ..core.connection import CountableDjangoObjectType\n from ..core.types.money import TaxedMoney\n from ..order.utils import applicable_shipping_methods\n+from ..payment.enums import PaymentGatewayEnum\n from ..shipping.types import ShippingMethod\n \n \n@@ -36,6 +38,9 @@\n     available_shipping_methods = graphene.List(\n         ShippingMethod, required=False,\n         description='Shipping methods that can be used with this order.')\n+    available_payment_gateways = graphene.List(\n+        PaymentGatewayEnum, description='List of available payment gateways.',\n+        required=True)\n     is_shipping_required = graphene.Boolean(\n         description='Returns True, if checkout requires shipping.',\n         required=True)\n@@ -86,5 +91,8 @@\n             taxes=taxes, discounts=info.context.discounts)\n         return applicable_shipping_methods(self, info, price.gross.amount)\n \n+    def resolve_available_payment_gateways(self, info):\n+        return settings.CHECKOUT_PAYMENT_GATEWAYS.keys()\n+\n     def resolve_is_shipping_required(self, info):\n         return self.is_shipping_required()\n", "issue": "Expose in API list of supported payment gateways\nIn API we expose the `GatewaysEnum` enum which contains all the available payment gateways, but there is no way for the Storefront 2.0 to determine which of them are actually enabled (currently Braintree is hardcoded over there). We should expose a field that would provide this information, e.g:\r\n```\r\ntype Shop {\r\n  enabledGateways: [GatewaysEnum]\r\n}\r\n```\r\n\r\nA resolver function should take into account gateways enabled in `CHECKOUT_PAYMENT_GATEWAYS` setting.\n", "before_files": [{"content": "import graphene\nimport graphene_django_optimizer as gql_optimizer\n\nfrom ...checkout import models\nfrom ...core.utils.taxes import get_taxes_for_address\nfrom ..core.connection import CountableDjangoObjectType\nfrom ..core.types.money import TaxedMoney\nfrom ..order.utils import applicable_shipping_methods\nfrom ..shipping.types import ShippingMethod\n\n\nclass CheckoutLine(CountableDjangoObjectType):\n    total_price = graphene.Field(\n        TaxedMoney,\n        description=(\n            'The sum of the checkout line price, taxes and discounts.'))\n    requires_shipping = graphene.Boolean(\n        description='Indicates whether the item need to be delivered.')\n\n    class Meta:\n        exclude_fields = ['cart', 'data']\n        description = 'Represents an item in the checkout.'\n        interfaces = [graphene.relay.Node]\n        model = models.CartLine\n        filter_fields = ['id']\n\n    def resolve_total_price(self, info):\n        taxes = get_taxes_for_address(self.cart.shipping_address)\n        return self.get_total(taxes=taxes)\n\n    def resolve_requires_shipping(self, info):\n        return self.is_shipping_required()\n\n\nclass Checkout(CountableDjangoObjectType):\n    available_shipping_methods = graphene.List(\n        ShippingMethod, required=False,\n        description='Shipping methods that can be used with this order.')\n    is_shipping_required = graphene.Boolean(\n        description='Returns True, if checkout requires shipping.',\n        required=True)\n    lines = gql_optimizer.field(\n        graphene.List(\n            CheckoutLine, description=(\n                'A list of checkout lines, each containing information about '\n                'an item in the checkout.')),\n        model_field='lines')\n    shipping_price = graphene.Field(\n        TaxedMoney,\n        description='The price of the shipping, with all the taxes included.')\n    subtotal_price = graphene.Field(\n        TaxedMoney,\n        description=(\n            'The price of the checkout before shipping, with taxes included.'))\n    total_price = graphene.Field(\n        TaxedMoney,\n        description=(\n            'The sum of the the checkout line prices, with all the taxes,'\n            'shipping costs, and discounts included.'))\n\n    class Meta:\n        exclude_fields = ['payments']\n        description = 'Checkout object'\n        model = models.Cart\n        interfaces = [graphene.relay.Node]\n        filter_fields = ['token']\n\n    def resolve_total_price(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        return self.get_total(taxes=taxes)\n\n    def resolve_subtotal_price(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        return self.get_subtotal(taxes=taxes)\n\n    def resolve_shipping_price(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        return self.get_shipping_price(taxes=taxes)\n\n    def resolve_lines(self, info):\n        return self.lines.prefetch_related('variant')\n\n    def resolve_available_shipping_methods(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        price = self.get_subtotal(\n            taxes=taxes, discounts=info.context.discounts)\n        return applicable_shipping_methods(self, info, price.gross.amount)\n\n    def resolve_is_shipping_required(self, info):\n        return self.is_shipping_required()\n", "path": "saleor/graphql/checkout/types.py"}], "after_files": [{"content": "import graphene\nimport graphene_django_optimizer as gql_optimizer\nfrom django.conf import settings\n\nfrom ...checkout import models\nfrom ...core.utils.taxes import get_taxes_for_address\nfrom ..core.connection import CountableDjangoObjectType\nfrom ..core.types.money import TaxedMoney\nfrom ..order.utils import applicable_shipping_methods\nfrom ..payment.enums import PaymentGatewayEnum\nfrom ..shipping.types import ShippingMethod\n\n\nclass CheckoutLine(CountableDjangoObjectType):\n    total_price = graphene.Field(\n        TaxedMoney,\n        description=(\n            'The sum of the checkout line price, taxes and discounts.'))\n    requires_shipping = graphene.Boolean(\n        description='Indicates whether the item need to be delivered.')\n\n    class Meta:\n        exclude_fields = ['cart', 'data']\n        description = 'Represents an item in the checkout.'\n        interfaces = [graphene.relay.Node]\n        model = models.CartLine\n        filter_fields = ['id']\n\n    def resolve_total_price(self, info):\n        taxes = get_taxes_for_address(self.cart.shipping_address)\n        return self.get_total(taxes=taxes)\n\n    def resolve_requires_shipping(self, info):\n        return self.is_shipping_required()\n\n\nclass Checkout(CountableDjangoObjectType):\n    available_shipping_methods = graphene.List(\n        ShippingMethod, required=False,\n        description='Shipping methods that can be used with this order.')\n    available_payment_gateways = graphene.List(\n        PaymentGatewayEnum, description='List of available payment gateways.',\n        required=True)\n    is_shipping_required = graphene.Boolean(\n        description='Returns True, if checkout requires shipping.',\n        required=True)\n    lines = gql_optimizer.field(\n        graphene.List(\n            CheckoutLine, description=(\n                'A list of checkout lines, each containing information about '\n                'an item in the checkout.')),\n        model_field='lines')\n    shipping_price = graphene.Field(\n        TaxedMoney,\n        description='The price of the shipping, with all the taxes included.')\n    subtotal_price = graphene.Field(\n        TaxedMoney,\n        description=(\n            'The price of the checkout before shipping, with taxes included.'))\n    total_price = graphene.Field(\n        TaxedMoney,\n        description=(\n            'The sum of the the checkout line prices, with all the taxes,'\n            'shipping costs, and discounts included.'))\n\n    class Meta:\n        exclude_fields = ['payments']\n        description = 'Checkout object'\n        model = models.Cart\n        interfaces = [graphene.relay.Node]\n        filter_fields = ['token']\n\n    def resolve_total_price(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        return self.get_total(taxes=taxes)\n\n    def resolve_subtotal_price(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        return self.get_subtotal(taxes=taxes)\n\n    def resolve_shipping_price(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        return self.get_shipping_price(taxes=taxes)\n\n    def resolve_lines(self, info):\n        return self.lines.prefetch_related('variant')\n\n    def resolve_available_shipping_methods(self, info):\n        taxes = get_taxes_for_address(self.shipping_address)\n        price = self.get_subtotal(\n            taxes=taxes, discounts=info.context.discounts)\n        return applicable_shipping_methods(self, info, price.gross.amount)\n\n    def resolve_available_payment_gateways(self, info):\n        return settings.CHECKOUT_PAYMENT_GATEWAYS.keys()\n\n    def resolve_is_shipping_required(self, info):\n        return self.is_shipping_required()\n", "path": "saleor/graphql/checkout/types.py"}]}