Skip to content

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

Add missing payload fields (#14238)

Iga Karbowiak843a2c1905ad
diff --git a/saleor/graphql/order/tests/mutations/test_order_lines_create.py b/saleor/graphql/order/tests/mutations/test_order_lines_create.py
index 6572fb1fd6..7e3b19c434 100644
--- a/saleor/graphql/order/tests/mutations/test_order_lines_create.py
+++ b/saleor/graphql/order/tests/mutations/test_order_lines_create.py
@@ -46,6 +46,7 @@ ORDER_LINES_CREATE_MUTATION = """
quantity
productSku
productVariantId
+ saleId
unitPrice {
gross {
amount
@@ -620,6 +621,9 @@ def test_order_lines_create_variant_on_promotion(
line_data["unitPrice"]["net"]["amount"]
== variant_channel_listing.price_amount - reward_value
)
+ assert line_data["saleId"] == graphene.Node.to_global_id(
+ "Promotion", promotion_without_rules.id
+ )
line = order.lines.get(product_sku=variant.sku)
assert line.sale_id == graphene.Node.to_global_id(
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 7d4f9bab32..837ab07203 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -73,6 +73,7 @@ from ..core.descriptions import (
ADDED_IN_310,
ADDED_IN_311,
ADDED_IN_313,
+ ADDED_IN_314,
ADDED_IN_315,
DEPRECATED_IN_3X_FIELD,
PREVIEW_FEATURE,
@@ -728,6 +729,13 @@ class OrderLine(ModelObjectType[models.OrderLine]):
OrderPermissions.MANAGE_ORDERS,
],
)
+ sale_id = graphene.ID(
+ required=False,
+ description=(
+ "Denormalized sale ID, set when order line is created for a product "
+ "variant that is on sale." + ADDED_IN_314
+ ),
+ )
quantity_to_fulfill = graphene.Int(
required=True,
description="A quantity of items remaining to be fulfilled." + ADDED_IN_31,
@@ -765,6 +773,10 @@ class OrderLine(ModelObjectType[models.OrderLine]):
"permissions to access." + ADDED_IN_39
),
)
+ voucher_code = graphene.String(
+ required=False,
+ description="Voucher code that was used for this order line." + ADDED_IN_314,
+ )
class Meta:
description = "Represents order line of particular order."
diff --git a/saleor/graphql/payment/types.py b/saleor/graphql/payment/types.py
index d668ec327f..1106ddf970 100644
--- a/saleor/graphql/payment/types.py
+++ b/saleor/graphql/payment/types.py
@@ -19,6 +19,7 @@ from ..core.descriptions import (
ADDED_IN_34,
ADDED_IN_36,
ADDED_IN_313,
+ ADDED_IN_314,
ADDED_IN_315,
PREVIEW_FEATURE,
)
@@ -200,6 +201,13 @@ class Payment(ModelObjectType[models.Payment]):
credit_card = graphene.Field(
CreditCard, description="The details of the card used for this payment."
)
+ partial = graphene.Boolean(
+ required=True,
+ description="Informs whether this is a partial payment." + ADDED_IN_314,
+ )
+ psp_reference = graphene.String(
+ required=False, description="PSP reference of the payment." + ADDED_IN_314
+ )
class Meta:
description = "Represents a payment of a given type."
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 0e6266a03b..c4fefccc4f 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -11832,6 +11832,13 @@ type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
"""
allocations: [Allocation!]
+ """
+ Denormalized sale ID, set when order line is created for a product variant that is on sale.
+
+ Added in Saleor 3.14.
+ """
+ saleId: ID
+
"""
A quantity of items remaining to be fulfilled.
@@ -11871,6 +11878,13 @@ type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
Added in Saleor 3.9.
"""
taxClassPrivateMetadata: [MetadataItem!]!
+
+ """
+ Voucher code that was used for this order line.
+
+ Added in Saleor 3.14.
+ """
+ voucherCode: String
}
"""
@@ -12192,6 +12206,20 @@ type Payment implements Node & ObjectWithMetadata @doc(category: "Payments") {
"""The details of the card used for this payment."""
creditCard: CreditCard
+
+ """
+ Informs whether this is a partial payment.
+
+ Added in Saleor 3.14.
+ """
+ partial: Boolean!
+
+ """
+ PSP reference of the payment.
+
+ Added in Saleor 3.14.
+ """
+ pspReference: String
}
"""An object representing a single payment."""