Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
More explicit error code name
Tomasz Szymanski37f970eb1bb7
diff --git a/saleor/graphql/order/mutations/orders.py b/saleor/graphql/order/mutations/orders.pyindex 3058e2888c..6ab22dea08 100644--- a/saleor/graphql/order/mutations/orders.py+++ b/saleor/graphql/order/mutations/orders.py@@ -589,8 +589,8 @@ class CreateInvoice(ModelMutation):raise ValidationError({"orderId": ValidationError(- "Provided order cannot be draft.",- code=InvoiceErrorCode.NOT_READY,+ "Provided order status cannot be draft.",+ code=InvoiceErrorCode.INVALID_STATUS,)})diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 70da1283ec..4e82133e7f 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1972,6 +1972,7 @@ enum InvoiceErrorCode {NOT_READYURL_OR_NUMBER_NOT_SETNOT_FOUND+ INVALID_STATUS}scalar JSONStringdiff --git a/saleor/order/error_codes.py b/saleor/order/error_codes.pyindex 16db8a7a75..2efa43e469 100644--- a/saleor/order/error_codes.py+++ b/saleor/order/error_codes.py@@ -31,3 +31,4 @@ class InvoiceErrorCode(Enum):NOT_READY = "not_ready"URL_OR_NUMBER_NOT_SET = "url_or_number_not_set"NOT_FOUND = "not_found"+ INVALID_STATUS = "invalid_status"diff --git a/tests/api/test_order.py b/tests/api/test_order.pyindex c3bff85864..0c52493470 100644--- a/tests/api/test_order.py+++ b/tests/api/test_order.py@@ -3237,7 +3237,7 @@ def test_create_invoice_for_draft_order().exists()error = content["data"]["createInvoice"]["invoiceErrors"][0]assert error["field"] == "orderId"- assert error["code"] == InvoiceErrorCode.NOT_READY.name+ assert error["code"] == InvoiceErrorCode.INVALID_STATUS.namedef test_create_invoice_invalid_id(staff_api_client, permission_manage_orders):