@PostMapping("/add") public ResponseEntity<ApiResponse> placeOrder(@RequestParam("token") String token, @RequestParam("sessionId") String sessionId) throws ProductNotExistException, AuthenticationFailException { authenticationService.authenticate(token); int userId = authenticationService.getUser(token).getId(); orderService.placeOrder(userId, sessionId); return new ResponseEntity<ApiResponse>(new ApiResponse(true, "Order has been placed"), HttpStatus.CREATED); }