APAR status
Closed as program error.
Error description
When shoppers enter promotion codes which have already been redeemed, marked for delete, rejected or cannot yet be released (if the WaitingPeriodForUniqueCodeRelease property is configured), the storefront displays a general error indicating that the "The promotion code is invalid." This APAR allows for the ability to change the error messages independently for these situations through customization.
Local fix
Problem summary
USERS AFFECTED: WebSphere Commerce users on v7.0 and v8.0 who use promotions with promotion codes. PROBLEM ABSTRACT: Enable customization of promotion code error messages on store front. BUSINESS IMPACT: Shoppers may see a vague invalid code error message when adding a promotion code to their order. This could result in the customers abandoning their order due to lack of promotions. RECOMMENDATION:
Problem conclusion
To customize error messages related to invalid promotion codes at the store front, two new classes were introduced to return specific ECApplicationException objects. The new classes introduced in this enhancement are: 1. PromotionExceptionHandler 2. DefaultPromotionExceptionHandler PromotionExceptionHandler is an interface which defines the method getPromotionCodeException(). getPromotionCodeException determines which ECApplicationException object is the correct one to throw. It takes two parameters: 1. cause - value indicating the cause of the exception 2. params - a HashMap of parameters available at the time this method was called. The HashMap allows flexibility for passing in any number of parameters. By default, the violating PromotionCode must be passed in with key=PromotionExceptionHandler.PARAMETER_KEY_PROMOTION_CODE. A sample call of getPromotionCodeException is provided as follws: params.put(PromotionExceptionHander.PARAMETER_KEY_PROMOTION_COD E, "CODE123"); getPromotionCodeException(PromotionExceptionHander.EXCEPTION_CA USE_PROMOTION_CODE_REDEEMED, params); DefaultPromotionExceptionHandler is the implementing class of PromotionExceptionHandler. It implements getPromotionCodeException, as well as defines additional methods to return specific ECApplicationExceptions (i.e. the method getPromotionCodeExceptionRedeemed returns the ECApplicationException for when the promotion code entered has already been redeemed). getPromotionCodeException() works by returning the result of these ECApplicationException methods. ================================================================ Steps for implementing the customization: 1. Create a custom class ExtDefaultPromotionExceptionHandler extending DefaultPromotionExceptionHandler. Override any of the desired methods. The customization is currently available for: -Promotion codes that have already been redeemed override getPromotionCodeExceptionRedeemed() -Promotion codes that have been marked as deleted override getPromotionCodeExceptionDeleted() -Promotion codes that have been marked as rejected override getPromotionCodeExceptionRejected() -Error caused by unreleased promotion codes override getPromotionCodeExceptionUnreleaseable() 2. (if neccessary) create a new string in storeErrorMessages.properties and all other resource bundles in use. ERR_PROMOTION_CODE_CUSTOM.-xxxx=Custom string displaying to the store front where -xxxx is a negative and unique four-digit code. create a corresponding string in WcPromotionUserMessages.properties and all other resource bundles in use. ERR_PROMOTION_CODE_CUSTOM=Custom string displaying to the store front 3. in WCSPromotionEngineConfig.xml configure the promotion engine to implement your custom class. <PromotionExceptionHandler impl="com.mycompany.custom.ExtDefaultPromotionExceptionHandler"/ > 4. restart the server ================================================================ Hints: 1) Forming the ECApplicationException objects within the overriding methods: ECMessage errorMessage = MyCustomMessageConstants.ECMESSAGE_ERR_PROMOTION_CODE_CUSTOM; String errorCode = String.valueOf(MyCustomMessageConstants.ERR_MAJ_PROMOTION_CODE_C USTOM); String code = (String)params.get(PromotionExceptionCentral.PARAMETER_KEY_PROMO TION_CODE); TypedProperty hshNVPs = new TypedProperty(); hshNVPs.put(ECConstants.EC_ERROR_CODE,errorCode); ECApplicationException e = new ECApplicationException( errorMessage, CLASSNAME, METHODNAME, new Object[]{code}, hshNVPs); 2) Define the above constants as a separate class MyCustomMessageConstants for example: public static final ECMessage ECMESSAGE_ERR_PROMOTION_CODE_CUSTOM = new ECMessage( ECMessageSeverity.ERROR, ECMessageType.USER, "ERR_PROMOTION_CODE_CUSTOM", WcPromotionMessage.USER_RESOURCE_BUNDLE); public static final int ERR_MAJ_PROMOTION_CODE_CUSTOM = -xxxx;
Temporary fix
Comments
APAR Information
APAR number
JR54737
Reported component name
WC BUS EDITION
Reported component ID
5724I3800
Reported release
700
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2015-11-13
Closed date
2015-12-21
Last modified date
2015-12-29
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
WC BUS EDITION
Fixed component ID
5724I3800
Applicable component levels
R700 PSY
UP
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSYSYL","label":"WebSphere Commerce Enterprise"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.0","Line of Business":{"code":"LOB31","label":"WCE Watson Marketing and Commerce"}}]
Document Information
Modified date:
11 December 2021