Author: sichen
Date: Fri Dec 7 16:36:02 2007
New Revision: 602282
URL:
http://svn.apache.org/viewvc?rev=602282&view=revLog:
Finally fixed the usps rate estimate: only parcel post can have a Container tag. This is on the USPS web api documentation
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=602282&r1=602281&r2=602282&view=diff==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java Fri Dec 7 16:36:02 2007
@@ -171,13 +171,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);