svn commit: r926987 [22/26] - in /ofbiz/branches/multitenant20100310: ./ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/fixedasset/ applications/accou...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r926987 [22/26] - in /ofbiz/branches/multitenant20100310: ./ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/fixedasset/ applications/accou...

jonesde
Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java Wed Mar 24 09:23:07 2010
@@ -43,6 +43,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.common.DataModelConstants;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -63,6 +64,7 @@ import com.ebay.sdk.ApiException;
 import com.ebay.sdk.SdkException;
 import com.ebay.sdk.SdkSoapException;
 import com.ebay.sdk.call.*;
+import com.ebay.sdk.util.eBayUtil;
 import com.ebay.soap.eBLBaseComponents.AmountType;
 import com.ebay.soap.eBLBaseComponents.CheckoutStatusCodeType;
 import com.ebay.soap.eBLBaseComponents.CurrencyCodeType;
@@ -77,14 +79,24 @@ import com.ebay.soap.eBLBaseComponents.G
 import com.ebay.soap.eBLBaseComponents.GetStoreOptionsResponseType;
 import com.ebay.soap.eBLBaseComponents.GetStoreRequestType;
 import com.ebay.soap.eBLBaseComponents.GetStoreResponseType;
+import com.ebay.soap.eBLBaseComponents.ItemSortTypeCodeType;
+import com.ebay.soap.eBLBaseComponents.ListingTypeCodeType;
 import com.ebay.soap.eBLBaseComponents.MerchDisplayCodeType;
 import com.ebay.soap.eBLBaseComponents.OfferType;
+import com.ebay.soap.eBLBaseComponents.OrderTransactionArrayType;
+import com.ebay.soap.eBLBaseComponents.OrderTransactionType;
+import com.ebay.soap.eBLBaseComponents.OrderType;
+import com.ebay.soap.eBLBaseComponents.PaginationType;
 import com.ebay.soap.eBLBaseComponents.SecondChanceOfferDurationCodeType;
 import com.ebay.soap.eBLBaseComponents.SellingManagerProductDetailsType;
 import com.ebay.soap.eBLBaseComponents.SellingManagerProductInventoryStatusType;
 import com.ebay.soap.eBLBaseComponents.SellingManagerProductType;
+import com.ebay.soap.eBLBaseComponents.SellingManagerSearchType;
+import com.ebay.soap.eBLBaseComponents.SellingManagerSearchTypeCodeType;
+import com.ebay.soap.eBLBaseComponents.SellingManagerSoldListingsPropertyTypeCodeType;
 import com.ebay.soap.eBLBaseComponents.SellingManagerTemplateDetailsArrayType;
 import com.ebay.soap.eBLBaseComponents.SellingManagerTemplateDetailsType;
+import com.ebay.soap.eBLBaseComponents.SellingStatusType;
 import com.ebay.soap.eBLBaseComponents.SetStoreCategoriesRequestType;
 import com.ebay.soap.eBLBaseComponents.SetStoreCategoriesResponseType;
 import com.ebay.soap.eBLBaseComponents.SetStoreRequestType;
@@ -110,10 +122,16 @@ import com.ebay.soap.eBLBaseComponents.S
 import com.ebay.soap.eBLBaseComponents.StoreThemeType;
 import com.ebay.soap.eBLBaseComponents.StoreType;
 import com.ebay.soap.eBLBaseComponents.TaskStatusCodeType;
+import com.ebay.soap.eBLBaseComponents.TransactionArrayType;
+import com.ebay.soap.eBLBaseComponents.TransactionType;
 import com.ebay.soap.eBLBaseComponents.UserType;
 import com.ebay.soap.eBLBaseComponents.VerifyAddSecondChanceItemResponseType;
 
 import java.sql.Timestamp;
+
+import javax.swing.event.TableModelListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableModel;
 
 import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType;
 import com.ebay.soap.eBLBaseComponents.ItemArrayType;
