Author: jleroux
Date: Fri Jan 21 18:02:56 2011 New Revision: 1061939 URL: http://svn.apache.org/viewvc?rev=1061939&view=rev Log: A patch from Arun Patidar "Some misc issues in ebayStore component." (https://issues.apache.org/jira/browse/OFBIZ-4118) - OFBIZ-4118 Patch to export single product to ebay in ebay store component. Added require attributes in item and call request of export product to ebay after successfully verify item. Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java?rev=1061939&r1=1061938&r2=1061939&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java Fri Jan 21 18:02:56 2011 @@ -87,6 +87,8 @@ import com.ebay.soap.eBLBaseComponents.V import com.ebay.soap.eBLBaseComponents.VerifyAddItemRequestType; import com.ebay.soap.eBLBaseComponents.VerifyAddItemResponseType; import com.ebay.soap.eBLBaseComponents.WarningLevelCodeType; +import com.ebay.soap.eBLBaseComponents.AddItemRequestType; +import com.ebay.soap.eBLBaseComponents.AddItemResponseType; public class EbayEvents { @@ -799,6 +801,7 @@ public class EbayEvents { attributeMapList.put("ShippingServiceCostCurrency", "USD"); attributeMapList.put("ShippingServicePriority", "1"); attributeMapList.put("ShippingType", "Flat"); + attributeMapList.put("ShippingServiceAdditionalCost", amtServiceCost.getValue()); EbayStoreHelper.mappedShippingLocations(requestParams, item, apiContext, request, attributeMapList); @@ -840,6 +843,12 @@ public class EbayEvents { if (UtilValidate.isNotEmpty(requestParams.get("ebayStore1Category")) || UtilValidate.isNotEmpty(requestParams.get("ebayStore2Category"))) { item.setStorefront(storeFront); } + //TODO: set value of country and currency on the basis of request param values + item.setCountry(CountryCodeType.US); + attributeMapList.put("Country", "US"); + item.setCurrency(CurrencyCodeType.USD); + attributeMapList.put("Currency", "USD"); + if (UtilValidate.isNotEmpty(requestParams.get("requireEbayInventory")) && "Y".equals(requestParams.get("requireEbayInventory").toString())) { GenericValue ebayProductStore = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("EbayProductStoreInventory", UtilMisc.toMap("productStoreId", productStoreId, "productId", productId)))); if (UtilValidate.isNotEmpty(ebayProductStore)) { @@ -938,7 +947,7 @@ public class EbayEvents { return "success"; } - public static String verifyItemBeforeAdd(HttpServletRequest request, HttpServletResponse response) { + public static String verifyItemBeforeAddAndExportToEbay(HttpServletRequest request, HttpServletResponse response) { Delegator delegator = (Delegator) request.getAttribute("delegator"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Map<String,Object> requestParams = UtilHttp.getParameterMap(request); @@ -951,6 +960,8 @@ public class EbayEvents { ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); VerifyAddItemRequestType req = new VerifyAddItemRequestType(); VerifyAddItemResponseType resp = null; + AddItemResponseType addItemResp = null; + VerifyAddItemCall verifyCall = new VerifyAddItemCall(apiContext); Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); @@ -978,6 +989,10 @@ public class EbayEvents { double dfee = fee.getFee().getValue(); feesummary = feesummary + dfee; } + //if item is verified then export it to ebay + AddItemRequestType addItemReq = new AddItemRequestType(); + addItemReq.setItem(item); + addItemResp = (AddItemResponseType) addItemCall.execute(addItemReq); } else { EbayStoreHelper.createErrorLogMessage(userLogin, dispatcher, productStoreId, resp.getAck().toString(), "Verify Item : verifyItemBeforeAdd", resp.getErrors(0).getLongMessage()); } Modified: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml?rev=1061939&r1=1061938&r2=1061939&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Fri Jan 21 18:02:56 2011 @@ -302,10 +302,10 @@ <response name="success" type="view" value="prepareProductListing"/> <response name="error" type="view" value="exportProductListing"/> </request-map> - <request-map uri="verifyItem"> + <request-map uri="verifyItemBeforeAddAndExportToEbay"> <security https="true" auth="true"/> - <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="verifyItemBeforeAdd"/> - <response name="success" type="view" value="prepareProductListing"/> + <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="verifyItemBeforeAddAndExportToEbay"/> + <response name="success" type="request" value="clearExpListing"/> <response name="error" type="view" value="exportProductListing"/> </request-map> <request-map uri="exportListingToEbay"> Modified: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl?rev=1061939&r1=1061938&r2=1061939&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl (original) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl Fri Jan 21 18:02:56 2011 @@ -254,7 +254,7 @@ under the License. <a href="#" onclick="javascript:document.ProductsExportToEbay.action='<@ofbizUrl>updateProductExportDetail</@ofbizUrl>';document.ProductsExportToEbay.submit();" class="buttontext">${uiLabelMap.CommonSave}</a> <#-- request.setAttribute("isSaved")--> <#if isSaved?exists && isSaved=="Y"> - <a href="#" class="buttontext" onclick="javascript:document.ProductsExportToEbay.action='<@ofbizUrl>verifyItem</@ofbizUrl>';document.ProductsExportToEbay.submit();">Verifly Item</a> + <a href="#" class="buttontext" onclick="javascript:document.ProductsExportToEbay.action='<@ofbizUrl>verifyItemBeforeAddAndExportToEbay</@ofbizUrl>';document.ProductsExportToEbay.submit();">Verifly Item</a> </#if> <a href="#" class="buttontext" onclick="javascript:document.ProductsExportToEbay.action='<@ofbizUrl>removeProductFromListing</@ofbizUrl>';document.ProductsExportToEbay.submit();">Remove</a> <#--a href="#" class="buttontext">Save and ${uiLabelMap.EbayExportToEbay}</a--> |
Free forum by Nabble | Edit this page |