You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/09/16 14:48:21 UTC
svn commit: r815743 - in /ofbiz/trunk/specialpurpose/ebay: ./ data/
entitydef/ src/org/ofbiz/ebay/
Author: ashish
Date: Wed Sep 16 12:48:21 2009
New Revision: 815743
URL: http://svn.apache.org/viewvc?rev=815743&view=rev
Log:
Moved ShippingMethod & Carrier Party info into entity named "EbayShippingMethod"(new entity).
Prepared demo data to support this feature.Ebay supports couple of shipping method.
Supported shipping methods list: http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/types/ShippingServiceCodeType.html
In future if we plan to support more methods then we should prepare demo data and we will be done by then.
I will also provide GUI support for this feature soon.
Thanks Jacopo for your comment on this feature implementation.
Modified:
ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml
ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml
ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
Modified: ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml?rev=815743&r1=815742&r2=815743&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml Wed Sep 16 12:48:21 2009
@@ -24,5 +24,17 @@
<EbayConfig productStoreId="9000" devId="ppodkYk34Kh-279a-6khr-a07c-06fd1d65824b" appId="ApacheOFB-bf44-4c32-ac45-3e099a32b675" certId="99ca5f9f-dd5c-3de-9a4c-13b247ieidfg" compatibilityLevel="517" siteId="0" xmlGatewayUri="https://api.sandbox.ebay.com/ws/api.dll" webSiteId="EBAY">
<token><![CDATA[APACHEeerer**AQresT**aOFBIZ**Dddddg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFddddddddsssererdafjk23232uy+seQ**IzABAA**AAMAAA**6kOEMXRyvyVRLt7vAL7W+5dfjdkfjkldfjlkdjfldj121219fjlkdfjldjf+oRU0d07B0jfdFxJj6OolPHiQN5c0qmVNDRsSKaOucPjXTHSBmVm62p7M9/YmRCag/Mz1DjvDTFyS1kaBinGH2lwd9AjcBSBUbD9tSZVTdKn5PQBh3kkCh5Fe+UK5fyq9OeikM/Bdfafja377dkdkBddDDll+zPbG8pYL13cBgCGj8/zzMSGX2ugZkbU01bCLKkTzLOSqIcxj9xgJ4uDHxhjjizyWlHd2ovFKP8mmc/bEjLANUqS1z0vhR0NHydU/izZR8eYAruTvX6eYzSfsZA85sVOpIAjVEYX9M4CqgXazYxDFAT+y7E4+oM9N+tx8+/dkdkfdoTTKdHhdlKwVmgdULRhW0nP04BMugLpRCQrITSVpSJ1mfkwwb4JEQRNwSSUOe/1P3t21JhUBj3OJjpwC1ds84DSh9nlyykxF3X+EfFxtE4rTKUO+fODRDD5FBDO2+TD3AROz/3u/OWOvTWUm13u2kxMiiEQ3DNkuxN4g7Gj5xhKk7uNMIRRM8YoxoDoiJnbvuLQctBtpn1vibjUJsxTlnq92PLOhsgkp2NfhcxzS1JJfDKX1snOkmWfiluqyW5oDayJoZnrHIVKD0RkYNd2h+U5DOyOJ2/YXYIAPJAcWloGLpKO7k]]></token>
<customXml><![CDATA[<custom-xml><Currency>USD</Currency><UseTaxTable>false</UseTaxTable><DispatchTimeMax>3</DispatchTimeMax><ReturnPolicy><ReturnsAcceptedOption>ReturnsNotAccepted</ReturnsAcceptedOption></ReturnPolicy><ShippingDetails><ShippingType>Flat</ShippingType><ShippingServiceOptions><ShippingService>UPS2ndDay</ShippingService><ShippingServicePriority>1</ShippingServicePriority><ShippingServiceCost>5</ShippingServiceCost><ShippingServiceAdditionalCost>2</ShippingServiceAdditionalCost><ShippingSurcharge>1</ShippingSurcharge></ShippingServiceOptions></ShippingDetails></custom-xml>]]></customXml>
- </EbayConfig>
+ </EbayConfig>
+
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="USPSPriority" productStoreId="9000" amount="20.00" carrierPartyId="USPS" shipmentMethodTypeId="STANDARD"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="UPSGround" productStoreId="9000" amount="10.00" carrierPartyId="UPS" shipmentMethodTypeId="GROUND"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="UPS3rdDay" productStoreId="9000" amount="0.00" carrierPartyId="UPS" shipmentMethodTypeId="THIRD_DAY"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="UPS2ndDay" productStoreId="9000" amount="20.00" carrierPartyId="UPS" shipmentMethodTypeId="SECOND_DAY"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="USPSExpressMailInternational" productStoreId="9000" amount="10.00" carrierPartyId="USPS" shipmentMethodTypeId="INT_EXPRESS"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="UPSNextDay" productStoreId="9000" amount="0.00" carrierPartyId="UPS" shipmentMethodTypeId="NEXT_DAY"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="UPSNextDayAir" productStoreId="9000" amount="20.00" carrierPartyId="UPS" shipmentMethodTypeId="AIR"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="ShippingMethodStandard" productStoreId="9000" amount="10.00" carrierPartyId="UPS" shipmentMethodTypeId="GROUND"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="StandardInternational" productStoreId="9000" amount="0.00" carrierPartyId="USPS" shipmentMethodTypeId="INT_EXPRESS"/>
+ <EbayShippingMethod methodTypeEnumId="EBAY_FLAT_RATE" shipmentMethodName="LocalDelivery" productStoreId="9000" amount="0.00" carrierPartyId="_NA_" shipmentMethodTypeId="STANDARD"/>
+
</entity-engine-xml>
\ No newline at end of file
Modified: ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml?rev=815743&r1=815742&r2=815743&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/data/EbayTypeData.xml Wed Sep 16 12:48:21 2009
@@ -22,4 +22,7 @@
<ProductPricePurpose productPricePurposeId="EBAY" description="eBay Auction"/>
<ProductCategoryType productCategoryTypeId="EBAY_CATEGORY" description="eBay" hasTable="N" parentTypeId=""/>
<ProductContentType productContentTypeId="EBAY_DESCRIPTION" description="Detail Page for eBay Auctions"/>
+
+ <EnumerationType description="Ebay Ship Types" enumTypeId="EBAY_SHIP_TYPE" hasTable="N" parentTypeId=""/>
+ <Enumeration description="Flat Rate Shipping" enumCode="FLAT_RATE" enumId="EBAY_FLAT_RATE" sequenceId="01" enumTypeId="EBAY_SHIP_TYPE"/>
</entity-engine-xml>
Modified: ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml?rev=815743&r1=815742&r2=815743&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml Wed Sep 16 12:48:21 2009
@@ -61,5 +61,32 @@
<key-map field-name="webSiteId"/>
</relation>
</entity>
+
+ <entity entity-name="EbayShippingMethod"
+ package-name="org.ofbiz.googlecheckout.shipping"
+ title="Google Shipping Method Config">
+ <field name="shipmentMethodName" type="id-long-ne"></field>
+ <field name="productStoreId" type="id-ne"></field>
+ <field name="amount" type="currency-amount"></field>
+ <field name="additionalAmount" type="currency-amount"></field>
+ <field name="additionalPercent" type="fixed-point"></field>
+ <field name="methodTypeEnumId" type="id-ne"></field>
+ <field name="carrierPartyId" type="id-ne"></field>
+ <field name="shipmentMethodTypeId" type="id-ne"></field>
+ <prim-key field="shipmentMethodName"/>
+ <prim-key field="productStoreId"/>
+ <relation type="one" fk-name="EBYSM_PRD_STRE" rel-entity-name="ProductStore">
+ <key-map field-name="productStoreId"/>
+ </relation>
+ <relation type="one" fk-name="EBYSM_TPE_ENUM" rel-entity-name="Enumeration">
+ <key-map field-name="methodTypeEnumId" rel-field-name="enumId"/>
+ </relation>
+ <relation type="one" fk-name="EBYSM_CRIER_PRTY" rel-entity-name="Party">
+ <key-map field-name="carrierPartyId" rel-field-name="partyId"/>
+ </relation>
+ <relation type="one" fk-name="EBYSM_SHMETH_TPE" rel-entity-name="ShipmentMethodType">
+ <key-map field-name="shipmentMethodTypeId"/>
+ </relation>
+ </entity>
</entitymodel>
\ No newline at end of file
Modified: ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml?rev=815743&r1=815742&r2=815743&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml Wed Sep 16 12:48:21 2009
@@ -28,7 +28,7 @@
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/EbaySecurityData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/EbayTypeData.xml"/>
- <entity-resource type="data" reader-name="seed" loader="main" location="data/DemoEbayData.xml"/>
+ <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoEbayData.xml"/>
<service-resource type="model" loader="main" location="servicedef/services.xml"/>
<service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java?rev=815743&r1=815742&r2=815743&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java Wed Sep 16 12:48:21 2009
@@ -165,42 +165,17 @@
return outputBuilder.toString();
}
- public static void setShipmentMethodType(ShoppingCart cart, String shippingService) {
+ public static void setShipmentMethodType(ShoppingCart cart, String shippingService, String productStoreId, GenericDelegator delegator) {
String partyId = "_NA_";
String shipmentMethodTypeId = "NO_SHIPPING";
-
- if (shippingService != null) {
- if ("USPSPriority".equals(shippingService)) {
- partyId = "USPS";
- shipmentMethodTypeId = "STANDARD";
- } else if ("UPSGround".equals(shippingService)) {
- partyId = "UPS";
- shipmentMethodTypeId = "GROUND";
- } else if ("UPS3rdDay".equals(shippingService)) {
- partyId = "UPS";
- shipmentMethodTypeId = "THIRD_DAY";
- } else if ("UPS2ndDay".equals(shippingService)) {
- partyId = "UPS";
- shipmentMethodTypeId = "SECOND_DAY";
- } else if ("USPSExpressMailInternational".equals(shippingService)) {
- partyId = "USPS";
- shipmentMethodTypeId = "INT_EXPRESS";
- } else if ("UPSNextDay".equals(shippingService)) {
- partyId = "UPS";
- shipmentMethodTypeId = "NEXT_DAY";
- } else if ("UPSNextDayAir".equals(shippingService)) {
- partyId = "UPS";
- shipmentMethodTypeId = "AIR";
- } else if ("ShippingMethodStandard".equals(shippingService)) {
- partyId = "UPS";
- shipmentMethodTypeId = "GROUND";
- } else if ("StandardInternational".equals(shippingService)) {
- partyId = "USPS";
- shipmentMethodTypeId = "INT_EXPRESS";
- } else if ("LocalDelivery".equals(shippingService)) {
- partyId = "_NA_";
- shipmentMethodTypeId = "STANDARD";
+ try {
+ GenericValue ebayShippingMethod = delegator.findOne("EbayShippingMethod", UtilMisc.toMap("shipmentMethodName", shippingService, "productStoreId", productStoreId), false);
+ if (UtilValidate.isNotEmpty(ebayShippingMethod)) {
+ partyId = ebayShippingMethod.getString("carrierPartyId");
+ shipmentMethodTypeId = ebayShippingMethod.getString("shipmentMethodTypeId");
}
+ } catch (GenericEntityException e) {
+ Debug.logInfo("Unable to find EbayShippingMethod", module);
}
cart.setCarrierPartyId(partyId);
cart.setShipmentMethodTypeId(shipmentMethodTypeId);
Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java?rev=815743&r1=815742&r2=815743&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java Wed Sep 16 12:48:21 2009
@@ -678,7 +678,7 @@
cart.setMaySplit(Boolean.FALSE);
Debug.logInfo("Setting shipment method: " + (String) shippingServiceSelectedCtx.get("shippingService"), module);
- EbayHelper.setShipmentMethodType(cart, (String) shippingServiceSelectedCtx.get("shippingService"));
+ EbayHelper.setShipmentMethodType(cart, (String) shippingServiceSelectedCtx.get("shippingService"), productStoreId, delegator);
cart.makeAllShipGroupInfos();
// create the order
Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=815743&r1=815742&r2=815743&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java Wed Sep 16 12:48:21 2009
@@ -789,7 +789,7 @@
cart.setMaySplit(Boolean.FALSE);
Debug.logInfo("Setting shipment method: " + (String) parameters.get("shippingService"), module);
- EbayHelper.setShipmentMethodType(cart, (String) parameters.get("shippingService"));
+ EbayHelper.setShipmentMethodType(cart, (String) parameters.get("shippingService"), productStoreId, delegator);
cart.makeAllShipGroupInfos();