Skip to content

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

Make order more complete

Adam Janik747b737d89a9
diff --git a/saleor/graphql/account/types.py b/saleor/graphql/account/types.py
index 1ea6fea159..0f2ebd0831 100644
--- a/saleor/graphql/account/types.py
+++ b/saleor/graphql/account/types.py
@@ -23,7 +23,8 @@ class User(CountableDjangoObjectType):
exclude_fields = [
'addresses', 'is_staff', 'is_active', 'date_joined', 'password',
'default_shipping_address', 'default_billing_address',
- 'is_superuser', 'last_login', 'ordernote_set']
+ 'is_superuser', 'last_login', 'ordernote_set',
+ 'orderhistoryentry_set']
description = "Represents user data."
interfaces = [relay.Node]
model = get_user_model()
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 16a45eb039..86fd157c6a 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -7,8 +7,12 @@ from ..core.types import CountableDjangoObjectType
class Order(CountableDjangoObjectType):
+ is_paid = graphene.Boolean(description='Information if order is paid.')
order_id = graphene.Int(
description='Order number.')
+ payment_status = graphene.String(description='Information about payment')
+ payment_status_display = graphene.String(
+ description='Translated payment status')
status_display = graphene.String(description='Translated status display.')
class Meta:
@@ -19,13 +23,29 @@ class Order(CountableDjangoObjectType):
'shipping_price_gross', 'shipping_price_net', 'total_gross',
'total_net']
+ def resolve_is_paid(self, info):
+ return self.is_fully_paid()
+
def resolve_order_id(self, info):
return self.pk
+ def resolve_payment_status(self, info):
+ return self.get_last_payment_status()
+
+ def resolve_payment_status_display(self, info):
+ return self.get_last_payment_status_display()
+
def resolve_status_display(self, info):
return self.get_status_display()
+class OrderHistoryEntry(DjangoObjectType):
+ class Meta:
+ description = 'History log of the order.'
+ model = models.OrderHistoryEntry
+ exclude_fields = ['order']
+
+
class OrderLine(DjangoObjectType):
class Meta:
description = 'Represents order line of particular order.'
@@ -37,3 +57,15 @@ class OrderNote(DjangoObjectType):
class Meta:
description = 'Note from customer or staff user.'
model = models.OrderNote
+
+
+class Fulfillment(DjangoObjectType):
+ class Meta:
+ description = 'Represents order fulfillment.'
+ model = models.Fulfillment
+
+
+class FulfillmentLine(DjangoObjectType):
+ class Meta:
+ description = 'Represents line of the fulfillment.'
+ model = models.FulfillmentLine