Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebay/data/helpdata/HELP_EBAY_main.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebay/data/helpdata/HELP_EBAY_main.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebay/data/helpdata/HELP_EBAY_main.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebay/data/helpdata/HELP_EBAY_main.xml Wed Mar 24 09:23:07 2010 @@ -31,43 +31,43 @@ <title>How to setup OFBiz integration eBay.</title> <orderedlist> <listitem><para>Register with ebay developer site for obtain keys and certificate (eBayExport.devId,eBayExport.appId,eBayExport.cerId and eBayExport.token etc.) at <link xl:href="https://developer.ebay.com/join/">Join with ebay developers</link> </para></listitem> - <listitem> - <para> - After registered it should be following the keys below :# ebay keys example - <orderedlist> - <listitem><para>eBayExport.devID=f3586481-93c7-4aaf-ab87-d383d56b71b1</para></listitem> - <listitem><para>eBayExport.appID=antwebc0f-9bf9-4829-998b-e5e8fb773ac</para></listitem> - <listitem><para>eBayExport.certID=7f363bc0-11d6-489a-a54d-4a44de82f790</para></listitem> - </orderedlist> - # token key generated from ebay account example : - <orderedlist> - <listitem><para>eBayExport.token=AgAAAA**AQAAAA**aAAAAA**Ccn7Sg.....</para></listitem> - </orderedlist> - </para> - </listitem> + <listitem> + <para> + After registered it should be following the keys below :# ebay keys example + <orderedlist> + <listitem><para>eBayExport.devID=f3586481-93c7-4aaf-ab87-d383d56b71b1</para></listitem> + <listitem><para>eBayExport.appID=antwebc0f-9bf9-4829-998b-e5e8fb773ac</para></listitem> + <listitem><para>eBayExport.certID=7f363bc0-11d6-489a-a54d-4a44de82f790</para></listitem> + </orderedlist> + # token key generated from ebay account example : + <orderedlist> + <listitem><para>eBayExport.token=AgAAAA**AQAAAA**aAAAAA**Ccn7Sg.....</para></listitem> + </orderedlist> + </para> + </listitem> <listitem> - <para> - Following file in specialpurpose/ebay/config/eBayExport.properties. You will see Merchant configurations. - For : - eBayExport.xmlGatewayUri : - <orderedlist> - <listitem><para>https://api.sandbox.ebay.com/ws/api.dll (sandbox environment used for testing and develoment )if you want to use for testing should select sandbox enviroment. </para></listitem> - <listitem><para>https://api.ebay.com/ws/api.dll (production environment). </para></listitem> - </orderedlist> - For : eBayExport.siteID : - <orderedlist> - <listitem><para>It was siteId you want to sell products ex: site id (0=US, 101=Italy, ...) obtain from <link xl:href="http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/types/SiteCodeType.html">SiteCodeType</link> - </para></listitem> - </orderedlist> - - </para> - </listitem> + <para> + Following file in specialpurpose/ebay/config/eBayExport.properties. You will see Merchant configurations. + For : + eBayExport.xmlGatewayUri : + <orderedlist> + <listitem><para>https://api.sandbox.ebay.com/ws/api.dll (sandbox environment used for testing and develoment )if you want to use for testing should select sandbox enviroment. </para></listitem> + <listitem><para>https://api.ebay.com/ws/api.dll (production environment). </para></listitem> + </orderedlist> + For : eBayExport.siteID : + <orderedlist> + <listitem><para>It was siteId you want to sell products ex: site id (0=US, 101=Italy, ...) obtain from <link xl:href="http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/types/SiteCodeType.html">SiteCodeType</link> + </para></listitem> + </orderedlist> + + </para> + </listitem> <listitem> - <para> - Go to ebay-->Ebay Configurations screen(see link in the bottom of page) This screen will displayed ebay configurations with each stores. You need to âaddâ or âeditâ the configuration keys you got from ebay for each productstores into this screen. This configuration is for connect to ebay site and export or import data to ebay. - </para> - </listitem> + <para> + Go to ebay-->Ebay Configurations screen(see link in the bottom of page) This screen will displayed ebay configurations with each stores. You need to âaddâ or âeditâ the configuration keys you got from ebay for each productstores into this screen. This configuration is for connect to ebay site and export or import data to ebay. + </para> + </listitem> <listitem><para>Go to ebay-->Export to eBay screen or eBay orders Import then try to test export products and import orders from ebay. </para></listitem> </orderedlist> </section> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Wed Mar 24 09:23:07 2010 @@ -245,7 +245,7 @@ public class ProductsExportToEbay { String listingFormat = ""; if (UtilValidate.isNotEmpty(context.get("listingFormat"))) { - listingFormat = (String) context.get("listingFormat"); + listingFormat = (String) context.get("listingFormat"); UtilXml.addChildElementValue(itemElem, "ListingType", listingFormat, itemDocument); } if (listingFormat.equals("FixedPriceItem")) { Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayAdvancedSearch.ftl Wed Mar 24 09:23:07 2010 @@ -378,7 +378,7 @@ under the License. </#if> <tr> <td align="center" colspan="2"> - <hr/> + <hr /> <a href="javascript:submit($('advToKeywordSearchform'));" class="buttontext">${uiLabelMap.CommonFind}</a> </td> </tr> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayKeywordSearch.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayKeywordSearch.ftl?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayKeywordSearch.ftl (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/EbayKeywordSearch.ftl Wed Mar 24 09:23:07 2010 @@ -77,6 +77,7 @@ under the License. <form method="post" name="products"> <fieldset> <input type="hidden" name="productStoreId" value="${parameters.productStoreId?if_exists}" /> + <input type="hidden" name="SEARCH_CATEGORY_ID" value="${(requestParameters.SEARCH_CATEGORY_ID)?if_exists}" /> <table class="basic-table border-top border-bottom"> <#assign listIndex = lowIndex /> <#assign altRow = false /> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/ebayExportLink.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/ebayExportLink.ftl?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/ebayExportLink.ftl (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebay/webapp/ebay/find/ebayExportLink.ftl Wed Mar 24 09:23:07 2010 @@ -19,7 +19,11 @@ under the License. <script language="JavaScript" type="text/javascript"> function exportToEbay() { - document.products.action="<@ofbizUrl>ProductsExportToEbay</@ofbizUrl>"; + <#if toEbayStore?exists> + document.products.action="<@ofbizUrl>prepareProductListing</@ofbizUrl>"; + <#else> + document.products.action="<@ofbizUrl>ProductsExportToEbay</@ofbizUrl>"; + </#if> document.products.submit(); } </script> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebay/widget/EbayScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebay/widget/EbayScreens.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebay/widget/EbayScreens.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebay/widget/EbayScreens.xml Wed Mar 24 09:23:07 2010 @@ -234,6 +234,7 @@ under the License. <entity-one entity-name="EbayConfig" value-field="ebayConfig"/> <set field="tabButtonItem" value="${groovy:ebayConfig == null?'newEbayConfig' : 'editEbayConfig'}"/> <set field="xmlGatewayUri" value="${groovy:ebayConfig == null?'' : org.ofbiz.base.util.StringUtil.wrapString(ebayConfig.xmlGatewayUri)}"/> + <set field="apiServerUrl" value="${groovy:ebayConfig == null?'' : org.ofbiz.base.util.StringUtil.wrapString(ebayConfig.apiServerUrl)}"/> <set field="token" value="${groovy:ebayConfig == null?'' : org.ofbiz.base.util.StringUtil.wrapString(ebayConfig.token)}"/> <set field="customXml" value="${groovy:ebayConfig == null?'' : org.ofbiz.base.util.StringUtil.wrapString(ebayConfig.customXml)}"/> <!--set field="webSiteId" value="${groovy:ebayConfig == null?parameters.webSiteId : ebayConfig.webSiteId}"/--> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/build.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/build.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/build.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/build.xml Wed Mar 24 09:23:07 2010 @@ -29,7 +29,7 @@ under the License. <property name="name" value="ofbiz-ebaystore"/> <path id="local.class.path"> - <fileset dir="${lib.dir}" includes="*.jar"/> + <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../../framework/base/lib" includes="*.jar"/> <fileset dir="../../framework/base/lib/commons" includes="*.jar"/> <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/> @@ -46,6 +46,6 @@ under the License. <fileset dir="../../applications/product/build/lib" includes="*.jar"/> <fileset dir="../../applications/party/build/lib" includes="*.jar"/> <fileset dir="../../applications/order/build/lib" includes="*.jar"/> - <fileset dir="../../specialpurpose/ebay/build/lib" includes="*.jar"/> + <fileset dir="../../specialpurpose/ebay/build/lib" includes="*.jar"/> </path> </project> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml Wed Mar 24 09:23:07 2010 @@ -190,6 +190,9 @@ <value xml:lang="en">Buy It Now price</value> <value xml:lang="th">ราà¸à¸²à¸ªà¸¸à¸à¸à¸´</value> </property> + <property key="FormFieldTitle_webSiteUrl"> + <value xml:lang="en">Website Url</value> + </property> <property key="eBayOnlineAuction"> <value xml:lang="en">Online Auction</value> </property> @@ -275,4 +278,40 @@ <property key="EbayAutoSendItemDispatchEmail"> <value xml:lang="en">Automatic send item dispatched notification email</value> </property> + <property key="EbayContinueListing"> + <value xml:lang="en">Countinue</value> + </property> + <property key="EbayChangeCategory"> + <value xml:lang="en">Change</value> + </property> + <property key="EbayStoreCategory"> + <value xml:lang="en">eBay Store Category</value> + </property> + <property key="EbaySet"> + <value xml:lang="en">Set</value> + </property> + <property key="EbayUnsold"> + <value xml:lang="en">unsold</value> + </property> + <property key="EbayActive"> + <value xml:lang="en">Active</value> + </property> + <property key="EbayAutoRelistingItems"> + <value xml:lang="en">Auto Relisting Items</value> + </property> + <property key="EbayAutoRelistingItemsDescription"> + <value xml:lang="en">Auto Relisting Items when they are end item.</value> + </property> + <property key="EbayWaitingToShipping"> + <value xml:lang="en">Waiting to shipping</value> + </property> + <property key="EbayListOrderImported"> + <value xml:lang="en">List Orders Imported</value> + </property> + <property key="EbayNoOrderImported"> + <value xml:lang="en">No orders imported found</value> + </property> + <property key="EbayOpenListings"> + <value xml:lang="en">Open Listings</value> + </property> </resource> \ No newline at end of file Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/DemoEbayStoreData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/DemoEbayStoreData.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/DemoEbayStoreData.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/DemoEbayStoreData.xml Wed Mar 24 09:23:07 2010 @@ -51,10 +51,10 @@ <DataResource dataResourceId="EBAY_WIN_BUYER_NOTI" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FTL"/> <ElectronicText dataResourceId="EBAY_WIN_BUYER_NOTI"> <textData><![CDATA[ - <span style="color: rgb(255, 51, 0);"> - Demo : Automatically send a Winning Buyer Notification email to your winning buyer(s) after item has sold. - </span>]]> - </textData> + <span style="color: rgb(255, 51, 0);"> + Demo : Automatically send a Winning Buyer Notification email to your winning buyer(s) after item has sold. + </span>]]> + </textData> </ElectronicText> <Content contentId="EBAY_WIN_BUYER_NOTI" contentTypeId="DOCUMENT" dataResourceId="EBAY_WIN_BUYER_NOTI" ownerContentId="EBAY_WIN_BUYER_NOTI" statusId="CTNT_IN_PROGRESS"/> <ContentRole contentId="EBAY_WIN_BUYER_NOTI" partyId="DemoEbayAccount" roleTypeId="OWNER" fromDate="2010-01-01 00:00:00.000"/> @@ -62,10 +62,10 @@ <DataResource dataResourceId="EBAY_PAY_RECIEVED" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FTL"/> <ElectronicText dataResourceId="EBAY_PAY_RECIEVED"> <textData><![CDATA[ - <span style="color: rgb(255, 51, 0);"> - Demo : Automatically send Payment Received email when payment has been received. - </span>]]> - </textData> + <span style="color: rgb(255, 51, 0);"> + Demo : Automatically send Payment Received email when payment has been received. + </span>]]> + </textData> </ElectronicText> <Content contentId="EBAY_PAY_RECIEVED" contentTypeId="DOCUMENT" dataResourceId="EBAY_PAY_RECIEVED" ownerContentId="EBAY_PAY_RECIEVED" statusId="CTNT_IN_PROGRESS"/> <ContentRole contentId="EBAY_PAY_RECIEVED" partyId="DemoEbayAccount" roleTypeId="OWNER" fromDate="2010-01-01 00:00:00.000"/> @@ -73,10 +73,10 @@ <DataResource dataResourceId="EBAY_FEEBACK_REMIN" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FTL"/> <ElectronicText dataResourceId="EBAY_FEEBACK_REMIN"> <textData><![CDATA[ - <span style="color: rgb(255, 51, 0);"> - Demo : Automatically send a Feedback Reminder email if feedback has not been received. Please choose how many days after shipping you want this email sent. - </span>]]> - </textData> + <span style="color: rgb(255, 51, 0);"> + Demo : Automatically send a Feedback Reminder email if feedback has not been received. Please choose how many days after shipping you want this email sent. + </span>]]> + </textData> </ElectronicText> <Content contentId="EBAY_FEEBACK_REMIN" contentTypeId="DOCUMENT" dataResourceId="EBAY_FEEBACK_REMIN" ownerContentId="EBAY_FEEBACK_REMIN" statusId="CTNT_IN_PROGRESS"/> <ContentRole contentId="EBAY_FEEBACK_REMIN" partyId="DemoEbayAccount" roleTypeId="OWNER" fromDate="2010-01-01 00:00:00.000"/> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/EbayStoreTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/EbayStoreTypeData.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/EbayStoreTypeData.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/EbayStoreTypeData.xml Wed Mar 24 09:23:07 2010 @@ -27,7 +27,7 @@ under the License. <EnumerationType description="Ebay setting auto preferences" enumTypeId="EBAY_AUTO_PREF" hasTable="N" parentTypeId=""/> - <!-- Automation Preference --> + <!-- Automation Preference --> <Enumeration enumId="EBAY_AUTO_DISPUTE1" description="Automatic Dispute not complete" enumTypeId="EBAY_AUTO_PREF"/> <Enumeration enumId="EBAY_AUTO_DISPUTE2" description="Automatic Dispute not pay" enumTypeId="EBAY_AUTO_PREF"/> <Enumeration enumId="EBAY_AUTO_RELISTING" description="Automatic Relisting" enumTypeId="EBAY_AUTO_PREF"/> @@ -38,13 +38,13 @@ under the License. <Enumeration enumId="EBAY_AUTO_ITEM_DISP" description="Automatic send item dispatched email" enumTypeId="EBAY_AUTO_PREF"/> <Enumeration enumId="EBAY_AUTO_BLK_ITEM" description="Automatic block item that out of stock" enumTypeId="EBAY_AUTO_PREF"/> - <!-- Automation email --> - <Enumeration enumId="EBAY_WIN_BUYER_NOTI" description="Automatically send a Winning Buyer Notification email to your winning buyer(s) after item has sold." enumTypeId="PRDS_EMAIL"/> - <Enumeration enumId="EBAY_PAY_RECIEVED" description="Automatically send Payment Received email when payment has been received." enumTypeId="PRDS_EMAIL"/> - <Enumeration enumId="EBAY_FEEBACK_REMIN" description="Automatically send a Feedback Reminder email if feedback has not been received. Please choose how many days after shipping you want this email sent." enumTypeId="PRDS_EMAIL"/> + <!-- Automation email --> + <Enumeration enumId="EBAY_WIN_BUYER_NOTI" description="Automatically send a Winning Buyer Notification email to your winning buyer(s) after item has sold." enumTypeId="PRDS_EMAIL"/> + <Enumeration enumId="EBAY_PAY_RECIEVED" description="Automatically send Payment Received email when payment has been received." enumTypeId="PRDS_EMAIL"/> + <Enumeration enumId="EBAY_FEEBACK_REMIN" description="Automatically send a Feedback Reminder email if feedback has not been received. Please choose how many days after shipping you want this email sent." enumTypeId="PRDS_EMAIL"/> <Enumeration enumId="EBAY_ITEM_DISPATCH" description="Automatic send item dispatched notification email when user mark sold listing as dispatched" enumTypeId="PRDS_EMAIL"/> <!-- Content main for specify Enumeration --> - <Content contentId="EBAY_WIN_BUYER_NOTI" contentTypeId="TEMPLATE" description="Automatically send a Winning Buyer Notification email to your winning buyer(s) after item has sold."/> + <Content contentId="EBAY_WIN_BUYER_NOTI" contentTypeId="TEMPLATE" description="Automatically send a Winning Buyer Notification email to your winning buyer(s) after item has sold."/> <Content contentId="EBAY_PAY_RECIEVED" contentTypeId="TEMPLATE" description="Automatically send Payment Received email when payment has been received."/> <Content contentId="EBAY_FEEBACK_REMIN" contentTypeId="TEMPLATE" description="Automatically send a Feedback Reminder email if feedback has not been received. Please choose how many days after shipping you want this email sent"/> <Content contentId="EBAY_ITEM_DISPATCH" contentTypeId="TEMPLATE" description="Automatic send item dispatched notification email when user mark sold listing as dispatched"/> Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_LeaveFeedback.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_LeaveFeedback.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_LeaveFeedback.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_LeaveFeedback.xml Wed Mar 24 09:23:07 2010 @@ -18,22 +18,22 @@ xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd" xmlns="http://docbook.org/ns/docbook"> <title>EBay Leave Feedback help screen.</title> - <section> - <section> - <para> - This screen have 3 tab button All, bought, sold. "All" = bought and sold, "bought" = this account is buyer, "sold" = this account is seller. - All item in the list can leave message to buyer and seller multi action that mean each item is seperated. If item is bought it have 3 options to select - and then when select "Positive", "Neutral" and "Negative" a rating section appear,add rating to seller, and comment, if select "I'll leave Feedback later" a rating section disappear. - If item is sold it have 2 options to select and then when select "Positive" a comment box appear to add comment text to buyer, if select "I'll leave Feedback later" this comment box will disappear. - </para> - </section> - <section> - <title> - Note : - </title> - <para> - If you don't add comment in text box, leave feedback don't send. - </para> - </section> - </section> + <section> + <section> + <para> + This screen have 3 tab button All, bought, sold. "All" = bought and sold, "bought" = this account is buyer, "sold" = this account is seller. + All item in the list can leave message to buyer and seller multi action that mean each item is seperated. If item is bought it have 3 options to select + and then when select "Positive", "Neutral" and "Negative" a rating section appear,add rating to seller, and comment, if select "I'll leave Feedback later" a rating section disappear. + If item is sold it have 2 options to select and then when select "Positive" a comment box appear to add comment text to buyer, if select "I'll leave Feedback later" this comment box will disappear. + </para> + </section> + <section> + <title> + Note : + </title> + <para> + If you don't add comment in text box, leave feedback don't send. + </para> + </section> + </section> </section> \ No newline at end of file Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/entitydef/entitymodel.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/entitydef/entitymodel.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/entitydef/entitymodel.xml Wed Mar 24 09:23:07 2010 @@ -78,4 +78,38 @@ under the License. <key-map field-name="autoPrefJobId" rel-field-name="jobId"/> </relation> </entity> + <entity entity-name="EbayProductListing" package-name="org.ofbiz.ebay.store" + title="eBay Product Listing"> + <field name="productListingId" type="id-ne"/> + <field name="itemId" type="id-long"/> + <field name="productStoreId" type="id-ne"/> + <field name="productId" type="id-ne"/> + <field name="userLoginId" type="id-long"/> + <field name="statusId" type="id-ne"/> + <field name="listingXml" type="very-long"/> + <field name="startDateTime" type="date-time"/> + <field name="endDateTime" type="date-time"/> + <field name="autoRelisting" type="indicator"/> + <prim-key field="productListingId"/> + <relation type="one" fk-name="EBAY_PRODUCT" rel-entity-name="Product"> + <key-map field-name="productId"/> + </relation> + <relation type="one" fk-name="EBAY_STORE" rel-entity-name="ProductStore"> + <key-map field-name="productStoreId"/> + </relation> + <relation type="one" fk-name="EBAY_STATUS" rel-entity-name="StatusItem"> + <key-map field-name="statusId"/> + </relation> + </entity> + <entity entity-name="EbayProductListingAttribute" package-name="org.ofbiz.ebay.store" + title="eBay Product Listing"> + <field name="productListingId" type="id-ne"/> + <field name="attrName" type="id-long-ne"/> + <field name="attrValue" type="value"/> + <prim-key field="productListingId"/> + <prim-key field="attrName"/> + <relation type="one" fk-name="EBAY_PROD_ATTR" rel-entity-name="EbayProductListing"> + <key-map field-name="productListingId"/> + </relation> + </entity> </entitymodel> \ No newline at end of file Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/servicedef/services.xml?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/servicedef/services.xml (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/servicedef/services.xml Wed Mar 24 09:23:07 2010 @@ -168,6 +168,9 @@ under the License. <attribute name="productStoreId" mode="IN" type="String" optional="false"/> <attribute name="status" mode="IN" type="String" optional="true"/> <attribute name="period" mode="IN" type="String" optional="true"/> + <attribute name="filter" mode="IN" type="String" optional="true"/> + <attribute name="itemId" mode="IN" type="String" optional="true"/> + <attribute name="buyerId" mode="IN" type="String" optional="true"/> <attribute name="soldItems" mode="OUT" type="List" optional="true"/> </service> <!-- ebay inventory --> @@ -378,10 +381,64 @@ under the License. <attribute name="jobId" mode="IN" type="String" optional="false"/> <attribute name="productStoreId" mode="IN" type="String" optional="false"/> </service> + <service name="getEbayStoreCategories" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStore" invoke="getEbayStoreCategories" auth="true"> + <description>Get Ebay Store Category</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"></attribute> + <attribute name="ebayStoreCategoryId" type="String" mode="IN" optional="true"></attribute> + <attribute name="storeCategories" type="List" mode="OUT" optional="false"></attribute> + </service> <service name="autoBlockItemsOutOfStock" engine="java" transaction-timeout="7200" location="org.ofbiz.ebaystore.EbayStoreAutoPreferences" invoke="autoBlockItemsOutOfStock" auth="false"> <description>Automatic service to send item dispatched notification email when user mark sold listing as dispatched</description> <attribute name="jobId" mode="IN" type="String" optional="false"/> <attribute name="productStoreId" mode="IN" type="String" optional="false"/> </service> + <service name="exportProductEachItem" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStoreHelper" invoke="exportProductEachItem" auth="false"> + <description>Export Product Each Item</description> + <attribute name="itemObject" mode="IN" type="Object" optional="false"/> + </service> + <service name="createEbayProductListing" engine="entity-auto" default-entity-name="EbayProductListing" invoke="create" auth="true"> + <auto-attributes include="pk" mode="INOUT" optional="true"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <attribute name="autoRelisting" mode="IN" type="String" optional="false" default-value="N"/> + <attribute name="listingXml" mode="IN" type="String" optional="true" allow-html="any"/> + </service> + <service name="updateEbayProductListing" engine="entity-auto" default-entity-name="EbayProductListing" invoke="update" auth="true" > + <attribute name="productListingId" mode="IN" type="String" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true" /> + <attribute name="listingXml" mode="IN" type="String" optional="true" allow-html="any"/> + </service> + <service name="setEbayProductListingAttribute" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStoreHelper" invoke="setEbayProductListingAttribute" auth="true"> + <attribute name="productListingId" mode="IN" type="String" optional="false"/> + <attribute name="attributeMapList" mode="IN" type="java.util.HashMap" optional="false"/> + </service> + <service name="getMyeBaySelling" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStore" invoke="getMyeBaySelling" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="entriesPerPage" mode="IN" type="String" optional="true"/> + <attribute name="pageNumber" mode="IN" type="String" optional="true"/> + <attribute name="listingType" mode="IN" type="String" optional="true"/> + <attribute name="activeItems" mode="OUT" type="List" optional="true"/> + <attribute name="soldItems" mode="OUT" type="List" optional="true"/> + <attribute name="unsoldItems" mode="OUT" type="List" optional="true"/> + <attribute name="scheduledItems" mode="OUT" type="List" optional="true"/> + <attribute name="activeSize" mode="OUT" type="Integer" optional="true"/> + <attribute name="soldSize" mode="OUT" type="Integer" optional="true"/> + <attribute name="unsoldeSize" mode="OUT" type="Integer" optional="true"/> + <attribute name="scheduledSize" mode="OUT" type="Integer" optional="true"/> + </service> + <service name="autoRelistingItems" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStoreAutoPreferences" invoke="autoRelistingItems" auth="false"> + <description>Automatic service to re-listing items when They are end item</description> + <attribute name="jobId" mode="IN" type="String" optional="false"/> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + </service> + <service name="uploadTrackingInfoBackToEbay" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStoreHelper" invoke="uploadTrackingInfoBackToEbay" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="orderId" type="String" mode="IN" optional="false"/> + </service> </services> \ No newline at end of file Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java?rev=926987&r1=926986&r2=926987&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java (original) +++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java Wed Mar 24 09:23:07 2010 @@ -18,24 +18,72 @@ */ package org.ofbiz.ebaystore; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javolution.util.FastList; import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; -import org.ofbiz.webapp.taglib.ServiceTag; +import org.ofbiz.service.ServiceUtil; + +import com.ebay.sdk.ApiContext; +import com.ebay.sdk.ApiException; +import com.ebay.sdk.SdkException; +import com.ebay.sdk.call.AddItemCall; +import com.ebay.sdk.call.VerifyAddItemCall; +import org.apache.axis.types.URI; +import com.ebay.soap.eBLBaseComponents.AmountType; +import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType; +import com.ebay.soap.eBLBaseComponents.CategoryType; +import com.ebay.soap.eBLBaseComponents.CountryCodeType; +import com.ebay.soap.eBLBaseComponents.CurrencyCodeType; +import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledCodeType; +import com.ebay.soap.eBLBaseComponents.ItemType; +import com.ebay.soap.eBLBaseComponents.ListingTypeCodeType; +import com.ebay.soap.eBLBaseComponents.PictureDetailsType; +import com.ebay.soap.eBLBaseComponents.ReturnPolicyType; +import com.ebay.soap.eBLBaseComponents.ShippingServiceDetailsType; +import com.ebay.soap.eBLBaseComponents.ShippingTypeCodeType; +import com.ebay.soap.eBLBaseComponents.SiteCodeType; +import com.ebay.soap.eBLBaseComponents.VATDetailsType; +import com.ebay.soap.eBLBaseComponents.WarningLevelCodeType; +import com.ebay.soap.eBLBaseComponents.ListingDesignerType; +import com.ebay.soap.eBLBaseComponents.ShippingDetailsType; +import com.ebay.soap.eBLBaseComponents.ShippingServiceOptionsType; +import com.ebay.soap.eBLBaseComponents.VerifyAddItemRequestType; +import com.ebay.soap.eBLBaseComponents.VerifyAddItemResponseType; +import com.ebay.soap.eBLBaseComponents.FeesType; +import com.ebay.soap.eBLBaseComponents.FeeType; +import com.ebay.soap.eBLBaseComponents.InsuranceDetailsType; +import com.ebay.soap.eBLBaseComponents.SalesTaxType; +import com.ebay.soap.eBLBaseComponents.AddItemRequestType; +import com.ebay.soap.eBLBaseComponents.AddItemResponseType; public class EbayEvents { - public static final String module = ServiceTag.class.getName(); + private static final int SHIPPING_SERVICE_ID_LIMIT = 50000; + public static final String module = EbayEvents.class.getName(); + @SuppressWarnings("unchecked") public static String sendLeaveFeedback(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(true); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); @@ -84,4 +132,774 @@ public class EbayEvents { } return "success"; } + /* event to add products to prepare create & export listing */ + @SuppressWarnings("unchecked") + public static String addProductListing(HttpServletRequest request, HttpServletResponse response) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + Map<String,Object> requestParams = UtilHttp.getParameterMap(request); + Locale locale = UtilHttp.getLocale(request); + + if (UtilValidate.isEmpty(requestParams.get("productStoreId"))) { + request.setAttribute("_ERROR_MESSAGE_","Required productStoreId and selected products."); + return "error"; + } + List<String> productIds = (List<String>) requestParams.get("productIds"); + if (UtilValidate.isNotEmpty(requestParams.get("productIds"))) { + productIds = (List<String>) requestParams.get("productIds"); + } else if (UtilValidate.isNotEmpty(requestParams.get("selectResult"))) { + try { + productIds = (List<String>) requestParams.get("selectResult"); + } catch (ClassCastException e) { + if (UtilValidate.isEmpty(productIds)) productIds = FastList.newInstance(); + productIds.add((String) requestParams.get("selectResult")); + } + } else { + request.setAttribute("_ERROR_MESSAGE_","Required productStoreId and selected products."); + return "error"; + } + String productStoreId = (String) requestParams.get("productStoreId"); + + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + //String webSiteUrl = (String) requestParams.get("webSiteUrl"); + String webSiteUrl = "http://demo.ofbiz.org"; + Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); + List<Map<String,Object>> itemObjs = null; + if (UtilValidate.isNotEmpty(addItemObject.get("itemListings"))) { + itemObjs = (List<Map<String,Object>>) addItemObject.get("itemListings"); + } else { + itemObjs = FastList.newInstance(); + } + + if (UtilValidate.isNotEmpty(productIds)) { + try { + // check add new product obj ? to export + for (String productId : productIds) { + for (Map<String,Object> itObj : itemObjs) { + if (UtilValidate.isNotEmpty(itObj.get(productId.concat("_Obj")))) { + productIds.remove(productId); + } + } + } + Debug.log("run in with productIds "+productIds); + for (String productId : productIds) { + AddItemCall addItemCall = new AddItemCall(apiContext); + ItemType item = new ItemType(); + GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); + item.setTitle(product.getString("internalName")); + item.setCurrency(CurrencyCodeType.USD); + String productDescription = ""; + String description = product.getString("description"); + String longDescription = product.getString("longDescription"); + if (UtilValidate.isNotEmpty(description)) { + productDescription = description; + } else if (UtilValidate.isNotEmpty(longDescription)) { + productDescription = longDescription; + } else if (UtilValidate.isNotEmpty(product.getString("productName"))) { + productDescription = product.getString("productName"); + } + item.setDescription(productDescription); + item.setSKU(product.getString("productId")); + item.setApplicationData(product.getString("productId")); + item.setCountry(CountryCodeType.US); + item.setQuantity(new Integer(1)); + String smallImage = product.getString("smallImageUrl"); + String mediumImage = product.getString("mediumImageUrl"); + String largeImage = product.getString("largeImageUrl"); + String ebayImage = null; + if (UtilValidate.isNotEmpty(largeImage)) { + ebayImage = largeImage; + } else if (UtilValidate.isNotEmpty(mediumImage)) { + ebayImage = mediumImage; + } else if (UtilValidate.isNotEmpty(smallImage)) { + ebayImage = smallImage; + } + if (UtilValidate.isNotEmpty(ebayImage)) { + PictureDetailsType pic = new PictureDetailsType(); + String pictureUrl = webSiteUrl + ebayImage; + String[] picURL = new String[1]; + picURL[0] = pictureUrl; + //String[] picURL = {webSiteUrl + ebayImage}; + //pic.setPictureURL(picURL); + pic.setPictureURL(picURL); + item.setPictureDetails(pic); + } + item.setCategoryMappingAllowed(true); + item.setSite(apiContext.getSite()); + addItemCall.setSite(apiContext.getSite()); + addItemCall.setItem(item); + addItemCall.setWarningLevel(WarningLevelCodeType.HIGH); + + Map<String,Object> itemListing = null; + for (Map<String,Object> itemObj : itemObjs) { + if (UtilValidate.isNotEmpty(itemObj.get(productId.concat("_Obj")))) { + itemListing = (Map<String,Object> )itemObj.get(productId.concat("_Obj")); + itemListing.put("addItemCall", addItemCall); + itemListing.put("productId", productId); + break; + } + } + if (UtilValidate.isEmpty(itemListing)) { + itemListing = FastMap.newInstance(); + itemListing.put("addItemCall", addItemCall); + itemListing.put("productId", productId); + itemObjs.add(itemListing); + } + } + addItemObject.put("itemListing", itemObjs); + } catch (Exception e) { + Debug.logError(e.getMessage(), module); + return "error"; + } + } + return "success"; + } + + public static String prepareEbaySiteFacadeObject(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(true); + if (request.getParameter("productStoreId") == null) { + return "error"; + } + ApiContext apiContext = getApiContext(request); + try { + if (UtilValidate.isNotEmpty(apiContext)) { + String siteCode = apiContext.getSite().name(); + if (UtilValidate.isNotEmpty(session.getAttribute("itemListings_".concat(siteCode)))) { + request.setAttribute("productStoreId", request.getParameter("productStoreId")); + return "prepare"; + } + getSiteFacade(apiContext,request); + } else { + request.setAttribute("_ERROR_MESSAGE_","No apiContext for this account or this site please register on ebay or check you user account."); + return "error"; + } + } catch (ApiException e) { + request.setAttribute("_ERROR_MESSAGE_","ApiException ".concat(e.getMessage())); + return "error"; + } catch (SdkException e) { + request.setAttribute("_ERROR_MESSAGE_","SdkException ".concat(e.getMessage())); + return "error"; + } catch (Exception e) { + request.setAttribute("_ERROR_MESSAGE_","Exception ".concat(e.getMessage())); + return "error"; + } + return "success"; + } + + public static EbayStoreSiteFacade getSiteFacade(ApiContext apiContext, HttpServletRequest request) throws ApiException, SdkException, Exception{ + String siteFacadeName = null; + EbayStoreSiteFacade siteFacade = null; + + if (request.getParameter("productStoreId") == null) { + Debug.logError("Required productStoreId for get ebay information.", module); + return siteFacade; + } + + HttpSession session = request.getSession(true); + if (UtilValidate.isNotEmpty(apiContext)) { + siteFacadeName = "siteFacade".concat("_".concat(apiContext.getSite().name())); + } + + if (UtilValidate.isEmpty(session.getAttribute(siteFacadeName))) { + session.setAttribute(siteFacadeName,new EbayStoreSiteFacade(apiContext)); + if (UtilValidate.isNotEmpty(session.getAttribute(siteFacadeName))) { + siteFacade = (EbayStoreSiteFacade)session.getAttribute(siteFacadeName); + } + } else { + siteFacade = (EbayStoreSiteFacade)session.getAttribute(siteFacadeName); + } + Debug.logInfo("loaded session for ebay site Facade is ".concat(siteFacadeName).concat(session.getAttribute(siteFacadeName).toString()),module); + return siteFacade; + } + + public static ApiContext getApiContext(HttpServletRequest request) { + Locale locale = UtilHttp.getLocale(request); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + + if (request.getParameter("productStoreId") == null && request.getAttribute("productStoreId") == null) { + Debug.logError("Required productStoreId for get ebay API config data.", module); + return null; + } + ApiContext apiContext = EbayStoreHelper.getApiContext((String)request.getParameter("productStoreId") != null ? request.getParameter("productStoreId"):(String)request.getAttribute("productStoreId"), locale, delegator); + return apiContext; + } + + public static String clearProductListing(HttpServletRequest request, HttpServletResponse response) { + removeItemListingObject(request, getApiContext(request)); + return "success"; + } + + public static void removeItemListingObject(HttpServletRequest request, ApiContext apiContext) { + HttpSession session = request.getSession(true); + String siteCode = apiContext.getSite().name(); + Map<String,Object> addItemObject = (Map<String,Object>) session.getAttribute("itemListings_".concat(siteCode)); + if (UtilValidate.isNotEmpty(addItemObject)) { + session.removeAttribute("itemListings_".concat(siteCode)); + } + } + + @SuppressWarnings("unchecked") + public static Map<String,Object> getAddItemListingObject(HttpServletRequest request, ApiContext apiContext) { + String siteCode = apiContext.getSite().name(); + Map<String,Object> addItemObject = (Map<String,Object>) request.getAttribute("itemListings_".concat(siteCode)); + HttpSession session = request.getSession(true); + if (addItemObject == null) { + addItemObject = (Map<String,Object>) session.getAttribute("itemListings_".concat(siteCode)); + } else { + session.setAttribute("itemListings_".concat(siteCode), addItemObject); + } + if (addItemObject == null) { + addItemObject = FastMap.newInstance(); + session.setAttribute("itemListings_".concat(siteCode), addItemObject); + } + return addItemObject; + } + + // make ebay category list + @SuppressWarnings("unchecked") + public static List<CategoryType> getChildCategories(HttpServletRequest request) throws ApiException, SdkException, Exception{ + List<CategoryType> categories = FastList.newInstance(); + EbayStoreSiteFacade sf = null; + String categoryId = null; + + if (request.getParameter("productStoreId") == null && request.getAttribute("productStoreId") == null) { + Debug.logError("Required productStoreId for get ebay LeafCategories.", module); + return categories; + } + if (request.getParameter("categoryId") != null || request.getAttribute("categoryId") != null) { + categoryId = (String) request.getParameter("categoryId") != null ? request.getParameter("categoryId") : (String) request.getAttribute("categoryId"); + Debug.logInfo("Load child categories from session following site id and categoryId is ".concat(categoryId), module); + } else { + Debug.logWarning("No categoryId to get child categories.", module); + } + + ApiContext apiContext = getApiContext(request); + sf = getSiteFacade(apiContext,request); + if (UtilValidate.isNotEmpty(sf)) { + Map<SiteCodeType, List<CategoryType>> csCateMaps = sf.getSiteCategoriesCSMap(); + List<CategoryType> csCateList = csCateMaps.get(apiContext.getSite()); + if (UtilValidate.isNotEmpty(csCateList)) { + if (UtilValidate.isNotEmpty(categoryId)) { + // find child of selected ebay categories + for (CategoryType csCate : csCateList) { + String[] categoryParentIds = csCate.getCategoryParentID(); + for (String categoryParentId : categoryParentIds) { + if (categoryId.equals(categoryParentId)) { + categories.add(csCate); + } + } + } + } else { + // find first level of ebay categories + for (CategoryType csCate : csCateList) { + String[] categoryParentIds = csCate.getCategoryParentID(); + for (String categoryParentId : categoryParentIds) { + if (csCate.getCategoryID().equals(categoryParentId)) { + categories.add(csCate); + } + } + } + } + //sort the cats list + Collections.sort(categories, new Comparator() { + public int compare(Object a, Object b) { + CategoryType cat1 = (CategoryType)a; + CategoryType cat2 = (CategoryType)b; + int catId1 = Integer.parseInt(cat1.getCategoryID()); + int catId2 = Integer.parseInt(cat2.getCategoryID()); + return catId1 - catId2; + } + }); + } + } + return categories; + } + + public static CategoryType getCsCategoriesMapped(HttpServletRequest request) throws ApiException, SdkException, Exception{ + EbayStoreSiteFacade sf = null; + String categoryId = null; + CategoryType cate = null; + + if (request.getParameter("productStoreId") == null && request.getAttribute("productStoreId") == null) { + Debug.logError("Required productStoreId for get ebay LeafCategories.", module); + return null; + } + if (request.getParameter("categoryId") != null || request.getAttribute("categoryId") != null) { + categoryId = (String)request.getParameter("categoryId") != null ? request.getParameter("categoryId") : (String)request.getAttribute("categoryId"); + Debug.logInfo("Load child categories from session following site id and categoryId is ".concat(categoryId), module); + } else { + Debug.logWarning("No categoryId to get child categories.", module); + return null; + } + + ApiContext apiContext = getApiContext(request); + sf = getSiteFacade(apiContext,request); + if (UtilValidate.isNotEmpty(sf)) { + Map<SiteCodeType, List<CategoryType>> csCateMaps = sf.getSiteCategoriesCSMap(); + List<CategoryType> csCateList = csCateMaps.get(apiContext.getSite()); + if (UtilValidate.isNotEmpty(csCateList)) { + if (UtilValidate.isNotEmpty(categoryId)) { + // find child of selected ebay categories + for (CategoryType csCate : csCateList) { + if (csCate.getCategoryID().equals(categoryId)) { + cate = csCate; + break; + } + } + } + } + } + return cate; + } + + public static String setSelectedEbayCategory(HttpServletRequest request, HttpServletResponse response) { + Map<String,Object> requestParams = UtilHttp.getParameterMap(request); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + if (UtilValidate.isEmpty(requestParams.get("productStoreId"))) { + request.setAttribute("_ERROR_MESSAGE_","Required productStoreId."); + return "error"; + } + if (UtilValidate.isEmpty(requestParams.get("isProductId"))) { + request.setAttribute("_ERROR_MESSAGE_","Required can not find form Id."); + return "error"; + } + String isProductId = (String) requestParams.get("isProductId"); + if (UtilValidate.isEmpty(requestParams.get("productId")) || UtilValidate.isEmpty(requestParams.get("ebayCategory"))) { + request.setAttribute("_ERROR_MESSAGE_","No ebay category or productId selected with form id ".concat(isProductId)); + return "error"; + } + String categoryId = (String)requestParams.get("ebayCategory"); + if (categoryId.contains("false")) { + request.setAttribute("_ERROR_MESSAGE_","Please select ebay category with low level of categories."); + return "error"; + } else { + if (categoryId.contains("true")) categoryId = categoryId.substring(0,categoryId.indexOf(":")); + } + String productId = (String) requestParams.get("isProductId"); + EbayStoreCategoryFacade cf = null; + EbayStoreSiteFacade sf = null; + // find is exiting product and set category into item in additem call + try { + if (UtilValidate.isNotEmpty(delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)))) { + ApiContext apiContext = getApiContext(request); + Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); + List<Map<String,Object>> addItemlist = (List<Map<String,Object>>) addItemObject.get("itemListing"); + + if (UtilValidate.isNotEmpty(addItemlist)) { + for (Map<String,Object> addItemCall : addItemlist) { + AddItemCall itemCall = (AddItemCall) addItemCall.get("addItemCall"); + ItemType item = itemCall.getItem(); + if (productId.equals(item.getSKU())) { + request.setAttribute("categoryId", categoryId); + CategoryType csCate = getCsCategoriesMapped(request); + if (UtilValidate.isNotEmpty(csCate)) { + Debug.logInfo("Set selected ebay category ".concat(csCate.getCategoryID().toString().concat(csCate.getCategoryName()).concat(String.valueOf((csCate.isLeafCategory())))), module); + item.setPrimaryCategory(csCate); + // get category feature and attributes + sf = getSiteFacade(apiContext, request); + String refName = "itemCateFacade_".concat(csCate.getCategoryID()); + if (UtilValidate.isEmpty(addItemObject.get(refName))) { + cf = new EbayStoreCategoryFacade(csCate.getCategoryID(), apiContext, sf.getAttrMaster(), sf); + addItemObject.put(refName, cf); + } + request.setAttribute("_EVENT_MESSAGE_","Set selected ebay category ".concat(csCate.getCategoryID().toString()).concat(" with product ".concat(productId).concat(" successed."))); + } else { + Debug.logWarning(categoryId.concat(" This category is not leaf category or ?"), module); + } + break; + } + } + } + } + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } catch (ApiException e) { + Debug.logError(e.getMessage(), module); + } catch (SdkException e) { + Debug.logError(e.getMessage(), module); + } catch (Exception e) { + Debug.logError(e.getMessage(), module); + } + request.setAttribute("productStoreId", requestParams.get("productStoreId")); + request.setAttribute("isProductId", productId); + request.removeAttribute("categoryId"); + return "success"; + } + + /* for shipping service detail filter */ + private static boolean isFlat(ShippingTypeCodeType[] st) { + for (int i = 0; i < st.length; i++) { + if (st[i].compareTo(ShippingTypeCodeType.FLAT) == 0) { + return true; + } + } + return false; + } + + public static ShippingServiceDetailsType[] filterShippingService(ShippingServiceDetailsType[] array) { + ArrayList<ShippingServiceDetailsType> list = new ArrayList<ShippingServiceDetailsType>(); + for (int i = 0; i < array.length; i++) { + if (isFlat(array[i].getServiceType()) && array[i].getShippingServiceID() < SHIPPING_SERVICE_ID_LIMIT) { + list.add(array[i]); + } + } + return list.toArray(new ShippingServiceDetailsType[0]); + } + + public static String updateProductExportDetail(HttpServletRequest request, HttpServletResponse response) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + HttpSession session = request.getSession(true); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + Map<String,Object> requestParams = UtilHttp.getParameterMap(request); + Locale locale = UtilHttp.getLocale(request); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + HashMap attributeMapList = new HashMap(); + String id = ""; + if (UtilValidate.isNotEmpty(requestParams.get("listype"))) { + if ("auction".equals(requestParams.get("listype"))) { + id = "_1"; + } else { + id = "_2"; + } + } + String startPrice = ""; + if (UtilValidate.isNotEmpty(requestParams.get("startPrice".concat(id)))) { + startPrice = (String) requestParams.get("startPrice".concat(id)); + } + String buyItNowPrice = ""; + if (UtilValidate.isNotEmpty(requestParams.get("buyItNowPrice".concat(id)))) { + buyItNowPrice = (String) requestParams.get("buyItNowPrice".concat(id)); + } + String productId = null; + if (UtilValidate.isNotEmpty(requestParams.get("productId"))) { + productId = requestParams.get("productId").toString(); + } + + String itemPkCateId = (String) requestParams.get("primaryCateId"); + String shippingService = (String) requestParams.get("ShippingService"); + String productStoreId = (String) requestParams.get("productStoreId"); + + try { + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); + List<Map<String,Object>> listAddItem = null; + if (UtilValidate.isNotEmpty(addItemObject.get("itemListing"))) { + listAddItem = (List<Map<String,Object>>) addItemObject.get("itemListing"); + } else { + listAddItem = FastList.newInstance(); + } + + for (Map<String,Object> itemObj : listAddItem) { + AddItemCall addItemCall = (AddItemCall) itemObj.get("addItemCall"); + ItemType item = addItemCall.getItem(); + String SKU = item.getSKU(); + if (UtilValidate.isNotEmpty(productId)) { + if (productId.equals(SKU)) { + + attributeMapList.put("Title", item.getTitle()); + attributeMapList.put("SKU", SKU); + attributeMapList.put("Currency", item.getCurrency().value()); + attributeMapList.put("Description", item.getDescription()); + attributeMapList.put("ApplicationData", item.getApplicationData()); + attributeMapList.put("Country", item.getCountry().value()); + attributeMapList.put("PictureURL", item.getPictureDetails().getPictureURL(0)); + attributeMapList.put("Site", item.getSite().value()); + attributeMapList.put("UseTaxTable", "false"); + attributeMapList.put("BestOfferEnabled", "true"); + attributeMapList.put("AutoPayEnabled", "true"); + attributeMapList.put("CategoryID", item.getPrimaryCategory().getCategoryID()); + attributeMapList.put("CategoryLevel", item.getPrimaryCategory().getCategoryLevel()); + attributeMapList.put("CategoryName", item.getPrimaryCategory().getCategoryName()); + attributeMapList.put("CategoryParentID", item.getPrimaryCategory().getCategoryParentID(0).toString()); + attributeMapList.put("LeafCategory", "true"); + attributeMapList.put("LSD", "true"); + + item.setUseTaxTable(false); + item.setDispatchTimeMax(3); + ReturnPolicyType policy = new ReturnPolicyType(); + policy.setReturnsAcceptedOption("ReturnsNotAccepted"); + item.setReturnPolicy(policy); + attributeMapList.put("ReturnsAcceptedOption", "ReturnsNotAccepted"); + + String currencyId = ""; + if (UtilValidate.isNotEmpty(requestParams.get("currencyId".concat(id)))) { + currencyId = (String) requestParams.get("currencyId".concat(id)); + } + if (UtilValidate.isNotEmpty(requestParams.get("enabledTheme")) && "Y".equals(requestParams.get("enabledTheme"))) { + ListingDesignerType designer = new ListingDesignerType(); + String layoutId = (String) requestParams.get("themeGroup"); + String themeIdImage = (String) requestParams.get("theme"); + String themeId = themeIdImage.substring(0, themeIdImage.indexOf(":")); + designer.setLayoutID(Integer.parseInt(layoutId)); + designer.setThemeID(Integer.parseInt(themeId)); + item.setListingDesigner(designer); + attributeMapList.put("LayoutID", item.getListingDesigner().getLayoutID()); + attributeMapList.put("ThemeID", item.getListingDesigner().getThemeID()); + } + if ("_1".equals(id)) { + item.setListingType(ListingTypeCodeType.CHINESE); + AmountType amtStart = new AmountType(); + amtStart.setCurrencyID(CurrencyCodeType.valueOf(currencyId)); + amtStart.setValue(Double.parseDouble(startPrice)); + item.setStartPrice(amtStart); + + AmountType amtBIN = new AmountType(); + amtBIN.setCurrencyID(CurrencyCodeType.valueOf(currencyId)); + amtBIN.setValue(Double.parseDouble(buyItNowPrice)); + item.setBuyItNowPrice(amtBIN); + attributeMapList.put("BuyItNowPrice", item.getBuyItNowPrice().getValue()); + + if (UtilValidate.isNotEmpty(requestParams.get("reservePrice".concat(id)))) { + AmountType amtResv = new AmountType(); + amtResv.setCurrencyID(CurrencyCodeType.valueOf(currencyId)); + amtResv.setValue(Double.parseDouble(requestParams.get("reservePrice".concat(id)).toString())); + item.setReservePrice(amtResv); + attributeMapList.put("ReservePrice", item.getReservePrice().getValue()); + } + } else if ("_2".equals(id)) { + item.setListingType(ListingTypeCodeType.FIXED_PRICE_ITEM); + AmountType amtBIN = new AmountType(); + amtBIN.setCurrencyID(CurrencyCodeType.valueOf(currencyId)); + amtBIN.setValue(Double.parseDouble(startPrice)); + item.setStartPrice(amtBIN); + if (UtilValidate.isNotEmpty(requestParams.get("enableBestOffer".concat(id)))) { + item.setBestOfferEnabled(new Boolean(requestParams.get("enableBestOffer".concat(id)).toString())); + } + } + attributeMapList.put("ListingType", item.getListingType().value()); + attributeMapList.put("StartPrice", item.getStartPrice().getValue()); + + EbayStoreHelper.mappedPaymentMethods(requestParams, itemPkCateId, addItemObject, item, attributeMapList); + + ShippingDetailsType shippingDetail = new ShippingDetailsType(); + ShippingServiceOptionsType[] shippingOptions = new ShippingServiceOptionsType[1]; + ShippingServiceOptionsType shippingOption = new ShippingServiceOptionsType(); + shippingOption.setShippingServicePriority(1); + shippingOption.setShippingService(shippingService); + AmountType amtServiceCost = new AmountType(); + amtServiceCost.setValue(5.0); + amtServiceCost.setCurrencyID(CurrencyCodeType.USD); + shippingOption.setShippingServiceCost(amtServiceCost); + shippingOptions[0] = shippingOption; + shippingDetail.setShippingType(ShippingTypeCodeType.FLAT); + shippingDetail.setShippingServiceOptions(shippingOptions); + item.setShippingDetails(shippingDetail); + attributeMapList.put("ShippingService", shippingService); + attributeMapList.put("ShippingServiceCost", ""+5.0); + attributeMapList.put("ShippingServiceCostCurrency", "USD"); + attributeMapList.put("ShippingServicePriority", "1"); + attributeMapList.put("ShippingType", "Flat"); + + + EbayStoreHelper.mappedShippingLocations(requestParams, item, apiContext, request, attributeMapList); + + if (UtilValidate.isNotEmpty(requestParams.get("vatPercent".concat(id)))) { + VATDetailsType vat = new VATDetailsType(); + vat.setVATPercent(new Float(requestParams.get("vatPercent".concat(id)).toString())); + item.setVATDetails(vat); + attributeMapList.put("VATPercent", vat); + } + if (UtilValidate.isNotEmpty(requestParams.get("location"))) { + item.setLocation(requestParams.get("location").toString()); + attributeMapList.put("Location", requestParams.get("location").toString()); + } + if (UtilValidate.isNotEmpty(requestParams.get("quantity".concat(id)))) { + item.setQuantity(Integer.parseInt(requestParams.get("quantity".concat(id)).toString())); + attributeMapList.put("Quantity", requestParams.get("quantity".concat(id)).toString()); + } + if (UtilValidate.isNotEmpty(requestParams.get("duration".concat(id)))) { + item.setListingDuration(requestParams.get("duration".concat(id)).toString()); + attributeMapList.put("ListingDuration", requestParams.get("duration".concat(id)).toString()); + } + if (UtilValidate.isNotEmpty(requestParams.get("lotsize".concat(id)))) { + item.setLotSize(Integer.parseInt(requestParams.get("lotsize".concat(id)).toString())); + attributeMapList.put("LotSize", requestParams.get("lotsize".concat(id)).toString()); + } + if (UtilValidate.isNotEmpty(requestParams.get("postalCode".concat(id)))) { + item.setPostalCode(requestParams.get("postalCode".concat(id)).toString()); + attributeMapList.put("PostalCode", requestParams.get("postalCode".concat(id)).toString()); + } + addItemCall.setItem(item); + + // create/update EbayProductListing entity + Map<String, Object> prodMap = FastMap.newInstance(); + prodMap.put("productStoreId", productStoreId); + prodMap.put("productId", productId); + prodMap.put("userLogin", userLogin); + if (UtilValidate.isNotEmpty(requestParams.get("isAutoRelist"))) { + prodMap.put("autoRelisting", "Y"); + itemObj.put("isAutoRelist", "Y"); + } + try { + GenericValue storeRole = EntityUtil.getFirst(delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", productStoreId, "roleTypeId", "EBAY_ACCOUNT"))); + if (UtilValidate.isNotEmpty(storeRole)) { + List<GenericValue> ebayUserLoginList = delegator.findByAnd("UserLogin", UtilMisc.toMap("partyId", storeRole.get("partyId"))); + if (ebayUserLoginList.size() > 0) { + GenericValue eBayUserLogin = EntityUtil.getFirst(ebayUserLoginList); + if (UtilValidate.isNotEmpty(eBayUserLogin)) { + prodMap.put("userLoginId", eBayUserLogin.get("userLoginId").toString()); + } + } + } + } catch (GenericEntityException ex) { + Debug.logError(ex.getMessage(), module); + return "error"; + } + String productListingId = null; + if (UtilValidate.isEmpty(itemObj.get("productListingId"))) { + try { + prodMap.put("statusId", "ITEM_CREATED"); + Map<String, Object> result = dispatcher.runSync("createEbayProductListing", prodMap); + productListingId = result.get("productListingId").toString(); + itemObj.put("productListingId", productListingId); + itemObj.put("isSaved", "Y"); + } catch (GenericServiceException ex) { + Debug.logError(ex.getMessage(), module); + return "error"; + } + } else { + productListingId = itemObj.get("productListingId").toString(); + prodMap.put("productListingId", productListingId); + try { + dispatcher.runSync("updateEbayProductListing", prodMap); + } catch (GenericServiceException ex) { + Debug.logError(ex.getMessage(), module); + return "error"; + } + } + + // create/update EbayProductListingAttribute + if (UtilValidate.isNotEmpty(productListingId)) { + attributeMapList.put("productListingId", productListingId); + Map<String, Object> ebayProdAttrMap = FastMap.newInstance(); + ebayProdAttrMap.put("productListingId", productListingId); + ebayProdAttrMap.put("userLogin", userLogin); + ebayProdAttrMap.put("attributeMapList", attributeMapList); + try { + dispatcher.runSync("setEbayProductListingAttribute", ebayProdAttrMap); + } catch (GenericServiceException ex) { + Debug.logError(ex.getMessage(), module); + return "error"; + } + } + } + } + } + request.setAttribute("productStoreId", requestParams.get("productStoreId")); + } catch(Exception e) { + Debug.logError(e.getMessage(), module); + return "error"; + } + return "success"; + } + + public static String verifyItemBeforeAdd(HttpServletRequest request, HttpServletResponse response) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + Map<String,Object> requestParams = UtilHttp.getParameterMap(request); + Locale locale = UtilHttp.getLocale(request); + String productStoreId = (String) requestParams.get("productStoreId"); + + try { + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + VerifyAddItemRequestType req = new VerifyAddItemRequestType(); + VerifyAddItemResponseType resp = null; + + VerifyAddItemCall verifyCall = new VerifyAddItemCall(apiContext); + Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); + List<Map<String,Object>> listAddItem = null; + if (UtilValidate.isNotEmpty(addItemObject.get("itemListing"))) { + listAddItem = (List<Map<String,Object>>) addItemObject.get("itemListing"); + } else { + listAddItem = FastList.newInstance(); + } + double feesummary = 0.0; + for (Map<String,Object> itemObj : listAddItem) { + AddItemCall addItemCall = (AddItemCall) itemObj.get("addItemCall"); + ItemType item = addItemCall.getItem(); + String SKU = item.getSKU(); + if (UtilValidate.isNotEmpty(requestParams.get("productId"))) { + String productId = requestParams.get("productId").toString(); + if (productId.equals(SKU)) { + req.setItem(item); + resp = (VerifyAddItemResponseType) verifyCall.execute(req); + if (resp != null && "SUCCESS".equals(resp.getAck().toString())) { + itemObj.put("isVerify", "Y"); + FeesType feest = (FeesType) resp.getFees(); + FeeType[] fees = feest.getFee(); + for (FeeType fee : fees) { + double dfee = fee.getFee().getValue(); + feesummary = feesummary + dfee; + } + } + } + } + } + request.setAttribute("itemFee", feesummary); + request.setAttribute("productStoreId", requestParams.get("productStoreId")); + + } catch (Exception e) { + Debug.logError(e.getMessage(), module); + return "error"; + } + return "success"; + } + + public static String removeProductFromListing(HttpServletRequest request, HttpServletResponse response) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + Map<String,Object> requestParams = UtilHttp.getParameterMap(request); + Locale locale = UtilHttp.getLocale(request); + String productStoreId = (String) requestParams.get("productStoreId"); + try { + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); + List<Map<String,Object>> listAddItem = null; + if (UtilValidate.isNotEmpty(addItemObject.get("itemListing"))) { + listAddItem = (List<Map<String,Object>>) addItemObject.get("itemListing"); + } else { + listAddItem = FastList.newInstance(); + } + int i = 0; + for (Map<String,Object> itemObj : listAddItem) { + AddItemCall addItemCall = (AddItemCall) itemObj.get("addItemCall"); + ItemType item = addItemCall.getItem(); + String SKU = item.getSKU(); + if (UtilValidate.isNotEmpty(requestParams.get("productId"))) { + String productId = requestParams.get("productId").toString(); + if (productId.equals(SKU)) { + listAddItem.remove(i); + } + } + i++; + } + request.setAttribute("productStoreId", requestParams.get("productStoreId")); + } catch (Exception e) { + Debug.logError(e.getMessage(), module); + return "error"; + } + return "success"; + } + + public static String exportListingToEbay(HttpServletRequest request, HttpServletResponse response) { + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + Map<String,Object> requestParams = UtilHttp.getParameterMap(request); + Locale locale = UtilHttp.getLocale(request); + String productStoreId = (String) requestParams.get("productStoreId"); + try { + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); + List<Map<String,Object>> listAddItem = null; + if (UtilValidate.isNotEmpty(addItemObject.get("itemListing"))) { + listAddItem = (List<Map<String,Object>>) addItemObject.get("itemListing"); + } else { + listAddItem = FastList.newInstance(); + } + for (Map<String,Object> itemObj : listAddItem) { + dispatcher.runSync("exportProductEachItem", UtilMisc.toMap("itemObject", itemObj)); + } + } catch (Exception e) { + Debug.logError(e.getMessage(), module); + return "error"; + } + return "success"; + } } \ No newline at end of file |
Free forum by Nabble | Edit this page |