Class CouponAction

java.lang.Object
org.apache.struts.action.Action

public class CouponAction extends CheckoutAction
Struts action class for submissions to record a coupon code entered by the user. Used for requests to "/CartCoupon.do" and "/CheckoutCoupon.do".

The execute method of this class first adds the submitted coupon code string to the enteredCouponCodes property of the current user's User instance. Next, it reprocesses discounts by invoking CartDiscountProcessor.processCouponCode(Map). Next, it checks the user's applied discounts to see if the coupon was applied. If it was not applied, an error is added to the request, the coupon code is removed from the enteredCouponCodes property, and the ActionForward returned will be named "failureCouponNotApplied". If the coupon is successfully applied, the "success" ActionForward is returned.

Author:
David Tobey
  • Field Details

    • log

      static org.apache.commons.logging.Log log
  • Constructor Details

    • CouponAction

      public CouponAction()
  • Method Details

    • execute

      public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
      Description copied from class: CheckoutAction
      Forwards the user to the appropriate checkout screen based on the status of the session and the store's database settings.
      Overrides:
      execute in class CheckoutAction
      Throws:
      Exception