We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Replace the custom Decimal scalar type with Float
Currently `graphene` uses a custom scalar type to represent an implementation detail of using a fixed-precision implementation for floating-point arithmetic.

This means the client (typically not written in Python) now has to deal with conversion to and from string. It also makes it hard to enforce strict type checking in TypeScript as there is no easy way to statically check whether a value is a valid decimal literal for Python.

I propose that we overload the builtin types to use `decimal.Decimal` in backend code and `Float!` in the GraphQL API.

--- 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/core/types/common.py`
Content:
```
1 import decimal
2 
3 import graphene
4 from graphene.types import Scalar
5 from graphene_django import DjangoObjectType
6 from graphql.language import ast
7 
8 from ....core import weight
9 from ..connection import CountableConnection
10 
11 
12 # FIXME: Decimal scalar implementation has been taken from Graphene repo.
13 # Remove it when a new version including this implementation is released.
14 class Decimal(Scalar):
15     """
16     The `Decimal` scalar type represents a python Decimal.
17     """
18 
19     @staticmethod
20     def serialize(dec):
21         if isinstance(dec, str):
22             dec = decimal.Decimal(dec)
23         assert isinstance(dec, decimal.Decimal), 'Received not compatible Decimal "{}"'.format(
24             repr(dec))
25         return str(dec)
26 
27     @classmethod
28     def parse_literal(cls, node):
29         if isinstance(node, ast.StringValue):
30             return cls.parse_value(node.value)
31 
32     @staticmethod
33     def parse_value(value):
34         try:
35             return decimal.Decimal(value)
36         except decimal.DecimalException:
37             return None
38 
39 
40 class CountryDisplay(graphene.ObjectType):
41     code = graphene.String(description='Country code.', required=True)
42     country = graphene.String(description='Country.', required=True)
43 
44 
45 class CountableDjangoObjectType(DjangoObjectType):
46     class Meta:
47         abstract = True
48 
49     @classmethod
50     def __init_subclass_with_meta__(cls, *args, **kwargs):
51         # Force it to use the countable connection
52         countable_conn = CountableConnection.create_type(
53             "{}CountableConnection".format(cls.__name__),
54             node=cls)
55         super().__init_subclass_with_meta__(
56             *args, connection=countable_conn, **kwargs)
57 
58 
59 class Error(graphene.ObjectType):
60     field = graphene.String(
61         description="""Name of a field that caused the error. A value of
62         `null` indicates that the error isn't associated with a particular
63         field.""", required=False)
64     message = graphene.String(description='The error message.')
65 
66     class Meta:
67         description = 'Represents an error in the input of a mutation.'
68 
69 
70 class LanguageDisplay(graphene.ObjectType):
71     code = graphene.String(description='Language code.', required=True)
72     language = graphene.String(description='Language.', required=True)
73 
74 
75 class PermissionDisplay(graphene.ObjectType):
76     code = graphene.String(
77         description='Internal code for permission.', required=True)
78     name = graphene.String(
79         description='Describe action(s) allowed to do by permission.',
80         required=True)
81 
82     class Meta:
83         description = 'Represents a permission object in a friendly form.'
84 
85 
86 class SeoInput(graphene.InputObjectType):
87     title = graphene.String(description='SEO title.')
88     description = graphene.String(description='SEO description.')
89 
90 
91 class Weight(graphene.ObjectType):
92     unit = graphene.String(description='Weight unit', required=True)
93     value = graphene.Float(description='Weight value', required=True)
94 
95     class Meta:
96         description = 'Represents weight value in a specific weight unit.'
97 
98 
99 WeightUnitsEnum = graphene.Enum.from_enum(weight.WeightUnitsEnum)
100
```

Path: `saleor/graphql/order/types.py`
Content:
```
1 import graphene
2 from graphene import relay
3 
4 from ...order import OrderEvents, models
5 from ..account.types import User
6 from ..core.types.common import CountableDjangoObjectType
7 from ..core.types.money import Money, TaxedMoney
8 from decimal import Decimal
9 
10 OrderEventsEnum = graphene.Enum.from_enum(OrderEvents)
11 
12 
13 class OrderEvent(CountableDjangoObjectType):
14     date = graphene.types.datetime.DateTime(
15         description='Date when event happened at in ISO 8601 format.')
16     type = OrderEventsEnum(description='Order event type')
17     user = graphene.Field(
18         User, id=graphene.Argument(graphene.ID),
19         description='User who performed the action.')
20     message = graphene.String(
21         description='Content of a note added to the order.')
22     email = graphene.String(description='Email of the customer')
23     email_type = graphene.String(
24         description='Type of an email sent to the customer')
25     amount = graphene.Float(description='Amount of money.')
26     quantity = graphene.Int(description='Number of items.')
27     composed_id = graphene.String(
28         description='Composed id of the Fulfillment.')
29 
30     class Meta:
31         description = 'History log of the order.'
32         model = models.OrderEvent
33         interfaces = [relay.Node]
34         exclude_fields = ['order', 'parameters']
35 
36     def resolve_email(self, info):
37         return self.parameters.get('email', None)
38 
39     def resolve_email_type(self, info):
40         return self.parameters.get('email_type', None)
41 
42     def resolve_amount(self, info):
43         amount = self.parameters.get('amount', None)
44         return Decimal(amount) if amount else None
45 
46     def resolve_quantity(self, info):
47         quantity = self.parameters.get('quantity', None)
48         return int(quantity) if quantity else None
49 
50     def resolve_message(self, info):
51         return self.parameters.get('message', None)
52 
53     def resolve_composed_id(self, info):
54         return self.parameters.get('composed_id', None)
55 
56 
57 class Fulfillment(CountableDjangoObjectType):
58     status_display = graphene.String(
59         description='User-friendly fulfillment status.')
60 
61     class Meta:
62         description = 'Represents order fulfillment.'
63         interfaces = [relay.Node]
64         model = models.Fulfillment
65         exclude_fields = ['order']
66 
67     def resolve_status_display(self, info):
68         return self.get_status_display()
69 
70 
71 class FulfillmentLine(CountableDjangoObjectType):
72     class Meta:
73         description = 'Represents line of the fulfillment.'
74         interfaces = [relay.Node]
75         model = models.FulfillmentLine
76         exclude_fields = ['fulfillment']
77 
78 
79 class Order(CountableDjangoObjectType):
80     fulfillments = graphene.List(
81         Fulfillment,
82         required=True,
83         description='List of shipments for the order.')
84     is_paid = graphene.Boolean(
85         description='Informs if an order is fully paid.')
86     number = graphene.String(description='User-friendly number of an order.')
87     payment_status = graphene.String(description='Internal payment status.')
88     payment_status_display = graphene.String(
89         description='User-friendly payment status.')
90     subtotal = graphene.Field(
91         TaxedMoney,
92         description='The sum of line prices not including shipping.')
93     status_display = graphene.String(description='User-friendly order status.')
94     total_authorized = graphene.Field(
95         Money, description='Amount authorized for the order.')
96     total_captured = graphene.Field(
97         Money, description='Amount captured by payment.')
98     events = graphene.List(
99         OrderEvent,
100         description='List of events associated with the order.')
101 
102     class Meta:
103         description = 'Represents an order in the shop.'
104         interfaces = [relay.Node]
105         model = models.Order
106         exclude_fields = [
107             'shipping_price_gross', 'shipping_price_net', 'total_gross',
108             'total_net']
109 
110     @staticmethod
111     def resolve_subtotal(obj, info):
112         return obj.get_subtotal()
113 
114     @staticmethod
115     def resolve_total_authorized(obj, info):
116         payment = obj.get_last_payment()
117         if payment:
118             return payment.get_total_price().gross
119 
120     @staticmethod
121     def resolve_total_captured(obj, info):
122         payment = obj.get_last_payment()
123         if payment:
124             return payment.get_captured_price()
125 
126     @staticmethod
127     def resolve_fulfillments(obj, info):
128         return obj.fulfillments.all()
129 
130     @staticmethod
131     def resolve_events(obj, info):
132         return obj.events.all()
133 
134     @staticmethod
135     def resolve_is_paid(obj, info):
136         return obj.is_fully_paid()
137 
138     @staticmethod
139     def resolve_number(obj, info):
140         return str(obj.pk)
141 
142     @staticmethod
143     def resolve_payment_status(obj, info):
144         return obj.get_last_payment_status()
145 
146     @staticmethod
147     def resolve_payment_status_display(obj, info):
148         return obj.get_last_payment_status_display()
149 
150     @staticmethod
151     def resolve_status_display(obj, info):
152         return obj.get_status_display()
153 
154     @staticmethod
155     def resolve_user_email(obj, info):
156         if obj.user_email:
157             return obj.user_email
158         if obj.user_id:
159             return obj.user.email
160 
161 
162 class OrderLine(CountableDjangoObjectType):
163     class Meta:
164         description = 'Represents order line of particular order.'
165         model = models.OrderLine
166         interfaces = [relay.Node]
167         exclude_fields = [
168             'order', 'unit_price_gross', 'unit_price_net', 'variant']
169
```
--- 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()

```

