private OrderService orderService;
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<OrderStatus> getOrderStatus(@PathVariable String id) {
OrderStatusEvent orderStatusEvent = orderService.requestOrderStatus(new RequestOrderStatusEvent(UUID.fromString(id)));
if (!orderStatusEvent.isEntityFound()) {
return new ResponseEntity<OrderStatus>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<OrderStatus>(
OrderStatus.fromOrderStatusDetails(
orderStatusEvent.getKey(),
orderStatusEvent.getOrderStatus()),
HttpStatus.OK);
}