svn commit: r784130 - in /ofbiz/trunk/applications: order/config/ order/script/org/ofbiz/order/order/ order/servicedef/ order/webapp/ordermgr/WEB-INF/ order/webapp/ordermgr/WEB-INF/actions/order/ order/webapp/ordermgr/order/ product/config/ product/ser...

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

svn commit: r784130 - in /ofbiz/trunk/applications: order/config/ order/script/org/ofbiz/order/order/ order/servicedef/ order/webapp/ordermgr/WEB-INF/ order/webapp/ordermgr/WEB-INF/actions/order/ order/webapp/ordermgr/order/ product/config/ product/ser...

ashish-18
Author: ashish
Date: Fri Jun 12 14:21:56 2009
New Revision: 784130

URL: http://svn.apache.org/viewvc?rev=784130&view=rev
Log:
Applied patch from jira issue OFBIZ-2548 (When shipment is put on hold from Packing screen then show online shipping estimates on order details page for UPS)
Thanks Divesh, Pranay for your contribution.

Modified:
    ofbiz/trunk/applications/order/config/OrderUiLabels.xml
    ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
    ofbiz/trunk/applications/product/config/shipment.properties
    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/order/config/OrderUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Fri Jun 12 14:21:56 2009
@@ -4574,6 +4574,9 @@
         <value xml:lang="it">Di venerdì</value>
         <value xml:lang="th">ภายในวันศุกร์</value>
     </property>
+    <property key="OrderOnlineUPSShippingEstimates">
+        <value xml:lang="en">Online UPS Shipping estimates based on weight and dimensions of packages</value>
+    </property>
     <property key="OrderOnOrder">
         <value xml:lang="de">Auf Auftrag</value>
         <value xml:lang="en">On Order</value>

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Fri Jun 12 14:21:56 2009
@@ -1285,5 +1285,55 @@
             </iterate>
         </iterate>
     </simple-method>
-
+    
+    <simple-method  method-name="updateShippingMethodAndCharges" short-description="Updates shipping method and shipping charges from Order View page when Shipment is in picked status and items of Order are packed">
+         <!-- splitting shipmentMethodAndAmount request parameter value that contains "*" symbol
+             into "shipmentMethod" and "newAmount".
+        -->
+         <!-- shipmentMethod request parameter value contains "@" symbol
+             between "shipmentMethodTypeId" and "carrierPartyId".This will be splitted in updateOrderItemShipGroup method
+        -->
+        
+        <call-bsh><![CDATA[
+            shipmentMethodAndAmount = parameters.get("shipmentMethodAndAmount");
+            if (shipmentMethodAndAmount != null) {
+               parameters.put("shipmentMethod", shipmentMethodAndAmount.substring(0, shipmentMethodAndAmount.indexOf("*")));
+               parameters.put("amount", shipmentMethodAndAmount.substring(shipmentMethodAndAmount.indexOf("*")+1));
+               parameters.put("shipmentMethodTypeId", shipmentMethodAndAmount.substring(0, shipmentMethodAndAmount.indexOf("@")));
+            }
+        ]]></call-bsh>
+        <set field="newAmount" from-field="parameters.amount" type="BigDecimal"/>
+        <set field="shippingAmount" from-field="parameters.shippingAmount" type="BigDecimal"/>
+        <property-to-field field="percentAllowed" resource="shipment" property="shipment.default.cost_actual_over_estimated_percent_allowed"/>
+        <if-compare-field field="newAmount" operator="greater" to-field="shippingAmount" type="BigDecimal">
+            <set field="diffPercentage" value="${(newAmount - shippingAmount/shippingAmount)*100}" type="BigDecimal"/>
+        <else>
+            <set field="diffPercentage" value="${(shippingAmount - newAmount/newAmount)*100}" type="BigDecimal"/>
+        </else>
+        </if-compare-field>
+        <if-compare-field field="diffPercentage" operator="greater" to-field="percentAllowed" type="BigDecimal">
+            <set-service-fields map="parameters" to-map="updateOrderItemShipGroupContext" service-name="updateOrderItemShipGroup"/>
+            <call-service service-name="updateOrderItemShipGroup" in-map-name="updateOrderItemShipGroupContext"/>
+            <set-service-fields map="parameters" to-map="updateOrderAdjustmentContext" service-name="updateOrderAdjustment"/>
+            <call-service service-name="updateOrderAdjustment" in-map-name="updateOrderAdjustmentContext"/>
+            <set-service-fields map="parameters" to-map="updateShipmentRouteSegmentContext" service-name="updateShipmentRouteSegment"/>
+            <clear-field field="updateShipmentRouteSegmentContext.trackingIdNumber"/>
+            <clear-field field="updateShipmentRouteSegmentContext.trackingDigest"/>
+            <clear-field field="updateShipmentRouteSegmentContext.carrierServiceStatusId"/>
+            <call-service service-name="updateShipmentRouteSegment" in-map-name="updateShipmentRouteSegmentContext"/>
+            <set-service-fields map="parameters" to-map="upsShipmentConfirmContext" service-name="upsShipmentConfirm"/>
+            <call-service service-name="upsShipmentConfirm" in-map-name="upsShipmentConfirmContext"/>
+        <else>
+            <set-service-fields map="parameters" to-map="updateOrderItemShipGroupContext" service-name="updateOrderItemShipGroup"/>
+            <call-service service-name="updateOrderItemShipGroup" in-map-name="updateOrderItemShipGroupContext"/>
+            <set-service-fields map="parameters" to-map="updateShipmentRouteSegmentContext" service-name="updateShipmentRouteSegment"/>
+            <clear-field field="updateShipmentRouteSegmentContext.trackingIdNumber"/>
+            <clear-field field="updateShipmentRouteSegmentContext.trackingDigest"/>
+            <clear-field field="updateShipmentRouteSegmentContext.carrierServiceStatusId"/>
+            <call-service service-name="updateShipmentRouteSegment" in-map-name="updateShipmentRouteSegmentContext"/>
+            <set-service-fields map="parameters" to-map="upsShipmentConfirmContext" service-name="upsShipmentConfirm"/>
+            <call-service service-name="upsShipmentConfirm" in-map-name="upsShipmentConfirmContext"/>
+        </else>
+        </if-compare-field>
+    </simple-method>
 </simple-methods>
