svn commit: r602283 - /ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r602283 - /ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

sichen
Author: sichen
Date: Fri Dec  7 16:36:12 2007
New Revision: 602283

URL: http://svn.apache.org/viewvc?rev=602283&view=rev
Log:
Finally fixed the usps rate estimate: only parcel post can have a Container tag.  This is on the USPS web api documentation

Modified:
    ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

Modified: ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=602283&r1=602282&r2=602283&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java (original)
+++ ofbiz/branches/release4.0/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java Fri Dec  7 16:36:12 2007
@@ -173,13 +173,17 @@
             UtilXml.addChildElementValue(packageElement, "Pounds", df.format(weightPounds), requestDocument);
             UtilXml.addChildElementValue(packageElement, "Ounces", df.format(weightOunces), requestDocument);
 
-            // TODO: handle other container types, package sizes, and machinabile packages
-            UtilXml.addChildElementValue(packageElement, "Container", "None", requestDocument);
+            // TODO: handle other container types, package sizes, and machinable packages
+            // IMPORTANT: Express or Priority Mail will fail if you supply a Container tag: you will get a message like
+            // Invalid container type. Valid container types for Priority Mail are Flat Rate Envelope and Flat Rate Box.
+            if ("Parcel".equalsIgnoreCase(serviceCode)) {
+                UtilXml.addChildElementValue(packageElement, "Container", "None", requestDocument);
+            }
             UtilXml.addChildElementValue(packageElement, "Size", "Regular", requestDocument);
             UtilXml.addChildElementValue(packageElement, "Machinable", "False", requestDocument);
         }
 
-        // send the request
+        // send the request                                                                รท
         Document responseDocument = null;
         try {
             responseDocument = sendUspsRequest("RateV2", requestDocument);