Order order = orderService.findOrderById(orderId, true);
if (order == null || order instanceof NullOrderImpl) {
throw new IllegalArgumentException("Could not order with id " + orderId);
}
CheckoutResponse response;
try {
response = checkoutService.performCheckout(order);
} catch (CheckoutException e) {
throw new Exception(e);
}
if (response.getOrder().getOrderNumber() == null) {
LOG.error("Order Number for Order ID: " + order.getId() + " is null.");
}
return response.getOrder().getOrderNumber();
}