Class AddToCartController

java.lang.Object
de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
de.hybris.platform.shoppingaddon.controllers.misc.AddToCartController

@Controller public class AddToCartController extends AbstractController
Controller for Add to Cart functionality which is not specific to a certain page.
  • Field Details

  • Constructor Details

    • AddToCartController

      public AddToCartController()
  • Method Details

    • addToCart

      @RequestMapping(value="/cart/add", method=POST, produces="application/json") @ResponseBody public AddToCartResponseData addToCart(AddToCartForm addToCartForm, org.springframework.ui.Model model)
      Add to cart string.
      Parameters:
      addToCartForm - the add to cart form
      model - the model
      Returns:
      String string
    • performAddToCart

      protected boolean performAddToCart(AddToCartForm addToCartForm, org.springframework.ui.Model model)
      Perform add to cart.
      Parameters:
      addToCartForm - the add to cart form
      model - the model
      Returns:
      true, if successful
    • addToCart

      @RequestMapping(value="/cart/add/group", method=POST, consumes="application/json", produces="application/json") @ResponseBody public AddToCartResponseData addToCart(@RequestBody List<AddToCartForm> addToCartForms, org.springframework.ui.Model model)
      Adds the to cart.
      Parameters:
      addToCartForms - the add to cart forms
      model - the model
      Returns:
      the string
    • addToCartBundle

      @RequestMapping(value="shopping/add/bundles", method=POST, produces="application/json") @ResponseBody public AddToCartResponseData addToCartBundle(@ModelAttribute("addBundleToCartForm") AddBundleToCartForms addBundleToCartForms, org.springframework.ui.Model model)
      Performs the addBundleToCart for the given addBundleToCartForm and returns the name of the jsp that builds the JSON response.
      Parameters:
      addBundleToCartForms - the add bundle to cart forms
      model - the model
      Returns:
      String the name of the jsp that builds the JSON response.
    • shoppingAddBundlesToCart

      protected String shoppingAddBundlesToCart(List<AddBundleToCartRequestData> addBundleToCartRequestDataList)
      Shopping add bundles to cart.
      Parameters:
      addBundleToCartRequestDataList - the add bundle to cart request data list
      Returns:
      the string
    • upgradeBundleInCart

      @RequestMapping(value="/cart/upgradeBundle", method=POST) public String upgradeBundleInCart(@ModelAttribute("addBundleToCartForm") AddBundleToCartForm addBundleToCartForm, org.springframework.validation.BindingResult bindingResult, org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel)
      Upgrade bundle in cart
      Parameters:
      addBundleToCartForm - the add bundle to cart form
      bindingResult - the binding result
      model - the model
      redirectModel - the redirect model
      Returns:
      the string
    • getUpgradeBundleErrorMessage

      protected String getUpgradeBundleErrorMessage(String errorMsg, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel)
      Gets upgrade bundle error message.
      Parameters:
      errorMsg - the error msg
      redirectModel - the redirect model
      Returns:
      the upgrade bundle error message
    • createAddToCartResponse

      protected AddToCartResponseData createAddToCartResponse(boolean valid, String errorMessage, Integer minOriginDestinationRefNumber)
      Creates an AddToCartResponseData
      Parameters:
      valid - the valid
      errorMessage - the error message
      minOriginDestinationRefNumber - the min origin destination ref number
      Returns:
      the AddToCartResponseData
    • addToCartBundle

      @RequestMapping(value="/cart/addBundle", method=POST, produces="application/json") @ResponseBody public AddToCartResponseData addToCartBundle(@ModelAttribute("addBundleToCartForm") AddBundleToCartForm addBundleToCartForm, org.springframework.ui.Model model)
      Performs the addBundleToCart for the given addBundleToCartForm and returns the name of the jsp that builds the JSON response.
      Parameters:
      addBundleToCartForm - the addBundleToCartForm
      model - the model
      Returns:
      String the name of the jsp that builds the JSON response.
    • addBundleToCart

      protected String addBundleToCart(AddBundleToCartRequestData addBundleToCartRequestData)
      Performs the addBundleToCart for the given addBundleToCartRequestData.
      Parameters:
      addBundleToCartRequestData - as the addBundleToCartRequestData
      Returns:
      a string representing the error message if the addToCartBundle was unsuccessful, an empty string otherwise
    • getAddBundleToCartRequestData

      protected AddBundleToCartRequestData getAddBundleToCartRequestData(AddBundleToCartForm addBundleToCartForm)
      Returns the AddBundleToCartRequestData built from the AddBundleToCartForm.
      Parameters:
      addBundleToCartForm - as the addBundleToCartForm
      Returns:
      the AddBundleToCartRequestData
    • shoppingAddTransportBundleToCart

      @RequestMapping(value="/shopping/cart/add-transport-bundle", method=POST, produces="application/json") @ResponseBody public AddToCartResponseData shoppingAddTransportBundleToCart(AddBundleToCartForms addBundleToCartForms, org.springframework.ui.Model model)
      Performs the addTransportBundleToCart for the given addBundleToCartForm and returns the name of the jsp that builds the JSON response.
      Parameters:
      addBundleToCartForms - the addBundleToCartForms
      model - the model
      Returns:
      String the name of the jsp that builds the JSON response.
    • addSelectedAccommodationsToCart

      @RequestMapping(value={"/cart/addremove/accommodations","/manage-booking/ancillary/cart/addremove/accommodations"}, method={POST,GET}, consumes="application/json", produces="application/json") @ResponseBody public AddToCartResponseData addSelectedAccommodationsToCart(@RequestBody List<AddRemoveAccommodation> addRemoveAccommodations, org.springframework.ui.Model model)
      Adds the selected accommodations to cart.
      Parameters:
      addRemoveAccommodations - the add remove accommodations
      model - the model
      Returns:
      the string
    • addPropertiesToCartEntry

      protected void addPropertiesToCartEntry(String travellerCode, int originDestinationRefNo, String travelRoute, List<String> transportOfferingCodes, Boolean active, AmendStatus amendStatus, CartModificationData cartModification)
      Adds the properties to cart entry.
      Parameters:
      travellerCode - the traveller code
      originDestinationRefNo - the origin destination ref no
      travelRoute - the travel route
      transportOfferingCodes - the transport offering codes
      active - the active
      amendStatus - the amend status
      cartModification - the cart modification
    • redeemVoucher

      @RequestMapping(value="/cart/voucher/redeem", method=POST) @ResponseBody public Map<String,String> redeemVoucher(@RequestParam("voucherCode") String voucherCode)
      Method to add voucher to cart
      Parameters:
      voucherCode - the voucher code
      model - the model
      Returns:
      map
    • releaseVoucher

      @RequestMapping(value="/cart/voucher/release", method=POST) @ResponseBody public Map<String,String> releaseVoucher(@RequestParam("voucherCode") String voucherCode)
      Method to remove voucher from cart
      Parameters:
      voucherCode - the voucher code
      model - the model
      Returns:
      map
    • updateAddToCartResponseDataErrorMessage

      protected void updateAddToCartResponseDataErrorMessage(AddToCartResponseData response)