\ No newline at end of file

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Jun 12 14:21:56 2009
@@ -970,4 +970,18 @@
         <attribute name="orderItemSeqId" type="String" mode="IN" optional="false"/>
         <attribute name="quantityAccepted"  type="BigDecimal" mode="IN" optional="false"/>
     </service>
+    
+    <service name="updateShippingMethodAndCharges" engine="simple"
+            location="component://order/script/org/ofbiz/order/order/OrderServices.xml" invoke="updateShippingMethodAndCharges">
+        <description>Compare order's shipping amount and new shipping amount(based on weight and dimension of packages).If new shipping amount is more then or less than default percentage (defined in shipment.properties) of Order's shipping amount, then shipping method and shipping charges are updated. And if new shipping amount is not more then or less than default percentage (defined in shipment.properties)% of Order's shipping amount then only shipping method is updated.Also updates record in ShipmentRouteSegment entity</description>
+        <attribute name="orderId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipGroupSeqId" type="String" mode="IN" optional="false"/>
+        <attribute name="oldContactMechId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentMethodAndAmount" type="String" mode="IN" optional="false"/>
+        <attribute name="contactMechPurposeTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="orderAdjustmentId" type="String" mode="IN" optional="false"/>
+        <attribute name="shippingAmount" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentRouteSegmentId" type="String" mode="IN" optional="false"/>
+    </service>
 </services>
\ No newline at end of file

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Fri Jun 12 14:21:56 2009
@@ -417,3 +417,48 @@
     orderItem = EntityUtil.getFirst(orderItems);
     context.orderItem = orderItem;
 }
+
+// getting online ship estimates corresponding to this Order from UPS when "Hold" button will be clicked, when user packs from weight package screen.
+// This case comes when order's shipping amount is  more then or less than default percentage (defined in shipment.properties) of online UPS shipping amount.
+
+    condn = EntityCondition.makeCondition([
+                                      EntityCondition.makeCondition("primaryOrderId", EntityOperator.EQUALS, orderId),
+                                      EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "SHIPMENT_PICKED")],
+                                  EntityOperator.AND);
+    shipments = delegator.findList("Shipment", condn, null, null, null, false);
+    if (shipments) {
+        pickedShipmentId = EntityUtil.getFirst(shipments).shipmentId;
+        shipmentRouteSegment = EntityUtil.getFirst(delegator.findList("ShipmentRouteSegment",EntityCondition.makeCondition([shipmentId : pickedShipmentId]), null, null, null, false));
+        context.shipmentRouteSegmentId = shipmentRouteSegment.shipmentRouteSegmentId;
+        context.pickedShipmentId = pickedShipmentId;
+        if (pickedShipmentId && shipmentRouteSegment.trackingIdNumber) {
+            if ("UPS" == shipmentRouteSegment.carrierPartyId) {
+                resultMap = dispatcher.runSync("upsShipmentAlternateRatesEstimate",[productStoreId : productStoreId, shipmentId : pickedShipmentId]);
+                shippingRates = resultMap.shippingRates;
+                shippingRateList = [];
+                shippingRates.each { shippingRate ->
+                    shippingMethodAndRate = [:];
+                    serviceCodes = shippingRate.keySet();
+                    serviceCodes.each { serviceCode ->
+                        carrierShipmentMethod = EntityUtil.getFirst(delegator.findByAnd("CarrierShipmentMethod", [partyId : "UPS", carrierServiceCode : serviceCode]));
+                        shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId;
+                        rate = shippingRate.get(serviceCode);
+                        shipmentMethodDescription = EntityUtil.getFirst(carrierShipmentMethod.getRelated("ShipmentMethodType")).description;
+                        shippingMethodAndRate.shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId;
+                        shippingMethodAndRate.rate = rate;
+                        shippingMethodAndRate.shipmentMethodDescription = shipmentMethodDescription;
+                        shippingRateList.add(shippingMethodAndRate);
+                    }
+               }
+                context.shippingRateList = shippingRateList;
+            }
+        }
+    }
+      
+    // get orderAdjustmentId for SHIPPING_CHARGES
+    orderAdjustments.each { orderAdjustment ->
+        if(orderAdjustment.orderAdjustmentTypeId.equals("SHIPPING_CHARGES")) {
+            orderAdjustmentId = orderAdjustment.orderAdjustmentId;
+        }
+    }
+    context.orderAdjustmentId = orderAdjustmentId;
\ No newline at end of file

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Fri Jun 12 14:21:56 2009
@@ -1527,6 +1527,13 @@
         <response name="success" type="view" value="returnhead"/>
         <response name="error" type="view" value="returnhead"/>
     </request-map>
