Author: ashish
Date: Sat May 30 12:58:05 2009 New Revision: 780257 URL: http://svn.apache.org/viewvc?rev=780257&view=rev Log: productStoreId is not required in service definition. It can be fetched from ShoppingCart object. Also remove the redundant code and fetched base price instead of itemSubTotal. Modified: ofbiz/trunk/specialpurpose/googlecheckout/servicedef/services_request.xml ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java Modified: ofbiz/trunk/specialpurpose/googlecheckout/servicedef/services_request.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/servicedef/services_request.xml?rev=780257&r1=780256&r2=780257&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/servicedef/services_request.xml (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/servicedef/services_request.xml Sat May 30 12:58:05 2009 @@ -25,7 +25,6 @@ <service name="sendGoogleCheckoutRequest" engine="java" auth="false" location="org.ofbiz.googlecheckout.GoogleRequestServices" invoke="sendShoppingCartRequest"> <attribute name="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart" mode="IN" optional="false"/> - <attribute name="productStoreId" type="String" mode="IN" optional="false"/> <attribute name="redirect" type="String" mode="OUT" optional="false"/> </service> Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java?rev=780257&r1=780256&r2=780257&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java Sat May 30 12:58:05 2009 @@ -31,6 +31,7 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.service.LocalDispatcher; import org.w3c.dom.Document; @@ -181,18 +182,7 @@ } private static String getProductStoreId(HttpServletRequest request) { - GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); - String websiteId = getWebsiteId(request); - GenericValue website = null; - try { - website = delegator.findOne("WebSite", true, "webSiteId", websiteId); - } catch (GenericEntityException e) { - Debug.logError(e, module); - } - if (website != null) { - return website.getString("productStoreId"); - } - return null; + return ProductStoreWorker.getProductStoreId(request); } private static String getCurrencyUom(HttpServletRequest request) { Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java?rev=780257&r1=780256&r2=780257&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java Sat May 30 12:58:05 2009 @@ -60,8 +60,8 @@ @SuppressWarnings("unchecked") public static Map<String, Object> sendShoppingCartRequest(DispatchContext dctx, Map<String, ? extends Object> context) { - ShoppingCart cart = (ShoppingCart) context.get("shoppingCart"); - String productStoreId = (String) context.get("productStoreId"); + ShoppingCart cart = (ShoppingCart) context.get("shoppingCart"); + String productStoreId = cart.getProductStoreId(); GenericDelegator delegator = dctx.getDelegator(); MerchantInfo mInfo = getMerchantInfo(); if (mInfo == null) { @@ -81,7 +81,7 @@ i.setItemDescription(item.getDescription()); i.setMerchantItemId(item.getProductId()); i.setQuantity(item.getQuantity().intValue()); - i.setUnitPriceAmount(item.getItemSubTotal(new BigDecimal(1)).floatValue()); + i.setUnitPriceAmount(item.getBasePrice().floatValue()); i.setUnitPriceCurrency(cart.getCurrency()); //i.setItemWeight(item.getWeight().floatValue()); // must convert weight to Lb if (!item.taxApplies()) { |
Free forum by Nabble | Edit this page |