|
Author: hansbak
Date: Wed Aug 11 10:39:10 2010 New Revision: 984366 URL: http://svn.apache.org/viewvc?rev=984366&view=rev Log: This feature is the automation of best offers. It is used to check and respond to an offer of a customer in the eBay Store. Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java Modified: ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml ofbiz/trunk/specialpurpose/ebaystore/data/EbayStoreTypeData.xml ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml Modified: ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml?rev=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml Wed Aug 11 10:39:10 2010 @@ -206,41 +206,83 @@ <value xml:lang="en">Require eBay Inventory</value> </property> <!-- Selling Manager preferences --> + <property key="EbayAcceptTheBestOffer1"> + <value xml:lang="en">use this percent value to accept the Best Offer if it is greater or equal</value> + </property> + <property key="EbayAcceptTheBestOffer2"> + <value xml:lang="en">% of the above price.</value> + </property> + <property key="EbayActive"> + <value xml:lang="en">Active</value> + </property> + <property key="EbayAddSecondChanceOffer"> + <value xml:lang="en">Add Second Chance Offer</value> + </property> + <property key="EbayAfter"> + <value xml:lang="en">After</value> + </property> + <property key="EbayAutoBestOfferSetting"> + <value xml:lang="en">Best Offer (Buy-It-Now Only)</value> + </property> <property key="EbayAutomationDispute"> <value xml:lang="en">Automation Dispute</value> </property> + <property key="EbayAutoPaymentReceviedEmail"> + <value xml:lang="en">Automatically send email when payment has been received</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="EbayAutoSendItemDispatchEmail"> + <value xml:lang="en">Automatic send item dispatched notification email</value> + </property> + <property key="EbayAutoSendWinBuyerEmail"> + <value xml:lang="en">Automatic send notification email to winning buyer on auction items</value> + </property> + <property key="EbayBasedOn"> + <value xml:lang="en">Best offer based on Price.</value> + </property> + <property key="EbayChangeCategory"> + <value xml:lang="en">Change</value> + </property> + <property key="EbayCombineOrderSetting"> + <value xml:lang="en">Combine Orders Setting</value> + </property> + <property key="EbayContinueListing"> + <value xml:lang="en">Countinue</value> + </property> <property key="EbayDisputeCheckoutNotComplete"> <value xml:lang="en">Create Dispute if checkout has not been completed</value> </property> <property key="EbayDisputeNotPay"> <value xml:lang="en">Create Dispute if checkout has been completed but no payment has been received</value> </property> - <property key="EbayAfter"> - <value xml:lang="en">After</value> + <property key="EbayEditEmailTemplate"> + <value xml:lang="en">Edit Email Template</value> </property> - <property key="EbayReason"> - <value xml:lang="en">Reason</value> + <property key="EbayErrorMessageList"> + <value xml:lang="en">Error Messages List</value> + </property> + <property key="EbayEvaluateOn"> + <value xml:lang="en">Automatically evaluate Best Offers</value> </property> <property key="EbayExplanation"> <value xml:lang="en">Explanation</value> </property> - <property key="EbayAddSecondChanceOffer"> - <value xml:lang="en">Add Second Chance Offer</value> + <property key="EbayIgnoreTheOffer"> + <value xml:lang="en">Ignore the offer if the buyer included any message.</value> </property> - <property key="EbayIsAutoPositiveFeedback"> - <value xml:lang="en">Automatically leave the positive feedback</value> - </property> - <property key="EbaySituations"> - <value xml:lang="en">Situations</value> - </property> - <property key="EbayTxtPaymentReceive"> - <value xml:lang="en">Buyer has paid for this item.</value> + <property key="EbayIncludeMyDefaultCrossPromotionInThisEmail"> + <value xml:lang="en">Include my default cross-promotion in this email</value> </property> - <property key="EbayTxtPaymentReceiveAndPositive"> - <value xml:lang="en">Buyer has paid for this item and left me positive feedback. </value> + <property key="EbayIncludePayNowButtonAndAcceptPaymentMethods"> + <value xml:lang="en">Include the Pay Now button and accepted payment methods</value> </property> - <property key="EbayTxtAutoPositiveFeedbackBuyer"> - <value xml:lang="en">Automated Positive Feedback for Buyers</value> + <property key="EbayIsAutoPositiveFeedback"> + <value xml:lang="en">Automatically leave the positive feedback</value> </property> <property key="EbayIsAutoFeedbackReminder"> <value xml:lang="en">Automatically send a Feedback Reminder email</value> @@ -248,73 +290,67 @@ <property key="EbayIsAutoFeedbackReminderTooltip"> <value xml:lang="en">Automatically send a Feedback Reminder email if feedback has not been received</value> </property> - <property key="EbayIsSendCopyEmailToSeller"> - <value xml:lang="en">Copy and Send to Seller</value> + <property key="EbayIsAutoSendEmail"> + <value xml:lang="en">Automatically send email</value> </property> <property key="EbayIsSendCopyEmailTooltip"> <value xml:lang="en">How many days after shipping you want this email sent?</value> </property> - <property key="EbayIsAutoSendEmail"> - <value xml:lang="en">Automatically send email</value> + <property key="EbayIsSendCopyEmailToSeller"> + <value xml:lang="en">Copy and Send to Seller</value> </property> - <property key="EbayAutoPaymentReceviedEmail"> - <value xml:lang="en">Automatically send email when payment has been received</value> + <property key="EbayListOrderImported"> + <value xml:lang="en">List Orders Imported</value> </property> - <property key="EbayEditEmailTemplate"> - <value xml:lang="en">Edit Email Template</value> + <property key="EbayNoOrderImported"> + <value xml:lang="en">No orders imported found</value> </property> - <property key="EbayIncludePayNowButtonAndAcceptPaymentMethods"> - <value xml:lang="en">Include the Pay Now button and accepted payment methods</value> + <property key="EbayOpenListings"> + <value xml:lang="en">Open Listings</value> </property> - <property key="EbayIncludeMyDefaultCrossPromotionInThisEmail"> - <value xml:lang="en">Include my default cross-promotion in this email</value> + <property key="EbayReason"> + <value xml:lang="en">Reason</value> </property> - <property key="EbayAutoSendWinBuyerEmail"> - <value xml:lang="en">Automatic send notification email to winning buyer on auction items</value> + <property key="EbayRejectGreaterRate1"> + <value xml:lang="en">Reject the offer if it is greater or equal to this percent value.</value> </property> - <property key="EbayCombineOrderSetting"> - <value xml:lang="en">Combine Orders Setting</value> + <property key="EbayRejectGreaterRate2"> + <value xml:lang="en">Reject the offer if it is less than this percent value.</value> </property> - <property key="EbayAutoSendItemDispatchEmail"> - <value xml:lang="en">Automatic send item dispatched notification email</value> + <property key="EbayRejectGreaterRate3"> + <value xml:lang="en">Message:</value> </property> - <property key="EbayContinueListing"> - <value xml:lang="en">Countinue</value> + <property key="EbayRejectLessRate1"> + <value xml:lang="en">Reject the offer if it is less than this percent value.</value> </property> - <property key="EbayChangeCategory"> - <value xml:lang="en">Change</value> + <property key="EbayRejectLessRate2"> + <value xml:lang="en">Message:</value> </property> - <property key="EbayStoreCategory"> - <value xml:lang="en">eBay Store Category</value> + <property key="EbayRejectTheOffer"> + <value xml:lang="en">Reject the offer if it is more than the inventory item's Buy-It-Now Price.</value> </property> <property key="EbaySet"> <value xml:lang="en">Set</value> </property> - <property key="EbayUnsold"> - <value xml:lang="en">unsold</value> + <property key="EbaySituations"> + <value xml:lang="en">Situations</value> </property> - <property key="EbayActive"> - <value xml:lang="en">Active</value> + <property key="EbayStoreCategory"> + <value xml:lang="en">eBay Store Category</value> </property> - <property key="EbayAutoRelistingItems"> - <value xml:lang="en">Auto Relisting Items</value> + <property key="EbayTxtAutoPositiveFeedbackBuyer"> + <value xml:lang="en">Automated Positive Feedback for Buyers</value> </property> - <property key="EbayAutoRelistingItemsDescription"> - <value xml:lang="en">Auto Relisting Items when they are end item.</value> + <property key="EbayTxtPaymentReceive"> + <value xml:lang="en">Buyer has paid for this item.</value> + </property> + <property key="EbayTxtPaymentReceiveAndPositive"> + <value xml:lang="en">Buyer has paid for this item and left me positive feedback. </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> - <property key="EbayErrorMessageList"> - <value xml:lang="en">Error Messages List</value> + <property key="unsold"> + <value xml:lang="en">unsold</value> </property> </resource> Modified: ofbiz/trunk/specialpurpose/ebaystore/data/EbayStoreTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/data/EbayStoreTypeData.xml?rev=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/data/EbayStoreTypeData.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/data/EbayStoreTypeData.xml Wed Aug 11 10:39:10 2010 @@ -37,7 +37,16 @@ under the License. <Enumeration enumId="EBAY_AUTO_PR_EMAIL" description="Automatic send payment received email when has not been received" enumTypeId="EBAY_AUTO_PREF"/> <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"/> - + <Enumeration enumId="EBAY_AUTO_BEST_OFFER" description="Automatic best offer enable" enumTypeId="EBAY_AUTO_PREF"/> + <!-- Ebay Automation Price --> + <EnumerationType description="Ebay setting auto price" enumTypeId="EBAY_AUTO_PRICE" hasTable="N" parentTypeId=""/> + <Enumeration enumId="REFAIL_PRICE" description="Refail Price" enumTypeId="EBAY_AUTO_PRICE"/> + <Enumeration enumId="START_PRICE" description="Start Price" enumTypeId="EBAY_AUTO_PRICE"/> + <Enumeration enumId="RESERVE_PRICE" description="Reserve Price" enumTypeId="EBAY_AUTO_PRICE"/> + <Enumeration enumId="BUY_IT_NOW_PRICE" description="Buy-It-Now Price" enumTypeId="EBAY_AUTO_PRICE"/> + <Enumeration enumId="SELLER_COST" description="Seller Cost" enumTypeId="EBAY_AUTO_PRICE"/> + <Enumeration enumId="SECOND_CHANCE_PRICE" description="Second Chance Price" enumTypeId="EBAY_AUTO_PRICE"/> + <Enumeration enumId="STORE_PRICE" description="Store Price" enumTypeId="EBAY_AUTO_PRICE"/> <!-- 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"/> Modified: ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml?rev=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml Wed Aug 11 10:39:10 2010 @@ -64,6 +64,7 @@ under the License. <field name="condition1" type="value"/> <field name="condition2" type="value"/> <field name="condition3" type="value"/> + <field name="parentPrefCondId" type="id-ne"></field> <prim-key field="productStoreId"/> <prim-key field="autoPrefEnumId"/> <relation type="one" fk-name="EBY_STR_PREF" rel-entity-name="ProductStore"> @@ -123,4 +124,21 @@ under the License. <key-map field-name="productStoreId"/> </relation> </entity> + <entity entity-name="EbayProductStorePrefCond" package-name="org.ofbiz.ebay.store"> + <field name="prefCondId" type="id-ne"/> + <field name="condition" type="long-varchar"></field> + <field name="description" type="long-varchar"></field> + <field name="parentPrefCondId" type="id-ne"></field> + <prim-key field="prefCondId"/> + </entity> + <entity entity-name="EbayUserBestOffer" package-name="org.ofbiz.ebay.store" + title="ebay User Best Offer"> + <field name="itemId" type="value"/> + <field name="userId" type="value"/> + <field name="bestOfferId" type="value"/> + <field name="productStoreId" type="id-ne"/> + <field name="contactStatus" type="value"/> + <prim-key field="itemId"/> + <prim-key field="userId"/> + </entity> </entitymodel> Modified: ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml?rev=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml Wed Aug 11 10:39:10 2010 @@ -325,7 +325,7 @@ under the License. <auto-attributes include="nonpk" mode="IN" optional="true"/> <attribute name="serviceName" mode="IN" type="String" optional="false"/> </service> - <service name="updateEbayProductStorePref" engine="entity-auto" default-entity-name="EbayProductStorePref" invoke="update" auth="true" > + <service name="updateEbayProductStorePref" engine="entity-auto" default-entity-name="EbayProductStorePref" invoke="update" auth="true"> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true" /> <attribute name="enabled" mode="IN" type="String" optional="false" default-value="N"/> @@ -426,6 +426,37 @@ under the License. <attribute name="functionName" mode="IN" type="String" optional="false"/> <attribute name="logMessage" mode="IN" type="String" optional="false"/> </service> + <service name="ebayBestOfferPrefCond" engine="java" + location="org.ofbiz.ebaystore.EbayBestOfferAutoPref" invoke="ebayBestOfferPrefCond" auth="true"> + <attribute name="productStoreId" mode="IN" type="String"/> + <attribute name="enabled" mode="IN" type="String" default-value="N" optional="true"></attribute> + <!--<attribute name="userLogin" mode="IN" type="String"></attribute>--> + <attribute name="condition1" mode="IN" type="String" optional="true"></attribute> + <attribute name="condition2" mode="IN" type="String" optional="true"></attribute> + <attribute name="condition3" mode="IN" type="String" default-value="N" optional="true"></attribute> + <attribute name="condition4" mode="IN" type="String" default-value="N" optional="true"></attribute> + <attribute name="condition5" mode="IN" type="String" default-value="N" optional="true"></attribute> + <attribute name="condition6" mode="IN" type="String" optional="true"></attribute> + <attribute name="condition7" mode="IN" type="String" optional="true"></attribute> + <attribute name="condition8" mode="IN" type="String" optional="true"></attribute> + <attribute name="condition9" mode="IN" type="String" default-value="N"></attribute> + <attribute name="condition10" mode="IN" type="String" optional="true"></attribute> + <attribute name="condition11" mode="IN" type="String" optional="true"></attribute> + </service> + <service name="createEbayProductStorePrefCond" engine="entity-auto" default-entity-name="EbayProductStorePrefCond" invoke="create" auth="true" use-transaction="true"> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="updateEbayProductStorePrefCond" engine="entity-auto" default-entity-name="EbayProductStorePrefCond" invoke="update" auth="true" use-transaction="true"> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true" /> + <attribute name="condition" mode="IN" type="String" optional="false"/> + </service> + <service name="autoBestOffer" engine="java" transaction-timeout="36000" + location="org.ofbiz.ebaystore.EbayStoreAutoPreferences" invoke="autoBestOffer" auth="false"> + <attribute name="jobId" mode="IN" type="String" optional="false"/> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + </service> <service name="getMyeBaySelling" engine="java" transaction-timeout="36000" location="org.ofbiz.ebaystore.EbayStore" invoke="getMyeBaySelling" auth="true"> <attribute name="productStoreId" mode="IN" type="String" optional="false"/> @@ -467,4 +498,39 @@ under the License. <attribute mode="IN" name="_imageData_contentType" optional="true" type="String"/> <attribute mode="IN" name="_imageData_fileName" optional="true" type="String"/> </service> + <service name="listBestOfferIncludeMessage" engine="java" transaction-timeout="10000" + location="org.ofbiz.ebaystore.EbayStoreCustomerService" invoke="listBestOfferIncludeMessage"> + <description>List customer offer data</description> + <attribute name="userId" mode="IN" type="String"></attribute> + <attribute name="itemId" mode="IN" type="String"></attribute> + <attribute name="bestOfferId" mode="IN" type="String"></attribute> + <attribute name="productStoreId" mode="IN" type="String"></attribute> + <attribute name="email" mode="OUT" type="String" optional="true"></attribute> + <attribute name="message" mode="OUT" type="String" optional="true"></attribute> + <attribute name="price" mode="OUT" type="String" optional="true"></attribute> + <attribute name="quantity" mode="OUT" type="String" optional="true"></attribute> + <attribute name="offerStatus" mode="OUT" type="String" optional="true"></attribute> + <attribute name="itemName" mode="OUT" type="String" optional="true"></attribute> + </service> + <service name="updateContactStatus" engine="java" transaction-timeout="10000" + location="org.ofbiz.ebaystore.EbayStoreCustomerService" invoke="updateContactStatus"> + <description>List customer offer data</description> + <attribute name="userId" mode="INOUT" type="String"></attribute> + <attribute name="itemId" mode="INOUT" type="String"></attribute> + <attribute name="itemName" mode="INOUT" type="String"></attribute> + <attribute name="productStoreId" mode="INOUT" type="String"></attribute> + <attribute name="offerId" mode="INOUT" type="String"></attribute> + <attribute name="price" mode="INOUT" type="String"></attribute> + <attribute name="email" mode="INOUT" type="String"></attribute> + <attribute name="quantity" mode="INOUT" type="String"></attribute> + <attribute name="contactStatus" mode="INOUT" type="String"></attribute> + <attribute name="contactSetting" mode="IN" type="String"></attribute> + </service> + <service name="deleteContactAlert" engine="java" transaction-timeout="10000" + location="org.ofbiz.ebaystore.EbayStoreCustomerService" invoke="deleteContactAlert"> + <description>Delete customer offer data</description> + <attribute name="userId" mode="IN" type="String"></attribute> + <attribute name="itemId" mode="IN" type="String"></attribute> + <attribute name="productStoreId" mode="INOUT" type="String"></attribute> + </service> </services> Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java?rev=984366&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java (added) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java Wed Aug 11 10:39:10 2010 @@ -0,0 +1,188 @@ +package org.ofbiz.ebaystore; + +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javolution.util.FastMap; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceUtil; + +public class EbayBestOfferAutoPref { + + public static final String module = EbayBestOfferAutoPref.class.getName(); + + public static Map<String, Object> ebayBestOfferPrefCond(DispatchContext dctx, Map<String, ? extends Object> context) { + + Map<String, Object> result = FastMap.newInstance(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + String productStoreId = (String) context.get("productStoreId"); + String enabled = (String) context.get("enabled"); + String condition1 = (String) context.get("condition1"); + String condition2 = (String) context.get("condition2"); + String condition3 = (String) context.get("condition3"); + String condition4 = (String) context.get("condition4"); + String condition5 = (String) context.get("condition5"); + String condition6 = (String) context.get("condition6"); + String condition7 = (String) context.get("condition7"); + String condition8 = (String) context.get("condition8"); + String condition9 = (String) context.get("condition9"); + String condition10 = (String) context.get("condition10"); + String condition11 = (String) context.get("condition11"); + try { + Map ebayCondition1 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition1.put("condition", condition1); + + Map ebayCondition2 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition2.put("condition", condition2); + + Map ebayCondition3 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition3.put("condition", condition3); + + Map ebayCondition4 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition4.put("condition", condition4); + + Map ebayCondition5 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition5.put("condition", condition5); + + Map ebayCondition6 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition6.put("condition", condition6); + + Map ebayCondition7 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition7.put("condition", condition7); + + Map ebayCondition8 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition8.put("condition", condition8); + + Map ebayCondition9 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition9.put("condition", condition9); + + Map ebayCondition10 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition10.put("condition", condition10); + + Map ebayCondition11 = UtilMisc.toMap("userLogin", userLogin); + ebayCondition11.put("condition", condition11); + + GenericValue productStorePref = delegator.findByPrimaryKey("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER")); + if (UtilValidate.isEmpty(productStorePref)) { + String prefCondId1 = delegator.getNextSeqId("EbayProductStorePrefCond"); + String parentPrefCondId = prefCondId1; + + ebayCondition1.put("prefCondId", prefCondId1); + ebayCondition1.put("parentPrefCondId", parentPrefCondId); + ebayCondition1.put("description", "Kind of Price Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition1); + + String prefCondId2 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition2.put("prefCondId", prefCondId2); + ebayCondition2.put("parentPrefCondId", parentPrefCondId); + ebayCondition2.put("description", "acceptBestOfferValue Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition2); + + String prefCondId3 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition3.put("prefCondId", prefCondId3); + ebayCondition3.put("parentPrefCondId", parentPrefCondId); + ebayCondition3.put("description", "rejectOffer Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition3); + + String prefCondId4 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition4.put("prefCondId", prefCondId4); + ebayCondition4.put("parentPrefCondId", parentPrefCondId); + ebayCondition4.put("description", "ignoreOfferMessage Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition4); + + String prefCondId5 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition5.put("prefCondId", prefCondId5); + ebayCondition5.put("parentPrefCondId", parentPrefCondId); + ebayCondition5.put("description", "rejectGreaterEnable Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition5); + + String prefCondId6 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition6.put("prefCondId", prefCondId6); + ebayCondition6.put("parentPrefCondId", parentPrefCondId); + ebayCondition6.put("description", "greaterValue Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition6); + + String prefCondId7 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition7.put("prefCondId", prefCondId7); + ebayCondition7.put("parentPrefCondId", parentPrefCondId); + ebayCondition7.put("description", "lessValue Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition7); + + String prefCondId8 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition8.put("prefCondId", prefCondId8); + ebayCondition8.put("parentPrefCondId", parentPrefCondId); + ebayCondition8.put("description", "rejectGreaterMsg Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition8); + + String prefCondId9 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition9.put("prefCondId", prefCondId9); + ebayCondition9.put("parentPrefCondId", parentPrefCondId); + ebayCondition9.put("description", "rejectLessEnable Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition9); + + String prefCondId10 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition10.put("prefCondId", prefCondId10); + ebayCondition10.put("parentPrefCondId", parentPrefCondId); + ebayCondition10.put("description", "lessThanValue Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition10); + + String prefCondId11 = delegator.getNextSeqId("EbayProductStorePrefCond"); + ebayCondition11.put("prefCondId", prefCondId11); + ebayCondition11.put("parentPrefCondId", parentPrefCondId); + ebayCondition11.put("description", "rejectLessMsg Field"); + dispatcher.runSync("createEbayProductStorePrefCond", ebayCondition11); + + Map ebayPref = UtilMisc.toMap("userLogin", userLogin, "serviceName", "autoBestOffer"); + ebayPref.put("parentPrefCondId",parentPrefCondId); + ebayPref.put("enabled", enabled); + ebayPref.put("autoPrefEnumId", "EBAY_AUTO_BEST_OFFER"); + ebayPref.put("productStoreId",productStoreId); + dispatcher.runSync("createEbayProductStorePref",ebayPref); + } else { + Map ebayPref = UtilMisc.toMap("userLogin", userLogin, "serviceName", "autoBestOffer"); + ebayPref.put("enabled", enabled); + ebayPref.put("autoPrefEnumId", "EBAY_AUTO_BEST_OFFER"); + ebayPref.put("productStoreId",productStoreId); + dispatcher.runSync("updateEbayProductStorePref",ebayPref); + + String parentPrefCondId = productStorePref.getString("parentPrefCondId"); + List<GenericValue> productPref = delegator.findByAnd("EbayProductStorePrefCond", UtilMisc.toMap("parentPrefCondId",parentPrefCondId)); + if (productPref.size() != 0) { + String[] condition = {condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8, condition9, condition10, condition11}; + Map ebayPrefCond = UtilMisc.toMap("userLogin", userLogin); + for (int i = 0; i < productPref.size(); i++) { + ebayPrefCond.put("prefCondId",productPref.get(i).getString("prefCondId")); + ebayPrefCond.put("condition",condition[i]); + dispatcher.runSync("updateEbayProductStorePrefCond",ebayPrefCond); + } + } + + } + + } catch (GenericServiceException e) { + String errorMessage = "Store best offer to entity failed."; + result = ServiceUtil.returnError(errorMessage); + return result; + } catch (GenericEntityException e) { + String errorMessage = "Store best offer to entity failed."; + result = ServiceUtil.returnError(errorMessage); + return result; + } + String successMsg = "Store best offer to entity Successfull."; + result = ServiceUtil.returnSuccess(successMsg); + return result; + } +} Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java?rev=984366&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java (added) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java Wed Aug 11 10:39:10 2010 @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.ebaystore; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import javolution.util.FastMap; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; + +public class EbayStoreAutoPrefEvents{ + + public static final String module = EbayStoreAutoPrefEvents.class.getName(); + + public static String ebayAutoPrefCond (HttpServletRequest request, HttpServletResponse response) { + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + HttpSession session = request.getSession(true); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + Map<String, Object> requestParams = UtilHttp.getParameterMap(request); + String enabled = (String) requestParams.get("automateEnable"); + String productStoreId = (String) requestParams.get("productStoreId"); + String condition1 = (String) requestParams.get("kindOfPrice"); + String condition2 = (String) requestParams.get("acceptBestOfferValue"); + String condition3 = (String) requestParams.get("rejectOffer"); + String condition4 = (String) requestParams.get("ignoreOfferMessage"); + String condition5 = (String) requestParams.get("rejectGreaterEnable"); + String condition6 = (String) requestParams.get("greaterValue"); + String condition7 = (String) requestParams.get("lessValue"); + String condition8 = (String) requestParams.get("rejectGreaterMsg"); + String condition9 = (String) requestParams.get("rejectLessEnable"); + String condition10 = (String) requestParams.get("lessThanValue"); + String condition11 = (String) requestParams.get("rejectLessMsg"); + if (UtilValidate.isNotEmpty(enabled)) { + if (enabled.equals("Y") && UtilValidate.isEmpty(condition1)) { + String errMsg = "Please select Based Price."; + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + if (enabled.equals("Y") && UtilValidate.isEmpty(condition2)) { + String errMsg = "Please enter \"Percent value to accept.\""; + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + if (enabled.equals("Y") && condition5.equals("Y") && (UtilValidate.isEmpty(condition6) || UtilValidate.isEmpty(condition7) || UtilValidate.isEmpty(condition8))) { + String errMsg = "Please enter \"Greater price percen\" , \"Less price percent \" and \"Message\""; + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } else if (enabled.equals("Y") && condition5.equals("N") && (UtilValidate.isNotEmpty(condition6) || UtilValidate.isNotEmpty(condition7) || UtilValidate.isNotEmpty(condition8))) { + String errMsg = "Please enable rejection notification before."; + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + if (enabled.equals("Y") && condition9.equals("Y") && (UtilValidate.isEmpty(condition10) || UtilValidate.isEmpty(condition11))) { + String errMsg = "Please enter \"Less price percent \" and \"Message\""; + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } else if (enabled.equals("Y") && condition9.equals("N") && (UtilValidate.isNotEmpty(condition10) || UtilValidate.isNotEmpty(condition11))) { + String errMsg = "Please enable rejection notification before."; + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + } + + Map<String, Object> bestOfferCondition = FastMap.newInstance(); + bestOfferCondition.put("productStoreId", productStoreId); + bestOfferCondition.put("userLogin", userLogin); + bestOfferCondition.put("enabled", enabled); + bestOfferCondition.put("condition1", condition1); + bestOfferCondition.put("condition2", condition2); + bestOfferCondition.put("condition3", condition3); + bestOfferCondition.put("condition4", condition4); + bestOfferCondition.put("condition5", condition5); + bestOfferCondition.put("condition6", condition6); + bestOfferCondition.put("condition7", condition7); + bestOfferCondition.put("condition8", condition8); + bestOfferCondition.put("condition9", condition9); + bestOfferCondition.put("condition10", condition10); + bestOfferCondition.put("condition11", condition11); + try { + Map result = dispatcher.runSync("ebayBestOfferPrefCond", bestOfferCondition); + } catch (GenericServiceException e) { + Debug.logError(e, module); + return "error"; + } + return "Success."; + } +} Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java Wed Aug 11 10:39:10 2010 @@ -18,6 +18,7 @@ */ package org.ofbiz.ebaystore; +import java.math.BigDecimal; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -29,6 +30,8 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Random; +import java.util.SortedMap; +import java.util.TreeMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -61,15 +64,24 @@ import com.ebay.sdk.call.AddDisputeCall; import com.ebay.sdk.call.AddItemCall; import com.ebay.sdk.call.AddOrderCall; import com.ebay.sdk.call.DeleteSellingManagerTemplateCall; +import com.ebay.sdk.call.GetBestOffersCall; +import com.ebay.sdk.call.GetItemCall; +import com.ebay.sdk.call.GetMyeBaySellingCall; import com.ebay.sdk.call.GetSellingManagerInventoryCall; import com.ebay.sdk.call.GetSellingManagerSoldListingsCall; import com.ebay.sdk.call.GetUserCall; import com.ebay.sdk.call.LeaveFeedbackCall; +import com.ebay.sdk.call.RespondToBestOfferCall; +import com.ebay.sdk.call.VerifyAddSecondChanceItemCall; import com.ebay.sdk.call.RelistItemCall; import com.ebay.soap.eBLBaseComponents.AddOrderRequestType; import com.ebay.soap.eBLBaseComponents.AddOrderResponseType; import com.ebay.soap.eBLBaseComponents.AmountType; import com.ebay.soap.eBLBaseComponents.AutomatedLeaveFeedbackEventCodeType; +import com.ebay.soap.eBLBaseComponents.BestOfferActionCodeType; +import com.ebay.soap.eBLBaseComponents.BestOfferDetailsType; +import com.ebay.soap.eBLBaseComponents.BestOfferStatusCodeType; +import com.ebay.soap.eBLBaseComponents.BestOfferType; import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType; import com.ebay.soap.eBLBaseComponents.CommentTypeCodeType; import com.ebay.soap.eBLBaseComponents.CurrencyCodeType; @@ -81,8 +93,14 @@ import com.ebay.soap.eBLBaseComponents.D import com.ebay.soap.eBLBaseComponents.FeedbackDetailType; import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryRequestType; import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryResponseType; +import com.ebay.soap.eBLBaseComponents.ItemArrayType; +import com.ebay.soap.eBLBaseComponents.ItemListCustomizationType; +import com.ebay.soap.eBLBaseComponents.ItemSortTypeCodeType; import com.ebay.soap.eBLBaseComponents.ItemType; +import com.ebay.soap.eBLBaseComponents.ListingTypeCodeType; import com.ebay.soap.eBLBaseComponents.OrderType; +import com.ebay.soap.eBLBaseComponents.PaginatedItemArrayType; +import com.ebay.soap.eBLBaseComponents.PaginationType; import com.ebay.soap.eBLBaseComponents.SellingManagerOrderStatusType; import com.ebay.soap.eBLBaseComponents.SellingManagerPaidStatusCodeType; import com.ebay.soap.eBLBaseComponents.SellingManagerProductDetailsType; @@ -1145,4 +1163,227 @@ public class EbayStoreAutoPreferences { } return ServiceUtil.returnSuccess(); } + public static Map<String, Object> autoBestOffer(DispatchContext dctx, Map<String, ? extends Object> context) { + LocalDispatcher dispatcher = dctx.getDispatcher(); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + try { + GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + String jobId = (String) context.get("jobId"); + String productStoreId = (String) context.get("productStoreId"); + GenericValue ebayProductStorePref = (GenericValue) delegator.findByPrimaryKey("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER")); + String parentPrefCondId = ebayProductStorePref.getString("parentPrefCondId"); + List<GenericValue> ebayProductStorePrefCond = delegator.findByAnd("EbayProductStorePrefCond", UtilMisc.toMap("parentPrefCondId", parentPrefCondId)); + //Parameters + String priceType = ebayProductStorePrefCond.get(0).getString("condition"); + String acceptBestOfferValue = ebayProductStorePrefCond.get(1).getString("condition"); + String rejectOffer = ebayProductStorePrefCond.get(2).getString("condition"); + String ignoreOfferMessage = ebayProductStorePrefCond.get(3).getString("condition"); + String rejectGreaterEnable = ebayProductStorePrefCond.get(4).getString("condition"); + String greaterValue = ebayProductStorePrefCond.get(5).getString("condition"); + String lessValue = ebayProductStorePrefCond.get(6).getString("condition"); + String rejectGreaterMsg = ebayProductStorePrefCond.get(7).getString("condition"); + String rejectLessEnable = ebayProductStorePrefCond.get(8).getString("condition"); + String lessThanValue = ebayProductStorePrefCond.get(9).getString("condition"); + String rejectLessMsg = ebayProductStorePrefCond.get(10).getString("condition"); + //case parameter to double type + BigDecimal acceptPercentValue = new BigDecimal(acceptBestOfferValue); + BigDecimal greaterPercentValue = new BigDecimal(greaterValue); + BigDecimal lessThanPercentValue = new BigDecimal(lessValue); + BigDecimal rejectPercentValue = new BigDecimal(lessThanValue); + + Map<String, Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", productStoreId); + inMap.put("userLogin", userLogin); + Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap); + String userID = (String) resultUser.get("userLoginId"); + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + //GetMysbaySellingCall for get total page + GetMyeBaySellingCall getTotalPage = new GetMyeBaySellingCall(apiContext); + ItemListCustomizationType itemListType = new ItemListCustomizationType(); + itemListType.setInclude(Boolean.TRUE); + itemListType.setSort(ItemSortTypeCodeType.ITEM_ID_DESCENDING); + itemListType.setListingType(ListingTypeCodeType.FIXED_PRICE_ITEM); + DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { + DetailLevelCodeType.RETURN_ALL, + DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES, + DetailLevelCodeType.ITEM_RETURN_DESCRIPTION + }; + getTotalPage.setDetailLevel(detailLevels); + getTotalPage.setActiveList(itemListType); + getTotalPage.getMyeBaySelling(); + int totalPage = getTotalPage.getReturnedActiveList().getPaginationResult().getTotalNumberOfPages(); + for (int t = 1; t <= totalPage; t++) { + //GetMyebaySellingCall for get item that is sold on store + GetMyeBaySellingCall ebaySelling = new GetMyeBaySellingCall(apiContext); + //Set type of item + ItemListCustomizationType itemList = new ItemListCustomizationType(); + itemList.setInclude(Boolean.TRUE); + itemListType.setSort(ItemSortTypeCodeType.ITEM_ID_DESCENDING); + itemListType.setListingType(ListingTypeCodeType.FIXED_PRICE_ITEM); + + PaginationType page = new PaginationType(); + page.setPageNumber(t); + itemList.setPagination(page); + itemList.setListingType(ListingTypeCodeType.FIXED_PRICE_ITEM); + + DetailLevelCodeType[] detailLevel = new DetailLevelCodeType[] { + DetailLevelCodeType.RETURN_ALL, + DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES, + DetailLevelCodeType.ITEM_RETURN_DESCRIPTION, + DetailLevelCodeType.RETURN_HEADERS, + DetailLevelCodeType.RETURN_MESSAGES + }; + ebaySelling.setDetailLevel(detailLevel); + ebaySelling.setActiveList(itemList); + ebaySelling.getMyeBaySelling(); + PaginatedItemArrayType itemListCustomizationType = ebaySelling.getReturnedActiveList(); + ItemArrayType itemArrayType = itemListCustomizationType.getItemArray(); + int itemArrayTypeSize = itemArrayType.getItemLength(); + + //Loop for get item + for (int itemCount = 0; itemCount < itemArrayTypeSize; itemCount++) { + ItemType item = itemArrayType.getItem(itemCount); + String itemID = item.getItemID(); + Double buyItNowPrice = item.getBuyItNowPrice().getValue(); + GetItemCall getItem = new GetItemCall(apiContext); + getItem.setDetailLevel(detailLevel); + getItem.getItem(itemID); + String SKUItem = getItem.getSKU(); + ItemType itemBestOffer = getItem.getReturnedItem(); + String sellerUserID = itemBestOffer.getSeller().getUserID(); + BestOfferDetailsType bestOfferDetailsType = itemBestOffer.getBestOfferDetails(); + int inventoryQuantityItem = item.getQuantityAvailable(); //Quantity of the item + int bestOfferCount = itemBestOffer.getBestOfferDetails().getBestOfferCount(); + Boolean bestOfferIsEnabled = itemBestOffer.getBestOfferDetails().isBestOfferEnabled(); + //Check value of Best offer Detail not null + if ((bestOfferDetailsType != null) && (bestOfferCount > 0) && bestOfferIsEnabled.equals(true)) { + //Get base price from kindOfPrice parameter + Double doBasePrice = null; + if (priceType.equals("BUY_IT_NOW_PRICE")) { + doBasePrice = buyItNowPrice; + } else if (priceType.equals("START_PRICE")) { + doBasePrice = itemBestOffer.getStartPrice().getValue(); + } else if (priceType.equals("RESERVE_PRICE")) { + doBasePrice = itemBestOffer.getReservePrice().getValue(); + } else if (priceType.equals("RETAIL_PRICE")) { + //ignore + } else if (priceType.equals("SELLER_COST")) { + List<GenericValue> supplierProduct = delegator.findByAnd("SupplierProduct", "productId", SKUItem, UtilMisc.toList("availableFromDate DESC")); + String lastPrice = supplierProduct.get(0).getString("lastPrice"); + doBasePrice = Double.parseDouble(lastPrice); + } else if (priceType.equals("SECOND_CHANCE_PRICE")) { + VerifyAddSecondChanceItemCall verifyAddSecondChanceItemCall = new VerifyAddSecondChanceItemCall(apiContext); + doBasePrice = verifyAddSecondChanceItemCall.getBuyItNowPrice().getValue(); + } else if (priceType.equals("STORE_PRICE")) { + //ignore + } + BigDecimal basePrice = new BigDecimal(doBasePrice); + BigDecimal percent = new BigDecimal(100); + //Calculate price with base price and percent from parameter + BigDecimal acceptPrice = (basePrice.multiply(acceptPercentValue)).divide(percent); + BigDecimal greaterPrice = (basePrice.multiply(greaterPercentValue)).divide(percent); + BigDecimal lessThanPrice = (basePrice.multiply(lessThanPercentValue)).divide(percent); + BigDecimal rejectPrice = (basePrice.multiply(rejectPercentValue)).divide(percent); + + //GetBestOfferCall for get best offer detail + GetBestOffersCall getBestOfferCall = new GetBestOffersCall(apiContext); + getBestOfferCall.setItemID(itemID); + getBestOfferCall.setDetailLevel(detailLevel); + getBestOfferCall.setBestOfferStatus(BestOfferStatusCodeType.ALL); + getBestOfferCall.getBestOffers(); + BestOfferType[] bestOffers = getBestOfferCall.getReturnedBestOffers(); + List<String> acceptBestOfferIndexId = FastList.newInstance(); + SortedMap<String, Object> acceptBestOfferIDs = new TreeMap<String, Object>(); + //Loop for get data best offer from buyer + RespondToBestOfferCall respondToBestOfferCall = new RespondToBestOfferCall(apiContext); + respondToBestOfferCall.setItemID(itemID); + for (int offerCount = 0; offerCount < bestOffers.length; offerCount++) { + BestOfferType bestOfferType = bestOffers[offerCount]; + BestOfferStatusCodeType bestOfferStatusCodeType = bestOfferType.getStatus(); + //Check status of best offer + if (bestOfferStatusCodeType == BestOfferStatusCodeType.PENDING) { + String bestOfferID = bestOfferType.getBestOfferID(); + UserType buyer = bestOfferType.getBuyer(); + String buyerUserID = buyer.getUserID(); + AmountType price = bestOfferType.getPrice(); + String offerPrice = new Double(price.getValue()).toString(); + Double doCerrentPrice = Double.parseDouble(offerPrice); + int offerQuantity = bestOfferType.getQuantity(); + String[] bestOfferIDs = { bestOfferID }; + respondToBestOfferCall.setBestOfferIDs(bestOfferIDs); + + if (rejectOffer.equals("Y")) { + if (offerQuantity > inventoryQuantityItem) { + respondToBestOfferCall.setSellerResponse("Your order is more than inventory item's Buy-It-Now price."); + respondToBestOfferCall.setBestOfferAction(BestOfferActionCodeType.DECLINE); + respondToBestOfferCall.respondToBestOffer(); + continue; + } + } + + String buyerMessage = bestOfferType.getBuyerMessage(); + if (ignoreOfferMessage.equals("Y") && UtilValidate.isNotEmpty(buyerMessage)) { + GenericValue userOfferCheck = delegator.findByPrimaryKey("EbayUserBestOffer", UtilMisc.toMap("itemId", itemID, "userId", buyerUserID)); + if (UtilValidate.isEmpty(userOfferCheck)) { + GenericValue ebayUserBestOffer = delegator.makeValue("EbayUserBestOffer"); + ebayUserBestOffer.put("productStoreId", productStoreId); + ebayUserBestOffer.put("itemId", itemID); + ebayUserBestOffer.put("userId", buyerUserID); + ebayUserBestOffer.put("bestOfferId", bestOfferID); + ebayUserBestOffer.put("contactStatus", "NOT_CONTACT"); + ebayUserBestOffer.create(); + } + continue; + } + BigDecimal cerrentPrice = new BigDecimal(doCerrentPrice); + if (cerrentPrice.compareTo(acceptPrice) >= 0) { + acceptBestOfferIndexId.add(bestOfferID); + String Quantity = String.valueOf(offerQuantity); + acceptBestOfferIDs.put(bestOfferID, Quantity); + } else if ((cerrentPrice.compareTo(greaterPrice) >= 0) && (cerrentPrice.compareTo(lessThanPrice) <= 0 ) && rejectGreaterEnable.equals("Y")) { + respondToBestOfferCall.setBestOfferAction(BestOfferActionCodeType.DECLINE); + respondToBestOfferCall.setSellerResponse(rejectGreaterMsg); + respondToBestOfferCall.respondToBestOffer(); + } else if ((cerrentPrice.compareTo(rejectPrice) <= 0 && rejectLessEnable.equals("Y"))) { + respondToBestOfferCall.setBestOfferAction(BestOfferActionCodeType.DECLINE); + respondToBestOfferCall.setSellerResponse(rejectLessMsg); + respondToBestOfferCall.respondToBestOffer(); + } else { + respondToBestOfferCall.setBestOfferAction(BestOfferActionCodeType.DECLINE); + respondToBestOfferCall.respondToBestOffer(); + } + } + } + + if (acceptBestOfferIndexId.size() > 0) { + int quantityAvailable = inventoryQuantityItem; + Collections.sort(acceptBestOfferIndexId); + RespondToBestOfferCall respondAcceptBestOfferCall = new RespondToBestOfferCall(apiContext); + respondAcceptBestOfferCall.setItemID(itemID); + for (String bestOfferIdIndex : acceptBestOfferIndexId) { + if (quantityAvailable <= 0) break; + Integer offerQuantity = Integer.parseInt(acceptBestOfferIDs.get(bestOfferIdIndex).toString()); + String[] bestOfferID = { bestOfferIdIndex }; + respondAcceptBestOfferCall.setBestOfferIDs(bestOfferID); + //respondAcceptBestOfferCall.setBestOfferIDs(bestOfferID); + if (offerQuantity <= quantityAvailable) { + respondAcceptBestOfferCall.setBestOfferAction(BestOfferActionCodeType.ACCEPT); + quantityAvailable = quantityAvailable - offerQuantity; + } else { + respondAcceptBestOfferCall.setBestOfferAction(BestOfferActionCodeType.DECLINE); + } + respondAcceptBestOfferCall.respondToBestOffer(); + } + } + } + } + } + } catch (ApiException e){ + return ServiceUtil.returnError(e.getMessage()); + }catch(Exception e){ + return ServiceUtil.returnError(e.getMessage()); + } + return ServiceUtil.returnSuccess(); + } } Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java?rev=984366&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java (added) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java Wed Aug 11 10:39:10 2010 @@ -0,0 +1,182 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.ebaystore; + +import java.util.Locale; +import java.util.Map; + +import javolution.util.FastMap; + +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceUtil; + +import com.ebay.sdk.ApiContext; +import com.ebay.sdk.call.GetBestOffersCall; +import com.ebay.sdk.call.GetItemCall; +import com.ebay.sdk.call.RespondToBestOfferCall; +import com.ebay.soap.eBLBaseComponents.BestOfferActionCodeType; +import com.ebay.soap.eBLBaseComponents.BestOfferStatusCodeType; +import com.ebay.soap.eBLBaseComponents.BestOfferType; +import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; +import com.ebay.soap.eBLBaseComponents.ItemType; +import com.ebay.soap.eBLBaseComponents.UserType; + +public class EbayStoreCustomerService { + + public static String module = EbayStoreCustomerService.class.getName(); + + public static Map<String, Object> listBestOfferIncludeMessage(DispatchContext dctx, Map<String, ? extends Object> context) { + LocalDispatcher dispatcher = dctx.getDispatcher(); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + if (UtilValidate.isEmpty(context.get("userId")) || UtilValidate.isEmpty(context.get("itemId"))) { + return ServiceUtil.returnFailure("Required userId and itemId."); + } + Map <String, Object> result = FastMap.newInstance(); + try { + String itemId = (String) context.get("itemId"); + String bestOfferId = (String) context.get("bestOfferId"); + String productStoreId = (String) context.get("productStoreId"); + GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + Map<String, Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", productStoreId); + inMap.put("userLogin", userLogin); + Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap); + String userID = (String) resultUser.get("userLoginId"); + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + DetailLevelCodeType[] detailLevel = new DetailLevelCodeType[] { + DetailLevelCodeType.RETURN_ALL, + DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES, + DetailLevelCodeType.ITEM_RETURN_DESCRIPTION + }; + GetItemCall getItemCall = new GetItemCall(apiContext); + getItemCall.setDetailLevel(detailLevel); + getItemCall.setItemID(itemId); + getItemCall.getItem(); + ItemType item = getItemCall.getReturnedItem(); + String itemName = item.getTitle(); + GetBestOffersCall getBestOffersCall = new GetBestOffersCall(apiContext); + getBestOffersCall.setDetailLevel(detailLevel); + getBestOffersCall.setItemID(itemId); + getBestOffersCall.setBestOfferID(bestOfferId); + getBestOffersCall.getBestOffers(); + BestOfferType[] bestOffers = getBestOffersCall.getReturnedBestOffers(); + BestOfferType bestOffer = bestOffers[0]; + BestOfferStatusCodeType bestOfferStatus = bestOffer.getStatus(); + String offerStatus = bestOfferStatus.toString(); + String buyerMessage = bestOffer.getBuyerMessage(); + Double price = bestOffer.getPrice().getValue(); + String currentPrice = price.toString(); + Integer quantity = bestOffer.getQuantity(); + String orderQuantity = quantity.toString(); + UserType buyer = bestOffer.getBuyer(); + String buyerEmail = buyer.getEmail(); + result.put("email", buyerEmail); + result.put("message", buyerMessage); + result.put("price", currentPrice); + result.put("quantity", orderQuantity); + result.put("offerStatus", offerStatus); + result.put("itemName", itemName); + } catch (Exception e) { + return ServiceUtil.returnFailure("Error from listBestOfferIncludeMessage service "+ e); + } + return result; + } + public static Map<String, Object> updateContactStatus(DispatchContext dctx, Map<String, ? extends Object> context) { + LocalDispatcher dispatcher = dctx.getDispatcher(); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + if (UtilValidate.isEmpty(context.get("productStoreId")) || UtilValidate.isEmpty(context.get("userId")) || UtilValidate.isEmpty(context.get("itemId")) || UtilValidate.isEmpty(context.get("offerId")) || UtilValidate.isEmpty(context.get("contactSetting"))) { + return ServiceUtil.returnFailure("Required userId, itemId, productStoreId, OfferId and contactStatus."); + } + String userId = (String) context.get("userId"); + String itemId = (String) context.get("itemId"); + String itemName = (String) context.get("itemName"); + String productStoreId = (String) context.get("productStoreId"); + String offerId = (String) context.get("offerId"); + String contactStatus = (String) context.get("contactSetting"); + String price = (String) context.get("price"); + String email = (String) context.get("email"); + String quantity = (String) context.get("quantity"); + Map <String, Object> result = FastMap.newInstance(); + try { + GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + Map<String, Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", productStoreId); + inMap.put("userLogin", userLogin); + Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap); + String userID = (String) resultUser.get("userLoginId"); + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + String[] bestOfferIDs = {offerId}; + RespondToBestOfferCall respondToBestOfferCall = new RespondToBestOfferCall(apiContext); + respondToBestOfferCall.setItemID(itemId); + respondToBestOfferCall.setBestOfferIDs(bestOfferIDs); + if (contactStatus.equals("ACCEPT")) { + respondToBestOfferCall.setBestOfferAction(BestOfferActionCodeType.ACCEPT); + respondToBestOfferCall.respondToBestOffer(); + contactStatus = "FINISHED"; + } else if (contactStatus.equals("DECLINE")) { + respondToBestOfferCall.setBestOfferAction(BestOfferActionCodeType.DECLINE); + respondToBestOfferCall.respondToBestOffer(); + contactStatus = "FINISHED"; + } else { + return ServiceUtil.returnFailure("Required contactStatus setting."); + } + GenericValue ebayUserBestOffer = delegator.findByPrimaryKey("EbayUserBestOffer", UtilMisc.toMap("userId", userId, "itemId", itemId)); + ebayUserBestOffer.set("contactStatus", contactStatus); + ebayUserBestOffer.store(); + + result.put("userId", userId); + result.put("itemId", itemId); + result.put("productStoreId", productStoreId); + result.put("offerId", offerId); + result.put("contactStatus", contactStatus); + result.put("price", price); + result.put("email", email); + result.put("itemName", itemName); + result.put("quantity", quantity); + } catch (Exception e) { + return ServiceUtil.returnFailure("Error from updateContactStatus service "+ e); + } + return result; + } + public static Map<String, Object> deleteContactAlert(DispatchContext dctx, Map<String, ? extends Object> context) { + Delegator delegator = dctx.getDelegator(); + String productStoreId = (String) context.get("productStoreId"); + Map <String, Object> result = FastMap.newInstance(); + if (UtilValidate.isEmpty(context.get("itemId")) || UtilValidate.isEmpty(context.get("userId"))) { + return ServiceUtil.returnFailure("Required userId and itemId"); + } + String itemId = (String) context.get("itemId"); + String userId = (String) context.get("userId"); + try { + GenericValue ebayUserBestOffer = delegator.findByPrimaryKey("EbayUserBestOffer", UtilMisc.toMap("itemId", itemId, "userId", userId)); + ebayUserBestOffer.remove(); + result.put("productStoreId", productStoreId); + } catch (Exception e) { + return ServiceUtil.returnFailure("Error from deleteContactAlert service "+ e); + } + return result; + } +} 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=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Wed Aug 11 10:39:10 2010 @@ -406,6 +406,69 @@ <response name="success" type="view" value="errorMessageList"/> <response name="error" type="view" value="errorMessageList"/> </request-map> + <request-map uri="bestOffer"> + <security https="true" auth="true"/> + <response name="success" type="view" value="bestOffer"/> + <response name="error" type="view" value="bestOffer"/> + </request-map> + <request-map uri="setBestOffer"> + <security https="true" auth="true"/> + <event type="service" invoke="setBestOffer"/> + <response name="success" type="view" value="AutomationPreferences"/> + <response name="error" type="view" value="AutomationPreferences"/> + </request-map> + <request-map uri="ebayAutoPrefCond"> + <security https="true" auth="true"/> + <event type="java" path="org.ofbiz.ebaystore.EbayStoreAutoPrefEvents" invoke="ebayAutoPrefCond"/> + <response name="success" type="view" value="AutomationPreferences"/> + <response name="error" type="view" value="AutomationPreferences"/> + </request-map> + <request-map uri="ebayBestOfferPrefCond"> + <security https="true" auth="true"/> + <event type="service" invoke="ebayBestOfferPrefCond"/> + <response name="success" type="view" value="AutomationPreferences"/> + <response name="error" type="view" value="AutomationPreferences"/> + </request-map> + <request-map uri="createEbayProductStorePrefCond"> + <security auth="true" https="true"/> + <event type="service" invoke="createEbayProductStorePrefCond"/> + <response name="success" type="view" value="AutomationPreferences"/> + <response name="error" type="view" value="AutomationPreferences"/> + </request-map> + <request-map uri="updateEbayProductStorePrefCond"> + <security auth="true" https="true"/> + <event type="service" invoke="updateEbayProductStorePrefCond"/> + <response name="success" type="view" value="AutomationPreferences"/> + <response name="error" type="view" value="AutomationPreferences"/> + </request-map> + <request-map uri="customerService"> + <security https="true" auth="true"/> + <response name="success" type="view" value="customerService"/> + <response name="error" type="view" value="customerService"/> + </request-map> + <request-map uri="customerOfferData"> + <security https="true" auth="true"/> + <response name="success" type="view" value="customerOfferData"/> + <response name="error" type="view" value="customerOfferData"/> + </request-map> + <request-map uri="listBestOfferIncludeMessage"> + <security auth="true" https="true"/> + <event type="service" invoke="listBestOfferIncludeMessage"/> + <response name="success" type="view" value="customerService"/> + <response name="error" type="view" value="customerService"/> + </request-map> + <request-map uri="updateContactStatus"> + <security auth="true" https="true"/> + <event type="service" invoke="updateContactStatus"/> + <response name="success" type="view" value="customerOfferData"/> + <response name="error" type="view" value="customerOfferData"/> + </request-map> + <request-map uri="deleteContactAlert"> + <security auth="true" https="true"/> + <event type="service" invoke="deleteContactAlert"/> + <response name="success" type="view" value="customerService"/> + <response name="error" type="view" value="customerService"/> + </request-map> <!-- end of request mappings --> <!-- View Mappings --> @@ -451,6 +514,8 @@ <view-map name="WaitingToShipping" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#WaitingToShipping"/> <view-map name="ordersImported" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#ordersImported"/> <view-map name="errorMessageList" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#errorMessageList"/> - + <!-- Customer Service--> + <view-map name="customerService" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#customerService"/> + <view-map name="customerOfferData" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#customerOfferData"/> <!-- end of view mappings --> </site-conf> Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml?rev=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml Wed Aug 11 10:39:10 2010 @@ -561,6 +561,50 @@ value="${bsh:billingAccount != null ? or </field> <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit/></field> </form> + <form name="bestOffer" type="single" target="ebayAutoPrefCond"> + <field name="productStoreId"><hidden value="${parameters.productStoreId}"/></field> + <field name="automateEnable" title="Enable" tooltip="${uiLabelMap.EbayEvaluateOn}" tooltip-style="h3"><check/></field> + <field name="kindOfPrice" title="Based Price" tooltip="${uiLabelMap.EbayBasedOn}" tooltip-style="h3"> + <drop-down> + <option key="" description="None Price"/> + <entity-options key-field-name="enumId" description="${enumId}" entity-name="Enumeration"> + <entity-constraint name="enumTypeId" operator="equals" value="EBAY_AUTO_PRICE"/> + </entity-options> + </drop-down> + </field> + <field name="acceptBestOfferValue" title="Percent value to accept" tooltip="${uiLabelMap.EbayAcceptTheBestOffer1}" tooltip-style="h3"><text/></field> + <field name="rejectOffer" title="Reject the offer" tooltip="${uiLabelMap.EbayRejectTheOffer}" tooltip-style="h3"><check/></field> + <field name="ignoreOfferMessage" title="Ignore offer message" tooltip="${uiLabelMap.EbayIgnoreTheOffer}" tooltip-style="h3"><check/></field> + <field name="rejectGreaterEnable" title="Enable rejection"><check/></field> + <field name="greaterValue" title="Greater price percent" tooltip="${uiLabelMap.EbayRejectGreaterRate1}" tooltip-style="h3"><text/></field> + <field name="lessValue" title="Less price percent" tooltip="${uiLabelMap.EbayRejectGreaterRate2}" tooltip-style="h3"><text/></field> + <field name="rejectGreaterMsg" title="${uiLabelMap.EbayRejectGreaterRate3}"><textarea cols="100" rows="2"/></field> + <field name="dummy" title=" "><display/></field> + <field name="rejectLessEnable" title="Enable rejection"><check/></field> + <field name="lessThanValue" title="Less price percent" tooltip="${uiLabelMap.EbayRejectLessRate1}" tooltip-style="h3"><text/></field> + <field name="rejectLessMsg" title="${uiLabelMap.EbayRejectGreaterRate3}"><textarea cols="100" rows="2"/></field> + <field name="save"><submit/> + </field> + <sort-order> + <field-group title="Enable Best Offer" collapsible="true"> + <sort-field name="automateEnable"/> + <sort-field name="kindOfPrice"/> + <sort-field name="acceptBestOfferValue"/> + <sort-field name="rejectOffer"/> + <sort-field name="ignoreOfferMessage"/> + </field-group> + <field-group title="Rejection Notifications" collapsible="true"> + <sort-field name="rejectGreaterEnable"/> + <sort-field name="greaterValue"/> + <sort-field name="lessValue"/> + <sort-field name="rejectGreaterMsg"/> + <sort-field name="dummy"/> + <sort-field name="rejectLessEnable"/> + <sort-field name="lessThanValue"/> + <sort-field name="rejectLessMsg"/> + </field-group> + </sort-order> + </form> <form name="EditItemProduct" target="editItemProduct" type="upload" > <field name="productStoreId"><hidden value="${parameters.productStoreId}"/></field> <field name="itemId"><hidden value="${parameters.itemId}"/></field> @@ -574,4 +618,86 @@ value="${bsh:billingAccount != null ? or <field name="currencyId" title="Currency Code"><display/></field> <field name="submit" title="${uiLabelMap.CommonUpdate}"><submit/></field> </form> + <form name="bestOfferIncludeMessage" type="list" title="" list-name="listIt" + odd-row-style="alternate-row" default-table-style="basic-table"> + <actions> + <set field="productStoreId" from-field="parameters.productStoreId"/> + <entity-and entity-name="EbayUserBestOffer" list="listIt"> + <field-map field-name="productStoreId" from-field="parameters.productStoreId"/> + </entity-and> + </actions> + <row-actions> + + <set field="userId" value="${userId}"/> + <set field="itemId" value="${itemId}"/> + <set field="bestOfferId" value="${bestOfferId}"/> + <set field="contactStatus" value="${contactStatus}"/> + <service service-name="listBestOfferIncludeMessage" result-map="inMap"> + <field-map field-name="userId" from-field="userId"/> + <field-map field-name="itemId" from-field="itemId"/> + <field-map field-name="bestOfferId" from-field="bestOfferId"/> + <field-map field-name="productStoreId" from-field="productStoreId"/> + </service> + </row-actions> + + <field name="itemId" title="Item ID"><display description="${itemId}"/></field> + <field name="itemName" title="Item Name"><display description="${inMap.itemName}"/></field> + <field name="userId" title="User ID"><display description="${userId}"/></field> + <field name="message" title="Message"><hidden value="${inMap.message}"/></field> + <field name="userEmail" title="Email"><hidden value="${inMap.email}"/></field> + <field name="offerStatus" title="Offer Status"><display description="${inMap.offerStatus}"/></field> + <field name="contactStatus" title="Contact Status"><display description="${contactStatus}"/></field> + <field name="viewCustomerDataButton" widget-style="buttontext" title="View Customer Offer Data"> + <hyperlink target="customerOfferData" description="View Data" also-hidden="false"> + <parameter param-name="productStoreId" from-field="productStoreId"/> + <parameter param-name="itemId" from-field="itemId"/> + <parameter param-name="userId" from-field="userId"/> + <parameter param-name="offerId" from-field="bestOfferId"/> + <parameter param-name="itemName" value="${inMap.itemName}"/> + <parameter param-name="email" value="${inMap.email}"/> + <parameter param-name="message" value="${inMap.message}"/> + <parameter param-name="quantity" value="${inMap.quantity}"/> + <parameter param-name="price" value="${inMap.price}"/> + <parameter param-name="contactStatus" from-field="contactStatus"/> + </hyperlink> + </field> + <field name="deleteOfferButton" title="Delete Offer Alert Data" widget-style="buttontext"> + <hyperlink target="deleteContactAlert" description="Delete Data" also-hidden="false"> + <parameter param-name="itemId" from-field="itemId"/> + <parameter param-name="userId" from-field="userId"/> + <parameter param-name="productStoreId" from-field="productStoreId"/> + </hyperlink> + </field> + </form> + <form name="viewCustomerOfferData" type="single" target="updateContactStatus"> + <field name="customerUserId" title="Customer User ID"><display description="${userId}"/></field> + <field name="productId" title="Item Id"><display description="${itemId}"/></field> + <field name="productName" title="Item Name"><display description="${itemName}"/></field> + <field name="orderQuantity"><display description="${quantity}"/></field> + <field name="offerPrice"><display description="${price}"/></field> + <field name="customerEmail"><display description="${email}"/></field> + <field name="customerMessage"><display description="${message}"/></field> + <field name="currentContact"><display description="${contactStatus}"/></field> + + <field name="userId"><hidden value="${userId}"/></field> + <field name="itemId"><hidden value="${itemId}"/></field> + <field name="itemName"><hidden value="${itemName}"/></field> + <field name="productStoreId"><hidden value="${productStoreId}"/></field> + <field name="offerId"><hidden value="${offerId}"/></field> + <field name="price"><hidden value="${price}"/></field> + <field name="message"><hidden value="${message}"/></field> + <field name="email"><hidden value="${email}"/></field> + <field name="quantity"><hidden value="${quantity}"/></field> + <field name="contactStatus"><hidden value="${contactStatus}"/></field> + <field name="contactSetting" title="Contact Status Setting"> + <drop-down > + <option key="_NA_" description="_Select_"/> + <option key="NOT_CONTACT" description="Not Contact"/> + <option key="CONTACTING" description="Contacting"/> + <option key="ACCEPT" description="Accept Offer"/> + <option key="DECLINE" description="Decline Offer"/> + </drop-down> + </field> + <field name="updateContactStatus"><submit button-type="button"/></field> + </form> </forms> Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml?rev=984366&r1=984365&r2=984366&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml Wed Aug 11 10:39:10 2010 @@ -269,6 +269,9 @@ <screenlet title="${uiLabelMap.EbayBlockItemOutOfStock}" id="blockItemsOutOfStock" collapsible="true" initially-collapsed="true"> <include-form name="blockItemsOutOfStock" location="component://ebaystore/widget/EbaySellingManagerForms.xml"/> </screenlet> + <screenlet title="${uiLabelMap.AutoBestOfferSetting}" id="bestOfferSetting" collapsible="true" initially-collapsed="true"> + <include-form name="bestOffer" location="component://ebaystore/widget/EbaySellingManagerForms.xml"/> + </screenlet> </decorator-section> </decorator-screen> </widgets> @@ -582,4 +585,50 @@ </widgets> </section> </screen> + <screen name="customerService"> + <section> + <actions> + <set field="headerItem" value="ebayStore"/> + <service service-name="getEbayStoreUser" result-map="result"> + <field-map field-name="productStoreId" from-field="parameters.productStoreId"/> + </service> + <set field="productStoreId" from-field="parameters.productStoreId"/> + <set field="userLoginId" from-field="result.userLoginId"/> + </actions> + <widgets> + <decorator-screen name="SellingManagerDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet name="ebayCustomerService" title="Customer Offer Included Message" collapsible="true"> + <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="bestOfferIncludeMessage"/> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="customerOfferData"> + <section> + <actions> + <set field="productStoreId" value="${parameters.productStoreId}"/> + <set field="itemId" value="${parameters.itemId}"/> + <set field="userId" value="${parameters.userId}"/> + <set field="itemName" value="${parameters.itemName}"/> + <set field="email" value="${parameters.email}"/> + <set field="quantity" value="${parameters.quantity}"/> + <set field="price" value="${parameters.price}"/> + <set field="message" value="${parameters.message}"/> + <set field="offerId" value="${parameters.offerId}"/> + <set field="contactStatus" value="${parameters.contactStatus}"/> + </actions> + <widgets> + <decorator-screen name="SellingManagerDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet name="customerData" title="Customer Offer Data"> + <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="viewCustomerOfferData"/> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> </screens> |
| Free forum by Nabble | Edit this page |