@@ -1403,6 +1421,10 @@ public class EbayStore {
         Delegator delegator = dctx.getDelegator();
         Locale locale = (Locale) context.get("locale");
         String productStoreId = (String) context.get("productStoreId");
+        String filter = (String) context.get("filter");
+        String itemId = (String) context.get("itemId");
+        String buyerId = (String) context.get("buyerId");
+        String listingType = (String) context.get("listingType");
         List soldItems = FastList.newInstance();
         try {
             Map<String, Object> inMap = FastMap.newInstance();
@@ -1412,10 +1434,26 @@ public class EbayStore {
             String userID = (String) resultUser.get("userLoginId");
             ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
             GetSellingManagerSoldListingsCall sellingManagerSoldListings = new GetSellingManagerSoldListingsCall(apiContext);
+            if (UtilValidate.isNotEmpty(filter)) {
+                SellingManagerSoldListingsPropertyTypeCodeType[] filterObject = {SellingManagerSoldListingsPropertyTypeCodeType.valueOf(filter)};
+                sellingManagerSoldListings.setFilter(filterObject );
+            }
+            if (UtilValidate.isNotEmpty(itemId)) {
+                SellingManagerSearchType search = new SellingManagerSearchType();
+                search.setSearchType(SellingManagerSearchTypeCodeType.ITEM_ID);
+                search.setSearchValue(itemId);
+                sellingManagerSoldListings.setSearch(search);
+            }
+            if (UtilValidate.isNotEmpty(buyerId)) {
+                SellingManagerSearchType search = new SellingManagerSearchType();
+                search.setSearchType(SellingManagerSearchTypeCodeType.BUYER_USER_ID);
+                search.setSearchValue(buyerId);
+                sellingManagerSoldListings.setSearch(search);
+            }
             sellingManagerSoldListings.getSellingManagerSoldListings();
             SellingManagerSoldOrderType[] sellingManagerSoldOrders = sellingManagerSoldListings.getReturnedSaleRecord();
 
-            if (sellingManagerSoldOrders != null) {
+            if (UtilValidate.isNotEmpty(sellingManagerSoldOrders)) {
                 int soldOrderLength = sellingManagerSoldOrders.length;
                 for (int i = 0; i < soldOrderLength; i++) {
                     SellingManagerSoldOrderType sellingManagerSoldOrder = sellingManagerSoldOrders[i];
@@ -1438,7 +1476,7 @@ public class EbayStore {
                             entry.put("buyer", buyer);
                             String buyerEmail = null;
                             if (sellingManagerSoldOrder.getBuyerID() != null) {
-                             buyerEmail  = sellingManagerSoldOrder.getBuyerEmail();
+                                buyerEmail  = sellingManagerSoldOrder.getBuyerEmail();
                             }
                             entry.put("buyerEmail", buyerEmail);
                             GetItemCall api = new GetItemCall(apiContext);
@@ -1493,7 +1531,7 @@ public class EbayStore {
                                     shippedStatus = sellingManagerSoldOrder.getOrderStatus().getShippedStatus().value();
                                 }
                                 if (sellingManagerSoldOrder.getOrderStatus().getShippedTime() != null) {
-                                 shippedTime = sellingManagerSoldOrder.getOrderStatus().getShippedTime().getTime();
+                                    shippedTime = sellingManagerSoldOrder.getOrderStatus().getShippedTime().getTime();
                                 }
                             }
                             entry.put("paidTime", paidTime);
@@ -1819,4 +1857,322 @@ public class EbayStore {
         }
         return ServiceUtil.returnSuccess("Add Second Chance Offer Successful.");
     }
+
+    public Map<String, Object> getMyeBaySelling(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 unsoldItems = FastList.newInstance();
+        try {
+            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);
+            GetMyeBaySellingCall api = new GetMyeBaySellingCall(apiContext);
+            ItemListCustomizationType itemListType = new ItemListCustomizationType();
+            itemListType.setInclude(Boolean.TRUE);
+
+            String entriesPerPage = (String) context.get("entriesPerPage");
+            String pageNumber = (String) context.get("pageNumber");
+            String listingType = (String) context.get("listingType");
+
+            PaginationType page = new PaginationType();
+            if (UtilValidate.isNotEmpty(entriesPerPage)) {
+                page.setEntriesPerPage(Integer.valueOf(entriesPerPage));
+            }
+            if (UtilValidate.isNotEmpty(pageNumber)) {
+                page.setPageNumber(Integer.valueOf(pageNumber));
+            }
+            itemListType.setPagination(page);
+            if (UtilValidate.isNotEmpty(listingType)) {
+                itemListType.setListingType(ListingTypeCodeType.valueOf(listingType));
+            }
+            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
+                    DetailLevelCodeType.RETURN_ALL,
+                    DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES,
+                    DetailLevelCodeType.ITEM_RETURN_DESCRIPTION
+            };
+            api.setDetailLevel(detailLevels);
+            api.setActiveList(itemListType);
+            api.setScheduledList(itemListType);
+            api.setSoldList(itemListType);
+            api.setUnsoldList(itemListType);
+            api.getMyeBaySelling();
+            ItemType[] tempActiveItems = null;
+            if (api.getReturnedActiveList() != null) tempActiveItems = (api.getReturnedActiveList().getItemArray()).getItem();
+            final ItemType[] activeItems = tempActiveItems;
+            // Display active items in table.
+            AbstractTableModel dataModel = new AbstractTableModel() {
+                public int getColumnCount() { return 0; }
+                public int getRowCount() { return activeItems == null ? 0 : activeItems.length;}
+                public Map<String, Object> getValueAt(int row, int col) {
+                    ItemType item = activeItems[row];
+                    return itemToColumns(item);
+                }
+            };
+            //add To List
+            List<Map> activeList = getDataModelToList(dataModel);
+            int activeSize = dataModel.getRowCount();
+            ItemType[] tempItems = null;
+            if (api.getReturnedScheduledList() != null) tempItems = (api.getReturnedScheduledList().getItemArray()).getItem();
+            final ItemType[] scheItems = tempItems;
+            // Display Scheduled items in table.
+            dataModel = new AbstractTableModel() {
+                public int getColumnCount() { return 0; }
+                public int getRowCount() { return scheItems == null ? 0 : scheItems.length;}
+                public Map<String, Object> getValueAt(int row, int col) {
+                    ItemType item = scheItems[row];
+                    return schItemToColumns(item);
+                }
+            };
+            // set data
+            List<Map> scheduledList = getDataModelToList(dataModel);
+            int scheduledSize = dataModel.getRowCount();
+            OrderTransactionType[] tempSoldItems = null;
+            if (UtilValidate.isNotEmpty(api.getReturnedSoldList())) tempSoldItems = (api.getReturnedSoldList().getOrderTransactionArray()).getOrderTransaction();
+            // add to list
+            List<Map> soldList =  EbayStore.getOrderTransactions(tempSoldItems);
+            int soldSize = tempSoldItems == null ? 0 : tempSoldItems.length;
+            ItemType[] tempUnSoldItems = null;
+            if (UtilValidate.isNotEmpty(api.getReturnedUnsoldList())) tempUnSoldItems = (api.getReturnedUnsoldList().getItemArray()).getItem();
+            final ItemType[] unSoldItems = tempUnSoldItems;
+            // Display unsold items in table.
+            dataModel = new AbstractTableModel() {
+                public int getColumnCount() { return 0; }
+                public int getRowCount() { return unSoldItems == null ? 0 : unSoldItems.length;}
+                public Map<String, Object> getValueAt(int row, int col) {
+                    ItemType item = unSoldItems[row];
+                    return unsoldItemToColumns(item);
+                }
+            };
+            // add to list
+            List<Map> unsoldList = getDataModelToList(dataModel);
+            int unsoldSize = dataModel.getRowCount();
+            //list to result
+            result.put("activeItems", activeList);
+            result.put("soldItems", soldList);
+            result.put("unsoldItems", unsoldList);
+            result.put("scheduledItems", scheduledList);
+            //page control to result;
+            result.put("activeSize", activeSize);
+            result.put("soldSize", soldSize);
+            result.put("unsoldeSize", unsoldSize);
+            result.put("scheduledSize", scheduledSize);
+        } catch (Exception e) {
+            return ServiceUtil.returnError(e.getMessage());
+        }
+        return result;
+    }
+    // set output data list (MyeBaySelling)
+    public List<Map> getDataModelToList(TableModel dataModel) {
+        List<Map> list = FastList.newInstance();
+        for (int rowIndex = 0; rowIndex < dataModel.getRowCount(); rowIndex++) {
+            list.add((Map<String, Object>) dataModel.getValueAt(rowIndex, 0));
+        }
+        return list;
+    }
+    static Map<String, Object> itemToColumns(ItemType item) {
+        Map<String, Object> cols = FastMap.newInstance();
+        int i = 0;
+        cols.put("itemId", item.getItemID() != null ? item.getItemID() : "");
+        cols.put("title", item.getTitle() != null ? item.getTitle() : "");
+        
+        SellingStatusType sst = item.getSellingStatus();
+        double currentPrice = 0;
+        int bidCount = 0;
+        double reservPrice = 0;
+        int hitCount = 0;
+        if (UtilValidate.isNotEmpty(sst)) {
+            AmountType amt = sst.getCurrentPrice();
+            currentPrice = amt != null ? (new Double(amt.getValue())) : 0;
+            bidCount = sst.getBidCount() != null ? sst.getBidCount() : 0;
+        }
+        cols.put("buyItNowPrice", item.getBuyItNowPrice().getValue());
+        cols.put("currentPrice", currentPrice);
+        cols.put("bidCount", bidCount);
+
+        java.util.Calendar startTime = item.getListingDetails() == null ? null : item.getListingDetails().getStartTime();
+        cols.put("startTime", startTime != null ? eBayUtil.toAPITimeString(startTime.getTime()) : "");
+
+        Integer quantity = item.getQuantity();
+        String quantityStr = null;
+        if (UtilValidate.isNotEmpty(quantity)) quantityStr = quantity.toString();
+        cols.put("quantity", quantityStr);
+        cols.put("listingType", item.getListingType().value());
+        cols.put("viewItemURL", item.getListingDetails().getViewItemURL());
+        cols.put("SKU", item.getSKU());
+        if (UtilValidate.isNotEmpty(item.getReservePrice())) reservPrice = item.getReservePrice().getValue();
+        cols.put("reservePrice", reservPrice);
+        cols.put("hitCount", item.getHitCount() != null ? item.getHitCount() : 0);
+        return cols;
+    }
+
+    static Map<String, Object> schItemToColumns(ItemType item) {
+        Map<String, Object> cols = FastMap.newInstance();
+        int i = 0;
+        cols.put("itemId", item.getItemID() != null ? item.getItemID() : "");
+        cols.put("title", item.getTitle() != null ? item.getTitle() : "");
+
+        java.util.Calendar startTime = item.getListingDetails() == null ? null : item.getListingDetails().getStartTime();
+        cols.put("startTime", startTime != null ? eBayUtil.toAPITimeString(startTime.getTime()) : "");
+        AmountType amt = item.getStartPrice();
+        cols.put("StartPrice", amt != null ? (new Double(amt.getValue()).toString()) : "");
+
+        Integer quantity = item.getQuantity();
+        String quantityStr = null;
+        if (UtilValidate.isNotEmpty(quantity)) {
+            quantityStr = quantity.toString();
+        }
+        cols.put("quantity", quantityStr);
+        cols.put("listingType", item.getListingType().value());
+        return cols;
+    }
+
+    static Map<String, Object> unsoldItemToColumns(ItemType item) {
+        Map<String, Object> cols = FastMap.newInstance();
+        int i = 0;
+        cols.put("itemId", item.getItemID() != null ? item.getItemID() : "");
+        cols.put("title", item.getTitle() != null ? item.getTitle() : "");
+
+        AmountType amt = item.getStartPrice();
+        cols.put("price", amt != null ? (new Double(amt.getValue()).toString()) : "");
+
+        java.util.Calendar startTime = item.getListingDetails() == null ? null : item.getListingDetails().getStartTime();
+        cols.put("startTime", startTime != null ? eBayUtil.toAPITimeString(startTime.getTime()) : "");
+
+        java.util.Calendar endTime = item.getListingDetails() == null ? null : item.getListingDetails().getEndTime();
+        cols.put("endTime", endTime != null ? eBayUtil.toAPITimeString(endTime.getTime()) : "");
+
+        Integer quantity = item.getQuantity();
+        String quantityStr = null;
+        if (UtilValidate.isNotEmpty(quantity)) {
+            quantityStr = quantity.toString();
+        }
+        cols.put("quantity", quantityStr);
+        cols.put("listingType", item.getListingType().value());
+        return cols;
+    }
+
+    public static List<Map> getOrderTransactions(OrderTransactionType[] orderTrans) {
+        List<Map> colsList = FastList.newInstance();
+        OrderTransactionType orderTran = null;
+        OrderType order = null;
+        TransactionType transaction= null;
+        for (int rowIndex = 0; rowIndex < orderTrans.length; rowIndex++) {
+            orderTran = orderTrans[rowIndex];
+            order = orderTran.getOrder();
+            transaction = orderTran.getTransaction();
+            if (UtilValidate.isNotEmpty(order)) {
+                TransactionType[] trans = order.getTransactionArray().getTransaction();
+                String orderId = order.getOrderID();
+                for (int rowIndex1 = 0; rowIndex1 < trans.length; rowIndex1++) {
+                    colsList.add(EbayStore.getTransaction(trans[rowIndex1]));
+                }
+            } else {
+                colsList.add(EbayStore.getTransaction(transaction));
+            }
+        }
+        return colsList;
+    }
+
+    public static Map<String, Object> getTransaction(TransactionType transaction){
+        Map<String, Object> cols = FastMap.newInstance();
+        ItemType item = transaction.getItem();
+        String itemId = null;
+        String title = null;
+        if (UtilValidate.isNotEmpty(item)) {
+            itemId = item.getItemID();
+            title = item.getTitle();
+        }
+        cols.put("itemId", itemId);
+        cols.put("title", title);
+        UserType buyer = transaction.getBuyer();
+        String user = null;
+        if (UtilValidate.isNotEmpty(buyer)) user = buyer.getUserID();
+        cols.put("buyer", user);
+        cols.put("listingType", item.getListingType().value());
+        Date paidTime = null;
+        String checkoutStatus = null;
+        String eBayPaymentStatus = null;
+        String completeStatus = null;
+        String buyerPaidStatus = null;
+        Date shippedTime = null;
+        String unpaidItemStatus = null;
+        String transactionId = null;
+        double totalPrice = 0;
+        double transactionPrice = 0;
+        Date createdDate = null;
+        String sellerPaidStatus = null;
+        String orderId = null;
+        double adjustmentAmount = 0;
+        double amountPaid = 0;
+        if (UtilValidate.isNotEmpty(transaction.getStatus())) {
+            if (UtilValidate.isNotEmpty(transaction.getStatus().getCheckoutStatus())) {
+                checkoutStatus = transaction.getStatus().getCheckoutStatus().value();
+            }
+            if (UtilValidate.isNotEmpty(transaction.getStatus().getEBayPaymentStatus())) {
+                eBayPaymentStatus = transaction.getStatus().getEBayPaymentStatus().value();
+            }
+            if (UtilValidate.isNotEmpty(transaction.getStatus().getCompleteStatus())) {
+                completeStatus = transaction.getStatus().getCompleteStatus().value();
+            }
+        }
+        if (UtilValidate.isNotEmpty(transaction.getBuyerPaidStatus())) {
+            buyerPaidStatus = transaction.getBuyerPaidStatus().value();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getPaidTime())) {
+            paidTime = transaction.getPaidTime().getTime();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getShippedTime())) {
+            shippedTime = transaction.getShippedTime().getTime();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getTransactionID())) {
+            transactionId = transaction.getTransactionID().toString();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getTotalPrice())) {
+            totalPrice = transaction.getTotalPrice().getValue();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getTransactionPrice())) {
+            transactionPrice = transaction.getTransactionPrice().getValue();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getCreatedDate())) {
+            createdDate = transaction.getCreatedDate().getTime();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getSellerPaidStatus())) {
+            sellerPaidStatus = transaction.getSellerPaidStatus().value();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getContainingOrder())) {
+            if (UtilValidate.isNotEmpty(transaction.getContainingOrder().getCheckoutStatus())) {
+                checkoutStatus = transaction.getContainingOrder().getCheckoutStatus().getStatus().value();
+            }
+            orderId = transaction.getContainingOrder().getOrderID();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getAdjustmentAmount())) {
+            adjustmentAmount = transaction.getAdjustmentAmount().getValue();
+        }
+        if (UtilValidate.isNotEmpty(transaction.getAmountPaid())) {
+            amountPaid = transaction.getAmountPaid().getValue();
+        }
+        cols.put("amountPaid", amountPaid);
+        cols.put("adjustmentAmount", adjustmentAmount);
+        cols.put("orderId", orderId);
+        cols.put("checkoutStatus", checkoutStatus);
+        cols.put("eBayPaymentStatus", eBayPaymentStatus);
+        cols.put("completeStatus", completeStatus);
+        cols.put("buyerPaidStatus", buyerPaidStatus);
+        cols.put("paidTime", paidTime);
+        cols.put("shippedTime", shippedTime);
+        cols.put("quantity", transaction.getQuantityPurchased());
+        cols.put("transactionId", transactionId);
+        cols.put("transactionPrice", transactionPrice);
+        cols.put("totalPrice", totalPrice);
+        cols.put("createdDate", createdDate);
+        cols.put("sellerPaidStatus", sellerPaidStatus);
+        return cols;
+    }
 }
