diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java index b0432ac328..85faca82fc 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java @@ -29,6 +29,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.order.shoppingcart.ShoppingCart; import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceUtil; public class ShippingEstimateWrapper { @@ -94,8 +95,10 @@ public class ShippingEstimateWrapper { shippingMethodTypeId, carrierPartyId, carrierRoleTypeId, shippingCmId, productStoreId, shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal); - Double shippingTotal = (Double) estimateMap.get("shippingTotal"); - shippingEstimates.put(shipMethod, shippingTotal); + if (!ServiceUtil.isError(estimateMap)) { + Double shippingTotal = (Double) estimateMap.get("shippingTotal"); + shippingEstimates.put(shipMethod, shippingTotal); + } } } } diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java index 11841cd9a8..8b6aac7092 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java @@ -181,7 +181,7 @@ public class ShippingEvents { shippingTotal += externalAmt.doubleValue(); } } catch (GeneralException e) { - return ServiceUtil.returnSuccess(standardMessage); + return ServiceUtil.returnError(standardMessage); } // update the initial amount @@ -194,7 +194,7 @@ public class ShippingEvents { shippingTotal += genericAmt.doubleValue(); } } catch (GeneralException e) { - return ServiceUtil.returnSuccess(standardMessage); + return ServiceUtil.returnError(standardMessage); } // return the totals @@ -213,7 +213,7 @@ public class ShippingEvents { Debug.logError(e, "Shipment Service Error", module); throw new GeneralException(); } - if (ServiceUtil.isError(genericEstimate)) { + if (ServiceUtil.isError(genericEstimate) || ServiceUtil.isFailure(genericEstimate)) { Debug.logError(ServiceUtil.getErrorMessage(genericEstimate), module); throw new GeneralException(); } else if (ServiceUtil.isFailure(genericEstimate)) { @@ -256,12 +256,16 @@ public class ShippingEvents { Debug.logError(e, "Shipment Service Error", module); throw new GeneralException(e); } - if (!ServiceUtil.isError(serviceResp)) { - externalShipAmt = (Double) serviceResp.get("shippingEstimateAmount"); - } else { + if (ServiceUtil.isError(serviceResp)) { String errMsg = "Error getting external shipment cost estimate: " + ServiceUtil.getErrorMessage(serviceResp); Debug.logError(errMsg, module); throw new GeneralException(errMsg); + } else if (ServiceUtil.isFailure(serviceResp)) { + String errMsg = "Failure getting external shipment cost estimate: " + ServiceUtil.getErrorMessage(serviceResp); + Debug.logError(errMsg, module); + throw new GeneralException(errMsg); + } else { + externalShipAmt = (Double) serviceResp.get("shippingEstimateAmount"); } } }