Author: jleroux
Date: Sat Jan 27 04:58:38 2007
New Revision: 500523
URL:
http://svn.apache.org/viewvc?view=rev&rev=500523Log:
A completing patch from Daniel Kunkel "USPS Rate Estimation" (
https://issues.apache.org/jira/browse/OFBIZ-270)
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?view=diff&rev=500523&r1=500522&r2=500523==============================================================================
--- 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 Sat Jan 27 04:58:38 2007
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
+
package org.ofbiz.shipment.thirdparty.usps;
import java.io.ByteArrayOutputStream;
@@ -158,8 +159,8 @@
packageElement.setAttribute("ID", String.valueOf(li.nextIndex() - 1)); // use zero-based index (see examples)
UtilXml.addChildElementValue(packageElement, "Service", serviceCode, requestDocument);
- UtilXml.addChildElementValue(packageElement, "ZipOrigination", originationZip, requestDocument);
- UtilXml.addChildElementValue(packageElement, "ZipDestination", destinationZip, requestDocument);
+ UtilXml.addChildElementValue(packageElement, "ZipOrigination", originationZip.substring(0,5), requestDocument);
+ UtilXml.addChildElementValue(packageElement, "ZipDestination", destinationZip.substring(0,5), requestDocument);
double weightPounds = Math.floor(packageWeight);
double weightOunces = Math.ceil(packageWeight * 16 % 16);
@@ -293,7 +294,7 @@
}
if (result.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_SUCCESS)) {
- productWeight *= ((Double) result.get("convertedValue")).doubleValue();
+ productWeight = ((Double) result.get("convertedValue")).doubleValue();
} else {
Debug.logError("Unsupported weightUom [" + weightUomId + "] for calcPackageWeight running productId " + productId + ", could not find a conversion factor to WT_lb",module);
}
@@ -1349,7 +1350,6 @@
return responseDocument;
}
-
}
class UspsRequestException extends GeneralException {