class OrderServiceImpl implements OrderService {

    @Override
    public Response alterOrder(OrderAlterInfo oai, HttpHeaders headers) {

        UUID oldOrderId = oai.getPreviousOrderId();
        Order oldOrder = orderRepository.findById(oldOrderId);
        if (oldOrder == null) {
            OrderServiceImpl.LOGGER.info("[Order Service][Alter Order] Fail.Order do not exist.");
            return new Response<>(0, "Old Order Does Not Exists", null);
        }
        oldOrder.setStatus(OrderStatus.CANCEL.getCode());
        saveChanges(oldOrder, headers);
        Order newOrder = oai.getNewOrderInfo();
        newOrder.setId(UUID.randomUUID());
        Response cor = create(oai.getNewOrderInfo(), headers);
        if (cor.getStatus() == 1) {
            OrderServiceImpl.LOGGER.info("[Order Service][Alter Order] Success.");
            return new Response<>(1, success, newOrder);
        } else {
            return new Response<>(0, cor.getMsg(), null);
        }
    }

}