ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hans...@apache.org
Subject svn commit: r910474 - in /ofbiz/trunk/specialpurpose/ebaystore: config/ script/org/ofbiz/ebaystore/ servicedef/ src/org/ofbiz/ebaystore/ webapp/ebaystore/WEB-INF/ webapp/ebaystore/WEB-INF/actions/store/ widget/
Date Tue, 16 Feb 2010 11:09:13 GMT
Author: hansbak
Date: Tue Feb 16 11:09:12 2010
New Revision: 910474

URL: http://svn.apache.org/viewvc?rev=910474&view=rev
Log:
Ebaystore update:
1. function for  open unpaid item dispute when items status is not unpaid or check out not
complete.
2.  when user select unpaid at the item the system will show section for add reason and explaination
for dispute.

Added:
    ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayStoreEvents.xml
    ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/SoldAction.groovy
Modified:
    ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml
    ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
    ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml
    ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml
    ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml

Modified: ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml?rev=910474&r1=910473&r2=910474&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml Tue Feb 16 11:09:12
2010
@@ -196,6 +196,9 @@
     <property key="eBayFixedPrice">
         <value xml:lang="en">Fixed Price</value>
     </property>
+    <property key="EbayStoreOpenUnpaidItemDispute">
+        <value xml:lang="en">Open unpaid item dispute</value>
+    </property>
     <property key="requireEbayInventory">
         <value xml:lang="en">Require eBay Inventory</value>
     </property>

Added: ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayStoreEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayStoreEvents.xml?rev=910474&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayStoreEvents.xml (added)
+++ ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayStoreEvents.xml Tue
Feb 16 11:09:12 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
+    <simple-method method-name="checkEbayAction" short-description="Check eBay Action">
+    	<set field="resultResponse" from-field="parameters.action"/>
+    	<return response-code="${resultResponse}"/>
+    </simple-method>   
+</simple-methods>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml?rev=910474&r1=910473&r2=910474&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml Tue Feb 16 11:09:12 2010
@@ -168,6 +168,8 @@
     <service name="getEbaySoldItems" engine="java"  transaction-timeout="3600"
         location="org.ofbiz.ebaystore.EbayStore" invoke="getEbaySoldItems" auth="true">
         <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="soldItems" mode="OUT" type="List" optional="true"/>
     </service>
     <service name="automaticEbayRelistSoldItems" engine="java"  transaction-timeout="3600"
@@ -283,10 +285,40 @@
         <attribute type="String" mode="IN" name="paymentMoneyXferAccepted" optional="true"/>
         <attribute type="String" mode="IN" name="paymentPersonalCheck" optional="true"/>
     </service>
-    
     <service name="updateEbayProductStoreInventory" default-entity-name="EbayProductStoreInventory"
engine="entity-auto" invoke="update" auth="true">
         <description>Update EbayProductStoreInventory entity</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
+    <service name="addEbayDispute" engine="java"  transaction-timeout="3600"
+        location="org.ofbiz.ebaystore.EbayStore" invoke="addEbayDispute" auth="true">
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
+        <attribute name="itemId" mode="IN" type="String" optional="false"/>
+        <attribute name="transactionId" mode="IN" type="String" optional="false"/>
+        <attribute name="disputeReasonCodeType" mode="IN" type="String" optional="false"/>
+        <attribute name="disputeExplanationCodeType" mode="IN" type="String" optional="false"/>
+        <attribute name="disputeId" mode="OUT" type="String" optional="false"/>
+    </service>
+    <service name="checkEbaySecondChanceOffer" engine="java"  transaction-timeout="3600"
+        location="org.ofbiz.ebaystore.EbayStore" invoke="checkEbaySecondChanceOffer" auth="true">
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"></attribute>
+    	<attribute name="itemId" mode="IN" type="String" optional="false"></attribute>
+    	<attribute name="isSecondChance" mode="OUT" type="Boolean" optional="false"></attribute>
+    </service>
+    <service name="addEbaySecondChanceOffer" engine="java"  transaction-timeout="3600"
+        location="org.ofbiz.ebaystore.EbayStore" invoke="addEbaySecondChanceOffer" auth="true">
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
+        <attribute name="duration" mode="IN" type="String" optional="false"/>
+        <attribute name="itemId" mode="IN" type="String" optional="false"/>
+        <attribute name="duration" mode="IN" type="String" optional="false"/>
+        <attribute name="recipientBidderUserId" mode="IN" type="String" optional="false"/>
+    	<attribute name="buyItNowPrice" mode="IN" type="String" optional="true"/>
+    	<attribute name="sellerMessage" mode="IN" type="String" optional="true"/>
+    </service>
+    <service name="getEbayAllBidders" engine="java"  transaction-timeout="3600"
+        location="org.ofbiz.ebaystore.EbayStore" invoke="getEbayAllBidders" auth="true">
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
+        <attribute name="itemId" mode="IN" type="String" optional="false"/>
+    	<attribute name="bidders" mode="OUT" type="List" optional="true"/>
+    </service>
 </services>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=910474&r1=910473&r2=910474&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java Tue Feb 16
