Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Return OrderEventsEmail as Enum in GraphQL API
Pacu2d9035f6e134d
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.pyindex 1cd0bbdec6..5dc67baf2f 100644--- a/saleor/graphql/order/types.py+++ b/saleor/graphql/order/types.py@@ -1,16 +1,15 @@-from decimal import Decimal-import graphenefrom graphene import relayfrom payments import PaymentStatus-from ...order import OrderEvents, models+from ...order import OrderEvents, OrderEventsEmails, modelsfrom ...product.templatetags.product_images import get_thumbnailfrom ..account.types import Userfrom ..core.types.common import CountableDjangoObjectTypefrom ..core.types.money import Money, TaxedMoneyOrderEventsEnum = graphene.Enum.from_enum(OrderEvents)+OrderEventsEmailsEnum = graphene.Enum.from_enum(OrderEventsEmails)PaymentStatusEnum = graphene.Enum('PaymentStatusEnum',[(code.upper(), code) for code, name in PaymentStatus.CHOICES])@@ -26,7 +25,7 @@ class OrderEvent(CountableDjangoObjectType):message = graphene.String(description='Content of a note added to the order.')email = graphene.String(description='Email of the customer')- email_type = graphene.String(+ email_type = OrderEventsEmailsEnum(description='Type of an email sent to the customer')amount = graphene.Float(description='Amount of money.')quantity = graphene.Int(description='Number of items.')@@ -40,7 +39,8 @@ class OrderEvent(CountableDjangoObjectType):exclude_fields = ['order', 'parameters']def resolve_email(self, info):- return self.parameters.get('email', None)+ email = self.parameters.get('email')+ return email.upper() if email else Nonedef resolve_email_type(self, info):return self.parameters.get('email_type', None)