public ModelAndView submitOrderDelivery(final HttpServletRequest request, final HttpServletResponse response, @Valid CartForm cartForm,
BindingResult result, ModelMap modelMap) throws Exception {
final RequestData requestData = requestUtil.getRequestData(request);
// SANITY CHECK
final Cart currentCart = requestData.getCart();
if (currentCart.getTotalCartItems() == 0) {
return new ModelAndView(new RedirectView(urlService.generateUrl(FoUrls.CART_DETAILS, requestUtil.getRequestData(request))));
}
if (result.hasErrors()) {
return displayOrderDelivery(request, response);
}
if (currentCart.getDeliveryMethods() == null) {
addErrorMessage(request, "DELIVERY");
return displayOrderDelivery(request, response);
}
webManagementService.updateCart(requestData, Long.parseLong(cartForm.getBillingAddressId()), Long.parseLong(cartForm.getShippingAddressId()));