@Controller @RequestMapping("/{baseSiteId}") public class OrdersController extends BaseCommerceController
Web Service Controller for the ORDERS resource. Most methods check orders of the user. Methods require authentication and are restricted to https channel.
  • Constructor Details

    • OrdersController

      public OrdersController()
  • Method Details

    • getOrder

      @Secured("ROLE_TRUSTED_CLIENT") @RequestMapping(value="/orders/{code}", method=GET) @Cacheable(value="orderCache", key="T(de.hybris.platform.commercewebservicescommons.cache.CommerceCacheKeyGenerator).generateKey(false,true,\'getOrder\',#code,#fields)") @ResponseBody public OrderWsDTO getOrder(@PathVariable String code, @RequestParam(defaultValue="DEFAULT") String fields)
    • getUserOrders

      @Secured({"ROLE_CUSTOMERGROUP","ROLE_CLIENT","ROLE_TRUSTED_CLIENT","ROLE_CUSTOMERMANAGERGROUP"}) @RequestMapping(value="/users/{userId}/orders/{code}", method=GET) @Cacheable(value="orderCache", key="T(de.hybris.platform.commercewebservicescommons.cache.CommerceCacheKeyGenerator).generateKey(true,true,\'getOrderForUserByCode\',#code,#fields)") @ResponseBody public OrderWsDTO getUserOrders(@PathVariable String code, @RequestParam(defaultValue="DEFAULT") String fields)
    • getUserOrderHistory

      @Secured({"ROLE_CUSTOMERGROUP","ROLE_TRUSTED_CLIENT","ROLE_CUSTOMERMANAGERGROUP"}) @RequestMapping(value="/users/{userId}/orders", method=GET) @ResponseBody public OrderHistoryListWsDTO getUserOrderHistory(@RequestParam(required=false) String statuses, @RequestParam(defaultValue="0") int currentPage, @RequestParam(defaultValue="20") int pageSize, @RequestParam(required=false) String sort, @RequestParam(defaultValue="DEFAULT") String fields, javax.servlet.http.HttpServletResponse response)
    • countUserOrders

      @Secured({"ROLE_CUSTOMERGROUP","ROLE_TRUSTED_CLIENT","ROLE_CUSTOMERMANAGERGROUP"}) @RequestMapping(value="/users/{userId}/orders", method=HEAD) @ResponseBody public void countUserOrders(@RequestParam(required=false) String statuses, javax.servlet.http.HttpServletResponse response)
    • placeOrder

      @Secured({"ROLE_CUSTOMERGROUP","ROLE_CLIENT","ROLE_CUSTOMERMANAGERGROUP","ROLE_TRUSTED_CLIENT"}) @RequestMapping(value="/users/{userId}/orders", method=POST) @ResponseStatus(CREATED) @ResponseBody @SiteChannelRestriction(allowedSiteChannelsProperty="api.compatibility.b2c.channels") public OrderWsDTO placeOrder(@RequestParam String cartId, @RequestParam(defaultValue="DEFAULT") String fields) throws PaymentAuthorizationException, InvalidCartException, NoCheckoutCartException
      Throws:
      PaymentAuthorizationException
      InvalidCartException
      NoCheckoutCartException
    • doCancelOrder

      @Secured({"ROLE_CUSTOMERGROUP","ROLE_TRUSTED_CLIENT","ROLE_CUSTOMERMANAGERGROUP"}) @PostMapping(value="/users/{userId}/orders/{code}/cancellation", produces="application/json", consumes="application/json") @ResponseStatus(OK) public void doCancelOrder(@PathVariable String code, @RequestBody CancellationRequestEntryInputListWsDTO cancellationRequestEntryInputList)
    • validateUserForOrder

      protected void validateUserForOrder(String code)
      Validates if the current user has access to the order
      Parameters:
      code - the order code
      Throws:
      NotFoundException - if current user has no access to the order
    • prepareCancellationRequestData

      protected OrderCancelRequestData prepareCancellationRequestData(String code, CancellationRequestEntryInputListWsDTO cancellationRequestEntryInputList)
      It prepares the OrderCancelRequestData object by taking the order code and a map of order entry and cancel quantity and sets the user
      Parameters:
      code - which we want to request to cancel
      cancellationRequestEntryInputList - map of order entry and cancel quantity
      Returns:
      Populated OrderCancelRequestData
    • mapToOrderCancelEntryData

      protected OrderCancelEntryData mapToOrderCancelEntryData(CancellationRequestEntryInputWsDTO entryInput)