+    
+    <request-map uri="updateShippingMethodAndCharges">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateShippingMethodAndCharges"/>
+        <response name="success" type="view" value="orderview"/>
+       <response name="error" type="view" value="orderview"/>
+    </request-map>
 
     <!-- Lookup request mappings -->
     <request-map uri="LookupPerson"><security https="true" auth="true"/><response name="success" type="view" value="LookupPerson"/></request-map>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl Fri Jun 12 14:21:56 2009
@@ -279,6 +279,54 @@
             </td>
           </tr>
         </#if>
+        
+        <#-- This section appears when Shipment of order is in picked status and its items are packed,this case comes when new shipping estimates based on weight of packages are more than or less than default percentage (defined in shipment.properties) of original shipping estimate-->
+        <#-- getShipGroupEstimate method of ShippingEvents class can be used for get shipping estimate from system, on the basis of new package's weight -->
+        <#if shippingRateList?has_content>
+          <#if orderReadHelper.getOrderTypeId() != "PURCHASE_ORDER">
+            <tr><td colspan="3"><hr/></td></tr>
+            <tr>
+              <td colspan="3">
+                <table>
+                  <tr>
+                    <td>
+                      <span class="label">&nbsp;${uiLabelMap.OrderOnlineUPSShippingEstimates}</span>
+                    </td>
+                  </tr>
+                  <form name="UpdateShippingMethod" method="post" action="<@ofbizUrl>updateShippingMethodAndCharges</@ofbizUrl>">
+                    <#list shippingRateList as shippingRate>
+                      <tr>
+                        <td>
+                          <#assign shipmentMethodAndAmount = shippingRate.shipmentMethodTypeId + "@" + "UPS" + "*" + shippingRate.rate>
+                          <input type='radio' name='shipmentMethodAndAmount' value='${shipmentMethodAndAmount?if_exists}'>
+                          UPS&nbsp;${shippingRate.shipmentMethodDescription?if_exists}
+                          <#if (shippingRate.rate > -1)>
+                            <@ofbizCurrency amount=shippingRate.rate isoCode=orderReadHelper.getCurrency()/>
+                          <#else>
+                            ${uiLabelMap.OrderCalculatedOffline}
+                          </#if>
+                        </td>
+                      </tr>
+                    </#list>
+                    <input type="hidden" name="shipmentRouteSegmentId" value="${shipmentRouteSegmentId?if_exists}"/>
+                    <input type="hidden" name="shipmentId" value="${pickedShipmentId?if_exists}"/>
+                    <input type="hidden" name="orderAdjustmentId" value="${orderAdjustmentId?if_exists}"/>
+                    <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
+                    <input type="hidden" name="shipGroupSeqId" value="${shipGroup.shipGroupSeqId?if_exists}"/>
+                    <input type="hidden" name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+                    <input type="hidden" name="oldContactMechId" value="${shipGroup.contactMechId?if_exists}"/>
+                    <input type="hidden" name="shippingAmount" value="${shippingAmount?if_exists}"/>
+                    <tr>
+                      <td valign="top" width="80%">
+                        <input type="submit" value="${uiLabelMap.CommonUpdate}" class="smallSubmit"/>
+                      </td>
+                    </tr>
+                  </form>
+                </table>
+              </td>
+            </tr>
+          </#if>
+        </#if>
 
         <#-- tracking number -->
         <#if shipGroup.trackingNumber?has_content || orderShipmentInfoSummaryList?has_content>

Modified: ofbiz/trunk/applications/product/config/shipment.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/shipment.properties?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/shipment.properties (original)
+++ ofbiz/trunk/applications/product/config/shipment.properties Fri Jun 12 14:21:56 2009
@@ -41,7 +41,7 @@
 ############################################
 
 # UPS configuration indicator
-shipment.ups.shipping="N"
+shipment.ups.shipping=N
 
 # UPS Connection URL & timeout in seconds
 shipment.ups.connect.url=https://wwwcie.ups.com/ups.app/xml
@@ -76,6 +76,17 @@
 # 20 - Air Service Center
 shipment.ups.shipper.pickup.type=06
 
+# Customer Classification
+# Valid Values are
+# 01 - Wholesale
+# 03 - Occasional
+# 04 - Retail
+# The default value is "01"(wholesale) when Pick Type code is "01"(daily pickup)
+# The default value is "03"(occasional) when Pick Type code is "06"(One Time Pickup),
+# "07"(On Call Air Pickup), "19"(Letter Center), "20"(Air Service Center)
+# The default value is "04"(Retail) when Pick Type code is "03"(Customer Counter)
+shipment.ups.customerclassification=03
+
 # Estimate split into packages
 # This number is used as the max weight per package
 # when the total weight is > than this weight the

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?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml Fri Jun 12 14:21:56 2009
@@ -100,5 +100,15 @@
         <attribute name="postalCode" type="String" mode="IN" optional="true"/>
         <attribute name="matches" type="List" mode="OUT" optional="true"/>
     </service>