11:09:12 2010
@@ -27,6 +27,7 @@
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.Calendar;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
@@ -73,9 +74,12 @@
 import com.ebay.sdk.SdkException;
 import com.ebay.sdk.SdkSoapException;
 import com.ebay.sdk.call.*;
+import com.ebay.sdk.helper.ui.ControlTagItem;
 import com.ebay.soap.eBLBaseComponents.AbstractRequestType;
 import com.ebay.soap.eBLBaseComponents.DeleteSellingManagerTemplateRequestType;
 import com.ebay.soap.eBLBaseComponents.DeleteSellingManagerTemplateResponseType;
+import com.ebay.soap.eBLBaseComponents.DisputeExplanationCodeType;
+import com.ebay.soap.eBLBaseComponents.DisputeReasonCodeType;
 import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryRequestType;
 import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryResponseType;
 import com.ebay.soap.eBLBaseComponents.GetStoreOptionsRequestType;
@@ -114,6 +118,8 @@
 import com.ebay.soap.eBLBaseComponents.StoreThemeArrayType;
 import com.ebay.soap.eBLBaseComponents.StoreThemeType;
 import com.ebay.soap.eBLBaseComponents.StoreType; 
+import com.ebay.soap.eBLBaseComponents.SummaryFrequencyCodeType;
+import com.ebay.soap.eBLBaseComponents.SummaryWindowPeriodCodeType;
 import com.ebay.soap.eBLBaseComponents.TaskStatusCodeType;
 
 import java.sql.Timestamp;
@@ -1421,45 +1427,64 @@
 			GetSellingManagerSoldListingsCall sellingManagerSoldListings = new GetSellingManagerSoldListingsCall(apiContext);
 			sellingManagerSoldListings.getSellingManagerSoldListings();
 			SellingManagerSoldOrderType[] sellingManagerSoldOrders = sellingManagerSoldListings.getReturnedSaleRecord();
