Class AddToCartController
java.lang.Object
de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController
de.hybris.platform.traveladdon.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 longThis constant value dictates the quantity of the fare product to be added in the cart.protected 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) 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.addTransportBundleToCart(AddBundleToCartForm addBundleToCartForm, org.springframework.ui.Model model) Performs the addTransportBundleToCart for the given addBundleToCartForm and returns the name of the jsp that builds the JSON response.changeTransportBundle(AddBundleToCartForm addBundleToCartForm, org.springframework.ui.Model model) Removes all cart entries for specific origin destination ref number and adds a newly selected bundle to cart for the same origin destination.protected AddToCartResponseDatacreateAddToCartResponse(boolean valid, String errorMessage, Integer minOriginDestinationRefNumber) Creates an AddToCartResponseDataprotected AddAccommodationToCartStrategyprotected AddBundleToCartRequestDatagetAddBundleToCartRequestData(AddBundleToCartForm addBundleToCartForm) Returns the AddBundleToCartRequestData built from the AddBundleToCartForm.protected TravelCartFacadeprotected ConfiguredAccommodationFacadeprotected de.hybris.platform.servicelayer.i18n.L10NServiceprotected TravellerFacadeprotected TravelRestrictionStrategyprotected StringgetUpgradeBundleErrorMessage(String errorMsg, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel) 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 cartvoidsetAddAccommodationToCartStrategy(AddAccommodationToCartStrategy addAccommodationToCartStrategy) voidsetCartFacade(TravelCartFacade cartFacade) voidsetConfiguredAccommodationFacade(ConfiguredAccommodationFacade configuredAccommodationFacade) voidsetL10NService(de.hybris.platform.servicelayer.i18n.L10NService l10nService) voidsetTravellerFacade(TravellerFacade travellerFacade) voidsetTravelRestrictionStrategy(TravelRestrictionStrategy travelRestrictionStrategy) protected voidupgradeBundleInCart(AddBundleToCartForm addBundleToCartForm, org.springframework.validation.BindingResult bindingResult, org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectModel) Methods 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_QUANTITYThis constant value dictates the quantity of the fare product to be added in the cart.- 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) - Parameters:
addToCartForm-model-- Returns:
- 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
-
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) -
getUpgradeBundleErrorMessage
-
createAddToCartResponse
protected AddToCartResponseData createAddToCartResponse(boolean valid, String errorMessage, Integer minOriginDestinationRefNumber) Creates an AddToCartResponseData- Parameters:
valid-errorMessage-minOriginDestinationRefNumber-- 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
-
addTransportBundleToCart
@RequestMapping(value="/cart/add-transport-bundle", method=POST, produces="application/json") @ResponseBody public AddToCartResponseData addTransportBundleToCart(AddBundleToCartForm addBundleToCartForm, 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:
addBundleToCartForm- the addBundleToCartFormmodel- the model- Returns:
- String the name of the jsp that builds the JSON response.
-
changeTransportBundle
@RequestMapping(value="/cart/package-change-transport", method=POST, produces="application/json") @ResponseBody public AddToCartResponseData changeTransportBundle(AddBundleToCartForm addBundleToCartForm, org.springframework.ui.Model model) Removes all cart entries for specific origin destination ref number and adds a newly selected bundle to cart for the same origin destination.- Parameters:
addBundleToCartForm- the addBundleToCartFormmodel- the model- Returns:
- String the name of the jsp that builds the JSON response.
-
updateAddToCartResponseDataErrorMessage
-
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-- 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-- Returns:
- map
-
getCartFacade
- Returns:
- TravelCartFacade
-
setCartFacade
- Parameters:
cartFacade-
-
getTravellerFacade
- Returns:
- TravellerFacade
-
setTravellerFacade
- Parameters:
travellerFacade-
-
getL10NService
protected de.hybris.platform.servicelayer.i18n.L10NService getL10NService()- Returns:
- L10NService
-
setL10NService
public void setL10NService(de.hybris.platform.servicelayer.i18n.L10NService l10nService) - Parameters:
l10nService-
-
getTravelRestrictionStrategy
- Returns:
- TravelRestrictionStrategy
-
setTravelRestrictionStrategy
- Parameters:
travelRestrictionStrategy-
-
getAddAccommodationToCartStrategy
- Returns:
- AddAccommodationToCartStrategy
-
setAddAccommodationToCartStrategy
public void setAddAccommodationToCartStrategy(AddAccommodationToCartStrategy addAccommodationToCartStrategy) - Parameters:
addAccommodationToCartStrategy-
-
getConfiguredAccommodationFacade
- Returns:
- ConfiguredAccommodationFacade
-
setConfiguredAccommodationFacade
public void setConfiguredAccommodationFacade(ConfiguredAccommodationFacade configuredAccommodationFacade) - Parameters:
configuredAccommodationFacade-
-