-
+    
+    <service name="upsShipmentAlternateRatesEstimate" engine="java"
+            location="org.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsShipmentAlternateRatesInquiry" auth="false">
+            <description>UPS On-Line rate inquire tool. Supports rate shopping where  upsRateInquireMode is set to 'Shop', and shippingRates
+                will return a List of Maps, of serviceCode -> rate for the shipping methods which are configured in ProductStoreShipmentMeth entity</description>
+        <attribute name="productStoreId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentRouteSegmentId" type="String" mode="IN" optional="true"/>
+        <attribute name="shippingRates" type="List" mode="OUT" optional="false"/>
+    </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?rev=784130&r1=784129&r2=784130&view=diff
==============================================================================
--- 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 Fri Jun 12 14:21:56 2009
@@ -61,6 +61,7 @@
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -2685,6 +2686,384 @@
         }
         return ServiceUtil.returnSuccess(UtilProperties.getMessage("OrderUiLabels", "OrderReturnLabelEmailSuccessful", locale));
     }
+    
+    public static Map<String, Object> upsShipmentAlternateRatesInquiry(DispatchContext dctx, Map<String, ? extends Object> context) {
+        GenericDelegator delegator = dctx.getDelegator();
+        
+        // prepare the data
+        String upsRateInquireMode = (String) context.get("upsRateInquireMode");
+        String shipmentId = (String) context.get("shipmentId");
+        String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId");
+        String rateResponseString = null;
+        String productStoreId = (String) context.get("productStoreId");
+        List<Map<String, Object>> shippingRates = FastList.newInstance();
+        GenericValue shipmentRouteSegment = null;
+        
+        try {
+            if (shipmentRouteSegmentId != null) {
+              
+                shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", false, UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId));
+            } else {
+                List<GenericValue> shipmentRouteSegments = delegator.findList("ShipmentRouteSegment", EntityCondition.makeCondition("shipmentId", EntityOperator.EQUALS, shipmentId), null, null, null, false);
+                shipmentRouteSegment = EntityUtil.getFirst(shipmentRouteSegments);
+            }
+            
+            if (shipmentRouteSegment == null) {
+                return ServiceUtil.returnError("ShipmentRouteSegment not found with shipmentId " + shipmentId);
+            }
+            shipmentRouteSegmentId = shipmentRouteSegment.getString("shipmentRouteSegmentId");
+            
+            if (!"UPS".equals(shipmentRouteSegment.getString("carrierPartyId"))) {
+                return ServiceUtil.returnError("ERROR: The Carrier for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is not UPS.");
+            }
+
+            // Get Origin Info
+            GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress");
+            if (originPostalAddress == null) {
+                return ServiceUtil.returnError("OriginPostalAddress not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
+            }
+            GenericValue originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber");
+            if (originTelecomNumber == null) {
+                return ServiceUtil.returnError("OriginTelecomNumber not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
+            }
+            String originPhoneNumber = originTelecomNumber.getString("areaCode") + originTelecomNumber.getString("contactNumber");
+            // don't put on country code if not specified or is the US country code (UPS wants it this way)
+            if (UtilValidate.isNotEmpty(originTelecomNumber.getString("countryCode")) && !"001".equals(originTelecomNumber.getString("countryCode"))) {
+                originPhoneNumber = originTelecomNumber.getString("countryCode") + originPhoneNumber;
+            }
+            originPhoneNumber = StringUtil.replaceString(originPhoneNumber, "-", "");
+            originPhoneNumber = StringUtil.replaceString(originPhoneNumber, " ", "");
+            // lookup the two letter country code (in the geoCode field)
+            GenericValue originCountryGeo = originPostalAddress.getRelatedOne("CountryGeo");
+            if (originCountryGeo == null) {
+                return ServiceUtil.returnError("OriginCountryGeo not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
+            }
+
+            // Get Dest Info
+            GenericValue destPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress");
+            if (destPostalAddress == null) {
+                return ServiceUtil.returnError("DestPostalAddress not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
+            }
+
+            GenericValue destTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber");
+            if (destTelecomNumber == null) {
+                String missingErrMsg = "DestTelecomNumber not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId;
+                Debug.logError(missingErrMsg, module);
+                // for now we won't require the dest phone number, but is it required?
+                //return ServiceUtil.returnError(missingErrMsg);
+            }
+            String destPhoneNumber = null;
+            if (destTelecomNumber != null) {
+                destPhoneNumber = destTelecomNumber.getString("areaCode") + destTelecomNumber.getString("contactNumber");
+                // don't put on country code if not specified or is the US country code (UPS wants it this way)
+                if (UtilValidate.isNotEmpty(destTelecomNumber.getString("countryCode")) && !"001".equals(destTelecomNumber.getString("countryCode"))) {
+                    destPhoneNumber = destTelecomNumber.getString("countryCode") + destPhoneNumber;
+                }
+                destPhoneNumber = StringUtil.replaceString(destPhoneNumber, "-", "");
+                destPhoneNumber = StringUtil.replaceString(destPhoneNumber, " ", "");
+            }
+
+            // lookup the two letter country code (in the geoCode field)
+            GenericValue destCountryGeo = destPostalAddress.getRelatedOne("CountryGeo");
+            if (destCountryGeo == null) {
+                return ServiceUtil.returnError("DestCountryGeo not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
+            }
+            
+            // grab the pickup type; if none is defined we will assume daily pickup
+            String pickupType = UtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipper.pickup.type", "01");
+         // grab the customer classification; if none is defined we will assume daily pickup
+            String customerClassification = UtilProperties.getPropertyValue("shipment.properties", "shipment.ups.customerclassification", "01");
+            
+            // should be shop to get estimates for all the possible shipping method of UPS
+            upsRateInquireMode = "Shop";
+            
+            // prepare the XML Document
+            Document rateRequestDoc = UtilXml.makeEmptyXmlDocument("RatingServiceSelectionRequest");
+            Element rateRequestElement = rateRequestDoc.getDocumentElement();
+            rateRequestElement.setAttribute("xml:lang", "en-US");
+
+            // XML request header
+            Element requestElement = UtilXml.addChildElement(rateRequestElement, "Request", rateRequestDoc);
+            Element transactionReferenceElement = UtilXml.addChildElement(requestElement, "TransactionReference", rateRequestDoc);
+            UtilXml.addChildElementValue(transactionReferenceElement, "CustomerContext", "Rating and Service", rateRequestDoc);
+            UtilXml.addChildElementValue(transactionReferenceElement, "XpciVersion", "1.0001", rateRequestDoc);
+
+            // RequestAction is always Rate, but RequestOption can be Rate to get a single rate or Shop for all shipping methods
+            UtilXml.addChildElementValue(requestElement, "RequestAction", "Rate", rateRequestDoc);
+            UtilXml.addChildElementValue(requestElement, "RequestOption", upsRateInquireMode, rateRequestDoc);
+
+            // set the pickup type
+            Element pickupElement = UtilXml.addChildElement(rateRequestElement, "PickupType", rateRequestDoc);
+            UtilXml.addChildElementValue(pickupElement, "Code", pickupType, rateRequestDoc);
+            
+            Element customerClassificationElement = UtilXml.addChildElement(rateRequestElement, "CustomerClassification", rateRequestDoc);
+            UtilXml.addChildElementValue(customerClassificationElement, "Code", customerClassification, rateRequestDoc);
+            
+            // shipment info
+            Element shipmentElement = UtilXml.addChildElement(rateRequestElement, "Shipment", rateRequestDoc);
+            Element rateInformationElement = UtilXml.addChildElement(shipmentElement, "RateInformation", rateRequestDoc);
+            Element negotiatedRatesIndicatorElement = UtilXml.addChildElement(rateInformationElement, "NegotiatedRatesIndicator", rateRequestDoc);
+            
+            Element shipperElement = UtilXml.addChildElement(shipmentElement, "Shipper", rateRequestDoc);
+            UtilXml.addChildElementValue(shipperElement, "Name", UtilValidate.isNotEmpty(originPostalAddress.getString("toName")) ? originPostalAddress.getString("toName") : "", rateRequestDoc);
+            UtilXml.addChildElementValue(shipperElement, "AttentionName", UtilValidate.isNotEmpty(originPostalAddress.getString("attnName")) ? originPostalAddress.getString("attnName") : "", rateRequestDoc);
+            UtilXml.addChildElementValue(shipperElement, "PhoneNumber", originPhoneNumber, rateRequestDoc);
+            UtilXml.addChildElementValue(shipperElement, "ShipperNumber", UtilProperties.getPropertyValue("shipment", "shipment.ups.shipper.number"), rateRequestDoc);
+
+            Element shipperAddressElement = UtilXml.addChildElement(shipperElement, "Address", rateRequestDoc);
+            UtilXml.addChildElementValue(shipperAddressElement, "AddressLine1", originPostalAddress.getString("address1"), rateRequestDoc);
+            if (UtilValidate.isNotEmpty(originPostalAddress.getString("address2"))) {
+                UtilXml.addChildElementValue(shipperAddressElement, "AddressLine2", originPostalAddress.getString("address2"), rateRequestDoc);
+            }
+            
+            UtilXml.addChildElementValue(shipperAddressElement, "City", originPostalAddress.getString("city"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipperAddressElement, "StateProvinceCode", originPostalAddress.getString("stateProvinceGeoId"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipperAddressElement, "PostalCode", originPostalAddress.getString("postalCode"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipperAddressElement, "CountryCode", originCountryGeo.getString("geoCode"), rateRequestDoc);
+
+            // Child of Shipment: ShipTo
+            Element shipToElement = UtilXml.addChildElement(shipmentElement, "ShipTo", rateRequestDoc);
+            UtilXml.addChildElementValue(shipToElement, "CompanyName", UtilValidate.isNotEmpty(destPostalAddress.getString("toName")) ? destPostalAddress.getString("toName") : "", rateRequestDoc);
+            UtilXml.addChildElementValue(shipToElement, "AttentionName", UtilValidate.isNotEmpty(destPostalAddress.getString("attnName")) ? destPostalAddress.getString("attnName") : "", rateRequestDoc);
+            if (UtilValidate.isNotEmpty(destPhoneNumber)) {
+                UtilXml.addChildElementValue(shipToElement, "PhoneNumber", destPhoneNumber, rateRequestDoc);
+            }
+            Element shipToAddressElement = UtilXml.addChildElement(shipToElement, "Address", rateRequestDoc);
+            UtilXml.addChildElementValue(shipToAddressElement, "AddressLine1", destPostalAddress.getString("address1"), rateRequestDoc);
+            if (UtilValidate.isNotEmpty(destPostalAddress.getString("address2"))) {
+                UtilXml.addChildElementValue(shipToAddressElement, "AddressLine2", destPostalAddress.getString("address2"), rateRequestDoc);
+            }
+            
+            UtilXml.addChildElementValue(shipToAddressElement, "City", destPostalAddress.getString("city"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipToAddressElement, "StateProvinceCode", destPostalAddress.getString("stateProvinceGeoId"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipToAddressElement, "PostalCode", destPostalAddress.getString("postalCode"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipToAddressElement, "CountryCode", destCountryGeo.getString("geoCode"), rateRequestDoc);
+            if (UtilValidate.isNotEmpty(shipmentRouteSegment.getString("homeDeliveryType"))) {
+                UtilXml.addChildElement(shipToAddressElement, "ResidentialAddress", rateRequestDoc);
+            }
+
+            // Child of Shipment: ShipFrom
+            Element shipFromElement = UtilXml.addChildElement(shipmentElement, "ShipFrom", rateRequestDoc);
+            UtilXml.addChildElementValue(shipFromElement, "CompanyName", UtilValidate.isNotEmpty(originPostalAddress.getString("toName")) ? originPostalAddress.getString("toName") : "", rateRequestDoc);
+            UtilXml.addChildElementValue(shipFromElement, "AttentionName", UtilValidate.isNotEmpty(originPostalAddress.getString("attnName")) ? originPostalAddress.getString("attnName") : "", rateRequestDoc);
+            UtilXml.addChildElementValue(shipFromElement, "PhoneNumber", originPhoneNumber, rateRequestDoc);
+            Element shipFromAddressElement = UtilXml.addChildElement(shipFromElement, "Address", rateRequestDoc);
+            UtilXml.addChildElementValue(shipFromAddressElement, "AddressLine1", originPostalAddress.getString("address1"), rateRequestDoc);
+            if (UtilValidate.isNotEmpty(originPostalAddress.getString("address2"))) {
+                UtilXml.addChildElementValue(shipFromAddressElement, "AddressLine2", originPostalAddress.getString("address2"), rateRequestDoc);
+            }
+            UtilXml.addChildElementValue(shipFromAddressElement, "City", originPostalAddress.getString("city"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipFromAddressElement, "StateProvinceCode", originPostalAddress.getString("stateProvinceGeoId"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipFromAddressElement, "PostalCode", originPostalAddress.getString("postalCode"), rateRequestDoc);
+            UtilXml.addChildElementValue(shipFromAddressElement, "CountryCode", originCountryGeo.getString("geoCode"), rateRequestDoc);
+            
+            List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId"));
+            if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) {
+                return ServiceUtil.returnError("No ShipmentPackageRouteSegs (ie No Packages) found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
+            }
+            for (GenericValue shipmentPackageRouteSeg :shipmentPackageRouteSegs) {
+            
+                GenericValue shipmentPackage = shipmentPackageRouteSeg.getRelatedOne("ShipmentPackage");
+                GenericValue shipmentBoxType = shipmentPackage.getRelatedOne("ShipmentBoxType");
+                List<GenericValue> carrierShipmentBoxTypes = shipmentPackage.getRelated("CarrierShipmentBoxType", UtilMisc.toMap("partyId", "UPS"), null);
+                GenericValue carrierShipmentBoxType = null;
+                if (carrierShipmentBoxTypes.size() > 0) {
+                    carrierShipmentBoxType = carrierShipmentBoxTypes.get(0);
+                }
+
+                Element packageElement = UtilXml.addChildElement(shipmentElement, "Package", rateRequestDoc);
+                Element packagingTypeElement = UtilXml.addChildElement(packageElement, "PackagingType", rateRequestDoc);
+                if (carrierShipmentBoxType != null && carrierShipmentBoxType.get("packagingTypeCode") != null) {
+                    UtilXml.addChildElementValue(packagingTypeElement, "Code", carrierShipmentBoxType.getString("packagingTypeCode"), rateRequestDoc);
+                } else {
+                    // default to "02", plain old Package
+                    UtilXml.addChildElementValue(packagingTypeElement, "Code", "02", rateRequestDoc);
+                 }
+                if (shipmentBoxType != null) {
+                    Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", rateRequestDoc);
+                    Element unitOfMeasurementElement = UtilXml.addChildElement(dimensionsElement, "UnitOfMeasurement", rateRequestDoc);
+                    GenericValue dimensionUom = shipmentBoxType.getRelatedOne("DimensionUom");
+                    if (dimensionUom != null) {
+                        UtilXml.addChildElementValue(unitOfMeasurementElement, "Code", dimensionUom.getString("abbreviation").toUpperCase(), rateRequestDoc);
+                    } else {
+                        UtilXml.addChildElementValue(unitOfMeasurementElement, "Code", "IN", rateRequestDoc);
+                    }
+                    BigDecimal boxLength = shipmentBoxType.getBigDecimal("boxLength");
+                    BigDecimal boxWidth = shipmentBoxType.getBigDecimal("boxWidth");
+                    BigDecimal boxHeight = shipmentBoxType.getBigDecimal("boxHeight");
+                    UtilXml.addChildElementValue(dimensionsElement, "Length", UtilValidate.isNotEmpty(boxLength) ? ""+boxLength.intValue() : "", rateRequestDoc);
+                    UtilXml.addChildElementValue(dimensionsElement, "Width", UtilValidate.isNotEmpty(boxWidth) ? ""+boxWidth.intValue() : "", rateRequestDoc);
+                    UtilXml.addChildElementValue(dimensionsElement, "Height", UtilValidate.isNotEmpty(boxHeight) ? ""+boxHeight.intValue() : "", rateRequestDoc);
+                }
+                else if
+                    (UtilValidate.isNotEmpty(shipmentPackage.get("boxLength")) && UtilValidate.isNotEmpty(shipmentPackage.get("boxWidth")) &&
+                            UtilValidate.isNotEmpty(shipmentPackage.get("boxHeight"))) {
+                        Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", rateRequestDoc);
+                        Element unitOfMeasurementElement = UtilXml.addChildElement(dimensionsElement, "UnitOfMeasurement", rateRequestDoc);
+                        UtilXml.addChildElementValue(unitOfMeasurementElement, "Code", "IN", rateRequestDoc);
+                        BigDecimal length = (BigDecimal) shipmentPackage.get("boxLength");
+                        BigDecimal width = (BigDecimal) shipmentPackage.get("boxWidth");
+                        BigDecimal height = (BigDecimal) shipmentPackage.get("boxHeight");
+                        UtilXml.addChildElementValue(dimensionsElement, "Length", length.setScale(decimals, rounding).toString(), rateRequestDoc);
+                        UtilXml.addChildElementValue(dimensionsElement, "Width", width.setScale(decimals, rounding).toString(), rateRequestDoc);
+                        UtilXml.addChildElementValue(dimensionsElement, "Height", height.setScale(decimals, rounding).toString(), rateRequestDoc);
+                }
+                
+                Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", rateRequestDoc);
+                Element packageWeightUnitOfMeasurementElement = UtilXml.addChildElement(packageElement, "UnitOfMeasurement", rateRequestDoc);
+                String weightUomUps = unitsOfbizToUps.get(shipmentPackage.get("weightUomId"));
+                if (weightUomUps != null) {
+                    UtilXml.addChildElementValue(packageWeightUnitOfMeasurementElement, "Code", weightUomUps, rateRequestDoc);
+                } else {
+                    // might as well default to LBS
+                    UtilXml.addChildElementValue(packageWeightUnitOfMeasurementElement, "Code", "LBS", rateRequestDoc);
+                }
+    
+                if (shipmentPackage.getString("weight") == null) {
+                    return ServiceUtil.returnError("Weight value not found for ShipmentRouteSegment with shipmentId " + shipmentId + ", shipmentRouteSegmentId " + shipmentRouteSegmentId + ", and shipmentPackageSeqId " + shipmentPackage.getString("shipmentPackageSeqId"));
+                }
+                BigDecimal boxWeight = shipmentPackage.getBigDecimal("weight");
+                UtilXml.addChildElementValue(packageWeightElement, "Weight", UtilValidate.isNotEmpty(boxWeight) ? ""+boxWeight.intValue() : "", rateRequestDoc);
+            }
+    
+            // service options
+            UtilXml.addChildElement(shipmentElement, "ShipmentServiceOptions", rateRequestDoc);
+            String rateRequestString = null;
+            try {
+                rateRequestString = UtilXml.writeXmlDocument(rateRequestDoc);
+            } catch (IOException e) {
+                String ioeErrMsg = "Error writing the RatingServiceSelectionRequest XML Document to a String: " + e.toString();
+                Debug.logError(e, ioeErrMsg, module);
+                return ServiceUtil.returnFailure(ioeErrMsg);
+            }
+    
+            // create AccessRequest XML doc
+            Document accessRequestDocument = createAccessRequestDocument("shipment.properties");
+            String accessRequestString = null;
+            try {
+                accessRequestString = UtilXml.writeXmlDocument(accessRequestDocument);
+            } catch (IOException e) {
+                String ioeErrMsg = "Error writing the AccessRequest XML Document to a String: " + e.toString();
+                Debug.logError(e, ioeErrMsg, module);
+                return ServiceUtil.returnFailure(ioeErrMsg);
+            }
+
+            // prepare the access/inquire request string
+            StringBuilder xmlString = new StringBuilder();
+            xmlString.append(accessRequestString);
+            xmlString.append(rateRequestString);
+            if (Debug.verboseOn()) Debug.logVerbose(xmlString.toString(), module);
+            // send the request
+            try {
+                rateResponseString = sendUpsRequest("Rate", xmlString.toString());
+            
+            } catch (UpsConnectException e) {
+                String uceErrMsg = "Error sending UPS request for UPS Service Rate: " + e.toString();
+                Debug.logError(e, uceErrMsg, module);
+                return ServiceUtil.returnFailure(uceErrMsg);
+            }
+            Debug.logVerbose(rateResponseString, module);
+            Document rateResponseDocument = null;
+            try {
+                rateResponseDocument = UtilXml.readXmlDocument(rateResponseString, false);
+            } catch (SAXException e2) {
+                String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
+                Debug.logError(e2, excErrMsg, module);
+                return ServiceUtil.returnFailure(excErrMsg);
+            } catch (ParserConfigurationException e2) {
+                 String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
+                 Debug.logError(e2, excErrMsg, module);
+                 return ServiceUtil.returnFailure(excErrMsg);
+            } catch (IOException e2) {
+                String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
+                Debug.logError(e2, excErrMsg, module);
+                return ServiceUtil.returnFailure(excErrMsg);
+            }
+            Map<String,Object> upsResponse = handleUpsAlternateRatesInquireResponse(rateResponseDocument);
+            Map<String,BigDecimal> upsRateCodeMap = (Map) upsResponse.get("upsRateCodeMap");
+            GenericValue carrierShipmentMethod = null;
+            // Filtering out rates of shipping methods which are not configured in ProductStoreShipmentMeth entity.
+            try {
+                List <GenericValue> productStoreShipmentMethods = delegator.findByAnd("ProductStoreShipmentMethView", UtilMisc.toMap("productStoreId", productStoreId));
+                for (GenericValue productStoreShipmentMethod :productStoreShipmentMethods) {
+                    if ("UPS".equals(productStoreShipmentMethod.get("partyId"))) {
+                        Map<String,Object> thisUpsRateCodeMap = FastMap.newInstance();
+                        carrierShipmentMethod = delegator.findOne("CarrierShipmentMethod", false, UtilMisc.toMap("shipmentMethodTypeId",
+                                productStoreShipmentMethod.getString("shipmentMethodTypeId"), "partyId", productStoreShipmentMethod.getString("partyId"), "roleTypeId", productStoreShipmentMethod.getString("roleTypeId")));
+                        String serviceCode = carrierShipmentMethod.getString("carrierServiceCode");
+                        for (String thisServiceCode : upsRateCodeMap.keySet()) {
+                            if (serviceCode.equals(thisServiceCode)) {
+                                BigDecimal newRate = upsRateCodeMap.get(serviceCode);
+                                thisUpsRateCodeMap.put(serviceCode,newRate);
+                                shippingRates.add(thisUpsRateCodeMap);
+                            }
+                        }
+                    }
+                }
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+            return UtilMisc.toMap(
+                    "shippingRates", shippingRates,
+                    ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+            if (rateResponseString != null) {
+                Debug.logError("Got XML ShipmentAlternateRatesInquiryResponse: " + rateResponseString, module);
+                return ServiceUtil.returnError(UtilMisc.toList(
+                        "Error reading or writing Shipment data for UPS Shipment Alternate Rates Inquiry: " + e.toString(),
+                        "A ShipmentAlternateRatesInquiryResponse was received: " + rateResponseString));
+            } else {
+                return ServiceUtil.returnError("Error reading or writing Shipment data for UPS Shipment Alternate Rates Inquiry: " + e.toString());
+            }
+        }
+    }
+    
+    public static Map<String, Object> handleUpsAlternateRatesInquireResponse(Document rateResponseDocument) {
+        Element rateResponseElement = rateResponseDocument.getDocumentElement();
+
+        // handle Response element info
+        Element responseElement = UtilXml.firstChildElement(rateResponseElement, "Response");
+        String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode");
+        List<Object> errorList = FastList.newInstance();
+        UpsServices.handleErrors(responseElement, errorList);
+        String totalRates = null;
+
+        if ("1".equals(responseStatusCode)) {
+            List<? extends Element> rates = UtilXml.childElementList(rateResponseElement, "RatedShipment");
+            Map<String, BigDecimal> rateMap = FastMap.newInstance();
+            if (rates == null || rates.size() == 0) {
+                return ServiceUtil.returnError("No rates available at this time");
+            } else {
+                for (Element element: rates) {
+                    // get service
+                    Element service = UtilXml.firstChildElement(element, "Service");
+                    String serviceCode = UtilXml.childElementValue(service, "Code");
+
+                    // get negotiated rates
+                    Element negotiatedRates = UtilXml.firstChildElement(element, "NegotiatedRates");
+                    if (negotiatedRates !=null) {
+                        Element netSummaryCharges = UtilXml.firstChildElement(negotiatedRates, "NetSummaryCharges");
+                        Element grandTotal = UtilXml.firstChildElement(netSummaryCharges, "GrandTotal");
+                        totalRates = UtilXml.childElementValue(grandTotal, "MonetaryValue");
+                    }
+                    else {
+                        // get total rates
+                        Element totalCharges = UtilXml.firstChildElement(element, "TotalCharges");
+                        totalRates = UtilXml.childElementValue(totalCharges, "MonetaryValue");
+                    }
+                    rateMap.put(serviceCode, new BigDecimal(totalRates));
+                }
+            }
+            Debug.log("UPS Rate Map : " + rateMap, module);
+            Map<String, Object> resp = ServiceUtil.returnSuccess();
+            resp.put("upsRateCodeMap", rateMap);
+            return resp;
+        } else {
+            errorList.add("Error status code : " + responseStatusCode);
+            return ServiceUtil.returnFailure(errorList);
+        }
+    }
 
 }