Author: jleroux
Date: Thu Jan 21 09:59:00 2010
New Revision: 901628
URL:
http://svn.apache.org/viewvc?rev=901628&view=revLog:
A patch from Si Chen "ups rate estimate will not work from non-US warehouses" (
https://issues.apache.org/jira/browse/OFBIZ-3420) - OFBIZ-3420
upsRateEstimate will not work from non-US warehouses because it's not passing the country code of the ship-from address
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=901628&r1=901627&r2=901628&view=diff==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Thu Jan 21 09:59:00 2010
@@ -2094,6 +2094,12 @@
Element shipperElement = UtilXml.addChildElement(shipmentElement, "Shipper", rateRequestDoc);
Element shipperAddrElement = UtilXml.addChildElement(shipperElement, "Address", rateRequestDoc);
UtilXml.addChildElementValue(shipperAddrElement, "PostalCode", shipFromAddress.getString("postalCode"), rateRequestDoc);
+ try {
+ //If the warehouse you are shipping from its located in a country other than US, you need to supply its country code to UPS
+ UtilXml.addChildElementValue(shipperAddrElement, "CountryCode", shipFromAddress.getRelatedOneCache("CountryGeo").getString("geoCode"), rateRequestDoc);
+ } catch (GenericEntityException e) {
+ return ServiceUtil.returnError(e.getMessage());
+ }
// ship-to info - (sub of shipment)
Element shiptoElement = UtilXml.addChildElement(shipmentElement, "ShipTo", rateRequestDoc);
@@ -2159,7 +2165,7 @@
Debug.logError(e, ioeErrMsg, module);
return ServiceUtil.returnFailure(ioeErrMsg);
}
-
+
// prepare the access/inquire request string
StringBuilder xmlString = new StringBuilder();
xmlString.append(accessRequestString);