Class TmaCartsController
- java.lang.Object
-
- de.hybris.platform.b2ctelcooccaddon.controllers.BaseController
-
- de.hybris.platform.b2ctelcooccaddon.controllers.TmaCartsController
-
@Controller @RequestMapping("/{baseSiteId}/users/{userId}/carts") public class TmaCartsController extends BaseControllerController for cart related requests such as retrieving/delete/update/... a cart- Since:
- 1911
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.b2ctelcooccaddon.controllers.BaseController
DEFAULT_FIELD_SET, FULL_FIELD_SET
-
-
Constructor Summary
Constructors Constructor Description TmaCartsController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CartModificationWsDTOaddCartEntryInternal(java.lang.String baseSiteId, java.lang.String fields, OrderEntryWsDTO entry, java.lang.Integer cartGroupNo, java.lang.String cartId, java.lang.String userId)CartWsDTOcreateCart(java.lang.String oldCartId, java.lang.String toMergeCartGuid, java.lang.String userId, java.lang.String fields)CartModificationWsDTOcreateCartEntry(java.lang.String cartId, java.lang.String userId, java.lang.String baseSiteId, OrderEntryWsDTO entry, java.lang.String fields)protected CartActionInputcreateCartItemAction(OrderEntryWsDTO entry, java.lang.String rootBpoCode, java.lang.Integer cartGroupNo, java.lang.String cartId, java.lang.String userId, java.lang.String pickupStore)Creates aCartActionInputfor aOrderEntryWsDTO.CartWsDTOgetCart(java.lang.String cartId, java.lang.String userId, java.lang.String fields)CartListWsDTOgetCarts(java.lang.String fields, boolean savedCartsOnly, int currentPage, int pageSize, java.lang.String sort)protected CartWsDTOgetRestoredCart(java.lang.String toMergeCartGuid, java.lang.String userId, java.lang.String fields)Gets restored cart or session cart when oldCartId is not provided.voidinitBinder(org.springframework.web.bind.WebDataBinder binder)protected CartWsDTOmergeCarts(java.lang.String oldCartId, java.lang.String evaluatedToMergeCartGuid, java.lang.String userId, java.lang.String fields)Merges anonymous cart with given user cart and returns user cart.protected voidpopulateDefaultCartEntryValues(OrderEntryWsDTO entry)voidremoveCartEntry(long entryNumber, java.lang.String cartId, java.lang.String userId)protected voidsetCpiInformation(OrderEntryWsDTO entry, CartActionInput cartActionInput)Sets CPI related informationprotected voidsetProductCharacteristics(OrderEntryWsDTO entry, CartActionInput cartActionInput)Sets PSCV related data from the entry on the cartActionInputCartModificationWsDTOupdateCartEntry(java.lang.String baseSiteId, long entryNumber, OrderEntryWsDTO entry, java.lang.String fields, java.lang.String cartId, java.lang.String userId)protected voidvalidateIfProductIsInStockInPOS(java.lang.String baseSiteId, java.lang.String productCode, java.lang.String storeName, java.lang.Long entryNumber)-
Methods inherited from class de.hybris.platform.b2ctelcooccaddon.controllers.BaseController
getDataMapper, getI18nService, getMessageSource, handleErrorInternal, handleModelNotFoundException, sanitize, setDataMapper, setI18nService, setMessageSource, validate
-
-
-
-
Method Detail
-
getCarts
@RequestMapping(method=GET) @ResponseBody public CartListWsDTO getCarts(@RequestParam(required=false,defaultValue="DEFAULT") java.lang.String fields, @RequestParam(defaultValue="false") boolean savedCartsOnly, @RequestParam(defaultValue="0") int currentPage, @RequestParam(defaultValue="20") int pageSize, @RequestParam(required=false) java.lang.String sort)
-
getCart
@RequestMapping(value="/{cartId}", method=GET) @ResponseBody public CartWsDTO getCart(@PathVariable("cartId") java.lang.String cartId, @PathVariable("userId") java.lang.String userId, @RequestParam(defaultValue="DEFAULT") java.lang.String fields)
-
createCartEntry
@RequestMapping(value="/{cartId}/entries", method=POST, consumes={"application/json","application/xml"}) @ResponseBody public CartModificationWsDTO createCartEntry(@PathVariable("cartId") java.lang.String cartId, @PathVariable("userId") java.lang.String userId, @PathVariable java.lang.String baseSiteId, @RequestBody OrderEntryWsDTO entry, @RequestParam(defaultValue="DEFAULT") java.lang.String fields) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException
-
createCart
@RequestMapping(method=POST) @ResponseStatus(CREATED) @ResponseBody public CartWsDTO createCart(@RequestParam(required=false) java.lang.String oldCartId, @RequestParam(required=false) java.lang.String toMergeCartGuid, @PathVariable("userId") java.lang.String userId, @RequestParam(defaultValue="DEFAULT") java.lang.String fields)
-
removeCartEntry
@RequestMapping(value="/{cartId}/entries/{entryNumber}", method=DELETE) @ResponseStatus(OK) public void removeCartEntry(@PathVariable long entryNumber, @PathVariable("cartId") java.lang.String cartId, @PathVariable("userId") java.lang.String userId) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException
-
updateCartEntry
@RequestMapping(value="/{cartId}/entries/{entryNumber}", method=PATCH, consumes={"application/json","application/xml"}) @ResponseBody public CartModificationWsDTO updateCartEntry(@PathVariable java.lang.String baseSiteId, @PathVariable long entryNumber, @RequestBody OrderEntryWsDTO entry, @RequestParam(defaultValue="DEFAULT") java.lang.String fields, @PathVariable("cartId") java.lang.String cartId, @PathVariable("userId") java.lang.String userId) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException
-
mergeCarts
protected CartWsDTO mergeCarts(java.lang.String oldCartId, java.lang.String evaluatedToMergeCartGuid, java.lang.String userId, java.lang.String fields) throws de.hybris.platform.commercewebservicescommons.errors.exceptions.CartException
Merges anonymous cart with given user cart and returns user cart.- Parameters:
oldCartId- the old cart idevaluatedToMergeCartGuid- the evaluated to merge cart guiduserId- the user idfields- the fields- Returns:
- the cart ws DTO
- Throws:
de.hybris.platform.commercewebservicescommons.errors.exceptions.CartException- the cart exception
-
getRestoredCart
protected CartWsDTO getRestoredCart(java.lang.String toMergeCartGuid, java.lang.String userId, java.lang.String fields) throws de.hybris.platform.commercewebservicescommons.errors.exceptions.CartException
Gets restored cart or session cart when oldCartId is not provided.- Parameters:
toMergeCartGuid- the evaluated to merge cart guiduserId- the user idfields- the fields- Returns:
- the restored cart
- Throws:
de.hybris.platform.commercewebservicescommons.errors.exceptions.CartException- the cart exception
-
addCartEntryInternal
protected CartModificationWsDTO addCartEntryInternal(java.lang.String baseSiteId, java.lang.String fields, OrderEntryWsDTO entry, java.lang.Integer cartGroupNo, java.lang.String cartId, java.lang.String userId) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException
-
createCartItemAction
protected CartActionInput createCartItemAction(OrderEntryWsDTO entry, java.lang.String rootBpoCode, java.lang.Integer cartGroupNo, java.lang.String cartId, java.lang.String userId, java.lang.String pickupStore)
Creates aCartActionInputfor aOrderEntryWsDTO.- Parameters:
entry- the cart entryrootBpoCode- the bpo CodecartGroupNo- the group numbercartId- the identifier of the shopping cartuserId- the identifier of the userpickupStore- the identifier of the pickupStore- Returns:
- instance of
CartActionInput
-
setCpiInformation
protected void setCpiInformation(OrderEntryWsDTO entry, CartActionInput cartActionInput)
Sets CPI related information- Parameters:
entry- the order entrycartActionInput- the cart action input
-
setProductCharacteristics
protected void setProductCharacteristics(OrderEntryWsDTO entry, CartActionInput cartActionInput)
Sets PSCV related data from the entry on the cartActionInput- Parameters:
entry- the order entrycartActionInput- the cart action input
-
populateDefaultCartEntryValues
protected void populateDefaultCartEntryValues(OrderEntryWsDTO entry) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException
-
validateIfProductIsInStockInPOS
protected void validateIfProductIsInStockInPOS(java.lang.String baseSiteId, java.lang.String productCode, java.lang.String storeName, java.lang.Long entryNumber)- Parameters:
baseSiteId- the store identifierproductCode- the product identifierstoreName- the store nameentryNumber- the long value for entry
-
initBinder
@InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
-
-