Class CartsController


  • @Controller
    @RequestMapping("/{baseSiteId}/users/{userId}/carts")
    public class CartsController
    extends BaseCommerceController
    • Field Detail

      • PICKUP_STORE_OBJECT_NAME

        public static final java.lang.String PICKUP_STORE_OBJECT_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • CartsController

        public CartsController()
    • Method Detail

      • getCartEntryForNumber

        protected static OrderEntryData getCartEntryForNumber​(CartData cart,
                                                              long number)
      • getCartEntry

        protected static OrderEntryData getCartEntry​(CartData cart,
                                                     java.lang.String productCode,
                                                     java.lang.String pickupStore)
      • getCarts

        @RequestMapping(method=GET)
        @ResponseBody
        public CartListWsDTO getCarts​(@RequestParam(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​(@RequestParam(defaultValue="DEFAULT")
                                 java.lang.String fields)
      • createCart

        @RequestMapping(method=POST)
        @ResponseStatus(CREATED)
        @ResponseBody
        public CartWsDTO createCart​(@RequestParam(required=false)
                                    java.lang.String oldCartId,
                                    @RequestParam(required=false)
                                    java.lang.String toMergeCartGuid,
                                    @RequestParam(defaultValue="DEFAULT")
                                    java.lang.String fields)
      • isUserCart

        protected boolean isUserCart​(java.lang.String toMergeCartGuid)
      • isCartAnonymous

        protected boolean isCartAnonymous​(java.lang.String cartGuid)
      • removeCart

        @RequestMapping(value="/{cartId}",
                        method=DELETE)
        @ResponseStatus(OK)
        public void removeCart()
      • replaceCartGuestUser

        @Secured({"ROLE_CLIENT","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/email",
                        method=PUT)
        @ResponseStatus(OK)
        public void replaceCartGuestUser​(@RequestParam
                                         java.lang.String email)
                                  throws DuplicateUidException
        Throws:
        DuplicateUidException
      • getCartEntries

        @RequestMapping(value="/{cartId}/entries",
                        method=GET)
        @ResponseBody
        public OrderEntryListWsDTO getCartEntries​(@RequestParam(defaultValue="DEFAULT")
                                                  java.lang.String fields)
      • createCartEntry

        @RequestMapping(value="/{cartId}/entries",
                        method=POST)
        @ResponseBody
        public CartModificationWsDTO createCartEntry​(@PathVariable
                                                     java.lang.String baseSiteId,
                                                     @RequestParam
                                                     java.lang.String code,
                                                     @RequestParam(defaultValue="1")
                                                     long qty,
                                                     @RequestParam(required=false)
                                                     java.lang.String pickupStore,
                                                     @RequestParam(defaultValue="DEFAULT")
                                                     java.lang.String fields)
                                              throws CommerceCartModificationException
        Throws:
        CommerceCartModificationException
      • getCartEntry

        @RequestMapping(value="/{cartId}/entries/{entryNumber}",
                        method=GET)
        @ResponseBody
        public OrderEntryWsDTO getCartEntry​(@PathVariable
                                            long entryNumber,
                                            @RequestParam(defaultValue="DEFAULT")
                                            java.lang.String fields)
      • replaceCartEntry

        @RequestMapping(value="/{cartId}/entries/{entryNumber}",
                        method=PUT)
        @ResponseBody
        public CartModificationWsDTO replaceCartEntry​(@PathVariable
                                                      java.lang.String baseSiteId,
                                                      @PathVariable
                                                      long entryNumber,
                                                      @RequestParam
                                                      java.lang.Long qty,
                                                      @RequestParam(required=false)
                                                      java.lang.String pickupStore,
                                                      @RequestParam(defaultValue="DEFAULT")
                                                      java.lang.String fields)
                                               throws CommerceCartModificationException
        Throws:
        CommerceCartModificationException
      • updateCartEntry

        @RequestMapping(value="/{cartId}/entries/{entryNumber}",
                        method=PATCH)
        @ResponseBody
        public CartModificationWsDTO updateCartEntry​(@PathVariable
                                                     java.lang.String baseSiteId,
                                                     @PathVariable
                                                     long entryNumber,
                                                     @RequestParam(required=false)
                                                     java.lang.Long qty,
                                                     @RequestParam(required=false)
                                                     java.lang.String pickupStore,
                                                     @RequestParam(defaultValue="DEFAULT")
                                                     java.lang.String fields)
                                              throws CommerceCartModificationException
        Throws:
        CommerceCartModificationException
      • createCartDeliveryAddress

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_CUSTOMERMANAGERGROUP","ROLE_GUEST","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/addresses/delivery",
                        method=POST)
        @ResponseStatus(CREATED)
        @ResponseBody
        public AddressWsDTO createCartDeliveryAddress​(javax.servlet.http.HttpServletRequest request,
                                                      @RequestParam(defaultValue="DEFAULT")
                                                      java.lang.String fields)
                                               throws NoCheckoutCartException
        Throws:
        NoCheckoutCartException
      • createCartDeliveryAddress

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_CUSTOMERMANAGERGROUP","ROLE_GUEST","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/addresses/delivery",
                        method=POST,
                        consumes={"application/json","application/xml"})
        @ResponseStatus(CREATED)
        @ResponseBody
        public AddressWsDTO createCartDeliveryAddress​(@RequestBody
                                                      AddressWsDTO address,
                                                      @RequestParam(defaultValue="DEFAULT")
                                                      java.lang.String fields)
                                               throws NoCheckoutCartException
        Throws:
        NoCheckoutCartException
      • replaceCartDeliveryAddress

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/addresses/delivery",
                        method=PUT)
        @ResponseStatus(OK)
        public void replaceCartDeliveryAddress​(@RequestParam
                                               java.lang.String addressId)
                                        throws NoCheckoutCartException
        Throws:
        NoCheckoutCartException
      • removeCartDeliveryAddress

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/addresses/delivery",
                        method=DELETE)
        @ResponseStatus(OK)
        public void removeCartDeliveryAddress()
      • getCartDeliveryMode

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/deliverymode",
                        method=GET)
        @ResponseBody
        public DeliveryModeWsDTO getCartDeliveryMode​(@RequestParam(defaultValue="DEFAULT")
                                                     java.lang.String fields)
      • replaceCartDeliveryMode

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/deliverymode",
                        method=PUT)
        @ResponseStatus(OK)
        public void replaceCartDeliveryMode​(@RequestParam(required=true)
                                            java.lang.String deliveryModeId)
                                     throws UnsupportedDeliveryModeException
        Throws:
        UnsupportedDeliveryModeException
      • removeCartDeliveryMode

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/deliverymode",
                        method=DELETE)
        @ResponseStatus(OK)
        public void removeCartDeliveryMode()
      • getCartDeliveryModes

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/deliverymodes",
                        method=GET)
        @ResponseBody
        public DeliveryModeListWsDTO getCartDeliveryModes​(@RequestParam(defaultValue="DEFAULT")
                                                          java.lang.String fields)
      • replaceCartPaymentDetails

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/paymentdetails",
                        method=PUT)
        @ResponseStatus(OK)
        public void replaceCartPaymentDetails​(@RequestParam
                                              java.lang.String paymentDetailsId)
                                       throws InvalidPaymentInfoException
        Throws:
        InvalidPaymentInfoException
      • getCartPromotions

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_CLIENT","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/promotions",
                        method=GET)
        @ResponseBody
        public PromotionResultListWsDTO getCartPromotions​(@RequestParam(required=false,defaultValue="DEFAULT")
                                                          java.lang.String fields)
      • getCartPromotion

        @Secured({"ROLE_CUSTOMERGROUP","ROLE_CLIENT","ROLE_GUEST","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"})
        @RequestMapping(value="/{cartId}/promotions/{promotionId}",
                        method=GET)
        @ResponseBody
        public PromotionResultListWsDTO getCartPromotion​(@PathVariable
                                                         java.lang.String promotionId,
                                                         @RequestParam(defaultValue="DEFAULT")
                                                         java.lang.String fields)
      • getCartVouchers

        @Secured({"ROLE_CLIENT","ROLE_CUSTOMERGROUP","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT","ROLE_GUEST"})
        @RequestMapping(value="/{cartId}/vouchers",
                        method=GET)
        @ResponseBody
        public VoucherListWsDTO getCartVouchers​(@RequestParam(defaultValue="DEFAULT")
                                                java.lang.String fields)
      • validateIfProductIsInStockInPOS

        protected void validateIfProductIsInStockInPOS​(java.lang.String baseSiteId,
                                                       java.lang.String productCode,
                                                       java.lang.String storeName,
                                                       java.lang.Long entryNumber)
      • validateIfProductIsInStockOnline

        protected void validateIfProductIsInStockOnline​(java.lang.String baseSiteId,
                                                        java.lang.String productCode,
                                                        java.lang.Long entryNumber)