Package com.skava.oms.web
Class OrderController
java.lang.Object
com.skava.oms.web.OrderController
This class defines the controller implementations to handle
the order request.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.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 localeorg.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 validationorg.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 idorg.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.
-
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 identifierversion
- 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 identifierversion
- 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 donepatchObj
- 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 identifierversion
- 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 donearchive
- 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 identifierversion
- 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 identifieruserid
- Indicates the User id for which the request's operationversion
- 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 identifierversion
- 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 creatednoteDTO
- 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 identifierversion
- 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 orderitemId
- id of the order item- Returns:
- It returns the
Binary Response
-