You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/02/16 03:52:56 UTC

svn commit: r508287 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

Author: sichen
Date: Thu Feb 15 18:52:55 2007
New Revision: 508287

URL: http://svn.apache.org/viewvc?view=rev&rev=508287
Log:
Changed USPS rate estimate service to use RateV2Request which is now required, at least on the production.shippingapis.com website.

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=508287&r1=508286&r2=508287
==============================================================================
--- 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 Thu Feb 15 18:52:55 2007
@@ -131,7 +131,7 @@
         }
 
         // create the request document
-        Document requestDocument = createUspsRequestDocument("RateRequest");
+        Document requestDocument = createUspsRequestDocument("RateV2Request");
 
         // TODO: 70 lb max is valid for Express, Priority and Parcel only - handle other methods
         double maxWeight = 70;
@@ -177,7 +177,7 @@
         // send the request
         Document responseDocument = null;
         try {
-            responseDocument = sendUspsRequest("Rate", requestDocument);
+            responseDocument = sendUspsRequest("RateV2", requestDocument);
         } catch (UspsRequestException e) {
             Debug.log(e, module);
             return ServiceUtil.returnError("Error sending request for USPS Domestic Rate Calculation service: " + e.getMessage());
@@ -192,7 +192,8 @@
         for (Iterator i = rates.iterator(); i.hasNext();) {
             Element packageElement = (Element) i.next();
             try {
-                double packageAmount = Double.parseDouble(UtilXml.childElementValue(packageElement, "Postage"));
+                Element postageElement = UtilXml.firstChildElement(packageElement, "Postage");
+                double packageAmount = Double.parseDouble(UtilXml.childElementValue(postageElement, "Rate"));
                 estimateAmount += packageAmount;
             } catch (NumberFormatException e) {
                 Debug.log(e, module);