You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2010/10/01 11:37:15 UTC
svn commit: r1003451 [2/2] - in /ofbiz/trunk/specialpurpose/ebaystore:
config/ servicedef/ src/org/ofbiz/ebaystore/ webapp/ebaystore/WEB-INF/
webapp/ebaystore/WEB-INF/actions/store/ widget/
Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java?rev=1003451&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java (added)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java Fri Oct 1 09:37:14 2010
@@ -0,0 +1,589 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.ofbiz.ebaystore;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javolution.util.FastMap;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.ebay.EbayHelper;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.order.order.OrderChangeHelper;
+import org.ofbiz.order.shoppingcart.CheckOutHelper;
+import org.ofbiz.order.shoppingcart.ShoppingCart;
+import org.ofbiz.order.shoppingcart.ShoppingCartItem;
+import org.ofbiz.party.party.PartyWorker;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
+
+public class EbayStoreOrder {
+
+ private static final String resource = "EbayUiLabels";
+ private static final String module = EbayStoreOrder.class.getName();
+
+ public static Map<String, Object> EbayStoreImportTransaction(DispatchContext dctx, Map<String, Object> context) {
+ Map<String, Object> result = FastMap.newInstance();
+ Delegator delegator = dctx.getDelegator();
+ LocalDispatcher dispatcher = dctx.getDispatcher();
+ Locale locale = (Locale) context.get("locale");
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
+ try {
+ if ("Complete".equals(context.get("checkoutStatus").toString()) && "NOT_IMPORT".equals(context.get("importStatus").toString())) {
+ if (UtilValidate.isEmpty(context.get("shippingAddressStreet1"))) {
+ context.put("shippingAddressStreet1", context.get("shippingAddressStreet").toString());
+ }
+ result = dispatcher.runSync("EbayStoreCreateTransactionShoppingCart", context);
+ }
+ } catch (Exception e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ }
+ result.put("productStoreId", context.get("productStoreId").toString());
+ result.put("formSelect", "transaction");
+ return result;
+ }
+ public static Map<String, Object> EbayStoreImportOrder(DispatchContext dctx, Map<String, Object> context) {
+ Delegator delegator = dctx.getDelegator();
+ LocalDispatcher dispatcher = dctx.getDispatcher();
+ Locale locale = (Locale) context.get("locale");
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Map result = FastMap.newInstance();
+ if (UtilValidate.isEmpty(context.get("orderId"))) {
+ try {
+ result = dispatcher.runSync("EbayStoreCreateOrderShoppingCart", context);
+ } catch (Exception e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ }
+ }
+ result.put("productStoreId", context.get("productStoreId").toString());
+ result.put("formSelect", "order");
+ return result;
+ }
+
+ public static Map<String, Object> EbayStoreCreateTransactionShoppingCart(DispatchContext dctx, Map<String, Object> context) {
+ Delegator delegator = dctx.getDelegator();
+ LocalDispatcher dispatcher = dctx.getDispatcher();
+ Locale locale = (Locale) context.get("locale");
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Map<String, Object> result = FastMap.newInstance();
+
+ String productStoreId = context.get("productStoreId").toString();
+ String defaultCurrencyUomId = "";
+ String payToPartyId = "";
+ String facilityId = "";
+
+ try {
+ if (UtilValidate.isEmpty(productStoreId)) {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale));
+ } else {
+ GenericValue productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", productStoreId));
+ if (UtilValidate.isNotEmpty(productStore)) {
+ defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId");
+ payToPartyId = productStore.getString("payToPartyId");
+ facilityId = productStore.getString("inventoryFacilityId");
+ } else {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale));
+ }
+ }
+
+ ShoppingCart cart = new ShoppingCart(delegator, productStoreId, locale, defaultCurrencyUomId);
+ String externalId = context.get("externalId").toString();
+ if (UtilValidate.isNotEmpty(externalId)) {
+ cart.setExternalId(externalId);
+ } else {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "EbayStoreOrder.externalIdNotAvailable", locale));
+ }
+
+ cart.setOrderType("SALES_ORDER");
+ cart.setChannelType("EBAY_SALES_CHANNEL");
+ cart.setUserLogin(userLogin, dispatcher);
+ cart.setProductStoreId(productStoreId);
+
+ if (UtilValidate.isNotEmpty(facilityId)) {
+ cart.setFacilityId(facilityId);
+ }
+
+ String amountStr = context.get("amountPaid").toString();
+ BigDecimal amountPaid = new BigDecimal(amountStr);
+ if (UtilValidate.isNotEmpty(amountPaid)) {
+ amountPaid = new BigDecimal(amountStr);
+ }
+ cart.addPaymentAmount("EXT_EBAY", amountPaid, externalId, null, true, false, false);
+
+ Timestamp orderDate = UtilDateTime.nowTimestamp();
+ if (UtilValidate.isNotEmpty(context.get("createdDate"))) {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ Date createdDate = dateFormat.parse((String) context.get("createdDate"));
+ orderDate = new Timestamp(createdDate.getTime());
+ }
+ cart.setOrderDate(orderDate);
+
+ String productId = context.get("productId").toString();
+ if (UtilValidate.isEmpty(productId)) {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdNotAvailable", locale));
+ } else {
+ GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));
+ if (UtilValidate.isEmpty(product)) {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdDoesNotExist", locale));
+ }
+ }
+
+ String paidTime = null;
+ if (UtilValidate.isNotEmpty(context.get("paidTime"))) {
+ paidTime = context.get("paidTime").toString();
+ } else {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.paymentIsStillNotReceived", locale));
+ }
+
+ BigDecimal unitPrice = new BigDecimal(context.get("transactionPrice").toString());
+ BigDecimal quantity = new BigDecimal(context.get("quantityPurchased").toString());
+ cart.addItemToEnd(productId, null, quantity, unitPrice, null, null, null, "PRODUCT_ORDER_ITEM", dispatcher, Boolean.FALSE, Boolean.FALSE);
+
+ if (UtilValidate.isNotEmpty(payToPartyId)) {
+ cart.setBillFromVendorPartyId(payToPartyId);
+ }
+
+ String shippingCost = context.get("shippingServiceCost").toString();
+ if (UtilValidate.isNotEmpty(shippingCost)) {
+ BigDecimal shippingAmount = new BigDecimal(shippingCost);
+ if (shippingAmount.doubleValue() > 0) {
+ GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SHIPPING_CHARGES", cart.getOrderId(), null, null, shippingAmount.doubleValue(), 0.0);
+ if (UtilValidate.isNotEmpty(shippingAdjustment)) {
+ cart.addAdjustment(shippingAdjustment);
+ }
+ }
+ }
+
+ String shippingTotalAdditionalCost = context.get("shippingTotalAdditionalCost").toString();
+ if (UtilValidate.isNotEmpty(shippingTotalAdditionalCost)) {
+ double shippingAdditionalCost = new Double(shippingTotalAdditionalCost).doubleValue();
+ if (shippingAdditionalCost > 0) {
+ GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "MISCELLANEOUS_CHARGE", cart.getOrderId(), null, null, shippingAdditionalCost, 0.0);
+ if (shippingAdjustment != null) {
+ cart.addAdjustment(shippingAdjustment);
+ }
+ }
+ }
+
+ String salesTaxAmount = context.get("salesTaxAmount").toString();
+ String salesTaxPercent = context.get("salesTaxPercent").toString();
+ if (UtilValidate.isNotEmpty(salesTaxAmount)) {
+ double salesTaxAmountTotal = new Double(salesTaxAmount).doubleValue();
+ if (salesTaxAmountTotal > 0) {
+ double salesPercent = 0.0;
+ if (UtilValidate.isNotEmpty(salesTaxPercent)) {
+ salesPercent = new Double(salesTaxPercent).doubleValue();
+ }
+ GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, salesTaxAmountTotal, salesPercent);
+ if (UtilValidate.isNotEmpty(salesTaxAdjustment)) {
+ cart.addAdjustment(salesTaxAdjustment);
+ }
+ }
+ }
+
+ Debug.logInfo("Importing new order from eBay", module);
+ // set partyId to
+ String partyId = null;
+ String contactMechId = "";
+ GenericValue partyAttribute = null;
+ if (UtilValidate.isNotEmpty(context.get("eiasTokenBuyer").toString())) {
+ partyAttribute = EntityUtil.getFirst(delegator.findByAnd("PartyAttribute", UtilMisc.toMap("attrValue", context.get("eiasTokenBuyer").toString())));
+ }
+
+ // if we get a party, check its contact information.
+ if (UtilValidate.isNotEmpty(partyAttribute)) {
+ partyId = (String) partyAttribute.get("partyId");
+ Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module);
+ GenericValue party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId));
+
+ contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, context);
+ String emailBuyer = context.get("emailBuyer").toString();
+ if (!(emailBuyer.equals("") || emailBuyer.equalsIgnoreCase("Invalid Request"))) {
+ EbayHelper.setEmailContactMech(dispatcher, delegator, party, userLogin, context);
+ }
+ EbayHelper.setPhoneContactMech(dispatcher, delegator, party, userLogin, context);
+ }
+
+ // create party if none exists already
+ if (UtilValidate.isEmpty(partyId)) {
+ Debug.logInfo("Creating new party for the eBay buyer.", module);
+ partyId = EbayHelper.createCustomerParty(dispatcher, context.get("buyerName").toString(), userLogin);
+ if (UtilValidate.isEmpty(partyId)) {
+ Debug.logWarning("Using admin party for the eBay buyer.", module);
+ partyId = "admin";
+ }
+ }
+
+ // create new party's contact information
+ if (UtilValidate.isEmpty(contactMechId)) {
+ Debug.logInfo("Creating new postal address for party: " + partyId, module);
+ contactMechId = EbayHelper.createAddress(dispatcher, partyId, userLogin, "SHIPPING_LOCATION", context);
+ if (UtilValidate.isEmpty(contactMechId)) {
+ return ServiceUtil.returnFailure("Unable to create postalAddress with input map: " + context);
+ }
+ Debug.logInfo("Created postal address: " + contactMechId, module);
+ Debug.logInfo("Creating new phone number for party: " + partyId, module);
+ EbayHelper.createPartyPhone(dispatcher, partyId, context.get("shippingAddressPhone").toString(), userLogin);
+ Debug.logInfo("Creating association to eBay buyer for party: " + partyId, module);
+ EbayHelper.createEbayCustomer(dispatcher, partyId, context.get("ebayUserIdBuyer").toString(), context.get("eiasTokenBuyer").toString(), userLogin);
+ String emailBuyer = context.get("emailBuyer").toString();
+ if (UtilValidate.isNotEmpty(emailBuyer) && !emailBuyer.equalsIgnoreCase("Invalid Request")) {
+ Debug.logInfo("Creating new email for party: " + partyId, module);
+ EbayHelper.createPartyEmail(dispatcher, partyId, emailBuyer, userLogin);
+ }
+ }
+
+ Debug.logInfo("Setting cart roles for party: " + partyId, module);
+ cart.setBillToCustomerPartyId(partyId);
+ cart.setPlacingCustomerPartyId(partyId);
+ cart.setShipToCustomerPartyId(partyId);
+ cart.setEndUserCustomerPartyId(partyId);
+
+ Debug.logInfo("Setting contact mech in cart: " + contactMechId, module);
+ cart.setShippingContactMechId(contactMechId);
+ cart.setMaySplit(Boolean.FALSE);
+
+ Debug.logInfo("Setting shipment method: " + context.get("shippingService").toString(), module);
+ EbayHelper.setShipmentMethodType(cart, context.get("shippingService").toString(), productStoreId, delegator);
+
+ cart.makeAllShipGroupInfos();
+
+ // create the order
+ Debug.logInfo("Creating CheckOutHelper.", module);
+ CheckOutHelper checkout = new CheckOutHelper(dispatcher, delegator, cart);
+ Debug.logInfo("Creating order.", module);
+ Map<String, Object> orderCreate = checkout.createOrder(userLogin);
+
+ String orderId = orderCreate.get("orderId").toString();
+ Debug.logInfo("Created order with id: " + orderId, module);
+
+ // approve the order
+ if (UtilValidate.isNotEmpty(orderId)) {
+ Debug.logInfo("Approving order with id: " + orderId, module);
+ boolean approved = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId);
+ Debug.logInfo("Order approved with result: " + approved, module);
+
+ // create the payment from the preference
+ if (approved) {
+ Debug.logInfo("Creating payment for approved order.", module);
+ EbayHelper.createPaymentFromPaymentPreferences(delegator, dispatcher, userLogin, orderId, externalId, cart.getOrderDate(), partyId);
+ Debug.logInfo("Payment created.", module);
+ }
+ }
+ } catch (Exception e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ }
+ return result;
+ }
+ public static Map<String, Object> EbayStoreCreateOrderShoppingCart(DispatchContext dctx, Map<String, Object> context) {
+ Delegator delegator = dctx.getDelegator();
+ LocalDispatcher dispatcher = dctx.getDispatcher();
+ Locale locale = (Locale) context.get("locale");
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Map <String, Object> result = FastMap.newInstance();
+
+ String productStoreId = context.get("productStoreId").toString();
+ String defaultCurrencyUomId = null;
+ String payToPartyId = null;
+ String facilityId = null;
+ try {
+ if (productStoreId == null) {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale));
+ } else {
+ GenericValue productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", productStoreId));
+ if (productStore != null) {
+ defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId");
+ payToPartyId = productStore.getString("payToPartyId");
+ facilityId = productStore.getString("inventoryFacilityId");
+ } else {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale));
+ }
+ }
+ ShoppingCart cart = new ShoppingCart(delegator, productStoreId, locale, defaultCurrencyUomId);
+
+ // set the external id with the eBay Item Id
+ String externalId = (String) context.get("externalId");
+ cart.setOrderType("SALES_ORDER");
+ cart.setChannelType("EBAY_SALES_CHANNEL");
+ cart.setUserLogin(userLogin, dispatcher);
+ cart.setProductStoreId(productStoreId);
+
+ if (UtilValidate.isNotEmpty(facilityId)) {
+ cart.setFacilityId(facilityId);
+ }
+
+ String amountStr = (String) context.get("amountPaid");
+ BigDecimal amountPaid = BigDecimal.ZERO;
+ if (UtilValidate.isNotEmpty(amountStr)) {
+ amountPaid = new BigDecimal(amountStr);
+ }
+ cart.addPaymentAmount("EXT_EBAY", amountPaid, externalId, null, true, false, false);
+ Timestamp orderDate = UtilDateTime.nowTimestamp();
+ if (UtilValidate.isNotEmpty(context.get("createdDate"))) {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ Date createdDate = dateFormat.parse((String) context.get("createdDate"));
+ orderDate = new Timestamp(createdDate.getTime());
+ }
+
+ cart.setOrderDate(orderDate);
+ // Before import the order from eBay to OFBiz is mandatory that the payment has be received
+ String paidTime = (String) context.get("paidTime");
+ if (UtilValidate.isEmpty(paidTime)) {
+ return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.paymentIsStillNotReceived", locale));
+ }
+
+ List<Map<String, Object>> orderItemList = UtilGenerics.checkList(context.get("orderItemList"));
+ Iterator<Map<String, Object>> orderItemIter = orderItemList.iterator();
+ while (orderItemIter.hasNext()) {
+ Map<String, Object> orderItem = (Map<String, Object>) orderItemIter.next();
+ addItem(cart, orderItem, dispatcher, delegator, 0);
+ }
+
+ // set partyId from
+ if (UtilValidate.isNotEmpty(payToPartyId)) {
+ cart.setBillFromVendorPartyId(payToPartyId);
+ }
+
+ Map<String, Object> shippingServiceSelectedCtx = UtilGenerics.checkMap(context.get("shippingServiceSelectedCtx"));
+ if (UtilValidate.isNotEmpty(shippingServiceSelectedCtx.get("shippingServiceCost"))) {
+ BigDecimal shippingAmount = new BigDecimal(shippingServiceSelectedCtx.get("shippingServiceCost").toString());
+ if (shippingAmount.doubleValue() > 0) {
+ GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SHIPPING_CHARGES", cart.getOrderId(), null, null, shippingAmount.doubleValue(), 0.0);
+ if (shippingAdjustment != null) {
+ cart.addAdjustment(shippingAdjustment);
+ }
+ }
+ }
+
+ // Apply additional shipping costs as order adjustment
+ if (UtilValidate.isNotEmpty(shippingServiceSelectedCtx.get("shippingTotalAdditionalCost"))) {
+ BigDecimal shippingAdditionalCost = new BigDecimal(shippingServiceSelectedCtx.get("shippingTotalAdditionalCost").toString());
+ if (shippingAdditionalCost.doubleValue() > 0) {
+ GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "MISCELLANEOUS_CHARGE", cart.getOrderId(), null, null, shippingAdditionalCost.doubleValue(), 0.0);
+ if (shippingAdjustment != null) {
+ cart.addAdjustment(shippingAdjustment);
+ }
+ }
+ }
+
+ // Apply sales tax as order adjustment
+ Map<String, Object> shippingDetailsCtx = UtilGenerics.checkMap(context.get("shippingDetailsCtx"));
+ if (UtilValidate.isNotEmpty(shippingDetailsCtx.get("salesTaxAmount"))) {
+ BigDecimal salesTaxAmount = new BigDecimal(shippingDetailsCtx.get("salesTaxAmount").toString());
+ if (salesTaxAmount.doubleValue() > 0) {
+ double salesPercent = 0.0;
+ if (UtilValidate.isNotEmpty(shippingDetailsCtx.get("salesTaxPercent"))) {
+ salesPercent = new Double(shippingDetailsCtx.get("salesTaxPercent").toString()).doubleValue();
+ }
+ GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, salesTaxAmount.doubleValue(), salesPercent);
+ if (salesTaxAdjustment != null) {
+ cart.addAdjustment(salesTaxAdjustment);
+ }
+ }
+ }
+
+ Debug.logInfo("Importing new order from eBay", module);
+ // set partyId to
+ String partyId = null;
+ String contactMechId = null;
+
+ Map<String, Object> shippingAddressCtx = UtilGenerics.checkMap(context.get("shippingAddressCtx"));
+ if (UtilValidate.isNotEmpty(shippingAddressCtx)) {
+ String buyerName = (String) shippingAddressCtx.get("buyerName");
+ String firstName = (String) buyerName.substring(0, buyerName.indexOf(" "));
+ String lastName = (String) buyerName.substring(buyerName.indexOf(" ")+1);
+
+ String country = (String) shippingAddressCtx.get("shippingAddressCountry");
+ String state = (String) shippingAddressCtx.get("shippingAddressStateOrProvince");
+ String city = (String) shippingAddressCtx.get("shippingAddressCityName");
+ EbayHelper.correctCityStateCountry(dispatcher, shippingAddressCtx, city, state, country);
+ String shippingAddressStreet = null;
+ if (UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet1"))) {
+ shippingAddressStreet = shippingAddressCtx.get("shippingAddressStreet").toString();
+ shippingAddressCtx.put("shippingAddressStreet1", shippingAddressStreet);
+ } else {
+ shippingAddressStreet = shippingAddressCtx.get("shippingAddressStreet1").toString();
+ }
+
+ List<GenericValue> shipInfo = PartyWorker.findMatchingPersonPostalAddresses(delegator, shippingAddressStreet,
+ (UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet2")) ? null : shippingAddressCtx.get("shippingAddressStreet2").toString()), shippingAddressCtx.get("city").toString(), shippingAddressCtx.get("stateProvinceGeoId").toString(),
+ shippingAddressCtx.get("shippingAddressPostalCode").toString(), null, shippingAddressCtx.get("countryGeoId").toString(), firstName, null, lastName);
+ if (UtilValidate.isNotEmpty(shipInfo)) {
+ GenericValue first = EntityUtil.getFirst(shipInfo);
+ partyId = first.getString("partyId");
+ Debug.logInfo("Existing shipping address found for : (party: " + partyId + ")", module);
+ }
+ }
+
+ // If matching party not found then try to find partyId from PartyAttribute entity.
+ GenericValue partyAttribute = null;
+ if (UtilValidate.isNotEmpty(context.get("eiasTokenBuyer"))) {
+ partyAttribute = EntityUtil.getFirst(delegator.findByAnd("PartyAttribute", UtilMisc.toMap("attrValue", (String) context.get("eiasTokenBuyer"))));
+ if (UtilValidate.isNotEmpty(partyAttribute)) {
+ partyId = (String) partyAttribute.get("partyId");
+ }
+ }
+
+ // if we get a party, check its contact information.
+ if (UtilValidate.isNotEmpty(partyId)) {
+ Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module);
+ GenericValue party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId));
+
+ contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx);
+ String emailBuyer = (String) context.get("emailBuyer");
+ if (!(emailBuyer.equals("") || emailBuyer.equalsIgnoreCase("Invalid Request"))) {
+ EbayHelper.setEmailContactMech(dispatcher, delegator, party, userLogin, context);
+ }
+ EbayHelper.setPhoneContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx);
+ }
+
+ // create party if none exists already
+ if (UtilValidate.isEmpty(partyId)) {
+ Debug.logInfo("Creating new party for the eBay buyer.", module);
+ partyId = EbayHelper.createCustomerParty(dispatcher, (String) shippingAddressCtx.get("buyerName"), userLogin);
+ if (UtilValidate.isEmpty(partyId)) {
+ Debug.logWarning("Using admin party for the eBay buyer.", module);
+ partyId = "admin";
+ }
+ }
+
+ // create new party's contact information
+ if (UtilValidate.isEmpty(contactMechId)) {
+
+ Debug.logInfo("Creating new postal address for party: " + partyId, module);
+ contactMechId = EbayHelper.createAddress(dispatcher, partyId, userLogin, "SHIPPING_LOCATION", shippingAddressCtx);
+ if (UtilValidate.isEmpty(contactMechId)) {
+ return ServiceUtil.returnFailure("Unable to create postalAddress with input map: " + shippingAddressCtx);
+ }
+ Debug.logInfo("Created postal address: " + contactMechId, module);
+ Debug.logInfo("Creating new phone number for party: " + partyId, module);
+ EbayHelper.createPartyPhone(dispatcher, partyId, (String) shippingAddressCtx.get("shippingAddressPhone"), userLogin);
+ Debug.logInfo("Creating association to eBay buyer for party: " + partyId, module);
+ EbayHelper.createEbayCustomer(dispatcher, partyId, (String) context.get("ebayUserIdBuyer"), null, userLogin);
+ String emailBuyer = (String) context.get("emailBuyer");
+ if (UtilValidate.isNotEmpty(emailBuyer) && !emailBuyer.equalsIgnoreCase("Invalid Request")) {
+ Debug.logInfo("Creating new email for party: " + partyId, module);
+ EbayHelper.createPartyEmail(dispatcher, partyId, emailBuyer, userLogin);
+ }
+ }
+
+ Debug.logInfo("Setting cart roles for party: " + partyId, module);
+ cart.setBillToCustomerPartyId(partyId);
+ cart.setPlacingCustomerPartyId(partyId);
+ cart.setShipToCustomerPartyId(partyId);
+ cart.setEndUserCustomerPartyId(partyId);
+
+ Debug.logInfo("Setting contact mech in cart: " + contactMechId, module);
+ cart.setShippingContactMechId(contactMechId);
+ cart.setMaySplit(Boolean.FALSE);
+
+ Debug.logInfo("Setting shipment method: " + (String) shippingServiceSelectedCtx.get("shippingService"), module);
+ EbayHelper.setShipmentMethodType(cart, (String) shippingServiceSelectedCtx.get("shippingService"), productStoreId, delegator);
+ cart.makeAllShipGroupInfos();
+
+ // create the order
+ Debug.logInfo("Creating CheckOutHelper.", module);
+ CheckOutHelper checkout = new CheckOutHelper(dispatcher, delegator, cart);
+ Debug.logInfo("Creating order.", module);
+ Map<?, ?> orderCreate = checkout.createOrder(userLogin);
+
+ if ("error".equals(orderCreate.get("responseMessage"))) {
+ List<String> errorMessageList = UtilGenerics.checkList(orderCreate.get("errorMessageList"), String.class);
+ return ServiceUtil.returnError(errorMessageList);
+ }
+ String orderId = (String) orderCreate.get("orderId");
+ Debug.logInfo("Created order with id: " + orderId, module);
+
+ if (UtilValidate.isNotEmpty(orderId)) {
+ String orderCreatedMsg = "Order created successfully with ID (" + orderId + ") & eBay Order ID associated with this order is (" + externalId + ").";
+ //orderImportSuccessMessageList.add(orderCreatedMsg);
+ }
+
+ // approve the order
+ if (UtilValidate.isNotEmpty(orderId)) {
+ Debug.logInfo("Approving order with id: " + orderId, module);
+ boolean approved = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId);
+ Debug.logInfo("Order approved with result: " + approved, module);
+
+ // create the payment from the preference
+ if (approved) {
+ Debug.logInfo("Creating payment for approved order.", module);
+ EbayHelper.createPaymentFromPaymentPreferences(delegator, dispatcher, userLogin, orderId, externalId, cart.getOrderDate(), partyId);
+ Debug.logInfo("Payment created.", module);
+ }
+ }
+ } catch (Exception e) {
+ result = ServiceUtil.returnFailure(e.getMessage());
+ }
+ return result;
+ }
+
+ private static void addItem(ShoppingCart cart, Map<String, Object> orderItem, LocalDispatcher dispatcher, Delegator delegator, int groupIdx) throws GeneralException {
+ String productId = orderItem.get("productId").toString();
+ GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+ if (UtilValidate.isEmpty(product)) {
+ String productMissingMsg = "The product having ID (" + productId + ") is misssing in the system.";
+ //orderImportFailureMessageList.add(productMissingMsg);
+ }
+ BigDecimal qty = new BigDecimal(orderItem.get("quantity").toString());
+ String itemPrice = orderItem.get("transactionPrice").toString();
+ if (UtilValidate.isEmpty(itemPrice)) {
+ itemPrice = orderItem.get("amount").toString();
+ }
+ BigDecimal price = new BigDecimal(itemPrice);
+ price = price.setScale(ShoppingCart.scale, ShoppingCart.rounding);
+
+ HashMap<Object, Object> attrs = new HashMap<Object, Object>();
+ attrs.put("shipGroup", groupIdx);
+
+ int idx = cart.addItemToEnd(productId, null, qty, null, null, attrs, null, null, dispatcher, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE);
+ ShoppingCartItem cartItem = cart.findCartItem(idx);
+ cartItem.setQuantity(qty, dispatcher, cart, true, false);
+ // locate the price verify it matches the expected price
+ BigDecimal cartPrice = cartItem.getBasePrice();
+ cartPrice = cartPrice.setScale(ShoppingCart.scale, ShoppingCart.rounding);
+ if (price.doubleValue() != cartPrice.doubleValue()) {
+ // does not match; honor the price but hold the order for manual review
+ cartItem.setIsModifiedPrice(true);
+ cartItem.setBasePrice(price);
+ cart.setHoldOrder(true);
+ cart.addInternalOrderNote("Price received [" + price + "] (for item # " + productId + ") from eBay Checkout does not match the price in the database [" + cartPrice + "]. Order is held for manual review.");
+ }
+ // assign the item to its ship group
+ cart.setItemShipGroupQty(cartItem, qty, groupIdx);
+ }
+}
\ No newline at end of file
Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy?rev=1003451&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy (added)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy Fri Oct 1 09:37:14 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.entity.util.EntityUtil;
+
+context.importStatus = "NOT_IMPORT";
+orderHeaders = delegator.findByAnd("OrderHeader", [externalId : externalId]);
+if (orderHeaders.size() > 0) {
+ orderHeader = EntityUtil.getFirst(orderHeaders);
+ context.orderId = orderHeader.get("orderId");
+ if ("ORDER_APPROVED".equals(orderHeader.get("statusId").toString())) {
+ context.importStatus = "IMPORTED";
+ }
+}
Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListParameters.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListParameters.groovy?rev=1003451&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListParameters.groovy (added)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListParameters.groovy Fri Oct 1 09:37:14 2010
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+ session.setAttribute("shippingAddressCtx", shippingAddressCtx);
+ session.setAttribute("shippingServiceSelectedCtx", shippingServiceSelectedCtx);
+ session.setAttribute("shippingDetailsCtx", shippingDetailsCtx);
+ session.setAttribute("checkoutStatusCtx", checkoutStatusCtx);
+ session.setAttribute("externalTransactionCtx", externalTransactionCtx);
+ session.setAttribute("orderItemList", orderItemList);
Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy?rev=1003451&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy (added)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy Fri Oct 1 09:37:14 2010
@@ -0,0 +1,79 @@
+/*
+ * 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.entity.util.EntityUtil;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+import org.ofbiz.entity.util.EntityUtil;
+
+orderLists = FastList.newInstance();
+if (orderList) {
+ for (orderCount = 0; orderCount < orderList.size(); orderCount++) {
+ orderItem = orderList[orderCount];
+ orderId = null;
+ orderHeaders = delegator.findByAnd("OrderHeader", [externalId : orderItem.("externalId")]);
+ if (orderHeaders.size() > 0) {
+ orderHeader = EntityUtil.getFirst(orderHeaders);
+ orderId = orderHeader.get("orderId").toString();
+ }
+ checkoutStatus = orderItem.get("checkoutStatusCtx");
+ paymentMethodUsed = null;
+ if (checkoutStatus) {
+ paymentMethodUsed = checkoutStatus.get("paymentMethodUsed");
+ }
+ //orderLists.add(orderMap);
+ items = orderItem.get("orderItemList");
+ for (itemCount = 0; itemCount < items.size(); itemCount++) {
+ item = items[itemCount];
+ title = null;
+ if (!(item.get("title"))) {
+ product = delegator.findOne("Product", [productId : item.get("productId")], true);
+ title = product.get("internalName");
+ }
+ orderMap = FastMap.newInstance();
+ orderMap.put("orderId", orderId);
+ orderMap.put("externalId", orderItem.get("externalId"));
+ orderMap.put("amountPaid", orderItem.get("amountPaid"));
+ orderMap.put("createdDate", orderItem.get("createdDate"));
+ orderMap.put("ebayUserIdBuyer", orderItem.get("ebayUserIdBuyer"));
+ orderMap.put("paymentMethodUsed", paymentMethodUsed);
+ orderMap.put("itemId", item.get("itemId"));
+ orderMap.put("quantity", item.get("quantity"));
+ orderMap.put("productId", item.get("productId"));
+ orderMap.put("transactionPrice", item.get("transactionPrice"));
+ orderMap.put("title", title);
+ orderMap.put("closedDate", item.get("closedDate"));
+
+ orderMap.put("shippingAddressCtx", orderItem.get("shippingAddressCtx"));
+ orderMap.put("shippingServiceSelectedCtx", orderItem.get("shippingServiceSelectedCtx"));
+ orderMap.put("shippingDetailsCtx", orderItem.get("shippingDetailsCtx"));
+ orderMap.put("checkoutStatusCtx", orderItem.get("checkoutStatusCtx"));
+ orderMap.put("externalTransactionCtx", orderItem.get("externalTransactionCtx"));
+ orderMap.put("orderItemList", orderItem.get("orderItemList"));
+ orderMap.put("paidTime", orderItem.get("paidTime"));
+ orderMap.put("shippedTime", orderItem.get("shippedTime"));
+ orderMap.put("paidTime", orderItem.get("paidTime"));
+ orderMap.put("emailBuyer", orderItem.get("emailBuyer"));
+
+ orderLists.add(orderMap);
+ }
+ }
+}
+context.orderLists = orderLists;
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=1003451&r1=1003450&r2=1003451&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Fri Oct 1 09:37:14 2010
@@ -469,6 +469,74 @@
<response name="success" type="view" value="customerService"/>
<response name="error" type="view" value="customerService"/>
</request-map>
+ <request-map uri="ClosedListing">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="ClosedListing"/>
+ </request-map>
+ <request-map uri="geteBayClosedItem">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="geteBayClosedItem"/>
+ <response name="success" type="view" value="ClosedListing"/>
+ <response name="error" type="view" value="ClosedListing"/>
+ </request-map>
+ <request-map uri="OrderListing">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="getEbayOrders">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="getEbayOrders"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="getSellerTransaction">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="getSellerTransaction"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="getMyeBaySelling">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="getMyeBaySelling"/>
+ <response name="success" type="view" value="ActiveListing"/>
+ <response name="error" type="view" value="ActiveListing"/>
+ </request-map>
+ <request-map uri="getEbayStoreTransaction">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="getEbayStoreTransaction"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="getEbayStoreOrder">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="getEbayStoreOrder"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="EbayStoreImportTransaction">
+ <security https="true" auth="true"/>
+ <event type="service-multi" invoke="EbayStoreImportTransaction"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="EbayStoreImportOrder">
+ <security https="true" auth="true"/>
+ <event type="service-multi" invoke="EbayStoreImportOrder"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="EbayStoreCreateTransactionShoppingCart">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="EbayStoreCreateTransactionShoppingCart"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
+ <request-map uri="EbayStoreCreateOrderShoppingCart">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="EbayStoreCreateOrderShoppingCart"/>
+ <response name="success" type="view" value="OrderListing"/>
+ <response name="error" type="view" value="OrderListing"/>
+ </request-map>
<!-- end of request mappings -->
<!-- View Mappings -->
@@ -517,5 +585,8 @@
<!-- Customer Service-->
<view-map name="customerService" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#customerService"/>
<view-map name="customerOfferData" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#customerOfferData"/>
+
+ <view-map name="ClosedListing" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#ClosedListing"/>
+ <view-map name="OrderListing" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#OrderListing"/>
<!-- end of view mappings -->
</site-conf>
Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml?rev=1003451&r1=1003450&r2=1003451&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerForms.xml Fri Oct 1 09:37:14 2010
@@ -148,7 +148,7 @@ value="${bsh:billingAccount != null ? or
</drop-down>
</field>
<field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit/></field>
- </form>
+ </form>
<!-- Inventory -->
<form name="EbayStoreFacilityList" type="single" list-name="productStoreFacilityList" target="ebayStoreInventory"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
@@ -700,4 +700,105 @@ value="${bsh:billingAccount != null ? or
</field>
<field name="updateContactStatus"><submit button-type="button"/></field>
</form>
+ <form name="ClosedItemList" type="list" target="doAction" list-name="closedList"
+ 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" view-size="100">
+ <field name="itemId" title="Item ID" sort-field="true"><display description="${itemId}"/></field>
+ <field name="SKU" title="Product ID"><display description="${SKU}"/></field>
+ <field name="title">
+ <hyperlink target="${viewItemURL}" description="${title}" target-type="plain" target-window="_BLANK"/>
+ </field>
+ <field name="sellingStatus" title="Status"><display description="${sellingStatus}"/></field>
+ <field name="endTime" title="Closing Time"><display description="${endTime}"/></field>
+ <field name="reservePrice" title="Reserve Price"><display description="${reservePrice}"/></field>
+ <field name="bidCount" title="Bids"><display description="${bidCount}"/></field>
+ <field name="hitCount" title="Hits"><display description="${hitCount}"/></field>
+ <field name="listingType" title="Listing Type"><display description="${listingType}"/></field>
+ </form>
+ <form name="TransactionList" type="multi" target="EbayStoreImportTransaction" list-name="transactionsList"
+ 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" view-size="100">
+ <row-actions>
+ <script location="component://ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy"></script>
+ </row-actions>
+ <field name="_rowSubmit" position="1" title="${uiLabelMap.CommonSelect}"><check/></field>
+ <field name="productStoreId"><hidden value="${productStoreId}"/></field>
+ <field name="orderId" title="Order ID">
+ <hyperlink target="https://localhost:8443/ordermgr/control/orderview?orderId=${orderId}" description="${orderId}" target-type="plain" target-window="_BLANK"/>
+ </field>
+ <field name="externalId" title="Transaction ID"><display description="${externalId}"/></field>
+ <field name="ebayUserIdBuyer" title="Winner Bidder"><display description="${ebayUserIdBuyer}"/></field>
+ <field name="productId" title="Product ID"><display description="${productId}"/></field>
+ <field name="title" title="Product Name"><display description="${title}"/></field>
+ <field name="createdDate" title="Listing Close Date"><display description="${createdDate}"/></field>
+ <field name="paymentType"><display description="${paymentMethod}"></display></field>
+ <field name="quantityPurchased" title="Quntity"><display description="${quantityPurchased}"/></field>
+ <field name="transactionPrice" title="Price Order Total"><display description="${transactionPrice}"/></field>
+ <field name="checkoutStatus" title="Checkout Status"><display description="${checkoutStatus}"></display></field>
+ <field name="importStatus" title="Import Status"><display description="${importStatus}"></display></field>
+ <field name="amountPaid"><hidden value="${amountPaid}"/></field>
+ <field name="paidTime"><hidden value="${paidTime}"/></field>
+ <field name="currency"><hidden value="${currency}"></hidden></field>
+ <field name="buyerName"><hidden value="${buyerName}"></hidden></field>
+ <field name="eiasTokenBuyer"><hidden value="${eiasTokenBuyer}"></hidden></field>
+ <field name="emailBuyer"><hidden value="${emailBuyer}"></hidden></field>
+ <field name="shippingService"><hidden value="${shippingService}"></hidden></field>
+ <field name="shippingServiceCost"><hidden value="${shippingServiceCost}"></hidden></field>
+ <field name="shippingTotalAdditionalCost"><hidden value="${shippingTotalAdditionalCost}"></hidden></field>
+ <field name="salesTaxAmount"><hidden value="${salesTaxAmount}"></hidden></field>
+ <field name="salesTaxPercent"><hidden value="${salesTaxPercent}"></hidden></field>
+ <field name="shippingAddressCityName"><hidden value="${shippingAddressCityName}"></hidden></field>
+ <field name="shippingAddressCountry"><hidden value="${shippingAddressCountry}"></hidden></field>
+ <field name="shippingAddressPhone"><hidden value="${shippingAddressPhone}"></hidden></field>
+ <field name="shippingAddressPostalCode"><hidden value="${shippingAddressPostalCode}"></hidden></field>
+ <field name="shippingAddressStateOrProvince"><hidden value="${shippingAddressStateOrProvince}"></hidden></field>
+ <field name="shippingAddressStreet"><hidden value="${shippingAddressStreet}"></hidden></field>
+ <field name="shippingAddressStreet1"><hidden value="${shippingAddressStreet1}"></hidden></field>
+ <field name="shippingAddressStreet2"><hidden value="${shippingAddressStreet2}"></hidden></field>
+ <field name="import" title="Import Orders"><submit button-type="button"/></field>
+ </form>
+ <form name="OrderList" type="multi" target="EbayStoreImportOrder" list-name="orderLists"
+ 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" view-size="100">
+ <row-actions>
+ <script location="component://ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListParameters.groovy"/>
+ </row-actions>
+ <field name="productStoreId"><hidden value="${productStoreId}"/></field>
+ <field name="_rowSubmit" position="1" title="${uiLabelMap.CommonSelect}" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><check/></field>
+ <field name="orderId" position="1" title="Order ID" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}">
+ <hyperlink target="https://localhost:8443/ordermgr/control/orderview?orderId=${orderId}" description="${orderId}" target-type="plain" target-window="_BLANK"/>
+ </field>
+ <field name="externalId" title="External ID" position="1" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><display description="${externalId}"></display></field>
+ <field name="ebayUserIdBuyer" title="Winning Bidder" position="1" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><display description="${ebayUserIdBuyer}"></display></field>
+ <field name="dummy4" title=" " position="1"><display></display></field>
+ <field name="dummy5" title=" " position="1"><display></display></field>
+ <field name="createdDate" title="Invoice Date" position="1" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><display description="${createdDate}"></display></field>
+ <field name="paymentMethodUsed" title="Payment Type" position="1" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><display description="${paymentMethodUsed}"></display></field>
+ <field name="dummy7" title=" " position="1"><display></display></field>
+ <field name="amountPaid" title="Order Total Price" position="1" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><display description="${amountPaid}"></display></field>
+
+ <field name="dummy1" title=" " position="2"><display></display></field>
+ <field name="dummy2" title=" " position="2"><display></display></field>
+ <field name="dummy3" title=" " position="2"><display></display></field>
+ <field name="dummy8" title=" " position="2"><display></display></field>
+ <field name="dummy10" title=" " position="2"><display></display></field>
+ <field name="productId" title="SKU" position="2"><display description="${productId}"></display></field>
+ <field name="title" title="Title" position="2"><display description="${title}"></display></field>
+ <field name="dummy9" title=" " position="2"><display></display></field>
+ <field name="dummy6" title=" " position="2"><display></display></field>
+ <field name="quantity" title="Quantity" position="2"><display description="${quantity}"></display></field>
+ <field name="amount" title="Amount price per item" position="2"><display description="${transactionPrice}"></display></field>
+
+ <field name="paidTime" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><hidden value="${paidTime}"></hidden></field>
+ <field name="shippedTime" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><hidden value="${shippedTime}"></hidden></field>
+ <field name="emailBuyer" use-when="${bsh:String prev=(String)previousItem.get("externalId");return new Boolean(!(prev!=null&&prev.equals(externalId)));}"><hidden value="${emailBuyer}"></hidden></field>
+
+ <field name="submitButton" title="${uiLabelMap.CommonSubmit}"><submit button-type="button"/></field>
+ </form>
+ <form name="FindEbayStoreOrders" type="single" target="OrderListing"
+ header-row-style="header-row" default-table-style="basic-table">
+ <field name="productStoreId"><hidden value="${productStoreId}"></hidden></field>
+ <field name="formSelect"><hidden value="${formSelect}"></hidden></field>
+ <field name="fromDate" title="${uiLabelMap.CommonFromDateTime}"><date-time type="String"/></field>
+ <field name="thruDate" title="${uiLabelMap.CommonThruDateTime}"><date-time type="String"/></field>
+ <field name="selectedDate"><hidden value="true"></hidden></field>
+ <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit button-type="button"/></field>
+ </form>
</forms>
Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml?rev=1003451&r1=1003450&r2=1003451&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbaySellingManagerScreens.xml Fri Oct 1 09:37:14 2010
@@ -631,4 +631,131 @@
</widgets>
</section>
</screen>
+ <screen name="EbayclosedListing">
+ <section>
+ <actions>
+ <set field="sellingManagerItem" value="closedListing"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="SellingManagerDecorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <decorator-section-include name="body"/>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="ClosedListing">
+ <section>
+ <actions>
+ <service service-name="geteBayClosedItem" result-map="closedItemMap">
+ <field-map field-name="productStoreId" from-field="parameters.productStoreId"/>
+ </service>
+ <set field="closedList" from-field="closedItemMap.closedItemList"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="EbayclosedListing">
+ <decorator-section name="body">
+ <screenlet title="Closed Item Listings">
+ <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="ItemOption"/>
+ <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="ClosedItemList"/>
+ </screenlet>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="EbayOrderListing">
+ <section>
+ <actions>
+ <set field="sellingManagerItem" value="orderListing"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="SellingManagerDecorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <decorator-section-include name="body"/>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="OrderListing">
+ <section>
+ <actions>
+ <set field="productStoreId" from-field="parameters.productStoreId"/>
+ <set field="check" from-field="parameters.formSelect" default-value="transaction"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="EbayOrderListing">
+ <decorator-section name="body">
+ <section>
+ <condition>
+ <if-compare operator="equals" value="transaction" field="check"/>
+ </condition>
+ <widgets>
+ <section>
+ <actions>
+ <set field="selectedDate" from-field="parameters.selectedDate" default-value="false"/>
+ </actions>
+ <widgets>
+ <section>
+ <condition>
+ <if-compare operator="equals" value="true" field="selectedDate"/>
+ </condition>
+ <actions>
+ <service service-name="getEbayStoreTransaction" result-map="transactionResult">
+ <field-map field-name="productStoreId" from-field="parameters.productStoreId"/>
+ <field-map field-name="fromDate" from-field="parameters.fromDate"/>
+ <field-map field-name="thruDate" from-field="parameters.thruDate"/>
+ </service>
+ <set field="transactionsList" from-field="transactionResult.transactionsList"/>
+ <set field="selectedDate" value="false"/>
+ </actions>
+ <widgets/>
+ </section>
+ <screenlet title="Order Listings (Import single Transactions)">
+ <include-menu location="component://ebaystore/widget/EbayStoreMenus.xml" name="EbayOrderSubBar"/>
+ <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="FindEbayStoreOrders"/>
+ <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="TransactionList"/>
+ </screenlet>
+ </widgets>
+ </section>
+ </widgets>
+ <fail-widgets>
+ <section>
+ <actions>
+ <set field="formSelect" from-field="parameters.formSelect"/>
+ <set field="selectedDate" from-field="parameters.selectedDate" default-value="false"/>
+ </actions>
+ <widgets>
+ <section>
+ <condition>
+ <if-compare operator="equals" value="true" field="selectedDate"/>
+ </condition>
+ <actions>
+ <service service-name="getEbayStoreOrder" result-map="orderResult">
+ <field-map field-name="productStoreId" from-field="parameters.productStoreId"/>
+ <field-map field-name="fromDate" from-field="parameters.fromDate"/>
+ <field-map field-name="thruDate" from-field="parameters.thruDate"/>
+ </service>
+ <set field="orderList" from-field="orderResult.orderList"/>
+ <script location="component://ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy"/>
+ <set field="selectedDate" value="false"/>
+ </actions>
+ <widgets/>
+ </section>
+ <screenlet title="Order Listings (Import many transactions)">
+ <include-menu location="component://ebaystore/widget/EbayStoreMenus.xml" name="EbayOrderSubBar"/>
+ <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="FindEbayStoreOrders"/>
+ <include-form location="component://ebaystore/widget/EbaySellingManagerForms.xml" name="OrderList"/>
+ </screenlet>
+ </widgets>
+ </section>
+ </fail-widgets>
+ </section>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
</screens>
Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml?rev=1003451&r1=1003450&r2=1003451&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml Fri Oct 1 09:37:14 2010
@@ -71,13 +71,13 @@
<parameter param-name="productStoreId" value="${parameters.productStoreId}"/>
</link>
</menu-item>
- <menu-item name="soldListing" title="${uiLabelMap.EbaySold}">
- <link target="soldListing">
+ <menu-item name="closedListing" title="${uiLabelMap.ClosedListing}">
+ <link target="ClosedListing">
<parameter param-name="productStoreId" value="${parameters.productStoreId}"/>
</link>
</menu-item>
- <menu-item name="unsoldListing" title="${uiLabelMap.EbayUnsold}">
- <link target="unsoldListing">
+ <menu-item name="orderListing" title="${uiLabelMap.EbayOrders}">
+ <link target="OrderListing">
<parameter param-name="productStoreId" value="${parameters.productStoreId}"/>
</link>
</menu-item>
@@ -155,4 +155,20 @@
</link>
</menu-item>
</menu>
+ <menu name="EbayOrderSubBar" menu-container-style="button-bar button-style-2" selected-menuitem-context-field-name="role">
+ <menu-item name="SelectTransaction" title="${uiLabelMap.EbayStoreStoreSelectTransaction}">
+ <link target="OrderListing">
+ <parameter param-name="formSelect" value="transaction"/>
+ <parameter param-name="selectedDate" value="false"/>
+ <parameter param-name="productStoreId" from-field="parameters.productStoreId"/>
+ </link>
+ </menu-item>
+ <menu-item name="SelectOrder" title="${uiLabelMap.EbayStoreStoreSelectOrder}">
+ <link target="OrderListing">
+ <parameter param-name="formSelect" value="order"/>
+ <parameter param-name="selectedDate" value="false"/>
+ <parameter param-name="productStoreId" from-field="parameters.productStoreId"/>
+ </link>
+ </menu-item>
+ </menu>
</menus>