\ No newline at end of file

Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java Wed Mar 24 09:23:07 2010
@@ -59,6 +59,7 @@ import com.ebay.sdk.ApiContext;
 import com.ebay.sdk.ApiException;
 import com.ebay.sdk.SdkException;
 import com.ebay.sdk.SdkSoapException;
+import com.ebay.sdk.call.AddItemCall;
 import com.ebay.sdk.call.AddOrderCall;
 import com.ebay.sdk.call.AddDisputeCall;
 import com.ebay.sdk.call.DeleteSellingManagerTemplateCall;
@@ -70,6 +71,7 @@ import com.ebay.soap.eBLBaseComponents.A
 import com.ebay.soap.eBLBaseComponents.AddOrderResponseType;
 import com.ebay.soap.eBLBaseComponents.AmountType;
 import com.ebay.sdk.call.RelistItemCall;
+import com.ebay.sdk.util.eBayUtil;
 import com.ebay.soap.eBLBaseComponents.AutomatedLeaveFeedbackEventCodeType;
 import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType;
 import com.ebay.soap.eBLBaseComponents.CommentTypeCodeType;
@@ -83,6 +85,8 @@ import com.ebay.soap.eBLBaseComponents.F
 import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryRequestType;
 import com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryResponseType;
 import com.ebay.soap.eBLBaseComponents.ItemType;
+import com.ebay.soap.eBLBaseComponents.ListingDurationCodeType;
+import com.ebay.soap.eBLBaseComponents.ListingDurationDefinitionType;
 import com.ebay.soap.eBLBaseComponents.OrderType;
 import com.ebay.soap.eBLBaseComponents.ItemType;
 import com.ebay.soap.eBLBaseComponents.SellingManagerOrderStatusType;
@@ -1097,4 +1101,49 @@ public class EbayStoreAutoPreferences {
         return result;
     }
 
+    public static Map<String, Object> autoRelistingItems(DispatchContext dctx, Map<String, ? extends Object> context) {
+        Map<String, Object> itemObject = FastMap.newInstance();
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        Delegator delegator = dctx.getDelegator();
+        Locale locale = (Locale) context.get("locale");
+        try {
+            GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system");
+            EntityCondition expression1 = EntityCondition.makeCondition("autoRelisting", EntityOperator.EQUALS, "Y");
+            EntityCondition expression2 = EntityCondition.makeCondition("endDateTime", EntityOperator.LESS_THAN, UtilDateTime.nowTimestamp());
+            EntityCondition expression3 = EntityCondition.makeCondition("itemId", EntityOperator.NOT_EQUAL, null);
+            List expressions = FastList.newInstance();
+            expressions.add(expression1);
+            expressions.add(expression2);
+            expressions.add(expression3);
+            EntityCondition cond = EntityCondition.makeCondition(expressions, EntityOperator.AND);
+            List<GenericValue> ebayProductListings = delegator.findList("EbayProductListing", cond , null, null, null, false);
+            for (int index = 0; index < ebayProductListings.size(); index++) {
+                Map<String, Object> inMap = FastMap.newInstance();
+                AddItemCall addItemCall = new AddItemCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
+                GenericValue ebayProductListing = ebayProductListings.get(index);
+                ItemType item = EbayStoreHelper.prepareAddItem(delegator, ebayProductListing);
+                addItemCall.setItem(item);
+                itemObject.put("addItemCall", addItemCall);
+                itemObject.put("productListingId", ebayProductListing.getString("productListingId"));
+                inMap.put("itemObject", itemObject);
+                inMap.put("userLogin", userLogin);
+                Map<String, Object>result = dispatcher.runSync("exportProductEachItem", inMap);
+                String success = (String) result.get("responseMessage");
+                if ("success".equals(success)) {
+                    String duration = item.getListingDuration();
+                    if (duration.length() > 4) {
+                        Timestamp startDateTime = UtilDateTime.nowTimestamp();
+                        int durationInt = Integer.parseInt(duration.replace("DAYS_", ""));
+                        Timestamp endDateTime = UtilDateTime.addDaysToTimestamp(startDateTime, durationInt);
+                        ebayProductListing.set("startDateTime", startDateTime);
+                        ebayProductListing.set("endDateTime", endDateTime);
+                        ebayProductListing.store();
+                    }
+                }
+            }
+        } catch (Exception e) {
+            return ServiceUtil.returnError(e.getMessage());
+        }
+        return ServiceUtil.returnSuccess();
+    }
 }

Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java Wed Mar 24 09:23:07 2010
@@ -24,10 +24,17 @@ import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.Calendar;
+
+import javax.servlet.http.HttpServletRequest;
 
 import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