diff --git a/saleor/graphql/core/types/common.py b/saleor/graphql/core/types/common.py
--- a/saleor/graphql/core/types/common.py
+++ b/saleor/graphql/core/types/common.py
@@ -1,37 +1,24 @@
 import decimal
 
 import graphene
-from graphene.types import Scalar
 from graphene_django import DjangoObjectType
-from graphql.language import ast
 
 from ....core import weight
 from ..connection import CountableConnection
 
 
-# FIXME: Decimal scalar implementation has been taken from Graphene repo.
-# Remove it when a new version including this implementation is released.
-class Decimal(Scalar):
+class Decimal(graphene.Float):
+    """Custom Decimal implementation.
+    Returns Decimal as a float in the API,
+    parses float to the Decimal on the way back.
     """
-    The `Decimal` scalar type represents a python Decimal.
-    """
-
-    @staticmethod
-    def serialize(dec):
-        if isinstance(dec, str):
-            dec = decimal.Decimal(dec)
-        assert isinstance(dec, decimal.Decimal), 'Received not compatible Decimal "{}"'.format(
-            repr(dec))
-        return str(dec)
-
-    @classmethod
-    def parse_literal(cls, node):
-        if isinstance(node, ast.StringValue):
-            return cls.parse_value(node.value)
 
     @staticmethod
     def parse_value(value):
         try:
+            # Converting the float to str before parsing it to Decimal is
+            # necessary to keep the decimal places as typed
+            value = str(value)
             return decimal.Decimal(value)
         except decimal.DecimalException:
             return None
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -5,7 +5,6 @@
 from ..account.types import User
 from ..core.types.common import CountableDjangoObjectType
 from ..core.types.money import Money, TaxedMoney
-from decimal import Decimal
 
 OrderEventsEnum = graphene.Enum.from_enum(OrderEvents)
 
@@ -41,7 +40,7 @@
 
     def resolve_amount(self, info):
         amount = self.parameters.get('amount', None)
-        return Decimal(amount) if amount else None
+        return float(amount) if amount else None
 
     def resolve_quantity(self, info):
         quantity = self.parameters.get('quantity', None)

{"golden_diff": "diff --git a/saleor/graphql/core/types/common.py b/saleor/graphql/core/types/common.py\n--- a/saleor/graphql/core/types/common.py\n+++ b/saleor/graphql/core/types/common.py\n@@ -1,37 +1,24 @@\n import decimal\n \n import graphene\n-from graphene.types import Scalar\n from graphene_django import DjangoObjectType\n-from graphql.language import ast\n \n from ....core import weight\n from ..connection import CountableConnection\n \n \n-# FIXME: Decimal scalar implementation has been taken from Graphene repo.\n-# Remove it when a new version including this implementation is released.\n-class Decimal(Scalar):\n+class Decimal(graphene.Float):\n+    \"\"\"Custom Decimal implementation.\n+    Returns Decimal as a float in the API,\n+    parses float to the Decimal on the way back.\n     \"\"\"\n-    The `Decimal` scalar type represents a python Decimal.\n-    \"\"\"\n-\n-    @staticmethod\n-    def serialize(dec):\n-        if isinstance(dec, str):\n-            dec = decimal.Decimal(dec)\n-        assert isinstance(dec, decimal.Decimal), 'Received not compatible Decimal \"{}\"'.format(\n-            repr(dec))\n-        return str(dec)\n-\n-    @classmethod\n-    def parse_literal(cls, node):\n-        if isinstance(node, ast.StringValue):\n-            return cls.parse_value(node.value)\n \n     @staticmethod\n     def parse_value(value):\n         try:\n+            # Converting the float to str before parsing it to Decimal is\n+            # necessary to keep the decimal places as typed\n+            value = str(value)\n             return decimal.Decimal(value)\n         except decimal.DecimalException:\n             return None\ndiff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py\n--- a/saleor/graphql/order/types.py\n+++ b/saleor/graphql/order/types.py\n@@ -5,7 +5,6 @@\n from ..account.types import User\n from ..core.types.common import CountableDjangoObjectType\n from ..core.types.money import Money, TaxedMoney\n-from decimal import Decimal\n \n OrderEventsEnum = graphene.Enum.from_enum(OrderEvents)\n \n@@ -41,7 +40,7 @@\n \n     def resolve_amount(self, info):\n         amount = self.parameters.get('amount', None)\n-        return Decimal(amount) if amount else None\n+        return float(amount) if amount else None\n \n     def resolve_quantity(self, info):\n         quantity = self.parameters.get('quantity', None)\n", "issue": "Replace the custom Decimal scalar type with Float\nCurrently `graphene` uses a custom scalar type to represent an implementation detail of using a fixed-precision implementation for floating-point arithmetic.\r\n\r\nThis means the client (typically not written in Python) now has to deal with conversion to and from string. It also makes it hard to enforce strict type checking in TypeScript as there is no easy way to statically check whether a value is a valid decimal literal for Python.\r\n\r\nI propose that we overload the builtin types to use `decimal.Decimal` in backend code and `Float!` in the GraphQL API.\n", "before_files": [{"content": "import decimal\n\nimport graphene\nfrom graphene.types import Scalar\nfrom graphene_django import DjangoObjectType\nfrom graphql.language import ast\n\nfrom ....core import weight\nfrom ..connection import CountableConnection\n\n\n# FIXME: Decimal scalar implementation has been taken from Graphene repo.\n# Remove it when a new version including this implementation is released.\nclass Decimal(Scalar):\n    \"\"\"\n    The `Decimal` scalar type represents a python Decimal.\n    \"\"\"\n\n    @staticmethod\n    def serialize(dec):\n        if isinstance(dec, str):\n            dec = decimal.Decimal(dec)\n        assert isinstance(dec, decimal.Decimal), 'Received not compatible Decimal \"{}\"'.format(\n            repr(dec))\n        return str(dec)\n\n    @classmethod\n    def parse_literal(cls, node):\n        if isinstance(node, ast.StringValue):\n            return cls.parse_value(node.value)\n\n    @staticmethod\n    def parse_value(value):\n        try:\n            return decimal.Decimal(value)\n        except decimal.DecimalException:\n            return None\n\n\nclass CountryDisplay(graphene.ObjectType):\n    code = graphene.String(description='Country code.', required=True)\n    country = graphene.String(description='Country.', required=True)\n\n\nclass CountableDjangoObjectType(DjangoObjectType):\n    class Meta:\n        abstract = True\n\n    @classmethod\n    def __init_subclass_with_meta__(cls, *args, **kwargs):\n        # Force it to use the countable connection\n        countable_conn = CountableConnection.create_type(\n            \"{}CountableConnection\".format(cls.__name__),\n            node=cls)\n        super().__init_subclass_with_meta__(\n            *args, connection=countable_conn, **kwargs)\n\n\nclass Error(graphene.ObjectType):\n    field = graphene.String(\n        description=\"\"\"Name of a field that caused the error. A value of\n        `null` indicates that the error isn't associated with a particular\n        field.\"\"\", required=False)\n    message = graphene.String(description='The error message.')\n\n    class Meta:\n        description = 'Represents an error in the input of a mutation.'\n\n\nclass LanguageDisplay(graphene.ObjectType):\n    code = graphene.String(description='Language code.', required=True)\n    language = graphene.String(description='Language.', required=True)\n\n\nclass PermissionDisplay(graphene.ObjectType):\n    code = graphene.String(\n        description='Internal code for permission.', required=True)\n    name = graphene.String(\n        description='Describe action(s) allowed to do by permission.',\n        required=True)\n\n    class Meta:\n        description = 'Represents a permission object in a friendly form.'\n\n\nclass SeoInput(graphene.InputObjectType):\n    title = graphene.String(description='SEO title.')\n    description = graphene.String(description='SEO description.')\n\n\nclass Weight(graphene.ObjectType):\n    unit = graphene.String(description='Weight unit', required=True)\n    value = graphene.Float(description='Weight value', required=True)\n\n    class Meta:\n        description = 'Represents weight value in a specific weight unit.'\n\n\nWeightUnitsEnum = graphene.Enum.from_enum(weight.WeightUnitsEnum)\n", "path": "saleor/graphql/core/types/common.py"}, {"content": "import graphene\nfrom graphene import relay\n\nfrom ...order import OrderEvents, models\nfrom ..account.types import User\nfrom ..core.types.common import CountableDjangoObjectType\nfrom ..core.types.money import Money, TaxedMoney\nfrom decimal import Decimal\n\nOrderEventsEnum = graphene.Enum.from_enum(OrderEvents)\n\n\nclass OrderEvent(CountableDjangoObjectType):\n    date = graphene.types.datetime.DateTime(\n        description='Date when event happened at in ISO 8601 format.')\n    type = OrderEventsEnum(description='Order event type')\n    user = graphene.Field(\n        User, id=graphene.Argument(graphene.ID),\n        description='User who performed the action.')\n    message = graphene.String(\n        description='Content of a note added to the order.')\n    email = graphene.String(description='Email of the customer')\n    email_type = graphene.String(\n        description='Type of an email sent to the customer')\n    amount = graphene.Float(description='Amount of money.')\n    quantity = graphene.Int(description='Number of items.')\n    composed_id = graphene.String(\n        description='Composed id of the Fulfillment.')\n\n    class Meta:\n        description = 'History log of the order.'\n        model = models.OrderEvent\n        interfaces = [relay.Node]\n        exclude_fields = ['order', 'parameters']\n\n    def resolve_email(self, info):\n        return self.parameters.get('email', None)\n\n    def resolve_email_type(self, info):\n        return self.parameters.get('email_type', None)\n\n    def resolve_amount(self, info):\n        amount = self.parameters.get('amount', None)\n        return Decimal(amount) if amount else None\n\n    def resolve_quantity(self, info):\n        quantity = self.parameters.get('quantity', None)\n        return int(quantity) if quantity else None\n\n    def resolve_message(self, info):\n        return self.parameters.get('message', None)\n\n    def resolve_composed_id(self, info):\n        return self.parameters.get('composed_id', None)\n\n\nclass Fulfillment(CountableDjangoObjectType):\n    status_display = graphene.String(\n        description='User-friendly fulfillment status.')\n\n    class Meta:\n        description = 'Represents order fulfillment.'\n        interfaces = [relay.Node]\n        model = models.Fulfillment\n        exclude_fields = ['order']\n\n    def resolve_status_display(self, info):\n        return self.get_status_display()\n\n\nclass FulfillmentLine(CountableDjangoObjectType):\n    class Meta:\n        description = 'Represents line of the fulfillment.'\n        interfaces = [relay.Node]\n        model = models.FulfillmentLine\n        exclude_fields = ['fulfillment']\n\n\nclass Order(CountableDjangoObjectType):\n    fulfillments = graphene.List(\n        Fulfillment,\n        required=True,\n        description='List of shipments for the order.')\n    is_paid = graphene.Boolean(\n        description='Informs if an order is fully paid.')\n    number = graphene.String(description='User-friendly number of an order.')\n    payment_status = graphene.String(description='Internal payment status.')\n    payment_status_display = graphene.String(\n        description='User-friendly payment status.')\n    subtotal = graphene.Field(\n        TaxedMoney,\n        description='The sum of line prices not including shipping.')\n    status_display = graphene.String(description='User-friendly order status.')\n    total_authorized = graphene.Field(\n        Money, description='Amount authorized for the order.')\n    total_captured = graphene.Field(\n        Money, description='Amount captured by payment.')\n    events = graphene.List(\n        OrderEvent,\n        description='List of events associated with the order.')\n\n    class Meta:\n        description = 'Represents an order in the shop.'\n        interfaces = [relay.Node]\n        model = models.Order\n        exclude_fields = [\n            'shipping_price_gross', 'shipping_price_net', 'total_gross',\n            'total_net']\n\n    @staticmethod\n    def resolve_subtotal(obj, info):\n        return obj.get_subtotal()\n\n    @staticmethod\n    def resolve_total_authorized(obj, info):\n        payment = obj.get_last_payment()\n        if payment:\n            return payment.get_total_price().gross\n\n    @staticmethod\n    def resolve_total_captured(obj, info):\n        payment = obj.get_last_payment()\n        if payment:\n            return payment.get_captured_price()\n\n    @staticmethod\n    def resolve_fulfillments(obj, info):\n        return obj.fulfillments.all()\n\n    @staticmethod\n    def resolve_events(obj, info):\n        return obj.events.all()\n\n    @staticmethod\n    def resolve_is_paid(obj, info):\n        return obj.is_fully_paid()\n\n    @staticmethod\n    def resolve_number(obj, info):\n        return str(obj.pk)\n\n    @staticmethod\n    def resolve_payment_status(obj, info):\n        return obj.get_last_payment_status()\n\n    @staticmethod\n    def resolve_payment_status_display(obj, info):\n        return obj.get_last_payment_status_display()\n\n    @staticmethod\n    def resolve_status_display(obj, info):\n        return obj.get_status_display()\n\n    @staticmethod\n    def resolve_user_email(obj, info):\n        if obj.user_email:\n            return obj.user_email\n        if obj.user_id:\n            return obj.user.email\n\n\nclass OrderLine(CountableDjangoObjectType):\n    class Meta:\n        description = 'Represents order line of particular order.'\n        model = models.OrderLine\n        interfaces = [relay.Node]\n        exclude_fields = [\n            'order', 'unit_price_gross', 'unit_price_net', 'variant']\n", "path": "saleor/graphql/order/types.py"}], "after_files": [{"content": "import decimal\n\nimport graphene\nfrom graphene_django import DjangoObjectType\n\nfrom ....core import weight\nfrom ..connection import CountableConnection\n\n\nclass Decimal(graphene.Float):\n    \"\"\"Custom Decimal implementation.\n    Returns Decimal as a float in the API,\n    parses float to the Decimal on the way back.\n    \"\"\"\n\n    @staticmethod\n    def parse_value(value):\n        try:\n            # Converting the float to str before parsing it to Decimal is\n            # necessary to keep the decimal places as typed\n            value = str(value)\n            return decimal.Decimal(value)\n        except decimal.DecimalException:\n            return None\n\n\nclass CountryDisplay(graphene.ObjectType):\n    code = graphene.String(description='Country code.', required=True)\n    country = graphene.String(description='Country.', required=True)\n\n\nclass CountableDjangoObjectType(DjangoObjectType):\n    class Meta:\n        abstract = True\n\n    @classmethod\n    def __init_subclass_with_meta__(cls, *args, **kwargs):\n        # Force it to use the countable connection\n        countable_conn = CountableConnection.create_type(\n            \"{}CountableConnection\".format(cls.__name__),\n            node=cls)\n        super().__init_subclass_with_meta__(\n            *args, connection=countable_conn, **kwargs)\n\n\nclass Error(graphene.ObjectType):\n    field = graphene.String(\n        description=\"\"\"Name of a field that caused the error. A value of\n        `null` indicates that the error isn't associated with a particular\n        field.\"\"\", required=False)\n    message = graphene.String(description='The error message.')\n\n    class Meta:\n        description = 'Represents an error in the input of a mutation.'\n\n\nclass LanguageDisplay(graphene.ObjectType):\n    code = graphene.String(description='Language code.', required=True)\n    language = graphene.String(description='Language.', required=True)\n\n\nclass PermissionDisplay(graphene.ObjectType):\n    code = graphene.String(\n        description='Internal code for permission.', required=True)\n    name = graphene.String(\n        description='Describe action(s) allowed to do by permission.',\n        required=True)\n\n    class Meta:\n        description = 'Represents a permission object in a friendly form.'\n\n\nclass SeoInput(graphene.InputObjectType):\n    title = graphene.String(description='SEO title.')\n    description = graphene.String(description='SEO description.')\n\n\nclass Weight(graphene.ObjectType):\n    unit = graphene.String(description='Weight unit', required=True)\n    value = graphene.Float(description='Weight value', required=True)\n\n    class Meta:\n        description = 'Represents weight value in a specific weight unit.'\n\n\nWeightUnitsEnum = graphene.Enum.from_enum(weight.WeightUnitsEnum)\n", "path": "saleor/graphql/core/types/common.py"}, {"content": "import graphene\nfrom graphene import relay\n\nfrom ...order import OrderEvents, models\nfrom ..account.types import User\nfrom ..core.types.common import CountableDjangoObjectType\nfrom ..core.types.money import Money, TaxedMoney\n\nOrderEventsEnum = graphene.Enum.from_enum(OrderEvents)\n\n\nclass OrderEvent(CountableDjangoObjectType):\n    date = graphene.types.datetime.DateTime(\n        description='Date when event happened at in ISO 8601 format.')\n    type = OrderEventsEnum(description='Order event type')\n    user = graphene.Field(\n        User, id=graphene.Argument(graphene.ID),\n        description='User who performed the action.')\n    message = graphene.String(\n        description='Content of a note added to the order.')\n    email = graphene.String(description='Email of the customer')\n    email_type = graphene.String(\n        description='Type of an email sent to the customer')\n    amount = graphene.Float(description='Amount of money.')\n    quantity = graphene.Int(description='Number of items.')\n    composed_id = graphene.String(\n        description='Composed id of the Fulfillment.')\n\n    class Meta:\n        description = 'History log of the order.'\n        model = models.OrderEvent\n        interfaces = [relay.Node]\n        exclude_fields = ['order', 'parameters']\n\n    def resolve_email(self, info):\n        return self.parameters.get('email', None)\n\n    def resolve_email_type(self, info):\n        return self.parameters.get('email_type', None)\n\n    def resolve_amount(self, info):\n        amount = self.parameters.get('amount', None)\n        return float(amount) if amount else None\n\n    def resolve_quantity(self, info):\n        quantity = self.parameters.get('quantity', None)\n        return int(quantity) if quantity else None\n\n    def resolve_message(self, info):\n        return self.parameters.get('message', None)\n\n    def resolve_composed_id(self, info):\n        return self.parameters.get('composed_id', None)\n\n\nclass Fulfillment(CountableDjangoObjectType):\n    status_display = graphene.String(\n        description='User-friendly fulfillment status.')\n\n    class Meta:\n        description = 'Represents order fulfillment.'\n        interfaces = [relay.Node]\n        model = models.Fulfillment\n        exclude_fields = ['order']\n\n    def resolve_status_display(self, info):\n        return self.get_status_display()\n\n\nclass FulfillmentLine(CountableDjangoObjectType):\n    class Meta:\n        description = 'Represents line of the fulfillment.'\n        interfaces = [relay.Node]\n        model = models.FulfillmentLine\n        exclude_fields = ['fulfillment']\n\n\nclass Order(CountableDjangoObjectType):\n    fulfillments = graphene.List(\n        Fulfillment,\n        required=True,\n        description='List of shipments for the order.')\n    is_paid = graphene.Boolean(\n        description='Informs if an order is fully paid.')\n    number = graphene.String(description='User-friendly number of an order.')\n    payment_status = graphene.String(description='Internal payment status.')\n    payment_status_display = graphene.String(\n        description='User-friendly payment status.')\n    subtotal = graphene.Field(\n        TaxedMoney,\n        description='The sum of line prices not including shipping.')\n    status_display = graphene.String(description='User-friendly order status.')\n    total_authorized = graphene.Field(\n        Money, description='Amount authorized for the order.')\n    total_captured = graphene.Field(\n        Money, description='Amount captured by payment.')\n    events = graphene.List(\n        OrderEvent,\n        description='List of events associated with the order.')\n\n    class Meta:\n        description = 'Represents an order in the shop.'\n        interfaces = [relay.Node]\n        model = models.Order\n        exclude_fields = [\n            'shipping_price_gross', 'shipping_price_net', 'total_gross',\n            'total_net']\n\n    @staticmethod\n    def resolve_subtotal(obj, info):\n        return obj.get_subtotal()\n\n    @staticmethod\n    def resolve_total_authorized(obj, info):\n        payment = obj.get_last_payment()\n        if payment:\n            return payment.get_total_price().gross\n\n    @staticmethod\n    def resolve_total_captured(obj, info):\n        payment = obj.get_last_payment()\n        if payment:\n            return payment.get_captured_price()\n\n    @staticmethod\n    def resolve_fulfillments(obj, info):\n        return obj.fulfillments.all()\n\n    @staticmethod\n    def resolve_events(obj, info):\n        return obj.events.all()\n\n    @staticmethod\n    def resolve_is_paid(obj, info):\n        return obj.is_fully_paid()\n\n    @staticmethod\n    def resolve_number(obj, info):\n        return str(obj.pk)\n\n    @staticmethod\n    def resolve_payment_status(obj, info):\n        return obj.get_last_payment_status()\n\n    @staticmethod\n    def resolve_payment_status_display(obj, info):\n        return obj.get_last_payment_status_display()\n\n    @staticmethod\n    def resolve_status_display(obj, info):\n        return obj.get_status_display()\n\n    @staticmethod\n    def resolve_user_email(obj, info):\n        if obj.user_email:\n            return obj.user_email\n        if obj.user_id:\n            return obj.user.email\n\n\nclass OrderLine(CountableDjangoObjectType):\n    class Meta:\n        description = 'Represents order line of particular order.'\n        model = models.OrderLine\n        interfaces = [relay.Node]\n        exclude_fields = [\n            'order', 'unit_price_gross', 'unit_price_net', 'variant']\n", "path": "saleor/graphql/order/types.py"}]}