CpqAppHandlerError Codes for Cart-Based APIs

Out of the box, error messages in CpqAppHandlerErrors.cls are based on custom labels. You define all CpqAppHandler error messages in the CpqAppHandlerErrors class, then create the translations for these messages.

Each error must have:

  • A unique integer code.

  • A default error message. You may use this message to construct the JSONMessage. The out of box error messages defined in the CpqAppHandlerErrors class are not intended to be translated because the error code is used to get the translated error message.

The following is the via_cpq/classes/CpqAppHandlerErrors.cls:

1public class CpqAppHandlerErrors {
2
3    // General Cart Errors - 100
4    public static CpqAppHandlerError INVALID_CART_ID = new CpqAppHandlerError('100', Label.CPQInvalidCartID);
5    public static CpqAppHandlerError NO_RESULTS_FOUND  = new CpqAppHandlerError('101', Label.CPQNoResultsFound);
6    public static CpqAppHandlerError INVALID_CATALOG_ID = new CpqAppHandlerError('102', Label.CPQInvalidCatalogID);
7    public static CpqAppHandlerError INVALID_ACCOUNT_ID = new CpqAppHandlerError('103', Label.InvalidAccountId);
8    public static CpqAppHandlerError INVALID_ASSET_ID = new CpqAppHandlerError('104', Label.InvalidAssetId);
9    public static CpqAppHandlerError NO_PARAMS_FOUND = new CpqAppHandlerError('105', Label.NoParamsFound);
10    public static CpqAppHandlerError NO_URL_PASSED = new CpqAppHandlerError('106', Label.NoURLPassed);
11    public static CpqAppHandlerError KEY_GENERATION_ERROR = new CpqAppHandlerError('107', Label.KeyGenerationError);
12    public static CpqAppHandlerError INVALID_PREMISES_ID = new CpqAppHandlerError('108', Label.InvalidPremisesId);
13
14    // Product Errors - 120
15    public static CpqAppHandlerError INVALID_COMPARE_PRODUCT_ID = new CpqAppHandlerError('120', Label.CPQNoValidProdID);
16    public static CpqAppHandlerError MIN_NUMBER_PRODUCT_COMPARE = new CpqAppHandlerError('121', Label.CPQMinTwoProd);
17    public static CpqAppHandlerError INVALID_PBE_ID = new CpqAppHandlerError('122', Label.CPQInvalidPBEID);
18
19    // Item Errors - 140
20    public static CpqAppHandlerError INVALID_ITEM_ID = new CpqAppHandlerError('140', Label.CPQInvalidItemID);
21    public static CpqAppHandlerError VALIDATION_ERROR_DELETE  = new CpqAppHandlerError('141', Label.CPQItemCannotBeDeleted);
22    public static CpqAppHandlerError INVALID_QUANTITY  = new CpqAppHandlerError('142', Label.CPQInvalidQLI);
23
24    public static CpqAppHandlerError NO_ITEMS_TO_ADD  = new CpqAppHandlerError('143', Label.CPQNoItemsToAdd);
25    public static CpqAppHandlerError NO_ITEMS_TO_UPDATE  = new CpqAppHandlerError('144', Label.CPQNoItemsToUpdate);
26    public static CpqAppHandlerError NO_ITEMS_TO_DELETE  = new CpqAppHandlerError('145', Label.CPQNoItemsToDelete);
27    public static CpqAppHandlerError VALIDATION_ERROR_ADD  = new CpqAppHandlerError('146', Label.CPQNoItemsToDelete);
28    public static CpqAppHandlerError NO_ITEMS_TO_CLONE  = new CpqAppHandlerError('147', Label.CPQNoItemsToClone);
29
30    public static CpqAppHandlerError ADD_SUCCESSFUL  = new CpqAppHandlerError('150', Label.CPQAddSuccess);
31    public static CpqAppHandlerError UPDATE_SUCCESSFUL  = new CpqAppHandlerError('151', Label.CPQUpdateSuccessful);
32    public static CpqAppHandlerError DELETE_SUCCESSFUL  = new CpqAppHandlerError('152', Label.CPQDeleteSuccessful);
33    public static CpqAppHandlerError CLONE_SUCCESSFUL  = new CpqAppHandlerError('153', Label.CPQCloneSuccessful);
34
35    // Attribute Errors - 160
36    public static CpqAppHandlerError NO_ATTRIBUTE_FOUND = new CpqAppHandlerError('160', Label.CPQNoAttributesFilters);
37    public static CpqAppHandlerError ATTRIBUTE_MODIFICATION_SUCCESSFUL = new CpqAppHandlerError('161', Label.CPQAttributesModifySuccess);
38    public static CpqAppHandlerError NO_ATTRIBUTE_MODIFICATION = new CpqAppHandlerError('162', Label.CPQNoAttributesToModify);
39    // Pricing Errors - 180
40    public static CpqAppHandlerError PRICELIST_INVALID  = new CpqAppHandlerError('181', Label.CPQInvalidPriceList);
41
42    // Other errors - 200
43    public static CpqAppHandlerError REQUIRED_FIELDS_MISSING = new CpqAppHandlerError('200', Label.CPQReqFieldMissing);
44    public static CpqAppHandlerError INSERT_FAILED = new CpqAppHandlerError('201', Label.CPQInsertFailed);
45    public static CpqAppHandlerError INVALID_OBJECT_TYPE = new CpqAppHandlerError('202', Label.CPQInvalidObjectType);
46    public static CpqAppHandlerError VALUE_MISSING = new CpqAppHandlerError('203', Label.CPQPleaseEnterValue);
47    public static CpqAppHandlerError REQUIRED_ATTR_MISSING = new CpqAppHandlerError('204', Label.CPQAttributeMissing);
48    public static CpqAppHandlerError INVALID_PARAM = new CpqAppHandlerError('205', Label.CPQInvalidParameter);
49    public static CpqAppHandlerError VALIDATION_INFO = new CpqAppHandlerError('206', Label.CPQValidationInfo);
50    public static CpqAppHandlerError VALIDATION_WARN = new CpqAppHandlerError('207', Label.CPQValidationWarning);
51    public static CpqAppHandlerError VALIDATION_ERROR = new CpqAppHandlerError('208', Label.CPQValidationError);
52
53    // Generic catch all Error messages
54    public static CpqAppHandlerError GENERIC_PRODUCT_SERVICE_EXCEPTION = new CpqAppHandlerError('209', Label.CPQProductServiceException);
55    public static CpqAppHandlerError GENERIC_ITEM_SERVICE_EXCEPTION = new CpqAppHandlerError('210', Label.CPQItemServiceException);
56    public static CpqAppHandlerError GENERIC_PRICING_SERVICE_EXCEPTION = new CpqAppHandlerError('211', Label.CPQPricingServiceException);
57
58    //Other errors continued
59    public static CpqAppHandlerError CLONE_FAILED = new CpqAppHandlerError('212', Label.CPQCloneFailed);
60    public static CpqAppHandlerError UPDATE_FAILED = new CpqAppHandlerError('213', Label.CPQUpdateFailed);
61    public static CpqAppHandlerError SUBMIT_FAILED = new CpqAppHandlerError('214', Label.CPQSubmitFailed);
62    public static CpqAppHandlerError FDO_FAILED = new CpqAppHandlerError('215', Label.CPQFdoFailed);
63    public static CpqAppHandlerError ACCOUNT_INACTIVE = new CpqAppHandlerError('216', Label.CPQAccountInactiveOrExpired);
64
65    //Bundle Error/Warning messages - 220
66    public static CpqAppHandlerError BUNDLE_HAS_ERRORS = new CpqAppHandlerError('220', Label.ThisBundleHasErrors);
67    public static CpqAppHandlerError BUNDLE_HAS_WARNINGS = new CpqAppHandlerError('221', Label.ThisBundleHasWarnings);
68
69    //Promotion Service Errors - 300
70    public static CpqAppHandlerError GENERIC_PROMOTION_SERVICE_EXCEPTION = new CpqAppHandlerError('310', Label.CPQPromotionServiceException);
71    public static CpqAppHandlerError MULTIPLE_CONTEXT_NODES_DETECTED = new CpqAppHandlerError('320', Label.CPQMultipleNodesDetected);
72    public static CpqAppHandlerError CARDINALITY_EXCEPTION = new CpqAppHandlerError('330', Label.CPQPromotionCardinalityException);
73    public static CpqAppHandlerError PAST_OR_ENDOFLIFE_PRODUCTS_EXCEPTION = new CpqAppHandlerError('340', Label.CPQPastOrEndOfLifeProductException);
74    public static CpqAppHandlerError PROMOTION_PAST_OR_ENDOFLIFE_PRODUCTS_EXCEPTION = new CpqAppHandlerError('340', Label.CPQPromotionPastOrEndOfLifeProductException);
75
76    //Override Service Errors - 400
77    public static CpqAppHandlerError CARDINALITY_OVERRIDE_SERVICE_EXCEPTION = new CpqAppHandlerError('410', Label.CPQCardinalityOverrideServiceException);
78    public static CpqAppHandlerError CART_UPGRADE_EXCEPTION = new CpqAppHandlerError('420', Label.CPQCartUpgradeException);
79
80    public static CpqAppHandlerError GENERIC_PRODUCT_HIERARCHY_EXCEPTION = new CpqAppHandlerError('230', Label.CPQIncorrectProdConfig);
81
82    public static CpqAppHandlerError RULE_CODE_FAIL_LEVEL_HARD_FAIL = new CpqAppHandlerError('301', Label.CPQRuleConditionHardFail);
83    public static CpqAppHandlerError RULE_CODE_FAIL_LEVEL_SOFT_FAIL = new CpqAppHandlerError('302', Label.CPQRuleConditionSoftFail);
84    public static CpqAppHandlerError RULE_CODE_FAIL_LEVEL_SOFT_PASS = new CpqAppHandlerError('303', Label.CPQRuleConditionSoftPass);
85
86    public static CpqAppHandlerError CANNOT_CANCEL = new CpqAppHandlerError('304', Label.CannotCancel);
87    public static CpqAppHandlerError CANCEL_SUCCESSFUL = new CpqAppHandlerError('305', Label.CancelSuccessful);
88    public static CpqAppHandlerError CANCEL_FAILED = new CpqAppHandlerError('306', Label.CancelFailed);
89    public static CpqAppHandlerError CANCEL_RETRY = new CpqAppHandlerError('307', Label.CancelRetry);
90    public static CpqAppHandlerError CANCEL_ORDER_INVALID_SUBMIT_STATUS = new CpqAppHandlerError('308', Label.CancelOrderInvalidSubmitStatus);
91    public static CpqAppHandlerError CANCEL_ACCEPTED = new CpqAppHandlerError('309', 'Cancellation is accepted.');//CMT-5552 can not add Custom label in patch. We can fix it in v105
92
93    // Discount messages - 500
94    public static CpqAppHandlerError DISCOUNT_ADD_SUCCESSFUL = new CpqAppHandlerError('510', Label.CPQDiscountAddedSuccess);
95    public static CpqAppHandlerError DISCOUNT_CONFIGURE_SUCCESSFUL = new CpqAppHandlerError('520', Label.CPQDiscountConfigSuccess);
96    public static CpqAppHandlerError DISCOUNT_CLONE_SUCCESSFUL = new CpqAppHandlerError('530', Label.CPQDiscountCloneSuccess);
97    public static CpqAppHandlerError DISCOUNT_DELETE_SUCCESSFUL = new CpqAppHandlerError('540', Label.CPQDiscountDeleteSuccess);
98    public static CpqAppHandlerError DISCOUNT_SUBMIT_SUCCESSFUL = new CpqAppHandlerError('550', Label.CPQDiscountSubmitSuccess);
99
100    public static CpqAppHandlerError DISCOUNT_ADD_FAIL = new CpqAppHandlerError('560', Label.CPQDiscountAddedFailed);
101    public static CpqAppHandlerError DISCOUNT_CONFIGURE_FAIL = new CpqAppHandlerError('570', Label.CPQDiscountConfigFailed);
102    public static CpqAppHandlerError DISCOUNT_CLONE_FAIL = new CpqAppHandlerError('580', Label.CPQDiscountCloneFailed);
103    public static CpqAppHandlerError DISCOUNT_DELETE_FAIL = new CpqAppHandlerError('590', Label.CPQDiscountDeleteFailed);
104    public static CpqAppHandlerError DISCOUNT_SUBMIT_FAIL = new CpqAppHandlerError('600', Label.CPQDiscountSubmitFailed);
105    public static CpqAppHandlerError DISCOUNT_UNAPPROVED = new CpqAppHandlerError('610', Label.CPQDiscountUnapproved);
106    public static CpqAppHandlerError DISCOUNT_ALREADY_SUBMITTED = new CpqAppHandlerError('620', Label.CPQDiscountAlreadySubmitted);
107
108    //Offer Migration Plans Errors - 700
109    public static CpqAppHandlerError GENERIC_OFFER_MIGRATION_PLAN_EXCEPTION = new CpqAppHandlerError('710', Label.CPQOfferMigrationPlanServiceException);
110    public static CpqAppHandlerError CANNOT_REPLACE_SAME_OFFER_EXCEPTION = new CpqAppHandlerError('720', Label.CPQCannotReplaceSameOfferException);
111    public static CpqAppHandlerError NO_REPLACEABLE_OFFER_IN_CART_EXCEPTION = new CpqAppHandlerError('730', Label.CPQNoReplaceableOfferInCart);
112    public static CpqAppHandlerError ALL_DISCONNECTED_COMPONENTS_EXCEPTION = new CpqAppHandlerError('740', Label.CPQAllDisconnectedComponents);
113
114    //Replace offer service errors - 800
115    public static CpqAppHandlerError GENERIC_REPLACE_OFFER_SERVICE_EXCEPTION = new CpqAppHandlerError('810', Label.CPQReplaceOfferServiceException);
116    public static CpqAppHandlerError PROMOTION_ITEM_EXCEPTION = new CpqAppHandlerError('820', Label.CPQPromotionItemException);
117    public static CpqAppHandlerError REPLACEMENT_SUCCESSFUL = new CpqAppHandlerError('830', Label.CPQReplaceSuccess);
118    public static CpqAppHandlerError NO_REPLACEMENT_PERFORMED = new CpqAppHandlerError('840', Label.CPQNoReplacementPerformed);
119
120    //Compare offer service errors - 900
121    public static CpqAppHandlerError GENERIC_COMPARE_OFFER_SERVICE_EXCEPTION = new CpqAppHandlerError('910', Label.CPQCompareOfferServiceException);
122    public static CpqAppHandlerError TARGET_NOT_FOUND_EXCEPTION = new CpqAppHandlerError('920', Label.CPQCompareTargetNotFoundException);
123
124    public class CpqAppHandlerError {
125        public String code;
126        public String message;
127
128        public CpqAppHandlerError(String code, String message) {
129            this.code = code;
130            this.message = message;
131        }
132    }
133}