@@ -49,7 +56,39 @@ import com.ebay.sdk.ApiAccount;
 import com.ebay.sdk.ApiContext;
 import com.ebay.sdk.ApiCredential;
 import com.ebay.sdk.ApiLogging;
+import com.ebay.sdk.call.AddItemCall;
+import com.ebay.sdk.call.AddOrderCall;
+import com.ebay.sdk.call.GetOrdersCall;
+import com.ebay.soap.eBLBaseComponents.AddItemRequestType;
+import com.ebay.soap.eBLBaseComponents.AddItemResponseType;
+import com.ebay.soap.eBLBaseComponents.AddOrderRequestType;
+import com.ebay.soap.eBLBaseComponents.AddOrderResponseType;
+import com.ebay.soap.eBLBaseComponents.AmountType;
+import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType;
+import com.ebay.soap.eBLBaseComponents.CategoryType;
+import com.ebay.soap.eBLBaseComponents.CountryCodeType;
+import com.ebay.soap.eBLBaseComponents.CurrencyCodeType;
+import com.ebay.soap.eBLBaseComponents.GetOrdersRequestType;
+import com.ebay.soap.eBLBaseComponents.GetOrdersResponseType;
+import com.ebay.soap.eBLBaseComponents.GeteBayDetailsResponseType;
+import com.ebay.soap.eBLBaseComponents.ItemType;
+import com.ebay.soap.eBLBaseComponents.ListingDesignerType;
+import com.ebay.soap.eBLBaseComponents.ListingTypeCodeType;
+import com.ebay.soap.eBLBaseComponents.OrderArrayType;
+import com.ebay.soap.eBLBaseComponents.OrderIDArrayType;
+import com.ebay.soap.eBLBaseComponents.OrderStatusCodeType;
+import com.ebay.soap.eBLBaseComponents.OrderType;
+import com.ebay.soap.eBLBaseComponents.PictureDetailsType;
+import com.ebay.soap.eBLBaseComponents.ReturnPolicyType;
+import com.ebay.soap.eBLBaseComponents.ShipmentTrackingDetailsType;
+import com.ebay.soap.eBLBaseComponents.ShippingDetailsType;
+import com.ebay.soap.eBLBaseComponents.ShippingServiceCodeType;
+import com.ebay.soap.eBLBaseComponents.ShippingServiceOptionsType;
+import com.ebay.soap.eBLBaseComponents.ShippingTypeCodeType;
 import com.ebay.soap.eBLBaseComponents.SiteCodeType;
+import com.ebay.soap.eBLBaseComponents.ShippingLocationDetailsType;
+import com.ebay.soap.eBLBaseComponents.TradingRoleCodeType;
+import com.ebay.soap.eBLBaseComponents.VATDetailsType;
 
 import org.ofbiz.ebay.EbayHelper;
 
