Class AddToCartController
java.lang.Object
de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
de.hybris.platform.shoppingaddon.controllers.misc.AddToCartController
Controller for Add to Cart functionality which is not specific to a certain page.
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
AbstractController.HttpNotFoundException -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final longprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
FORWARD_PREFIX, REDIRECT_PREFIX, ROOT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddBundleToCart(AddBundleToCartRequestData addBundleToCartRequestData) Performs the addBundleToCart for the given addBundleToCartRequestData.protected voidaddPropertiesToCartEntry(String travellerCode, int originDestinationRefNo, String travelRoute, List<String> transportOfferingCodes, Boolean active, AmendStatus amendStatus, CartModificationData cartModification) Adds the properties to cart entry.addSelectedAccommodationsToCart(List<AddRemoveAccommodation> addRemoveAccommodations, org.springframework.ui.Model model) Adds the selected accommodations to cart.addToCart(AddToCartForm addToCartForm, org.springframework.ui.Model model) Add to cart string.addToCart(List<AddToCartForm> addToCartForms, org.springframework.ui.Model model) Adds the to cart.addToCartBundle(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.addToCartBundle(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.protected AddToCartResponseDatacreateAddToCartResponse(boolean valid, String errorMessage, Integer minOriginDestinationRefNumber) Creates an AddToCartResponseDataprotected AddBundleToCartRequestDatagetAddBundleToCartRequestData(AddBundleToCartForm addBundleToCartForm) Returns the AddBundleToCartRequestData built from the AddBundleToCartForm.protected StringgetUpgradeBundleErrorMessage(String errorMsg, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel) Gets upgrade bundle error message.protected booleanperformAddToCart(AddToCartForm addToCartForm, org.springframework.ui.Model model) Perform add to cart.redeemVoucher(String voucherCode) Method to add voucher to cartreleaseVoucher(String voucherCode) Method to remove voucher from cartprotected StringshoppingAddBundlesToCart(List<AddBundleToCartRequestData> addBundleToCartRequestDataList) Shopping add bundles to cart.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.protected voidupgradeBundleInCart(AddBundleToCartForm addBundleToCartForm, org.springframework.validation.BindingResult bindingResult, org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel) Upgrade bundle in cartMethods inherited from class de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
addRequestToModel, getBean
-
Field Details
-
ERROR_MSG_TYPE
- See Also:
-
BASKET_ERROR_OCCURRED
- See Also:
-
ADD_BUNDLE_TO_CART_REQUEST_ERROR
- See Also:
-
PRODUCT_QUANTITY
protected static final long PRODUCT_QUANTITY- See Also:
-
SUCCESS_MSG
- See Also:
-
VOUCHER_ADD_SUCCESS_MESSAGE_KEY
- See Also:
-
VOUCHER_DELETE_SUCCESS_MESSAGE_KEY
- See Also:
-
-
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 formmodel- the model- Returns:
- String string
-
performAddToCart
Perform add to cart.- Parameters:
addToCartForm- the add to cart formmodel- 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 formsmodel- 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 formsmodel- 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 formbindingResult- the binding resultmodel- the modelredirectModel- 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 msgredirectModel- 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 validerrorMessage- the error messageminOriginDestinationRefNumber- 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 addBundleToCartFormmodel- the model- Returns:
- String the name of the jsp that builds the JSON response.
-
addBundleToCart
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 addBundleToCartFormsmodel- 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 accommodationsmodel- 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 codeoriginDestinationRefNo- the origin destination ref notravelRoute- the travel routetransportOfferingCodes- the transport offering codesactive- the activeamendStatus- the amend statuscartModification- 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 codemodel- 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 codemodel- the model- Returns:
- map
-
updateAddToCartResponseDataErrorMessage
-