You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2007/01/25 21:41:46 UTC

svn commit: r499957 - in /ofbiz/trunk/applications/product: servicedef/services_shipment_ups.xml src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java

Author: jonesde
Date: Thu Jan 25 12:41:46 2007
New Revision: 499957

URL: http://svn.apache.org/viewvc?view=rev&rev=499957
Log:
Applied patch from Anil Patel to add country code to UPS services; in Jira #OFBIZ-655

Modified:
    ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml?view=diff&rev=499957&r1=499956&r2=499957
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml Thu Jan 25 12:41:46 2007
@@ -76,5 +76,6 @@
         <attribute name="upsRateInquireMode" type="String" mode="IN" optional="true"/>
         <attribute name="upsRateCodeMap" type="Map" mode="OUT" optional="false"/>
         <attribute name="isResidentialAddress" type="String" mode="IN" optional="true"/>
+        <attribute name="shippingCountryCode" type="String" mode="IN" optional="true"/>
     </service>
 </services>

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?view=diff&rev=499957&r1=499956&r2=499957
==============================================================================
--- 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 25 12:41:46 2007
@@ -1843,6 +1843,7 @@
         String shipmentMethodTypeId = (String) context.get("shipmentMethodTypeId");
        // String shippingContactMechId = (String) context.get("shippingContactMechId");
         String shippingPostalCode = (String) context.get("shippingPostalCode");
+        String shippingCountryCode = (String) context.get("shippingCountryCode");
         List shippableItemInfo = (List) context.get("shippableItemInfo");
         Double shippableTotal = (Double) context.get("shippableTotal");
         Double shippableQuantity = (Double) context.get("shippableQuantity");
@@ -1962,6 +1963,10 @@
         Element shiptoElement = UtilXml.addChildElement(shipmentElement, "ShipTo", rateRequestDoc);
         Element shiptoAddrElement = UtilXml.addChildElement(shiptoElement, "Address", rateRequestDoc);
         UtilXml.addChildElementValue(shiptoAddrElement, "PostalCode", shippingPostalCode, rateRequestDoc);
+        if (shippingCountryCode != null && !shippingCountryCode.equals("")) {
+            UtilXml.addChildElementValue(shiptoAddrElement, "CountryCode", "CA", rateRequestDoc);
+        }
+        
         if (isResidentialAddress != null && isResidentialAddress.equals("Y")) {
             UtilXml.addChildElement(shiptoAddrElement, "ResidentialAddress", rateRequestDoc);
         }
@@ -2009,6 +2014,8 @@
         StringBuffer xmlString = new StringBuffer();
         xmlString.append(accessRequestString);
         xmlString.append(rateRequestString);
+        
+        System.err.println(xmlString.toString());
 
         // send the request
         String rateResponseString = null;