@@ -240,9 +279,8 @@ public class EbayStoreHelper {
             GenericValue ebayProductPref = delegator.findByPrimaryKey("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId));
             String jobId = ebayProductPref.getString("autoPrefJobId");
             if (UtilValidate.isNotEmpty(jobId)) {
-                GenericValue job = delegator.findByPrimaryKey("JobSandbox", UtilMisc.toMap("jobId", jobId));
-                job = EbayStoreHelper.getCurrentJob(delegator, userLogin, job);
-                if (!job.getString("statusId").equals("SERVICE_PENDING")) {
+                List<GenericValue> jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("parentJobId", jobId, "statusId", "SERVICE_PENDING"));
+                if (jobs.size() == 0) {
                     Map<String, Object>inMap = FastMap.newInstance();
                     inMap.put("jobId", jobId);
                     inMap.put("userLogin", userLogin);
@@ -319,12 +357,14 @@ public class EbayStoreHelper {
         try {
             GenericValue ebayProductPref = delegator.findByPrimaryKey("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId));
             String jobId = ebayProductPref.getString("autoPrefJobId");
-            GenericValue job = delegator.findByPrimaryKey("JobSandbox", UtilMisc.toMap("jobId", jobId));
-            job = EbayStoreHelper.getCurrentJob(delegator, userLogin, job);
+            List<GenericValue> jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("parentJobId", jobId ,"statusId", "SERVICE_PENDING"));
+
             Map<String, Object>inMap = FastMap.newInstance();
             inMap.put("userLogin", userLogin);
-            inMap.put("jobId", job.getString("jobId"));
-            dispatcher.runSync("cancelScheduledJob", inMap);
+            for (int index = 0; index < jobs.size(); index++) {
+                inMap.put("jobId", jobs.get(index).getString("jobId"));
+                dispatcher.runSync("cancelScheduledJob", inMap);
+            }
         } catch (GenericEntityException e) {
             return ServiceUtil.returnError(e.getMessage());
         } catch (GenericServiceException e) {
@@ -333,17 +373,330 @@ public class EbayStoreHelper {
         return result;
     }
 
-    private static GenericValue getCurrentJob(Delegator delegator, GenericValue userLogin, GenericValue job) {
+    public static void mappedPaymentMethods(Map requestParams, String itemPkCateId, Map<String,Object> addItemObject, ItemType item, HashMap attributeMapList) {
+        String refName = "itemCateFacade_"+itemPkCateId;
+        if (UtilValidate.isNotEmpty(addItemObject) && UtilValidate.isNotEmpty(requestParams)) {
+            EbayStoreCategoryFacade cf = (EbayStoreCategoryFacade) addItemObject.get(refName);
+            BuyerPaymentMethodCodeType[] paymentMethods = cf.getPaymentMethods();
+            if (UtilValidate.isNotEmpty(paymentMethods)) {
+                BuyerPaymentMethodCodeType[] tempPayments = new BuyerPaymentMethodCodeType[paymentMethods.length];
+                int i = 0;
+                for (BuyerPaymentMethodCodeType paymentMethod : paymentMethods) {
+                    String pmName = paymentMethod.value();
+                    String payPara = (String) requestParams.get("Payments_".concat(pmName));
+                    if ("true".equals(payPara)) {
+                        tempPayments[i] = paymentMethod;
+                        attributeMapList.put(""+pmName, pmName);
+                        if ("PayPal".equals(pmName)) {
+                            if (UtilValidate.isNotEmpty(requestParams.get("paymentMethodPaypalEmail"))) {
+                                item.setPayPalEmailAddress(requestParams.get("paymentMethodPaypalEmail").toString());
+                                attributeMapList.put("PaypalEmail", requestParams.get("paymentMethodPaypalEmail").toString());
+                            }
+                        }
+                        i++;
+                    }
+                }
+                item.setPaymentMethods(tempPayments);
+            }
+        }
+    }
+
+    public static void mappedShippingLocations(Map requestParams, ItemType item, ApiContext apiContext, HttpServletRequest request, HashMap attributeMapList) {
         try {
-            List<GenericValue> jobNew = delegator.findByAnd("JobSandbox", UtilMisc.toMap("previousJobId", job.getString("jobId")));
-            if (jobNew.size() != 0) {
-                job = EbayStoreHelper.getCurrentJob(delegator, userLogin, jobNew.get(0));
-            } else {
-                return job;
+            if (UtilValidate.isNotEmpty(requestParams)) {
+                EbayStoreSiteFacade sf = (EbayStoreSiteFacade) EbayEvents.getSiteFacade(apiContext, request);
+                Map<SiteCodeType, GeteBayDetailsResponseType> eBayDetailsMap = sf.getEBayDetailsMap();
+                GeteBayDetailsResponseType eBayDetails = eBayDetailsMap.get(apiContext.getSite());
+                ShippingLocationDetailsType[] shippingLocationDetails = eBayDetails.getShippingLocationDetails();
+                if (UtilValidate.isNotEmpty(shippingLocationDetails)) {
+                    int i = 0;
+                    String[] tempShipLocation = new String[shippingLocationDetails.length];
+                    for (ShippingLocationDetailsType shippingLocationDetail : shippingLocationDetails) {
+                        String shippingLocation = (String) shippingLocationDetail.getShippingLocation();
+                        String shipParam = (String)requestParams.get("Shipping_".concat(shippingLocation));
+                        if ("true".equals(shipParam)) {
+                            tempShipLocation[i] = shippingLocation;
+                            attributeMapList.put(""+shippingLocation, shippingLocation);
+                            i++;
+                        }
+                    }
+                    item.setShipToLocations(tempShipLocation);
+                }
+            }
+        } catch(Exception e) {
+            Debug.logError(e.getMessage(), module);
+        }
+    }
+
+    public static Map<String, Object> exportProductEachItem(DispatchContext dctx, Map<String, Object> context) {
+        Map<String,Object> result = FastMap.newInstance();
+        LocalDispatcher dispatcher = (LocalDispatcher) dctx.getDispatcher();
+        Delegator delegator = dctx.getDelegator();
+        Map<String, Object> itemObject = (Map<String, Object>) context.get("itemObject");
+        String productListingId = itemObject.get("productListingId").toString();
+        AddItemCall addItemCall = (AddItemCall) itemObject.get("addItemCall");
+        AddItemRequestType req = new AddItemRequestType();
+        AddItemResponseType resp = null;
+        try {
+            GenericValue userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+            ItemType item = addItemCall.getItem();
+            req.setItem(item);
+            resp = (AddItemResponseType) addItemCall.execute(req);
+            if (resp != null && "SUCCESS".equals(resp.getAck().toString()) || "WARNING".equals(resp.getAck().toString())) {
+                String itemId = resp.getItemID();
+                String listingXml = addItemCall.getRequestXml().toString();
+                Map<String, Object> updateItemMap = FastMap.newInstance();
+                updateItemMap.put("productListingId", productListingId);
+                updateItemMap.put("itemId", itemId);
+                updateItemMap.put("listingXml", listingXml);
+                updateItemMap.put("statusId", "ITEM_APPROVED");
+                updateItemMap.put("userLogin", userLogin);
+                try {
+                    dispatcher.runSync("updateEbayProductListing", updateItemMap);
+                } catch (GenericServiceException ex) {
+                    Debug.logError(ex.getMessage(), module);
+                    return ServiceUtil.returnError(ex.getMessage());
+                }
+            }
+            result = ServiceUtil.returnSuccess();
+        } catch (Exception e) {
+            return ServiceUtil.returnError(e.getMessage());
+        }
+        return result;
+    }
+
+    public static Map<String, Object> setEbayProductListingAttribute(DispatchContext dctx, Map<String, 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");
+        HashMap attributeMapList = (HashMap) context.get("attributeMapList");
+        String productListingId = (String) context.get("productListingId");
+        try {
+           List<GenericValue> attributeToClears = delegator.findByAnd("EbayProductListingAttribute", UtilMisc.toMap("productListingId", productListingId));
+           for (int clearCount = 0; clearCount < attributeToClears.size(); clearCount++) {
+              GenericValue valueToClear = attributeToClears.get(clearCount);
+              if (valueToClear != null) {
+                 valueToClear.remove();
+              }
+           }
+           Set attributeSet = attributeMapList.entrySet();
+           Iterator itr = attributeSet.iterator();
+           while (itr.hasNext()) {
+             Map.Entry attrMap = (Map.Entry) itr.next();
+
+             if (UtilValidate.isNotEmpty(attrMap.getKey())) {
+                 GenericValue ebayProductListingAttribute = delegator.makeValue("EbayProductListingAttribute");
+                  ebayProductListingAttribute.set("productListingId", productListingId);
+                  ebayProductListingAttribute.set("attrName", attrMap.getKey().toString());
+                  ebayProductListingAttribute.set("attrValue", attrMap.getValue().toString());
+                  ebayProductListingAttribute.create();
+              }
+           }
+        } catch (GenericEntityException e) {
+            return ServiceUtil.returnError(e.getMessage());
+        }
+        return ServiceUtil.returnSuccess();
+    }
+
+    public static ItemType prepareAddItem(Delegator delegator, GenericValue attribute) {
+        ItemType item = new ItemType();
+        try {
+            List<GenericValue> attrs = delegator.findByAnd("EbayProductListingAttribute", UtilMisc.toMap("productListingId", attribute.getString("productListingId")));
+            AmountType amount = new AmountType();
+            AmountType shippingServiceCost = new AmountType();
+            PictureDetailsType picture = new PictureDetailsType();
+            CategoryType category = new CategoryType();
+            ListingDesignerType designer = new ListingDesignerType();
+            ShippingDetailsType shippingDetail = new ShippingDetailsType();
+            ShippingServiceOptionsType shippingOption = new ShippingServiceOptionsType();
+            for (int index = 0; index < attrs.size(); index++) {
+                if ("Title".equals(attrs.get(index).getString("attrName"))) {
+                    item.setTitle(attrs.get(index).getString("attrValue"));
+                } else if ("SKU".equals(attrs.get(index).getString("attrName"))) {
+                    item.setSKU(attrs.get(index).getString("attrValue"));
+                } else if ("Currency".equals(attrs.get(index).getString("attrName"))) {
+                    amount.setCurrencyID(CurrencyCodeType.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("Description".equals(attrs.get(index).getString("attrName"))) {
+                    item.setDescription(attrs.get(index).getString("attrValue"));
+                } else if ("ApplicationData".equals(attrs.get(index).getString("attrName"))) {
+                    item.setApplicationData(attrs.get(index).getString("attrValue"));
+                } else if ("Country".equals(attrs.get(index).getString("attrName"))) {
+                    item.setCountry(CountryCodeType.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("PictureURL".equals(attrs.get(index).getString("attrName"))) {
+                    String[] pictureUrl = {attrs.get(index).getString("attrValue")};
+                    picture.setPictureURL(pictureUrl);
+                } else if ("Site".equals(attrs.get(index).getString("attrName"))) {
+                    item.setSite(SiteCodeType.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("UseTaxTable".equals(attrs.get(index).getString("attrName"))) {
+                    item.setUseTaxTable(Boolean.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("BestOfferEnabled".equals(attrs.get(index).getString("attrName"))) {
+                    item.setBestOfferEnabled(Boolean.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("AutoPayEnabled".equals(attrs.get(index).getString("attrName"))) {
+                    item.setAutoPay(Boolean.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("CategoryID".equals(attrs.get(index).getString("attrName"))) {
+                    category.setCategoryID(attrs.get(index).getString("attrValue"));
+                } else if ("CategoryLevel".equals(attrs.get(index).getString("attrName"))) {
+                    category.setCategoryLevel(Integer.parseInt(attrs.get(index).getString("attrValue")));
+                } else if ("CategoryName".equals(attrs.get(index).getString("attrName"))) {
+                    category.setCategoryName(attrs.get(index).getString("attrValue"));
+                } else if ("CategoryParentID".equals(attrs.get(index).getString("attrName"))) {
+                    String[] parent = {attrs.get(index).getString("attrValue")};
+                    category.setCategoryParentID(parent );
+                } else if ("LeafCategory".equals(attrs.get(index).getString("attrName"))) {
+                    category.setLeafCategory(Boolean.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("LSD".equals(attrs.get(index).getString("attrName"))) {
+                    category.setLSD(Boolean.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("ReturnsAcceptedOption".equals(attrs.get(index).getString("attrName"))) {
+                    ReturnPolicyType policy = new ReturnPolicyType();
+                    policy.setReturnsAcceptedOption(attrs.get(index).getString("attrValue"));
+                    item.setReturnPolicy(policy);
+                } else if ("LayoutID".equals(attrs.get(index).getString("attrName"))) {
+                    designer.setLayoutID(Integer.parseInt(attrs.get(index).getString("attrValue")));
+                } else if ("ThemeID".equals(attrs.get(index).getString("attrName"))) {
+                    designer.setThemeID(Integer.parseInt(attrs.get(index).getString("attrValue")));
+                } else if ("BuyItNowPrice".equals(attrs.get(index).getString("attrName"))) {
+                    amount = new AmountType();
+                    amount.setValue(Double.parseDouble(attrs.get(index).getString("attrValue")));
+                    item.setBuyItNowPrice(amount);
+                } else if ("ReservePrice".equals(attrs.get(index).getString("attrName"))) {
+                    amount = new AmountType();
+                    amount.setValue(Double.parseDouble(attrs.get(index).getString("attrValue")));
+                    item.setReservePrice(amount);
+                } else if ("ListingType".equals(attrs.get(index).getString("attrName"))) {
+                    item.setListingType(ListingTypeCodeType.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("StartPrice".equals(attrs.get(index).getString("attrName"))) {
+                    amount = new AmountType();
+                    amount.setValue(Double.parseDouble(attrs.get(index).getString("attrValue")));
+                    item.setStartPrice(amount);
+                } else if ("ShippingService".equals(attrs.get(index).getString("attrName"))) {
+                    shippingOption.setShippingService(attrs.get(index).getString("attrValue"));
+                } else if ("ShippingServiceCost".equals(attrs.get(index).getString("attrName"))) {
+                    shippingServiceCost.setValue(Double.parseDouble(attrs.get(index).getString("attrValue")));
+                    shippingOption.setShippingServiceCost(shippingServiceCost);
+                } else if ("ShippingServiceCostCurrency".equals(attrs.get(index).getString("attrName"))) {
+                    shippingServiceCost.setCurrencyID(CurrencyCodeType.valueOf(attrs.get(index).getString("attrValue")));
+                    shippingOption.setShippingServiceCost(shippingServiceCost);
+                } else if ("ShippingServicePriority".equals(attrs.get(index).getString("attrName"))) {
+                    shippingOption.setShippingServicePriority(Integer.parseInt(attrs.get(index).getString("attrValue")));
+                } else if ("ShippingType".equals(attrs.get(index).getString("attrName"))) {
+                    shippingDetail.setShippingType(ShippingTypeCodeType.valueOf(attrs.get(index).getString("attrValue")));
+                } else if ("VATPercent".equals(attrs.get(index).getString("attrName"))) {
+                    VATDetailsType vat = new VATDetailsType();
+                    vat.setVATPercent(new Float(attrs.get(index).getString("attrValue")));
+                    item.setVATDetails(vat);
+                } else if ("Location".equals(attrs.get(index).getString("attrName"))) {
+                    item.setLocation(attrs.get(index).getString("attrValue"));
+                } else if ("Quantity".equals(attrs.get(index).getString("attrName"))) {
+                    item.setQuantity(Integer.parseInt(attrs.get(index).getString("attrValue")));
+                } else if ("ListingDuration".equals(attrs.get(index).getString("attrName"))) {
+                    item.setListingDuration(attrs.get(index).getString("attrValue"));
+                } else if ("LotSize".equals(attrs.get(index).getString("attrName"))) {
+                    item.setLotSize(Integer.parseInt(attrs.get(index).getString("attrValue")));
+                } else if ("PostalCode".equals(attrs.get(index).getString("attrName"))) {
+                    item.setPostalCode(attrs.get(index).getString("attrValue"));
+                } else if ("Title".equals(attrs.get(index).getString("attrName"))) {
+                    item.setTitle(attrs.get(index).getString("attrValue"));
+                }
+                if (category != null) {
+                    item.setPrimaryCategory(category);
+                }
+                if (shippingOption != null) {
+                    ShippingServiceOptionsType[] options = {shippingOption};
+                    shippingDetail.setShippingServiceOptions(options);
+                }
+                if (shippingDetail != null) {
+                    item.setShippingDetails(shippingDetail);
+                }
             }
         } catch (GenericEntityException e) {
+            Debug.logError(e.getMessage(), module);
             return null;
         }
-        return job;
+        return item;
+    }
+
+    public static Map<String, Object> uploadTrackingInfoBackToEbay(DispatchContext dctx, Map<String, Object> context) {
+    Delegator delegator = dctx.getDelegator();
+    Locale locale = (Locale) context.get("locale");
+    String productStoreId = (String) context.get("productStoreId");
+    String orderId = (String) context.get("orderId");
+    GetOrdersRequestType req = new GetOrdersRequestType();
+    GetOrdersResponseType resp = null;
+    try {
+        GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
+        if (UtilValidate.isNotEmpty(orderHeader)) {
+            String externalId = orderHeader.getString("externalId").toString();
+            List<GenericValue> orderShipment = orderHeader.getRelated("OrderShipment");
+            if (orderShipment.size() > 0) {
+                List<GenericValue> trackingOrders = orderHeader.getRelated("TrackingCodeOrder");
+                ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
+                GetOrdersCall ordersCall = new GetOrdersCall(apiContext);
+                OrderIDArrayType orderIdArr = new OrderIDArrayType();
+                String[] orderIdStr = {""+externalId};
+                orderIdArr.setOrderID(orderIdStr);
+                req.setOrderIDArray(orderIdArr);
+                Calendar orderFrom = Calendar.getInstance();
+                orderFrom.setTime(UtilDateTime.toDate("01/01/2001 00:00:00"));
+                req.setCreateTimeFrom(orderFrom);
+                Calendar orderTo = Calendar.getInstance();
+                orderTo.setTime(UtilDateTime.nowDate());
+                req.setCreateTimeTo(orderTo);
+                req.setOrderStatus(OrderStatusCodeType.SHIPPED);
+                req.setOrderRole(TradingRoleCodeType.SELLER);
+                resp = (GetOrdersResponseType) ordersCall.execute(req);
+                if (resp != null && "SUCCESS".equals(resp.getAck().toString())) {
+                    OrderArrayType orderArr = resp.getOrderArray();
+                    OrderType[] orderTypeList = orderArr.getOrder();
+                    for (OrderType order : orderTypeList) {
+                        String orderID = order.getOrderID();
+                        if (orderID.equals(externalId)) {
+                            AddOrderCall addOrderCall = new AddOrderCall(apiContext);
+                            AddOrderRequestType addReq = new AddOrderRequestType();
+                            AddOrderResponseType addResp = null;
+                            OrderType newOrder = new OrderType();
+                            ShippingDetailsType shippingDetail = (ShippingDetailsType) order.getShippingDetails();
+                            if (trackingOrders.size() > 0) {
+                                ShipmentTrackingDetailsType[] trackDetails = new ShipmentTrackingDetailsType[trackingOrders.size()];
+                                for (int i = 0; i < trackDetails.length; i++) {
+                                    ShipmentTrackingDetailsType track = new ShipmentTrackingDetailsType();
+                                    track.setShipmentTrackingNumber(trackingOrders.get(i).get("trackingCodeId").toString());
+                                    trackDetails[i] = track;
+                                }
+                                shippingDetail.setShipmentTrackingDetails(trackDetails);
+                                newOrder.setShippingDetails(shippingDetail);
+                            }
+                            newOrder.setOrderID(order.getOrderID());
+                            newOrder.setOrderStatus(order.getOrderStatus());
+                            newOrder.setAdjustmentAmount(order.getAdjustmentAmount());
+                            newOrder.setAmountSaved(order.getAmountSaved());
+                            newOrder.setCheckoutStatus(order.getCheckoutStatus());
+                            newOrder.setShippingDetails(order.getShippingDetails());
+                            newOrder.setCreatingUserRole(order.getCreatingUserRole());
+                            newOrder.setCreatedTime(order.getCreatedTime());
+                            newOrder.setPaymentMethods(order.getPaymentMethods());
+                            newOrder.setShippingAddress(order.getShippingAddress());
+                            newOrder.setSubtotal(order.getSubtotal());
+                            newOrder.setTotal(order.getTotal());
+                            newOrder.setTransactionArray(order.getTransactionArray());
+                            newOrder.setBuyerUserID(order.getBuyerUserID());
+                            newOrder.setPaidTime(order.getPaidTime());
+                            newOrder.setShippedTime(order.getShippedTime());
+                            newOrder.setIntegratedMerchantCreditCardEnabled(order.isIntegratedMerchantCreditCardEnabled());
+                            addReq.setOrder(newOrder);
+                            addResp = (AddOrderResponseType) addOrderCall.execute(addReq);
+                            if (addResp != null && "SUCCESS".equals(addResp.getAck().toString())) {
+                                Debug.log("Upload tracking code to eBay success...");
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    } catch (Exception e) {
+        return ServiceUtil.returnError(e.getMessage());
+    }
+    return ServiceUtil.returnSuccess();
     }
 }

Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java Wed Mar 24 09:23:07 2010
@@ -21,27 +21,36 @@ package org.ofbiz.ebaystore;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.ebay.ProductsExportToEbay;
 import org.ofbiz.entity.Delegator;
+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;
 import org.ofbiz.webapp.event.EventHandlerException;
 
+import com.ebay.sdk.ApiContext;
 import com.ebay.sdk.ApiException;
 import com.ebay.sdk.SdkException;
 import com.ebay.sdk.SdkSoapException;
 import com.ebay.sdk.call.GetStoreOptionsCall;
+import com.ebay.soap.eBLBaseComponents.CategoryType;
 import com.ebay.soap.eBLBaseComponents.GetStoreOptionsRequestType;
 import com.ebay.soap.eBLBaseComponents.GetStoreOptionsResponseType;
 import com.ebay.soap.eBLBaseComponents.StoreColorSchemeType;
@@ -56,7 +65,9 @@ import net.sf.json.JSONObject;
 
 public class EbayStoreOptions {
 
-    public static String  retrieveThemeColorSchemeByThemeId(HttpServletRequest request, HttpServletResponse response) {
+    private static final String module = EbayStoreOptions.class.getName();
+    
+    public static String retrieveThemeColorSchemeByThemeId(HttpServletRequest request, HttpServletResponse response) {
         Locale locale = UtilHttp.getLocale(request);
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         GetStoreOptionsRequestType req = null;
@@ -157,4 +168,142 @@ public class EbayStoreOptions {
             throw new EventHandlerException("Unable to get response writer", e);
         }
     }
+
+    public static String retrieveItemTemplateByTemplateGroupId(HttpServletRequest request,HttpServletResponse response) {
+        Map paramMap = UtilHttp.getCombinedMap(request);
+        try {
+            if (paramMap.get("productStoreId") != null) {
+                String temGroupId = (String)paramMap.get("templateGroupId");
+                Map<String,Object> addItemObj = EbayEvents.getAddItemListingObject(request, EbayEvents.getApiContext(request));
+                if (UtilValidate.isNotEmpty(addItemObj)) {
+                    String refName = "itemCateFacade_".concat((String) paramMap.get("pkCategoryId"));
+                    if (UtilValidate.isNotEmpty(addItemObj.get(refName))) {
+                        EbayStoreCategoryFacade cf = (EbayStoreCategoryFacade) addItemObj.get(refName);
+                        List<Map<String,Object>> theme = cf.getAdItemTemplates(temGroupId);
+                        if (theme.size() > 0) {
+                            toJsonObjectList(theme,response);
+                        }
+                    }
+                }
+            }
+        } catch (EventHandlerException e) {
+            Debug.logError(e.getMessage(), module);
+        }
+        return "success";
+    }
+
+    public static String retrieveEbayCategoryByParent(HttpServletRequest request, HttpServletResponse response) {
+        List<CategoryType> results = FastList.newInstance();
+        try {
+            Map paramMap = UtilHttp.getCombinedMap(request);
+            if (paramMap.get("productStoreId") != null) {
+                String ebayCategoryId = (String)paramMap.get("ebayCategoryId");
+                // when change category should be remove old category from session
+                if (ebayCategoryId.indexOf("CH_") != -1) {
+                    ebayCategoryId = ebayCategoryId.replace("CH_", "");
+                    if (UtilValidate.isNotEmpty(ebayCategoryId)) {
+                        ApiContext apiContext = EbayEvents.getApiContext(request);
+                        Map<String,Object> addItemObject = EbayEvents.getAddItemListingObject(request, apiContext);
+                        String refName = "itemCateFacade_".concat(ebayCategoryId);
+                        if (UtilValidate.isNotEmpty(addItemObject.get(refName))) {
+                            addItemObject.remove(refName);
+                        }
+                    }
+                    ebayCategoryId = "";
+                }
+                request.setAttribute("productStoreId", paramMap.get("productStoreId"));
+                request.setAttribute("categoryId", ebayCategoryId);
+                results = EbayEvents.getChildCategories(request);
+                if (UtilValidate.isNotEmpty(results)) {
+                    List<Map<String,Object>> categories = FastList.newInstance();
+                    for (CategoryType category : results) {
+                        Map<String,Object> context = FastMap.newInstance();
+                        context.put("CategoryCode", category.getCategoryID());
+                        context.put("CategoryName", category.getCategoryName());
+                        String isLeaf = String.valueOf(category.isLeafCategory()!= null ? category.isLeafCategory() : "false");
+                        context.put("IsLeafCategory", isLeaf);
+                        categories.add(context);
+                    }
+                    if (categories.size() > 0) {
+                        toJsonObjectList(categories,response);
+                    }
+                }
+            }
+        } catch (GenericServiceException e) {
+            Debug.logError(e.getMessage(), module);
+        } catch (EventHandlerException e) {
+            Debug.logError(e.getMessage(), module);
+        } catch (ApiException e) {
+            Debug.logError(e.getMessage(), module);
+        } catch (SdkException e) {
+            Debug.logError(e.getMessage(), module);
+        } catch (Exception e) {
+            Debug.logError(e.getMessage(), module);
+        }
+        return "success";
+    }
+
+    public static String retrieveEbayStoreCategoryByParent(HttpServletRequest request, HttpServletResponse response) {
+        LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+        HttpSession session = request.getSession();
+        GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
+        Map<String,Object> result = FastMap.newInstance();
+        Map<String,Object> context = FastMap.newInstance();
+        try {
+            Map paramMap = UtilHttp.getCombinedMap(request);
+            if (paramMap.get("productStoreId") != null) {
+                String ebayCategoryId = (String)paramMap.get("ebayCategoryId");
+                context.put("productStoreId", paramMap.get("productStoreId"));
+                context.put("ebayStoreCategoryId", ebayCategoryId);
+                context.put("userLogin", userLogin);
+                result = dispatcher.runSync("getEbayStoreCategories", context);
+                if (result != null) {
+                    List<Map<String,Object>> categories = (List<Map<String,Object>>) result.get("storeCategories");
+                    if (categories.size()>0) {
+                        toJsonObjectList(categories,response);
+                    }
+                }
+            }
+        } catch (GenericServiceException e) {
+            Debug.logError(e.getMessage(), module);
+        } catch (EventHandlerException e) {
+            Debug.logError(e.getMessage(), module);
+        }
+        return "success";
+    }
+
+    public static void toJsonObjectList(List<Map<String,Object>> list, HttpServletResponse response) throws EventHandlerException {
+        JSONObject json = null;
+        List<JSONObject> jsonList = new ArrayList<JSONObject>();
+        if (list != null) {
+            for (Map<String,Object> val : list) {
+                json = new JSONObject();
+                for (String rowKey: val.keySet()) {
+                    json.put(rowKey, val.get(rowKey));
+                }
+                jsonList.add(json);
+            }
+            String jsonStr = jsonList.toString();
+            if (jsonStr == null) {
+                throw new EventHandlerException("JSON Object was empty; fatal error!");
+            }
+            // set the X-JSON content type
+            response.setContentType("application/json");
+            // jsonStr.length is not reliable for unicode characters
+            try {
+                response.setContentLength(jsonStr.getBytes("UTF8").length);
+            } catch (UnsupportedEncodingException e) {
+                throw new EventHandlerException("Problems with Json encoding", e);
+            }
+            // return the JSON String
+            Writer out;
+            try {
+                out = response.getWriter();
+                out.write(jsonStr);
+                out.flush();
+            } catch (IOException e) {
+                throw new EventHandlerException("Unable to get response writer", e);
+            }
+        }
+    }
 }

Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy Wed Mar 24 09:23:07 2010
@@ -22,13 +22,13 @@ import org.ofbiz.base.util.*;
 contentId = null;
 contentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "OWNER"));
 if (contentRoles.size() != 0) {
- contentRoles.each { contentRole->
- contents = delegator.findByAnd("Content", UtilMisc.toMap("contentId", contentRole.getString("contentId"), "ownerContentId", emailType));
- if (contents.size() != 0) {
- if (emailType.equals(contents.get(0).getString("ownerContentId"))) {
- contentId = contents.get(0).getString("contentId");
- }
- }
- }
+    contentRoles.each { contentRole->
+        contents = delegator.findByAnd("Content", UtilMisc.toMap("contentId", contentRole.getString("contentId"), "ownerContentId", emailType));
+        if (contents.size() != 0) {
+            if (emailType.equals(contents.get(0).getString("ownerContentId"))) {
+                contentId = contents.get(0).getString("contentId");
+            }
+        }
+    }
 }
 context.contentId =  contentId;
\ No newline at end of file

Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Wed Mar 24 09:23:07 2010
@@ -68,6 +68,10 @@
         <response name="success" type="view" value="EbayAccount"/>
     </request-map>
     <!-- Store output -->
+    <request-map uri="loadEbayStores">
+        <security https="true" auth="true"/>
+        <response name="success" type="request" value="exportProductListing"/>
+    </request-map>
     <request-map uri="ebayStores">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ebayStores"/>
@@ -147,7 +151,7 @@
         <response name="success" type="view" value="AutomationPreferences"/>
         <response name="error" type="view" value="AutomationPreferences"/>
     </request-map>
- <request-map uri="editEmailTemplate">
+    <request-map uri="editEmailTemplate">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="editEmailTemplate"/>
     </request-map>
@@ -237,22 +241,92 @@
         <event type="service" invoke="updateEbayProductQtyReserved"/>
         <response name="success" type="view" value="ebayLoadStoreInventory"/>
     </request-map>
+    <!-- export productListing in ebay store -->
     <request-map uri="exportProductListing">
         <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="prepareEbaySiteFacadeObject"/>
         <response name="success" type="view" value="exportProductListing"/>
+        <response name="prepare" type="view" value="prepareProductListing"/>
         <response name="error" type="view" value="exportProductListing"/>
     </request-map>
     <request-map uri="productsearch">
         <security https="true" auth="true"/>
-        <response name="success" type="view" value="productsearch"/>
-        <response name="error" type="view" value="productsearch"/>
+        <response name="success" type="view" value="productSearchResults"/>
     </request-map>
-    <request-map uri="exportProductsFromEbayStore">
+    <request-map uri="testSetEbayCategory">
         <security https="true" auth="true"/>
-        <event type="service-multi" invoke="exportProductsFromEbayStore"/>
+        <response name="success" type="view" value="loadEbayAdItemTemplate"/>
+    </request-map>
+    <request-map uri="prepareProductListing">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="addProductListing"/>
+        <response name="success" type="view" value="prepareProductListing"/>
+        <response name="error" type="view" value="exportProductListing"/>
+    </request-map>
+    <request-map uri="setSelectedCategory">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="setSelectedEbayCategory"/>
+        <response name="success" type="view" value="prepareProductListing"/>
+        <response name="error" type="view" value="prepareProductListing"/>
+    </request-map>
+    <request-map uri="retrieveEbayCategoryByParent">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayStoreOptions" invoke="retrieveEbayCategoryByParent"/>
+        <response name="success" type="view" value="main"/>
+    </request-map>
+    <request-map uri="clearExpListing">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="clearProductListing"/>
         <response name="success" type="view" value="exportProductListing"/>
+    </request-map>
+    <!-- Ad item template -->
+    <request-map uri="ebayAdItemTemplate">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayStoreOptions" invoke="retrieveItemTemplateByTemplateGroupId"/>
+        <response name="success" type="view" value="main"/>
+    </request-map>
+    <request-map uri="updateProductExportDetail">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="updateProductExportDetail"/>
+        <response name="success" type="view" value="prepareProductListing"/>
+        <response name="error" type="view" value="exportProductListing"/>
+    </request-map>
+    <request-map uri="removeProductFromListing">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="removeProductFromListing"/>
+        <response name="success" type="view" value="prepareProductListing"/>
+        <response name="error" type="view" value="exportProductListing"/>
+    </request-map>
+    <request-map uri="verifyItem">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="verifyItemBeforeAdd"/>
+        <response name="success" type="view" value="prepareProductListing"/>
+        <response name="error" type="view" value="exportProductListing"/>
+    </request-map>
+    <request-map uri="exportListingToEbay">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="exportListingToEbay"/>
+        <response name="success" type="request" value="clearExpListing"/>
         <response name="error" type="view" value="exportProductListing"/>
     </request-map>
+
+    <!--request-map uri="prepareProductListingDetails">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="prepareProductListingDetails"/>
+        <response name="success" type="view" value="prepareProductListing"/>
+    </request-map-->
+    <!--request-map uri="retrieveEbayStoreCategoryByParent">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.ebaystore.EbayStoreOptions" invoke="retrieveEbayStoreCategoryByParent"/>
+        <response name="success" type="view" value="main"/>
+    </request-map-->
+    <!--request-map uri="exportProductsFromEbayStore">
+        <security https="true" auth="true"/>
+        <event type="service-multi" invoke="exportProductsFromEbayStore"/>
+        <response name="success" type="view" value="exportProductListing"/>
+        <response name="error" type="view" value="exportProductListing"/>
+    </request-map-->
+
     <!-- Selling Manager -->
     <request-map uri="sellingManager">
         <security https="true" auth="true"/>
@@ -303,6 +377,33 @@
         <response name="error" type="view" value="MakeSecondChanceOffer"/>
         <response name="success" type="view" value="SoldListing"/>
     </request-map>
+    <!-- Unsold Listing -->
+    <request-map uri="unsoldListing">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="UnsoldListing"/>
+    </request-map>
+    <!-- waiting to shipping -->
+    <request-map uri="waitingToShipping">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="WaitingToShipping"/>
+    </request-map>
+    <request-map uri="ordersImported">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="ordersImported"/>
+        <response name="error" type="view" value="ordersImported"/>
+    </request-map>
+    <request-map uri="searchOrdersImported">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="findOrders"/>
+        <response name="success" type="view" value="ordersImported"/>
+        <response name="error" type="view" value="ordersImported"/>
+    </request-map>
+    <request-map uri="uploadTrackingCodeBack">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="uploadTrackingInfoBackToEbay"/>
+        <response name="success" type="view" value="ordersImported"/>
+        <response name="error" type="view" value="ordersImported"/>
+    </request-map>
     <!-- end of request mappings -->
 
     <!-- View Mappings -->
@@ -327,14 +428,24 @@
     <view-map name="ebayLoadStoreInventory" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#ebayLoadStoreInventory"/>
     <view-map name="reserveEbayProductInventory" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#reserveEbayProductInventory"/>
     <view-map name="updateQuantityReserved" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#updateQuantityReserved"/>
+    <!-- export productListing in ebay store -->
     <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"/>
+    <view-map name="productSearchResults" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#productSearchResults"/>
+    <view-map name="selectEbayCategory" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#selectEbayCategory"/>
+    <view-map name="prepareProductListing" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#prepareProductListing"/>
+    <!-- Ad item template -->
+    <view-map name="loadEbayAdItemTemplate" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#loadEbayAdItemTemplate"/>
     <!-- Active -->
-    <view-map name="ActiveListing" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#EbayActiveListing"/>
+    <view-map name="ActiveListing" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#ActiveListing"/>
     <view-map name="AssignAutomaticRule" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#AssignAutomaticRule"/>
     <!-- Sold -->
     <view-map name="SoldListing" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#SoldListing"/>
     <view-map name="OpenUnpaid" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#OpenUnpaid"/>
     <view-map name="MakeSecondChanceOffer" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#MakeSecondChanceOffer"/>
+    <!-- Unsold -->
+    <view-map name="UnsoldListing" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#UnsoldListing"/>
+    <!-- Waiting to shipping -->
+    <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"/>
     <!-- end of view mappings -->
 </site-conf>

Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/feedback/LeaveFeedback.ftl Wed Mar 24 09:23:07 2010
@@ -93,7 +93,7 @@ under the License.
                                 onclick="document.getElementById('rate${feedbackCounter}').style.display='none';"/><span>I'll leave Feedback later</span>
                             <div id="rate${feedbackCounter}" style="display:none">
                                 <input type="text" value="" maxlength="80" size="80" name="commentText${feedbackCounter}" label="Tell us more"/>
-                                <br/>80 characters left<br/><br/>
+                                <br />80 characters left<br /><br />
                             </div>
                         </td>
                         <td>
@@ -128,7 +128,7 @@ under the License.
                             onclick="document.getElementById('rate${feedbackCounter}').style.display='none';"/><span>I'll leave Feedback later</span>
                         <div id="rate${feedbackCounter}" style="display:none">
                             <input type="text" value="" maxlength="80" size="80" name="commentText${feedbackCounter}" label="Tell us more"/>
-                            <br/>80 characters left<br/><br/>
+                            <br />80 characters left<br /><br />
                             <b>Rate details about this purchase</b>
                             <table>
                                 <tr>
@@ -250,7 +250,7 @@ under the License.
                             onclick="document.getElementById('rate${feedbackCounter}').style.display='none';"/><span>I'll leave Feedback later</span>
                         <div id="rate${feedbackCounter}" style="display:none">
                             <input type="text" value="" maxlength="80" size="80" name="commentText${feedbackCounter}" label="Tell us more"/>
-                            <br/>80 characters left<br/><br/>
+                            <br />80 characters left<br /><br />
                         </div>
                     </td>
                     <td>
@@ -287,7 +287,7 @@ under the License.
                         onclick="document.getElementById('rate${feedbackCounter}').style.display='none';"/><span>I'll leave Feedback later</span>
                     <div id="rate${feedbackCounter}" style="display:none">
                         <input type="text" value="" maxlength="80" size="80" name="commentText${feedbackCounter}" label="Tell us more"/>
-                        <br/>80 characters left<br/><br/>
+                        <br />80 characters left<br /><br />
                         <b>Rate details about this purchase</b>
                         <table>
                             <tr>
@@ -419,7 +419,7 @@ under the License.
                 <#if leaveFeedback.role == "seller">
                     <div id="rate${feedbackCounter}" style="display:none">
                         <input type="text" value="" maxlength="80" size="80" name="commentText${feedbackCounter}" label="Tell us more"/>
-                        <br/>80 characters left<br/><br/>
+                        <br />80 characters left<br /><br />
                         <b>Rate details about this purchase</b>
                         <table>
                             <tr>
@@ -512,7 +512,7 @@ under the License.
                 <#else>
                     <div id="rate${feedbackCounter}" style="display:none">
                         <input type="text" value="" maxlength="80" size="80" name="commentText${feedbackCounter}" label="Tell us more"/>
-                        <br/>80 characters left<br/><br/>
+                        <br />80 characters left<br /><br />
                     </div>
                 </#if>
                 </td>
@@ -529,7 +529,7 @@ under the License.
         </#list>
     </tbody>
 </table>
-<br/>
+<br />
 <input type="hidden" name="feedbackSize" value="${feedbackCounter}"/>
 <input type="submit" value="Leave Feedback"/>
 </form>

Modified: ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl?rev=926987&r1=926986&r2=926987&view=diff
==============================================================================
--- ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl (original)
+++ ofbiz/branches/multitenant20100310/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl Wed Mar 24 09:23:07 2010
@@ -132,7 +132,7 @@ under the License.
           </tr>
           <tr>
             <td align="center" colspan="2">
-              <hr/>
+              <hr />
               <a href="javascript:submit($('productSearchform'));" class="buttontext">${uiLabelMap.CommonFind}</a>
             </td>
           </tr>