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 85faca82fc..c2cd30d929 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java @@ -49,6 +49,7 @@ public class ShippingEstimateWrapper { protected double shippableQuantity = 0; protected double shippableWeight = 0; protected double shippableTotal = 0; + protected String partyId = null; public static ShippingEstimateWrapper getWrapper(LocalDispatcher dispatcher, ShoppingCart cart, int shipGroup) { return new ShippingEstimateWrapper(dispatcher, cart, shipGroup); @@ -66,6 +67,7 @@ public class ShippingEstimateWrapper { this.shippableTotal = cart.getShippableTotal(shipGroup); this.shippingAddress = cart.getShippingAddress(shipGroup); this.productStoreId = cart.getProductStoreId(); + this.partyId = cart.getPartyId(); this.loadShippingMethods(); this.loadEstimates(); @@ -93,7 +95,7 @@ public class ShippingEstimateWrapper { Map estimateMap = ShippingEvents.getShipGroupEstimate(dispatcher, delegator, "SALES_ORDER", shippingMethodTypeId, carrierPartyId, carrierRoleTypeId, shippingCmId, productStoreId, - shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal); + shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal, partyId); if (!ServiceUtil.isError(estimateMap)) { Double shippingTotal = (Double) estimateMap.get("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 8b6aac7092..b0263201aa 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java @@ -88,7 +88,7 @@ public class ShippingEvents { return getShipGroupEstimate(dispatcher, delegator, cart.getOrderType(), shipmentMethodTypeId, carrierPartyId, null, cart.getShippingContactMechId(groupNo), cart.getProductStoreId(), cart.getShippableItemInfo(groupNo), - cart.getShippableWeight(groupNo), cart.getShippableQuantity(groupNo), cart.getShippableTotal(groupNo)); + cart.getShippableWeight(groupNo), cart.getShippableQuantity(groupNo), cart.getShippableTotal(groupNo), cart.getPartyId()); } public static Map getShipEstimate(LocalDispatcher dispatcher, GenericDelegator delegator, OrderReadHelper orh, String shipGroupSeqId) { @@ -108,17 +108,22 @@ public class ShippingEvents { if (shipAddr == null) { return UtilMisc.toMap("shippingTotal", new Double(0)); } - + String contactMechId = shipAddr.getString("contactMechId"); + String partyId = null; + GenericValue partyObject = orh.getPlacingParty(); + if (UtilValidate.isNotEmpty(partyObject)) { + partyId = partyObject.getString("partyId"); + } return getShipGroupEstimate(dispatcher, delegator, orh.getOrderTypeId(), shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId, contactMechId, orh.getProductStoreId(), orh.getShippableItemInfo(shipGroupSeqId), orh.getShippableWeight(shipGroupSeqId).doubleValue(), - orh.getShippableQuantity(shipGroupSeqId).doubleValue(), orh.getShippableTotal(shipGroupSeqId).doubleValue()); + orh.getShippableQuantity(shipGroupSeqId).doubleValue(), orh.getShippableTotal(shipGroupSeqId).doubleValue(), partyId); } public static Map getShipGroupEstimate(LocalDispatcher dispatcher, GenericDelegator delegator, String orderTypeId, String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String shippingContactMechId, String productStoreId, List itemInfo, double shippableWeight, double shippableQuantity, - double shippableTotal) { + double shippableTotal, String partyId) { String standardMessage = "A problem occurred calculating shipping. Fees will be calculated offline."; List errorMessageList = new ArrayList(); @@ -173,6 +178,7 @@ public class ShippingEvents { serviceFields.put("carrierPartyId", carrierPartyId); serviceFields.put("shipmentMethodTypeId", shipmentMethodTypeId); serviceFields.put("shippingContactMechId", shippingContactMechId); + serviceFields.put("partyId", partyId); // call the external shipping service try { diff --git a/applications/product/servicedef/services_shipment.xml b/applications/product/servicedef/services_shipment.xml index d107034440..f62a30ebc9 100644 --- a/applications/product/servicedef/services_shipment.xml +++ b/applications/product/servicedef/services_shipment.xml @@ -642,6 +642,7 @@ under the License. +