Class OrderController

java.lang.Object
com.skava.oms.web.OrderController

@RestController @RequestMapping("/orders") public class OrderController extends Object
This class defines the controller implementations to handle the order request.
Author:
Infosys Equinox
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ResponseEntity<OrderDTO>
    createNotes(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, long collectionid, String version, String locale, String orderId, @Valid NoteDTO noteDTO)
    This method is used to create the note to the given order id NoteRequest, collectionId, version and locale
    org.springframework.http.ResponseEntity<OrderDTO>
    createOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, long collectionid, String version, String locale, @Valid OrderDTO orderDTO)
    This method is used to create the order based on given OrderRequest, collectionId, version and locale OrderRequest is validated by various constraints as followed:
    Fulfillment type validation
    Shipping method validation
    Tax validation
    Discount validation
    Math validation
    org.springframework.http.ResponseEntity<OrderDTO>
    deleteOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, long collectionid, String version, String locale, String orderId)
     
    org.springframework.http.ResponseEntity<OrderDTO>
    getOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, long collectionid, String version, String locale, String orderId, boolean archive)
    This method is used to get order by order id
    org.springframework.http.ResponseEntity<Collection<SkuResponse>>
    getSku(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, long collectionid, String userid, String version, String locale, boolean archive)
     
    org.springframework.http.ResponseEntity<OrderDTO>
    patchOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, long collectionid, String version, String locale, String orderId, @Valid OrderPatchDTO patchObj)
    This method is used to patch the modifiable order details based on given request.
    org.springframework.http.ResponseEntity<byte[]>
    returnLabel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, long collectionId, String orderId, String itemId, String version, String locale)
    This API will fetch the return shipping label for the requsted order.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OrderController

      public OrderController()
  • Method Details

    • createOrder

      @PostMapping @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_REG_USER\', \'oms\', #collectionid) || hasRoleForServiceAndCollection(\'ROLE_GUEST\', \'oms\', #collectionid) ||hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER\', \'oms\', #collectionid) ||hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'oms\', #collectionid) ||hasPrivilegeForServiceAndCollection(\'oms/create/order\', \'oms\', #collectionid)") public org.springframework.http.ResponseEntity<OrderDTO> createOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestHeader(value="x-collection-id",required=true) long collectionid, @RequestHeader(value="x-version",required=false) String version, @RequestHeader(value="locale",required=false,defaultValue="en_US") String locale, @RequestBody @Valid @Valid OrderDTO orderDTO)

      This method is used to create the order based on given OrderRequest, collectionId, version and locale OrderRequest is validated by various constraints as followed:
      Fulfillment type validation
      Shipping method validation
      Tax validation
      Discount validation
      Math validation

      Parameters:
      request - Request provides request information for HTTP servlets. Request provides request information for HTTP servlets.
      response - Response provides HTTP-specific functionality in sending a response.
      collectionid - It contains the valid collection identifier of this micro service and requested operation will be performed on this collection identifier
      version - It contains value of the API version.
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      orderDTO - Contains the order which is the request
      Returns:
      It returns the OrderResponse which contains the Order being created
    • patchOrder

      @PatchMapping("/{orderId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_REG_USER\', \'oms\', #collectionid) || hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER\', \'oms\', #collectionid) ||hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'oms\', #collectionid) ||hasPrivilegeForServiceAndCollection(\'oms/update/order\', \'oms\', #collectionid)") public org.springframework.http.ResponseEntity<OrderDTO> patchOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestHeader(value="x-collection-id",required=true) long collectionid, @RequestHeader(value="x-version",required=false) String version, @RequestHeader(value="locale",required=false,defaultValue="en_US") String locale, @PathVariable("orderId") String orderId, @RequestBody @Valid @Valid OrderPatchDTO patchObj)
      This method is used to patch the modifiable order details based on given request.
      Parameters:
      request - Request provides request information for HTTP servlets. Request provides request information for HTTP servlets.
      response - Response provides HTTP-specific functionality in sending a response.
      collectionid - It contains the valid collection identifier of this micro service and requested operation will be performed on this collection identifier
      version - It contains value of the API version.
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      orderId - It refers to unique identifier of order for which the patch request has to be done
      patchObj - Contains the patch request for the order/item
      Returns:
      It returns the OrderResponse.
    • getOrder

      @GetMapping("/{orderId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_REG_USER\', \'oms\', #collectionid) || hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER\', \'oms\', #collectionid) ||hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'oms\', #collectionid) ||hasPrivilegeForServiceAndCollection(\'oms/view/order\', \'oms\', #collectionid)") public org.springframework.http.ResponseEntity<OrderDTO> getOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestHeader(value="x-collection-id",required=true) long collectionid, @RequestHeader(value="x-version",required=false) String version, @RequestHeader(value="locale",required=false,defaultValue="en_US") String locale, @PathVariable("orderId") String orderId, @RequestParam(value="archive",required=false) boolean archive)
      This method is used to get order by order id
      Parameters:
      request - Request provides request information for HTTP servlets.\ Request provides request information for HTTP servlets.
      response - Response provides HTTP-specific functionality in sending a response.
      collectionid - It contains the valid collection identifier of this micro service and requested operation will be performed on this collection identifier
      version - It contains value of the API version.
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      orderId - It refers to unique identifier of order for which the request has to be done
      archive - It decides the Order Data fetched from Primary or Archive
      Returns:
      It returns the OrderDTO.
    • deleteOrder

      @DeleteMapping("/{orderId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_REG_USER\', \'oms\', #collectionid) || hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER\', \'oms\', #collectionid) ||hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'oms\', #collectionid) ||hasPrivilegeForServiceAndCollection(\'oms/delete/order\', \'oms\', #collectionid)") public org.springframework.http.ResponseEntity<OrderDTO> deleteOrder(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestHeader(value="x-collection-id",required=true) long collectionid, @RequestHeader(value="x-version",required=false) String version, @RequestHeader(value="locale",required=false,defaultValue="en_US") String locale, @PathVariable("orderId") String orderId)
      Parameters:
      request - Request provides request information for HTTP servlets. Request provides request information for HTTP servlets.
      response - Response provides HTTP-specific functionality in sending a response.
      collectionid - It contains the valid collection identifier of this micro service and requested operation will be performed on this collection identifier
      version - It contains value of the API version.
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      orderId - Id of the order to be deleted
      Returns:
      It returns the OrderDTO
    • getSku

      @GetMapping("/sku") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_REG_USER\', \'oms\', #collectionid) || hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER\', \'oms\', #collectionid) ||hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'oms\', #collectionid) ||hasPrivilegeForServiceAndCollection(\'oms/view/order\', \'oms\', #collectionid)") public org.springframework.http.ResponseEntity<Collection<SkuResponse>> getSku(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestHeader(value="x-collection-id",required=true) long collectionid, @RequestHeader(value="X-user-id",required=false) String userid, @RequestHeader(value="x-version",required=false) String version, @RequestHeader(value="locale",required=false,defaultValue="en_US") String locale, @RequestParam(value="archive",required=false) boolean archive)
      Parameters:
      request - Request provides request information for HTTP servlets. Request provides request information for HTTP servlets.
      response - Response provides HTTP-specific functionality in sending a response.
      collectionid - It contains the valid collection identifier of this micro service and requested operation will be performed on this collection identifier
      userid - Indicates the User id for which the request's operation
      version - It contains value of the API version.
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      archive - It decides the Order Data fetched from Primary or Archive
      Returns:
      It returns the OrderDTO
    • createNotes

      @PostMapping("/{orderId}/notes") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'oms/create/note\', \'oms\', #collectionid)") public org.springframework.http.ResponseEntity<OrderDTO> createNotes(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestHeader(value="x-collection-id",required=true) long collectionid, @RequestHeader(value="x-version",required=false) String version, @RequestHeader(value="locale",required=false,defaultValue="en_US") String locale, @PathVariable(value="orderId",required=true) String orderId, @RequestBody @Valid @Valid NoteDTO noteDTO)

      This method is used to create the note to the given order id NoteRequest, collectionId, version and locale

      Parameters:
      request - Request provides request information for HTTP servlets. Request provides request information for HTTP servlets.
      response - Response provides HTTP-specific functionality in sending a response.
      collectionid - It contains the valid collection identifier of this micro service and requested operation will be performed on this collection identifier
      version - It contains value of the API version.
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      orderId - Id of the order for which the notes to be created
      noteDTO - contains the NoteDTO input
      Returns:
      It returns the OrderResponse
    • returnLabel

      @GetMapping("/{orderId}/items/{itemId}/returnLabel") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_REG_USER\', \'oms\', #collectionid) || hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER\', \'oms\', #collectionid) ||hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'oms\', #collectionid) ||hasPrivilegeForServiceAndCollection(\'oms/view/order\', \'oms\', #collectionid)") @ResponseBody public org.springframework.http.ResponseEntity<byte[]> returnLabel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @RequestHeader(value="x-collection-id",required=true) long collectionId, @PathVariable("orderId") String orderId, @PathVariable("itemId") String itemId, @RequestHeader(value="x-version",required=false) String version, @RequestHeader(value="locale",required=false,defaultValue="en_US") String locale)
      This API will fetch the return shipping label for the requsted order.
      Parameters:
      request - Request provides request information for HTTP servlets. Request provides request information for HTTP servlets.
      response - Response provides HTTP-specific functionality in sending a response.
      collectionId - It contains the valid collection identifier of this micro service and requested operation will be performed on this collection identifier
      version - It contains value of the API version.
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      orderId - Id of the order
      itemId - id of the order item
      Returns:
      It returns the Binary Response