-			if(sellingManagerSoldOrders != null){
+			if (sellingManagerSoldOrders != null) {
 				int soldOrderLength = sellingManagerSoldOrders.length;
-				for(int i=0; i<soldOrderLength; i++){
+				for (int i=0; i<soldOrderLength; i++) {
 					SellingManagerSoldOrderType sellingManagerSoldOrder = sellingManagerSoldOrders[i];
-					if(sellingManagerSoldOrder != null){
+					if (sellingManagerSoldOrder != null) {
 						SellingManagerSoldTransactionType[] sellingManagerSoldTransactions = sellingManagerSoldOrder.getSellingManagerSoldTransaction();
 						int sellingManagerSoldTransactionLength = sellingManagerSoldTransactions.length;
-						for(int j=0;j<sellingManagerSoldTransactionLength;j++){
+						for (int j=0; j < sellingManagerSoldTransactionLength; j++) {
 							Map<String, Object> entry = FastMap.newInstance();
 							SellingManagerSoldTransactionType sellingManagerSoldTransaction = sellingManagerSoldTransactions[j];
 							entry.put("itemId",sellingManagerSoldTransaction.getItemID());
 							entry.put("title",sellingManagerSoldTransaction.getItemTitle());
-							if(soldItems!=null){
-								int soldItemsLength = soldItems.size();
-								boolean checkStatus = false;
-								for(int check=0;check<soldItemsLength;check++){
-									Map checkMap = (Map)soldItems.get(check);
-									if(checkMap.get("itemId").equals(entry.get("itemId"))){
-										checkStatus = true;
-									}
+							entry.put("transactionId",sellingManagerSoldTransaction.getTransactionID());
+							entry.put("quantity",sellingManagerSoldTransaction.getQuantitySold());
+							entry.put("listingType",sellingManagerSoldTransaction.getListingType().value());
+
+							String unpaidItemStatus = null;
+							if (sellingManagerSoldOrder.getUnpaidItemStatus() != null) {
+								unpaidItemStatus  = sellingManagerSoldOrder.getUnpaidItemStatus().value();
+							}
+							entry.put("unpaidItemStatus", unpaidItemStatus);
+							Date creationTime = null;
+							if (sellingManagerSoldOrder.getCreationTime() != null) {
+								creationTime = sellingManagerSoldOrder.getCreationTime().getTime();
+							}
+							entry.put("creationTime", creationTime);
+							double totalAmount = 0;
+							if (sellingManagerSoldOrder.getTotalAmount() != null) {
+								totalAmount  = sellingManagerSoldOrder.getTotalAmount().getValue();
+							}
+							entry.put("totalAmount", totalAmount);
+							if (sellingManagerSoldOrder.getSalePrice() != null) {
+								entry.put("salePrice", sellingManagerSoldOrder.getSalePrice().getValue());
+							}
+							Date paidTime = null;
+							String checkoutStatus = null;
+							if (sellingManagerSoldOrder.getOrderStatus() != null) {
+								if (sellingManagerSoldOrder.getOrderStatus().getPaidTime() != null) {
+									paidTime  = sellingManagerSoldOrder.getOrderStatus().getPaidTime().getTime();
 								}
-								if(!checkStatus){
-									soldItems.add(entry);
+								if (sellingManagerSoldOrder.getOrderStatus().getCheckoutStatus() != null) {
+									checkoutStatus  = sellingManagerSoldOrder.getOrderStatus().getCheckoutStatus().value();
 								}
-							}else{
-								soldItems.add(entry);
 							}
+							entry.put("paidTime", paidTime);
+							entry.put("checkoutStatus", checkoutStatus);
+							soldItems.add(entry);
 						}
 					}
 				}
 			}
 			result.put("soldItems", soldItems);
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
 			return ServiceUtil.returnError(e.getMessage());
 		}
 		return result;
 	}
-	public static Map<String, Object> automaticEbayRelistSoldItems(DispatchContext dctx,
Map<String, ? extends Object> context){
+	public static Map<String, Object> automaticEbayRelistSoldItems(DispatchContext dctx,
Map<String, ? extends Object> context) {
 		Map<String, Object>result = FastMap.newInstance();
 		LocalDispatcher dispatcher = dctx.getDispatcher();
 		GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -1469,39 +1494,39 @@
 			Map<String, Object>serviceMap = FastMap.newInstance();
 			serviceMap.put("userLogin", userLogin);
 			List<GenericValue>stores = delegator.findByAnd("ProductStore", UtilMisc.toMap());
-			for(int storeCount=0;storeCount<stores.size();storeCount++){
+			for(int storeCount=0;storeCount<stores.size();storeCount++) {
 				String productStoreId = stores.get(storeCount).getString("productStoreId");
 				serviceMap.put("productStoreId", productStoreId);
 				Map eBayUserLogin = dispatcher.runSync("getEbayStoreUser", serviceMap);
 				String eBayUserLoginId = (String)eBayUserLogin.get("userLoginId");
-				if(eBayUserLoginId != null){
+				if(eBayUserLoginId != null) {
 					List<GenericValue>jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("authUserLoginId",
eBayUserLoginId));
-					if(jobs.size() != 0){
+					if(jobs.size() != 0) {
 						GenericValue job = jobs.get(0);
 						Timestamp startDateTime = (Timestamp)job.get("startDateTime");
 						Timestamp finishDateTime = (Timestamp)job.get("finishDateTime");
 						//check can re-list items by eBay account setting
 						boolean canRelistItems = false;
 						Timestamp nowTime = UtilDateTime.nowTimestamp();
-						if(startDateTime!=null&&finishDateTime!=null){
-							if(startDateTime.before(nowTime) && finishDateTime.after(nowTime)){
+						if(startDateTime!=null&&finishDateTime!=null) {
+							if(startDateTime.before(nowTime) && finishDateTime.after(nowTime)) {
 								canRelistItems = true;
 							}
-						}else if(startDateTime!=null&&finishDateTime==null){
-							if(startDateTime.before(nowTime)){
+						}else if(startDateTime!=null&&finishDateTime==null) {
+							if(startDateTime.before(nowTime)) {
 								canRelistItems = true;
 							}
 						}
-						if(canRelistItems){
+						if(canRelistItems) {
 							//save sold items to OFbBiz product entity
 							Map resultService = dispatcher.runSync("getEbaySoldItems", serviceMap);
 							List soldItems = (List)resultService.get("soldItems");
-							if(soldItems.size()!=0){
-								for(int itemCount=0;itemCount<soldItems.size();itemCount++){
+							if(soldItems.size()!=0) {
+								for(int itemCount=0;itemCount<soldItems.size();itemCount++) {
 									Map soldItemMap = (Map)soldItems.get(itemCount);
-									if(UtilValidate.isNotEmpty(soldItemMap.get("itemId"))){
+									if(UtilValidate.isNotEmpty(soldItemMap.get("itemId"))) {
 										GenericValue productCheck = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId",
soldItemMap.get("itemId")));
-										if(productCheck == null){
+										if(productCheck == null) {
 											GenericValue product = delegator.makeValue("Product");
 											product.set("productId", soldItemMap.get("itemId"));
 											product.set("internalName", soldItemMap.get("title"));
@@ -1518,10 +1543,10 @@
 							resultService = dispatcher.runSync("getEbayActiveItems", serviceMap);
 							List activeItems = (List)resultService.get("activeItems");
 							List<String> activeItemMaps = FastList.newInstance();
-							if(activeItems.size()!=0){
-								for(int itemCount=0;itemCount<activeItems.size();itemCount++){
+							if(activeItems.size()!=0) {
+								for(int itemCount=0;itemCount<activeItems.size();itemCount++) {
 									Map activeItemMap = (Map)activeItems.get(itemCount);
-									if(UtilValidate.isNotEmpty(activeItemMap.get("itemId"))){
+									if(UtilValidate.isNotEmpty(activeItemMap.get("itemId"))) {
 										activeItemMaps.add((String)activeItemMap.get("itemId"));
 									}
 								}
@@ -1536,7 +1561,7 @@
 							EntityCondition andCond =  EntityCondition.makeCondition(andExpr, EntityOperator.AND);
 				
 							List itemsToRelist = delegator.findList("Product", andCond, null, null, null, false);
-							if(itemsToRelist.size() != 0){
+							if(itemsToRelist.size() != 0) {
 								//re-list sold items and not active
 								Map<String, Object> inMap = FastMap.newInstance();
 								inMap.put("productStoreId", productStoreId);
@@ -1544,7 +1569,7 @@
 								Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap);
 								String userID = (String)resultUser.get("userLoginId");
 								ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
-								for(int itemRelist=0;itemRelist<itemsToRelist.size();itemRelist++){
+								for(int itemRelist=0;itemRelist<itemsToRelist.size();itemRelist++) {
 									RelistItemCall relistItemCall = new RelistItemCall(apiContext);
 									ItemType itemToBeRelisted = new ItemType();
 									GenericValue product = (GenericValue)itemsToRelist.get(itemRelist);
@@ -1568,38 +1593,38 @@
 	}
 	
 	/* ebay store block out of stock items */
-	public static Map<String,Object> getSellingInventory(DispatchContext dctx, Map<String,Object>
context){
+	public static Map<String,Object> getSellingInventory(DispatchContext dctx, Map<String,Object>
context) {
 	       Locale locale = (Locale) context.get("locale");
 	       Delegator delegator = dctx.getDelegator();
 	       Map<String,Object> result = FastMap.newInstance();
 	       GetSellingManagerInventoryRequestType req = new GetSellingManagerInventoryRequestType();
 	       GetSellingManagerInventoryResponseType resp =  null;
 
-	       if(context.get("productStoreId") != null){
+	       if(context.get("productStoreId") != null) {
 	           GetSellingManagerInventoryCall call = new GetSellingManagerInventoryCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
locale, delegator));
 
 	           try {
 	        	   Map<String,Object> ebayResp = FastMap.newInstance();
 	               SellingManagerProductType[] returnedSellingManagerProductType = null;
 	               resp = (GetSellingManagerInventoryResponseType)call.execute(req);
-	               if(resp != null && "SUCCESS".equals(resp.getAck().toString())){
+	               if(resp != null && "SUCCESS".equals(resp.getAck().toString())) {
 	                   returnedSellingManagerProductType  = resp.getSellingManagerProduct();
 	                   //result = ServiceUtil.returnSuccess("load store data success..");
-	                   for (int i=0;i<returnedSellingManagerProductType.length;i++){
+	                   for (int i=0;i<returnedSellingManagerProductType.length;i++) {
 	                      SellingManagerProductInventoryStatusType sellingProductInventory =
returnedSellingManagerProductType[i].getSellingManagerProductInventoryStatus();
 	                      SellingManagerProductDetailsType prodDetailType = returnedSellingManagerProductType[i].getSellingManagerProductDetails();
 	                      Long productID = (Long)prodDetailType.getProductID();
 	                      int qty = prodDetailType.getQuantityAvailable();
 
-	                      if (qty == 0){
+	                      if (qty == 0) {
 	                    	  SellingManagerTemplateDetailsArrayType sellingTempArr =  returnedSellingManagerProductType[i].getSellingManagerTemplateDetailsArray();
 	                          SellingManagerTemplateDetailsType[] selllingTempType = null;
-	                          if (UtilValidate.isNotEmpty(sellingTempArr)){
+	                          if (UtilValidate.isNotEmpty(sellingTempArr)) {
 	                        	  selllingTempType = sellingTempArr.getSellingManagerTemplateDetails();
 	                          }
 
-	                          if (selllingTempType.length > 0){
-	                        	  for (int j=0;j<selllingTempType.length;j++){
+	                          if (selllingTempType.length > 0) {
+	                        	  for (int j=0;j<selllingTempType.length;j++) {
 	                                  Long longTemplete = Long.parseLong(selllingTempType[j].getSaleTemplateID());
 	                                  DeleteSellingManagerTemplateCall tcall = new DeleteSellingManagerTemplateCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
locale, delegator));
 	                                  DeleteSellingManagerTemplateRequestType treq = new DeleteSellingManagerTemplateRequestType();
@@ -1607,7 +1632,7 @@
 	                                  treq.setSaleTemplateID(longTemplete);
 
 	                                  tresp = (DeleteSellingManagerTemplateResponseType) tcall.execute(treq);
-	                                  if(tresp != null && "SUCCESS".equals(tresp.getAck().toString())){
+	                                  if(tresp != null && "SUCCESS".equals(tresp.getAck().toString()))
{
 	                                      ebayResp.put("TemplateID", tresp.getDeletedSaleTemplateID());
 	                                      ebayResp.put("TemplateName", tresp.getDeletedSaleTemplateName());
 	                                      result.put("itemBlocked", ebayResp);
@@ -1617,7 +1642,7 @@
 	                      }
 	                   }
 	                   result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
-	                   if (UtilValidate.isNotEmpty(ebayResp.get("TemplateID"))){
+	                   if (UtilValidate.isNotEmpty(ebayResp.get("TemplateID"))) {
 	                	   result.put(ModelService.SUCCESS_MESSAGE, "block "+ebayResp.get("TemplateID")+"
out of stock success..");
 	                   }else{
 	                	   result.put(ModelService.SUCCESS_MESSAGE, "no item out of stock");
@@ -1634,7 +1659,7 @@
 	       }
 	       return result;
 	   }
-    public static Map<String, Object> exportProductsFromEbayStore(DispatchContext dctx,
Map context){
+    public static Map<String, Object> exportProductsFromEbayStore(DispatchContext dctx,
Map context) {
         Map<String,Object> result = FastMap.newInstance();
         Locale locale = (Locale) context.get("locale");
         Delegator delegator = dctx.getDelegator();
@@ -1753,4 +1778,79 @@
         }
         return result;
     }
+    public static DisputeExplanationCodeType getEbayDisputeExplanationCodeType(String disputeExplanationCode)
{
+    	DisputeExplanationCodeType disputeExplanationCodeType = null;
+    	if (disputeExplanationCode != null) {
+	    	if (disputeExplanationCode.equals("BUYER_HAS_NOT_RESPONDED")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.BUYER_HAS_NOT_RESPONDED;
+	    	} else if (disputeExplanationCode.equals("BUYER_REFUSED_TO_PAY")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.BUYER_REFUSED_TO_PAY;
+	    	} else if (disputeExplanationCode.equals("BUYER_RETURNED_ITEM_FOR_REFUND")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.BUYER_RETURNED_ITEM_FOR_REFUND;
+	    	} else if (disputeExplanationCode.equals("UNABLE_TO_RESOLVE_TERMS")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.UNABLE_TO_RESOLVE_TERMS;
+	    	} else if (disputeExplanationCode.equals("BUYER_PURCHASING_MISTAKE")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.BUYER_PURCHASING_MISTAKE;
+	    	} else if (disputeExplanationCode.equals("SHIP_COUNTRY_NOT_SUPPORTED")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.SHIP_COUNTRY_NOT_SUPPORTED;
+	    	} else if (disputeExplanationCode.equals("SHIPPING_ADDRESS_NOT_CONFIRMED")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.SHIPPING_ADDRESS_NOT_CONFIRMED;
+	    	} else if (disputeExplanationCode.equals("PAYMENT_METHOD_NOT_SUPPORTED")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.PAYMENT_METHOD_NOT_SUPPORTED;
+	    	} else if (disputeExplanationCode.equals("BUYER_NO_LONGER_REGISTERED")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.BUYER_NO_LONGER_REGISTERED;
+	    	} else if (disputeExplanationCode.equals("BUYER_NO_LONGER_REGISTERED")) {
+				disputeExplanationCodeType = DisputeExplanationCodeType.BUYER_NO_LONGER_REGISTERED;
+	    	} else {
+				disputeExplanationCodeType = DisputeExplanationCodeType.OTHER_EXPLANATION;
+	    	}
+    	}else{
+			disputeExplanationCodeType = DisputeExplanationCodeType.OTHER_EXPLANATION;
+    	}
+    	return disputeExplanationCodeType;
+    }
+    public static DisputeReasonCodeType getEbayDisputeReasonCodeType(String disputeReasonCode)
{
+    	DisputeReasonCodeType disputeReasonCodeType = null;
+    	if (disputeReasonCode != null) {
+	    	if (disputeReasonCode.equals("TRANSACTION_MUTUALLY_CANCELED")) {
+	    		disputeReasonCodeType = DisputeReasonCodeType.TRANSACTION_MUTUALLY_CANCELED;
+	    	} else if (disputeReasonCode.equals("BUYER_HAS_NOT_PAID")) {
+	    		disputeReasonCodeType = DisputeReasonCodeType.BUYER_HAS_NOT_PAID;
+	    	}
+    	}
+		return disputeReasonCodeType;
+    }
+	public static Map<String, Object> addEbayDispute(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");
+		List soldItems = FastList.newInstance();
+		try {
+			String itemId = (String) context.get("itemId");
+			String transactionId = (String) context.get("transactionId");
+			DisputeReasonCodeType drct = EbayStore.getEbayDisputeReasonCodeType((String)context.get("disputeReasonCodeType"));
+		    DisputeExplanationCodeType dect = EbayStore.getEbayDisputeExplanationCodeType((String)
context.get("disputeExplanationCodeType"));
+		    DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
+		    		DetailLevelCodeType.RETURN_ALL,
+		    		DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES,
+		    		DetailLevelCodeType.ITEM_RETURN_DESCRIPTION
+		    	};
+		    ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
+		    AddDisputeCall api = new AddDisputeCall(apiContext);
+		    api.setDetailLevel(detailLevels);
+		    api.setItemID(itemId);
+		    api.setTransactionID(transactionId);
+		    api.setDisputeExplanation(dect);
+		    api.setDisputeReason(drct);
+
+		    String disputeId = api.addDispute();
+		    result.put("disputeId", disputeId);
+		} catch (Exception e) {
+            return ServiceUtil.returnError(e.getMessage());
+		}
+		return result;
+	}
 }
\ No newline at end of file

Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/SoldAction.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/SoldAction.groovy?rev=910474&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/SoldAction.groovy
(added)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/SoldAction.groovy
Tue Feb 16 11:09:12 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+import org.ofbiz.base.util.*;
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+actionList = FastList.newInstance();
+hasAction = false;
+
+if (unpaidItemStatus == null && paidTime == null && checkoutStatus != "CheckoutComplete")
{
+	inMap = FastMap.newInstance();
+	inMap.put("action","openUnpaid");
+	inMap.put("actionName","Open Unpaid");
+	actionList.add(inMap);
+	hasAction = true;
+}
+context.actionList = actionList;
+context.hasAction = hasAction;
\ No newline at end of file

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=910474&r1=910473&r2=910474&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Tue Feb 16
11:09:12 2010
@@ -23,6 +23,7 @@
     <include location="component://product/webapp/catalog/WEB-INF/controller.xml"/>
     <include location="component://ebay/webapp/ebay/WEB-INF/controller.xml"/>
     
+    
     <description>eBay Component Site Configuration File</description>
     <!-- request mappings -->
     <request-map uri="main">
@@ -102,7 +103,6 @@
         <response name="success" type="view" value="LeaveFeedback"/>
         <response name="error" type="view" value="LeaveFeedback"/>
     </request-map>
-    
     <!-- Automation Preferences -->
     <request-map uri="automationPreferences">
         <security auth="true" https="true"/>
@@ -186,6 +186,48 @@
         <response name="success" type="view" value="exportProductListing"/>
         <response name="error" type="view" value="exportProductListing"/>
     </request-map>
+	<!-- Active -->
+    <request-map uri="activeListing">
+    	<security auth="true" https="true"/>
+    	<response name="success" type="view" value="ActiveListing"/>
+    </request-map>
+    <request-map uri="assignAutomaticRule">
+    	<security auth="true" https="true"/>
+    	<response name="success" type="view" value="AssignAutomaticRule"/>
+    </request-map>
+    <!-- Sold -->
+    <request-map uri="soldListing">
+    	<security auth="true" https="true"/>
+    	<response name="success" type="view" value="SoldListing"/>
+    </request-map>
+    <request-map uri="openUnpaid">
+    	<security auth="true" https="true"/>
+    	<response name="success" type="view" value="OpenUnpaid"/>
+    </request-map>
+    <request-map uri="addDispute">
+    	<security auth="true" https="true"/>
+    	<event type="service" invoke="addEbayDispute"/>
+    	<response name="success" type="request-redirect" value="soldListing">
+    		<redirect-parameter name="productStoreId"/>
+    	</response>
+    	<response name="error" type="view" value="OpenUnpaid"/>
+    </request-map>
+    <request-map uri="doAction">
+    	<security auth="true" https="true"/>
+    	<event type="simple" path="component://ebaystore/script/org/ofbiz/ebaystore/EbayStoreEvents.xml"
invoke="checkEbayAction"/>
+    	<response name="makeSecondChanceOffer" type="request" value="makeSecondChanceOffer"/>
+    	<response name="openUnpaid" type="request" value="openUnpaid"/>
+    </request-map>
+    <request-map uri="makeSecondChanceOffer">
+    	<security auth="true" https="true"/>
+    	<response name="success" type="view" value="MakeSecondChanceOffer"/>
+    </request-map>
+    <request-map uri="addEbaySecondChanceOffer">
+    	<security auth="true" https="true"/>
+    	<event type="service" invoke="addEbaySecondChanceOffer"/>
+    	<response name="error" type="view" value="MakeSecondChanceOffer"/>
+    	<response name="success" type="view" value="SoldListing"/>
+    </request-map>
 	<!-- end of request mappings -->
     
     <!-- View Mappings -->
@@ -197,13 +239,11 @@
     <!-- ebay account -->
     <view-map name="NewEbayAccount" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#NewEbayAccount"/>
     <view-map name="EbayAccount" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#EbayAccount"/>
-  
     <!-- feedback -->
     <view-map name="FeedbackStore" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#FeedbackStore"/>
     <view-map name="Feedback" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#Feedback"/>
   
     <view-map name="LeaveFeedback" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#LeaveFeedback"/>

-    
-    <!-- AutomationPreferences -->
+   <!-- AutomationPreferences -->
     <view-map name="AutomationPreferences" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#EbayAutomationPreferences"/>
     <!-- block out of stock -->
     <view-map name="blockItemOutOfStock" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#blockItemOutOfStock"/>
@@ -215,5 +255,12 @@
     
     <view-map name="exportProductListing" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#exportProductListing"/>
     <view-map name="productsearch" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#productsearchexport"/>
+	<!-- Active -->    
+	<view-map name="ActiveListing" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#EbayActiveListing"/>
+	<view-map name="AssignAutomaticRule" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#AssignAutomaticRule"/>
+	<!-- Sold -->    
+	<view-map name="SoldListing" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#SoldListing"/>
+	<view-map name="OpenUnpaid" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#OpenUnpaid"/>
+	<view-map name="MakeSecondChanceOffer" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#MakeSecondChanceOffer"/>
     <!-- end of view mappings -->
 </site-conf>

Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml?rev=910474&r1=910473&r2=910474&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml Tue Feb 16 11:09:12 2010
@@ -154,4 +154,80 @@
         <field name="productStore" entry-name="parameters.productStoreId" ><display-entity
entity-name="ProductStore" description="${storeName} [${productStoreId}]" key-field-name="productStoreId"
></display-entity></field>
         <field name="submitButton" title="${uiLabelMap.BlockItemsOutOfStock}"><submit
button-type="button"/></field>
     </form>
+    <!-- Sold Items List -->
+	<form name="SoldItemList" type="list"  target="doAction" list-name="soldItemList"
+    	odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table
hover-bar" use-row-submit="true" separate-columns="true">
+    	<row-actions>
+    		<script location="component://ebaystore/webapp/ebaystore/WEB-INF/actions/store/SoldAction.groovy"/>
+    	</row-actions>
+    	<field name="productStoreId"><hidden value="${parameters.productStoreId}"/></field>
+    	<field name="itemId"><display description="${itemId} - ${title}"/></field>
+    	<field name="listingType"><display description="${listingType}"/></field>
+    	<field name="quantity"><display description="${quantity}"/></field>
+    	<field name="transactionId"><display description="${transactionId}"/></field>
+    	<field name="salePrice"><display description="${salePrice}"/></field>
+    	<field name="totalAmount"><display description="${totalAmount}"/></field>
+    	<field name="creationTime"><display description="${creationTime}" type="date"/></field>
+    	<field name="paidTime"><display description="${paidTime}" type="date"/></field>
+    	<field name="checkoutStatus"><display description="${checkoutStatus}"/></field>
+    	<field name="unpaidItemStatus"><display description="${unpaidItemStatus}"/></field>
+    	<field name="action" use-when="&quot;${hasAction}&quot;==&quot;true&quot;">
+    		<drop-down>
+    			<list-options key-name="action" list-name="actionList" description="${actionName}"/>
+    		</drop-down>
+    	</field>
+    	<field name="submitButton"  use-when="&quot;${hasAction}&quot;==&quot;true&quot;"
title="${uiLabelMap.CommonSubmit}"><submit/></field>
+    </form>
+    <form name="OpenUnpaid" type="single" target="addDispute">
+    	<field name="productStoreId"><hidden value="${parameters.productStoreId}"/></field>
+    	<field name="itemId"><hidden value="${parameters.itemId}"/></field>
+    	<field name="item"><text disabled="true" default-value="${parameters.itemId}
- ${parameters.title}"/></field>
+    	<field name="listingType"><text disabled="true" default-value="${parameters.listingType}"/></field>
+    	<field name="quantity"><text disabled="true" default-value="${parameters.quantity}"/></field>
+    	<field name="salePrice"><text disabled="true" default-value="${parameters.salePrice}"/></field>
+    	<field name="transactionId"><hidden value="${parameters.transactionId}"/></field>
+    	<field name="transaction"><text disabled="true" default-value="${parameters.transactionId}"/></field>
+    	<field name="disputeReasonCodeType">
+    		<radio no-current-selected-key="TransactionMutuallyCanceled">
+    			<option key="BUYER_HAS_NOT_PAID" description="The buyer has not paid for the item"/>
+    			<option key="TRANSACTION_MUTUALLY_CANCELED" description="We have both agreed not
to complete the transaction"/>
+    		</radio>
+    	</field>
+   		<field name="disputeExplanationCodeType">
+    		<drop-down>
+    			<option key="" description="- - Select One - -"/>
+    			<option key="BUYER_PURCHASING_MISTAKE" description="Buyer purchased item by mistake
or changed mind"/>
+    			<option key="BUYER_RETURNED_ITEM_FOR_REFUND" description="Buyer is returning item
for a refund"/>
+    			<option key="UNABLE_TO_RESOLVE_TERMS" description="Buyer and I disagreed over terms"/>
+    			<option key="BUYER_HAS_NOT_RESPONDED" description="Buyer is unresponsive"/>
+    			<option key="PAYMENT_METHOD_NOT_SUPPORTED" description="Buyer's payment hasn't
been received or hasn't cleared"/>
+    			<option key="SHIPPING_ADDRESS_NOT_CONFIRMED" description="Buyer requested shipment
to an unconfirmed address"/>
+    			<option key="SHIP_COUNTRY_NOT_SUPPORTED" description="Seller doesn't ship to the
country requested by buyer"/>
+ 	  			<option key="OTHER_EXPLANATION" description="Other reason"/>
+    		</drop-down>
+    	</field>
+    	<field name="submitButton" title="${uiLabelMap.CommonSubmit}" position="1"><submit/></field>
+    	<field name="cancelButton" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit"
position="2">
+    		<hyperlink target="soldListing" description="${uiLabelMap.CommonCancel}">
+    			<parameter param-name="productStoreId" from-field="parameters.productStoreId"/>
+    		</hyperlink>
+    	</field>
+	</form>
+    <form name="MakeSecondChanceOffer" type="single" target="addEbaySecondChanceOffer">
+    	<auto-fields-service service-name="addEbaySecondChanceOffer"/>
+    	<field name="duration">
+    		<drop-down>
+    			<option key="DAYS_1" description="a day"/>
+    			<option key="DAYS_3" description="3 days"/>
+    			<option key="DAYS_5" description="5 days"/>
+    			<option key="DAYS_7" description="7 days"/>
+    		</drop-down>
+    	</field>
+    	<field name="recipientBidderUserId">
+    		<drop-down>
+    			<list-options key-name="userId" list-name="bidders" description="${userId}"/>
+    		</drop-down>
+    	</field>
+    	<field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit/></field>
+    </form>   
 </forms>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml?rev=910474&r1=910473&r2=910474&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml Tue Feb 16 11:09:12 2010
@@ -53,6 +53,11 @@
                 <parameter param-name="productStoreId" value="${parameters.productStoreId}"/>
             </link>
         </menu-item>
+        <menu-item name="soldListing" title="${uiLabelMap.EbayStoreOpenUnpaidItemDispute}">
+            <link target="soldListing">
+                <parameter param-name="productStoreId" value="${parameters.productStoreId}"/>
+            </link>
+        </menu-item>
         <menu-item name="feedback" title="${uiLabelMap.EbayFeedback}">
             <link target="Feedback">
                 <parameter param-name="productStoreId" value="${parameters.productStoreId}"/>

Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml?rev=910474&r1=910473&r2=910474&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml Tue Feb 16 11:09:12 2010
@@ -595,4 +595,52 @@
             </widgets>
         </section>
     </screen>
+	<screen name="EbaySoldListing">
+        <section>
+            <actions>
+                <set field="tabButtonItem" value="soldListing"/>                
+            </actions>
+            <widgets>
+               <decorator-screen name="permission-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                    	<decorator-section-include name="body"/>
+                	</decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="SoldListing">
+    	<section>
+    		<actions>
+    			<service service-name="getEbaySoldItems" result-map="result">
+                	<field-map field-name="productStoreId" from-field="parameters.productStoreId"/>
+                	<field-map field-name="status" from-field="parameters.status"/>
+                	<field-map field-name="period" from-field="parameters.period"/>
+                </service>
+                <set field="soldItemList" from-field="result.soldItems"/>
+    		</actions>
+    		<widgets>
+    			<decorator-screen name="EbaySoldListing">
+    				<decorator-section name="body">
+                   		<screenlet title="Sold Listing">
+                   			<include-form location="component://ebaystore/widget/EbayStoreForms.xml"
name="SoldItemList"/>
+                   		</screenlet>
+    				</decorator-section>
+    			</decorator-screen>
+    		</widgets>
+    	</section>
+    </screen>
+    <screen name="OpenUnpaid">
+    	<section>
+    		<widgets>
+    			<decorator-screen name="EbaySoldListing">
+    				<decorator-section name="body">
+    					<screenlet title="Open Unpaid">
+                   			<include-form location="component://ebaystore/widget/EbayStoreForms.xml"
name="OpenUnpaid"/>
+                   		</screenlet>
+                   	</decorator-section>
+    			</decorator-screen>
+    		</widgets>
+    	</section>
+    </screen>
 </screens>
\ No newline at end of file



Mime
View raw message