Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Refactor error codes names
Aleksander Spyraefd50cadd979
diff --git a/saleor/graphql/core/utils/error_codes.py b/saleor/graphql/core/utils/error_codes.pyindex 884ac37975..1a461606a6 100644--- a/saleor/graphql/core/utils/error_codes.py+++ b/saleor/graphql/core/utils/error_codes.py@@ -78,18 +78,17 @@ class MenuErrorCode(Enum):class OrderErrorCode(Enum):CANNOT_CANCEL_FULFILLMENT = "cannot_cancel_fulfillment"CANNOT_CANCEL_ORDER = "cannot_cancel_order"+ CANNOT_DELETE = "cannot_delete"+ CANNOT_REFUND = "cannot_refund"CAPTURE_INACTIVE_PAYMENT = "capture_inactive_payment"- DELETE_LINE_NON_DRAFT_ORDER = "delete_line_non_draft_order"- DELETE_NON_DRAFT_ORDER = "delete_non_draft_order"EDIT_NON_DRAFT_ORDER = "edit_non_draft_order"FULFILL_ORDER_LINE = "fulfill_order_line"ORDER_INVALID_SHIPPING_METHOD = "order_invalid_shipping_method"- ORDER_NO_PAYMENT = "order_no_payment"ORDER_NO_PRODUCTS = "order_without_products"ORDER_NO_SHIPPING_ADDRESS = "order_no_shipping_address"- QUANTITY_LESS_THAN_ONE = "quantity_less_than_one"- REFUND_MANUAL_PAYMENT = "refund_manual_payment"+ PAYMENT_MISSING = "payment_missing"VOID_INACTIVE_PAYMENT = "void_inactive_payment"+ ZERO_QUANTITY = "zero_quantity"class CommonErrorCode(Enum):diff --git a/saleor/graphql/order/bulk_mutations/draft_orders.py b/saleor/graphql/order/bulk_mutations/draft_orders.pyindex a96be4aa85..d2238f7364 100644--- a/saleor/graphql/order/bulk_mutations/draft_orders.py+++ b/saleor/graphql/order/bulk_mutations/draft_orders.py@@ -24,7 +24,7 @@ class DraftOrderBulkDelete(ModelBulkDeleteMutation):{"id": ValidationError("Cannot delete non-draft orders.",- code=OrderErrorCode.DELETE_NON_DRAFT_ORDER,+ code=OrderErrorCode.CANNOT_DELETE,)})@@ -48,7 +48,7 @@ class DraftOrderLinesBulkDelete(ModelBulkDeleteMutation):{"id": ValidationError("Cannot delete line for non-draft orders.",- code=OrderErrorCode.DELETE_LINE_NON_DRAFT_ORDER,+ code=OrderErrorCode.CANNOT_DELETE,)})diff --git a/saleor/graphql/order/mutations/draft_orders.py b/saleor/graphql/order/mutations/draft_orders.pyindex 995522fc13..36236c0ff6 100644--- a/saleor/graphql/order/mutations/draft_orders.py+++ b/saleor/graphql/order/mutations/draft_orders.py@@ -312,8 +312,8 @@ class DraftOrderLinesCreate(BaseMutation):raise ValidationError({"quantity": ValidationError(- "Ensure this value is greater than or equal to 1.",- code=OrderErrorCode.QUANTITY_LESS_THAN_ONE,+ "Ensure this value is greater than 0.",+ code=OrderErrorCode.ZERO_QUANTITY,)})@@ -406,8 +406,8 @@ class DraftOrderLineUpdate(ModelMutation):raise ValidationError({"quantity": ValidationError(- "Ensure this value is greater than or equal to 1.",- code=OrderErrorCode.QUANTITY_LESS_THAN_ONE,+ "Ensure this value is greater than 0.",+ code=OrderErrorCode.ZERO_QUANTITY,)})diff --git a/saleor/graphql/order/mutations/orders.py b/saleor/graphql/order/mutations/orders.pyindex c306bb5396..20a9bb792e 100644--- a/saleor/graphql/order/mutations/orders.py+++ b/saleor/graphql/order/mutations/orders.py@@ -70,7 +70,7 @@ def clean_payment(payment):{"payment": ValidationError("There's no payment associated with the order.",- code=OrderErrorCode.ORDER_NO_PAYMENT,+ code=OrderErrorCode.PAYMENT_MISSING,)})@@ -110,7 +110,7 @@ def clean_refund_payment(payment):{"payment": ValidationError("Manual payments can not be refunded.",- code=OrderErrorCode.REFUND_MANUAL_PAYMENT,+ code=OrderErrorCode.CANNOT_REFUND,)})diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 8f39150567..b7a2858329 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1399,14 +1399,14 @@ enum ErrorCode {CANNOT_ASSIGN_NODECANNOT_CANCEL_FULFILLMENTCANNOT_CANCEL_ORDER+ CANNOT_DELETECANNOT_FETCH_TAX_RATES+ CANNOT_REFUNDCAPTURE_INACTIVE_PAYMENTCHECKOUT_NOT_FULLY_PAIDCONTRADICTIONDEACTIVATE_OWN_ACCOUNTDEACTIVATE_SUPERUSER_ACCOUNT- DELETE_LINE_NON_DRAFT_ORDER- DELETE_NON_DRAFT_ORDERDELETE_NON_STAFF_USERDELETE_OWN_ACCOUNTDELETE_STAFF_ACCOUNT@@ -1456,7 +1456,6 @@ enum ErrorCode {OBJECT_ALREADY_EXISTSOBJECT_DOES_NOT_EXISTORDER_INVALID_SHIPPING_METHOD- ORDER_NO_PAYMENTORDER_NO_SHIPPING_ADDRESSORDER_WITHOUT_PRODUCTSOVERFLOW@@ -1466,10 +1465,10 @@ enum ErrorCode {PASSWORD_TOO_SHORTPASSWORD_TOO_SIMILARPAYMENT_ERROR+ PAYMENT_MISSING+ PLUGIN_MISCONFIGUREDPOSITIVE_NUMBER_REQUIREDQUANTITY_GREATER_THAN_LIMIT- QUANTITY_LESS_THAN_ONE- REFUND_MANUAL_PAYMENTREQUIREDSHIPPING_ADDRESS_NOT_SETSHIPPING_METHOD_NOT_APPLICABLE@@ -1484,6 +1483,7 @@ enum ErrorCode {VARIANT_NO_DIGITAL_CONTENTVOID_INACTIVE_PAYMENTVOUCHER_NOT_APPLICABLE+ ZERO_QUANTITY}type Fulfillment implements Node {