|
Added: ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_ReserveProduct.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_ReserveProduct.xml?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_ReserveProduct.xml (added) +++ ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_ReserveProduct.xml Wed Feb 3 03:16:07 2010 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to you under the Apache License, Version + 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by + applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the + License. +--> +<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" + xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd" + xmlns="http://docbook.org/ns/docbook"> + <title>Reserve Product From Ofbiz Inventory screen.</title> + <para> +This screen allows the user to reserve products from ofbiz inventory for create listing and sell on ebay site.</para> + <section> + <title>How to reserve product?</title> + <orderedlist> + <listitem><para>Go to Reserve Product section</para></listitem> + <listitem><para>Enter field productId (Click "look up" to find product or type in text the system will show list of product)</para></listitem> + <listitem><para>Enter quantity of product you want to reserve.</para></listitem> + <listitem><para>Press "" button</para></listitem> + </orderedlist> + </section> +</section> Added: ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_StoreSetting.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_StoreSetting.xml?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_StoreSetting.xml (added) +++ ofbiz/trunk/specialpurpose/ebaystore/data/helpdata/HELP_EBAY_StoreSetting.xml Wed Feb 3 03:16:07 2010 @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to you under the Apache License, Version + 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by + applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the + License. +--> +<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" + xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd" + xmlns="http://docbook.org/ns/docbook"> + <title>Ebay Store Detail screen.</title> + <para> +This screen allows the user to manage store display setting (store detail, theme, and font color,logo etc.). you can setting in this screen and submit the system will sent your setting to your ebay store and store will update detail.</para> + <section> + <title>Fields Description : </title> + <orderedlist> + <listitem><para>Store Name(define 35 charactors)</para></listitem> + <listitem><para>Store Descrption(define 300 charactors)</para></listitem> + <listitem><para>Store Url</para></listitem> + <listitem><para>Store Logo Url(enter your company logo are located at the following URL..)</para></listitem> + <listitem><para> All of your Storeâs pages will appear with the theme you choose,On ebay there are two basic types of themes to choose from.</para></listitem> + <listitem><para>Store Advanced Theme (This is predesigned themes offer professionally designed background graphics and color combinations. Use one of these if you want to save time on creating an appealing, consistent look for your Store)</para></listitem> + <listitem><para>Store Advanced Theme Color</para></listitem> + <listitem><para>Store Basic Theme(Easily Customizable themes lend themselves to creating a more custom look. Use one of these if you'd prefer to have more control over the colors in your store)</para></listitem> + <listitem><para><link xl:href="http://developer.ebay.com/DevZone/XML/docs/WebHelp/images/CustomStoreLookAndFeelWithCallouts.jpg">See example layout on ebay</link></para></listitem> + <listitem><para>Primary Color</para></listitem> + <listitem><para>Secondary Color</para></listitem> + <listitem><para>Accent Color</para></listitem> + <listitem><para>Store Name(Font,Size and Color)</para></listitem> + <listitem><para>Store Title(Font,Size and Color)</para></listitem> + <listitem><para>Store Description(Font,Size and Color)</para></listitem> + <listitem><para>Header Display(Select No, do not include additional information in the header. + Select Yes, include additional information in the header. (Enter in text area below))</para></listitem> + <listitem><para>Select the eBay header style</para></listitem> + <listitem><para>Item List Display</para></listitem> + <listitem><para>Item Sort</para></listitem> + <listitem><para>Store Merch Display</para></listitem> + <listitem><para>Subscription Level</para></listitem> + <listitem><para>Press 'submit' to submit data to your ebay store site</para></listitem> + </orderedlist> + </section> +</section> + Added: ofbiz/trunk/specialpurpose/ebaystore/documents/EbayStore.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/documents/EbayStore.xml?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/documents/EbayStore.xml (added) +++ ofbiz/trunk/specialpurpose/ebaystore/documents/EbayStore.xml Wed Feb 3 03:16:07 2010 @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- + 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. +--> +<chapter xmlns="http://docbook.org/ns/docbook" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://docbook.org/ns/docbook ../../../applications/content/dtd/docbook.xsd"> + <title>The Ebay Component</title> + <section> + <title>Ebay Introduction</title> + <para> + The Ebay component provides an interface to the Ebay website. It is possible to export products from your store into eBay category also import an orders from ebay. + </para> + </section> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_EbayStore.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_NewEbayAccount.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_StoreSetting.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_ExportCategoriesToEbay.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_LeaveFeedback.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/data/helpdata/HELP_EBAY_Feedback.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_AutoPref.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_ProductInventory.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../data/helpdata/HELP_EBAY_ReserveProduct.xml"/> +</chapter> Added: ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml (added) +++ ofbiz/trunk/specialpurpose/ebaystore/entitydef/entitymodel.xml Wed Feb 3 03:16:07 2010 @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd"> + + <!-- ========================================================= --> + <!-- ======================== Defaults ======================= --> + <!-- ========================================================= --> + <title>Entity of an Open For Business Project Component</title> + <description>None</description> + <copyright>Copyright 2001-2009 The Apache Software Foundation</copyright> + <author>None</author> + <version>1.0</version> + + <extend-entity entity-name="EbayConfig"> + <field name="apiServerUrl" type="value"></field> + </extend-entity> + + <entity entity-name="EbayProductStoreInventory" + package-name="org.ofbiz.ebay.store" + title="Ebay store product inventory and status of listing"> + <field name="productStoreId" type="id-ne"></field> + <field name="facilityId" type="id-ne"></field> + <field name="productId" type="id-ne"></field> + <field name="folderId" type="id-ne"></field> + <field name="ebayProductId" type="numeric"></field> + <field name="quantityReserved" type="fixed-point"></field> + <field name="availableToPromiseListing" type="fixed-point"></field> + <field name="scheduled" type="fixed-point"></field> + <field name="activeListing" type="fixed-point"></field> + <field name="sold" type="fixed-point"></field> + <field name="unSold" type="fixed-point"></field> + <field name="successRatio" type="floating-point"></field> + <field name="avgSellingPrice" type="floating-point"></field> + <field name="reservedDate" type="date-time"></field> + <prim-key field="productStoreId"/> + <prim-key field="facilityId"/> + <prim-key field="productId"/> + <relation type="one" fk-name="EBYPSI_PRD_STRE" rel-entity-name="ProductStore"> + <key-map field-name="productStoreId"/> + </relation> + </entity> + +</entitymodel> + \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/ebaystore/lib/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Wed Feb 3 03:16:07 2010 @@ -0,0 +1 @@ +/ofbiz/branches/addbirt/specialpurpose/ebay/lib:831210-885099,885686-886087 Modified: ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml?rev=905876&r1=905875&r2=905876&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml Wed Feb 3 03:16:07 2010 @@ -25,13 +25,24 @@ <classpath type="dir" location="config"/> <classpath type="jar" location="lib/*"/> <classpath type="jar" location="build/lib/*"/> - + + <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> + + <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStoreSecurityData.xml"/> + <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStoreTypeData.xml"/> + <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStoreHelpData.xml"/> + <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStorePortletData.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoEbayStoreData.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/EbayStoreScheduledJobs.xml"/> + + <service-resource type="model" loader="main" location="servicedef/services.xml"/> + <webapp name="ebaystore" title="eBay Store" menu-name="secondary" server="default-server" location="webapp/ebaystore" - base-permission="OFBTOOLS,EBAY" + base-permission="OFBTOOLS,EBAYSTORE" mount-point="/ebaystore" app-bar-display="true"/> </ofbiz-component> Added: ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayServices.xml?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayServices.xml (added) +++ ofbiz/trunk/specialpurpose/ebaystore/script/org/ofbiz/ebaystore/EbayServices.xml Wed Feb 3 03:16:07 2010 @@ -0,0 +1,454 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> + <simple-method method-name="createEbayAccount" short-description="Create Ebay Account"> + + <set-service-fields service-name="createPersonAndUserLogin" to-map="newPerson" map="parameters"/> + <call-service service-name="createPersonAndUserLogin" in-map-name="newPerson"> + <result-to-field result-name="partyId" field="parameters.partyId"/> + </call-service> + + <set field="parameters.storeName" value="${parameters.userLoginId}_store"/> + <set-service-fields service-name="createProductStore" to-map="newProductStore" map="parameters"/> + <call-service service-name="createProductStore" in-map-name="newProductStore"> + <result-to-field result-name="productStoreId" field="parameters.productStoreId"/> + </call-service> + + <set field="parameters.roleTypeId" value="EBAY_ACCOUNT"/> + <set-service-fields service-name="createPartyRole" to-map="newPartyRole" map="parameters"/> + <call-service service-name="createPartyRole" in-map-name="newPartyRole"/> + + <set-service-fields service-name="createProductStoreRole" to-map="newProductStoreRole" map="parameters"/> + <call-service service-name="createProductStoreRole" in-map-name="newProductStoreRole"/> + <field-to-result field="parameters.productStoreId" result-name="productStoreId"/> + + </simple-method> + + <!-- Store Inventory Services --> + <simple-method method-name="reserveEbayStoreInventory" short-description="Reserve ofbiz Store product Inventory"> + <entity-one entity-name="Product" value-field="product" use-cache="true"/> + <entity-one entity-name="ProductStore" value-field="productStore" > + <field-map field-name="productStoreId" from-field="parameters.productStoreId"/> + </entity-one> + <if-empty field="productStore"> + <add-error><fail-message message="No ProductStore found with id ${parameters.productStoreId}, not reserving inventory."/></add-error> + <check-errors/> + </if-empty> + + <!-- if prodCatalog is set to not reserve inventory, break here --> + <if-compare value="N" operator="equals" field="productStore.reserveInventory"> + <!-- note: if not set, defaults to yes, reserve inventory --> + <log level="verbose" message="ProductStore with id ${productStore.productStoreId}, is set to NOT reserve inventory, not reserving inventory"/> + <field-to-result field="parameters.quantity" result-name="quantityNotReserved"/> + <return response-code="success"/> + </if-compare> + + <call-simple-method method-name="isStoreInventoryRequiredInline"/> + + <set from-field="parameters.facilityId" field="facilityId"/> + <if-not-empty field="facilityId"> + <entity-and entity-name="ProductStoreFacility" list="productStoreFacilities" use-cache="true"> + <field-map from-field="productStore.productStoreId" field-name="productStoreId"/> + <field-map from-field="facilityId" field-name="facilityId"/> + <order-by field-name="sequenceNum"/> + </entity-and> + <iterate list="productStoreFacilities" entry="productStoreFacility"> + <!-- Search Product Store Facilities to insure the facility passed in is associated to the Product Store passed in --> + <set field="facilityFound" from-field="productStoreFacility"/> + <log level="info" message="ProductStoreService:Facility Found : [${facilityFound}]"/> + </iterate> + <if-empty field="facilityFound"> + <add-error><fail-message message="Facility with id ${parameters.facilityId} is not associated to ProductStore with id ${parameters.productStoreId}, not reserving inventory."/></add-error> + <check-errors/> + </if-empty> + <!-- verifly that product was store in facility --> + <entity-and entity-name="ProductFacility" list="productFacilityList"> + <field-map from-field="facilityId" field-name="facilityId"/> + <field-map from-field="parameters.productId" field-name="productId"/> + </entity-and> + <if-empty field="productFacilityList"> + <add-error><fail-message message="Facility with id ${parameters.facilityId} is not associated to ProductId with id ${parameters.productId}, not reserving inventory."/></add-error> + <check-errors/> + </if-empty> + + <set-service-fields map="parameters" to-map="callServiceMap" service-name="reserveEbayProductInventoryByStoreFacility"/> + <set from-field="facilityId" field="callServiceMap.facilityId"/> + <set from-field="requireInventory" field="callServiceMap.requireInventory"/> + <set from-field="productStore.reserveOrderEnumId" field="callServiceMap.reserveOrderEnumId"/> + <call-service service-name="reserveEbayProductInventoryByStoreFacility" in-map-name="callServiceMap"> + <results-to-map map-name="resultMap"/> + <result-to-field result-name="quantityNotReserved" field="qtyNotReserve"/> + <result-to-field result-name="successMessage" field="returnSuccessMessage"/> + </call-service> + <set field="defaultReserve" default-value="0"/> + <!-- if quantityNotReserved greater than 0 then ATP in ofbiz stock not have, it should be return message or log warring--> + <if-compare-field field="qtyNotReserve" operator="equals" type="BigDecimal" to-field="defaultReserve"> + <call-simple-method method-name="editEbayProductStoreInventory"/> + <set field="successMessage" value="${returnSuccessMessage} quantity Reserved:${parameters.quantity} quantityNotReserved:${qtyNotReserve} "/> + <field-to-result field="successMessage"/> + <set field="quantityNotReserved" default-value="0" type="BigDecimal"/> + <field-to-result field="quantityNotReserved"/> + <else> + <!-- find qty which can reserved --> + <set field="requiredQty" from-field="parameters.quantity"/> + <calculate field="reservedQty" type="BigDecimal" > + <calcop operator="get"> + <calcop operator="get" field="requiredQty"/> + <calcop operator="negative" field="qtyNotReserve"/> + </calcop> + </calculate> + <set field="parameters.quantity" from-field="reservedQty"/> + <if-compare-field field="reservedQty" operator="greater" to-field="defaultReserve" > + <call-simple-method method-name="editEbayProductStoreInventory"/> + </if-compare-field> + + <!-- then show only qty was already reserved and show difference value that can not reserve --> + <set field="successMessage" value="${returnSuccessMessage} Quantity Reserved : ${reservedQty} Quantity Not Reserved : ${qtyNotReserve} "/> + <field-to-result field="successMessage"/> + <set field="quantityNotReserved" value="${qtyNotReserve}" default-value="0" type="BigDecimal"/> + <field-to-result field="quantityNotReserved"/> + </else> + </if-compare-field> + </if-not-empty> + </simple-method> + + <simple-method method-name="editEbayProductStoreInventory" short-description="add qty reserve from ofbiz Store product Inventory and combine with ebay store inventory"> + <entity-one entity-name="EbayProductStoreInventory" value-field="ebayProductStoreInventory" > + <field-map field-name="productStoreId" from-field="parameters.productStoreId"/> + <field-map field-name="facilityId" from-field="parameters.facilityId"/> + <field-map field-name="productId" from-field="parameters.productId"/> + </entity-one> + <if-empty field="ebayProductStoreInventory"> + <!-- add new reserved product --> + <make-value value-field="newEbayProductStoreInven" entity-name="EbayProductStoreInventory"/> + <set field="newEbayProductStoreInven.productStoreId" from-field="parameters.productStoreId"/> + <set field="newEbayProductStoreInven.facilityId" from-field="parameters.facilityId"/> + <set field="newEbayProductStoreInven.productId" from-field="parameters.productId"/> + <set field="newEbayProductStoreInven.quantityReserved" default-value="0" from-field="parameters.quantity"/> + <set field="newEbayProductStoreInven.availableToPromiseListing" default-value="0" from-field="parameters.quantity"/> + <set field="newEbayProductStoreInven.scheduled" default-value="0" type="BigDecimal"/> + <set field="newEbayProductStoreInven.activeListing" default-value="0" type="BigDecimal"/> + <set field="newEbayProductStoreInven.sold" default-value="0" type="BigDecimal"/> + <set field="newEbayProductStoreInven.unSold" default-value="0" type="BigDecimal"/> + <now-timestamp field="newEbayProductStoreInven.reservedDate" /> + <create-value value-field="newEbayProductStoreInven"/> + <else><!-- update reserved qty --> + <set field="qtyNow" default-value="0" from-field="ebayProductStoreInventory.quantityReserved"/> + <set field="atpListingNow" default-value="0" from-field="ebayProductStoreInventory.availableToPromiseListing"/> + <set field="reserveQty" default-value="0" from-field="parameters.quantity"/> + <calculate field="sumQtyReserved" type="BigDecimal" > + <calcop operator="add"> + <calcop operator="get" field="qtyNow"/> + <calcop operator="get" field="reserveQty"/> + </calcop> + </calculate> + <calculate field="sumQtyATPListing" type="BigDecimal" > + <calcop operator="add"> + <calcop operator="get" field="atpListingNow"/> + <calcop operator="get" field="reserveQty"/> + </calcop> + </calculate> + <now-timestamp field="ebayProductStoreInventory.reservedDate" /> + <set field="ebayProductStoreInventory.quantityReserved" from-field="sumQtyReserved"/> + <set field="ebayProductStoreInventory.availableToPromiseListing" from-field="sumQtyATPListing"/> + <store-value value-field="ebayProductStoreInventory"/> + </else> + </if-empty> + </simple-method> + + <simple-method method-name="isStoreInventoryRequiredInline" short-description="Is Store Inventory Required" login-required="false"> + <set from-field="product.requireInventory" field="requireInventory"/> + <if-empty field="requireInventory"> + <set from-field="productStore.requireInventory" field="requireInventory"/> + </if-empty> + <if-empty field="requireInventory"> + <set value="Y" field="requireInventory"/> + </if-empty> + </simple-method> + + <simple-method method-name="reserveEbayProductInventory" short-description="Reserve Inventory for a Product"> + + <now-timestamp field="nowTimestamp"/> + + <!-- check the product; make sure its a physical item --> + <entity-one entity-name="Product" value-field="product"/> + <entity-one entity-name="Facility" value-field="facility" use-cache="true"/> + <get-related-one value-field="product" relation-name="ProductType" to-value-field="productType"/> + <if-compare field="productType.isPhysical" operator="equals" value="N"> + <set field="parameters.quantityNotReserved" value="0" type="BigDecimal"/> + <else> + + <set value="EBAY_INV_RES" field="parameters.reserveReasonEnumId"/> + <set value="+datetimeReceived" field="orderByString"/> + <set from-field="parameters.quantity" field="parameters.quantityNotReserved"/> + + <!-- first reserve against InventoryItems in FLT_PICKLOC type locations, then FLT_BULK locations, then InventoryItems with no locations --> + <entity-condition entity-name="InventoryItemAndLocation" list="inventoryItemAndLocations"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="parameters.productId"/> + <condition-expr field-name="facilityId" from-field="parameters.facilityId" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="containerId" from-field="parameters.containerId" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="quantityOnHandTotal" operator="greater" value="0.0"/> + <condition-expr field-name="locationTypeEnumId" operator="equals" value="FLT_PICKLOC"/> + </condition-list> + <order-by field-name="${orderByString}"/> + </entity-condition> + <iterate entry="inventoryItemAndLocation" list="inventoryItemAndLocations"> + <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="Double"> + <!-- this is a little trick to get the InventoryItem value object without doing a query, possible since all fields on InventoryItem are also on InventoryItemAndLocation with the same names --> + <make-value entity-name="InventoryItem" map="inventoryItemAndLocation" value-field="inventoryItem"/> + <call-simple-method method-name="reserveForInventoryItemInline"/> + </if-compare> + </iterate> + <!-- still some left? try the FLT_BULK locations --> + <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="BigDecimal"> + <entity-condition entity-name="InventoryItemAndLocation" list="inventoryItemAndLocations"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="parameters.productId"/> + <condition-expr field-name="facilityId" from-field="parameters.facilityId" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="containerId" from-field="parameters.containerId" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="quantityOnHandTotal" operator="greater" value="0.0"/> + <condition-expr field-name="locationTypeEnumId" operator="equals" value="FLT_BULK"/> + </condition-list> + <order-by field-name="${orderByString}"/> + </entity-condition> + <iterate entry="inventoryItemAndLocation" list="inventoryItemAndLocations"> + <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="Double"> + <!-- this is a little trick to get the InventoryItem value object without doing a query, possible since all fields on InventoryItem are also on InventoryItemAndLocation with the same names --> + <make-value entity-name="InventoryItem" map="inventoryItemAndLocation" value-field="inventoryItem"/> + <call-simple-method method-name="reserveForInventoryItemInline"/> + </if-compare> + </iterate> + </if-compare> + + <!-- last of all try reserving in InventoryItems that have no locationSeqId, ie are not in any particular location --> + <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="BigDecimal"> + <entity-condition entity-name="InventoryItem" list="inventoryItems"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="parameters.productId"/> + <condition-expr field-name="facilityId" from-field="parameters.facilityId" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="containerId" from-field="parameters.containerId" ignore-if-empty="true" ignore-if-null="true"/> + <condition-expr field-name="quantityOnHandTotal" operator="greater" value="0.0"/> + <condition-expr field-name="locationSeqId" operator="equals" from-field="nullField"/> + </condition-list> + <order-by field-name="${orderByString}"/> + </entity-condition> + <iterate entry="inventoryItem" list="inventoryItems"> + <if> + <condition> + <and> + <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="Double"/> + <if-empty field="inventoryItem.locationSeqId"/> + </and> + </condition> + <then> + <call-simple-method method-name="reserveForInventoryItemInline"/> + </then> + </if> + </iterate> + </if-compare> + <!-- + if inventory is not required for purchase and quantityNotReserved != 0: + - subtract the remaining quantityNotReserved from the availableToPromise of the last non-serialized inventory item + - or if none was found create a non-ser InventoryItem with availableToPromise = -quantityNotReserved + --> + <if-compare field="parameters.quantityNotReserved" operator="not-equals" value="0" type="BigDecimal"> + <if-compare field="parameters.requireInventory" operator="equals" value="Y"> + <!-- use this else pattern to accomplish the anything but Y logic, ie if not specified default to inventory NOT required --> + <else> + <if-not-empty field="lastNonSerInventoryItem"> + <!-- subtract from quantityNotReserved from the availableToPromise of existing inventory item --> + <!-- instead of updating InventoryItem, add an InventoryItemDetail --> + <set from-field="lastNonSerInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/> + <set from-field="parameters.reserveReasonEnumId" field="createDetailMap.reasonEnumId"/> + <calculate field="createDetailMap.availableToPromiseDiff"> + <calcop field="parameters.quantityNotReserved" operator="negative"/> + </calculate> + <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/> + <clear-field field="createDetailMap"/> + + <!-- get the promiseDatetime --> + <get-related-one value-field="lastNonSerInventoryItem" relation-name="ProductFacility" to-value-field="productFacility"/> + <clear-field field="daysToShip"/> + <set field="daysToShip" from-field="productFacility.daysToShip"/> + <if-empty field="daysToShip"> + <!-- if the product does not have its own days to ship, use Facility.defaultDaysToShip, if not then use 30 days as a USA industry default --> + <if-not-empty field="facility.defaultDaysToShip"> + <set field="daysToShip" from-field="facility.defaultDaysToShip" type="Long"/> + <else> + <set field="daysToShip" value="30" type="Long"/> + </else> + </if-not-empty> + </if-empty> + <!-- TODO: Convert this to a <set-calendar> operation --> + <call-bsh><![CDATA[ + java.sql.Timestamp orderDate = orderHeader.getTimestamp("orderDate"); + com.ibm.icu.util.Calendar cal = com.ibm.icu.util.Calendar.getInstance(); + cal.setTimeInMillis(orderDate.getTime()); + cal.add(com.ibm.icu.util.Calendar.DAY_OF_YEAR, daysToShip.intValue()); + return org.ofbiz.base.util.UtilMisc.toMap("promisedDatetime", new java.sql.Timestamp(cal.getTimeInMillis())); + ]]></call-bsh> + + <else> + <!-- no non-ser inv item, create a non-ser InventoryItem with availableToPromise = -quantityNotReserved --> + <clear-field field="createInventoryItemInMap"/> + <clear-field field="createInventoryItemOutMap"/> + <!-- the createInventoryItem service is run by the the system user here --> + <entity-one entity-name="UserLogin" value-field="permUserLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set from-field="parameters.productId" field="createInventoryItemInMap.productId"/> + <set from-field="parameters.facilityId" field="createInventoryItemInMap.facilityId"/> + <set from-field="parameters.containerId" field="createInventoryItemInMap.containerId"/> + <set value="NON_SERIAL_INV_ITEM" field="createInventoryItemInMap.inventoryItemTypeId"/> + <set from-field="permUserLogin" field="createInventoryItemInMap.userLogin"/> + <call-service service-name="createInventoryItem" in-map-name="createInventoryItemInMap" include-user-login="false"> + <result-to-field result-name="inventoryItemId" field="createInventoryItemOutMap.inventoryItemId"/> + </call-service> + <entity-one entity-name="InventoryItem" value-field="newNonSerInventoryItem"> + <field-map field-name="inventoryItemId" from-field="createInventoryItemOutMap.inventoryItemId"/> + </entity-one> + + <!-- also create a detail record with the quantities --> + <set from-field="newNonSerInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/> + <set from-field="parameters.reserveReasonEnumId" field="createDetailMap.reasonEnumId"/> + <calculate field="createDetailMap.availableToPromiseDiff"> + <calcop field="parameters.quantityNotReserved" operator="negative"/> + </calculate> + <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/> + <clear-field field="createDetailMap"/> + + <!-- get the promiseDatetime --> + <get-related-one value-field="newNonSerInventoryItem" relation-name="ProductFacility" to-value-field="productFacility"/> + <clear-field field="daysToShip"/> + <set field="daysToShip" from-field="productFacility.daysToShip"/> + <if-empty field="daysToShip"> + <!-- if the product does not have its own days to ship, use Facility.defaultDaysToShip, if not then use 30 days as a USA industry default --> + <if-not-empty field="facility.defaultDaysToShip"> + <set field="daysToShip" from-field="facility.defaultDaysToShip" type="Long"/> + <else> + <set field="daysToShip" value="30" type="Long"/> + </else> + </if-not-empty> + </if-empty> + <!-- TODO: Convert this to a <set-calendar> operation --> + <call-bsh><![CDATA[ + java.sql.Timestamp orderDate = orderHeader.getTimestamp("orderDate"); + com.ibm.icu.util.Calendar cal = com.ibm.icu.util.Calendar.getInstance(); + cal.setTimeInMillis(orderDate.getTime()); + cal.add(com.ibm.icu.util.Calendar.DAY_OF_YEAR, daysToShip.intValue()); + return org.ofbiz.base.util.UtilMisc.toMap("promisedDatetime", new java.sql.Timestamp(cal.getTimeInMillis())); + ]]></call-bsh> + + </else> + </if-not-empty> + + <set field="parameters.quantityNotReserved" value="0" type="BigDecimal"/> + </else> + </if-compare> + </if-compare> + </else> + </if-compare> + + <field-to-result field="parameters.quantityNotReserved" result-name="quantityNotReserved"/> + </simple-method> + + <simple-method method-name="reserveForInventoryItemInline" short-description="Does a reservation for one InventoryItem, meant to be called in-line"> + <!-- only do something with this inventoryItem if there is more inventory to reserve --> + <if-compare field="parameters.quantityNotReserved" operator="greater" value="0" type="BigDecimal"> + + <if-compare value="SERIALIZED_INV_ITEM" operator="equals" field="inventoryItem.inventoryItemTypeId"> + <if-compare value="INV_AVAILABLE" operator="equals" field="inventoryItem.statusId"> + <!-- change status on inventoryItem --> + <set value="INV_PROMISED" field="inventoryItem.statusId"/> + <store-value value-field="inventoryItem"/> + + <clear-field field="reserveOisgirMap"/> + + <calculate field="parameters.quantityNotReserved"> + <calcop field="parameters.quantityNotReserved" operator="subtract"><number value="1.0"/></calcop> + </calculate> + </if-compare> + </if-compare> + <if-compare field="inventoryItem.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"> + <!-- reduce atp on inventoryItem if availableToPromise greater than 0, if not the code at the end of this method will handle it --> + <if> + <condition> + <and> + <if-compare field="inventoryItem.statusId" operator="not-equals" value="ON_HOLD_NS"/> + <if-compare field="inventoryItem.statusId" operator="not-equals" value="DEFECTIVE_NS"/> + <not><if-empty field="inventoryItem.availableToPromiseTotal"/></not> + <if-compare field="inventoryItem.availableToPromiseTotal" operator="greater" value="0" type="BigDecimal"/> + </and> + </condition> + <then> + <if-compare-field field="parameters.quantityNotReserved" to-field="inventoryItem.availableToPromiseTotal" operator="greater" type="BigDecimal"> + <set from-field="inventoryItem.availableToPromiseTotal" field="parameters.deductAmount"/> + <else> + <set from-field="parameters.quantityNotReserved" field="parameters.deductAmount"/> + </else> + </if-compare-field> + + <!-- instead of updating InventoryItem, add an InventoryItemDetail --> + <set from-field="inventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/> + <set from-field="parameters.reserveReasonEnumId" field="createDetailMap.reasonEnumId"/> + <calculate field="createDetailMap.availableToPromiseDiff"> + <calcop field="parameters.deductAmount" operator="negative"/> + </calculate> + <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/> + <clear-field field="createDetailMap"/> + + <calculate field="parameters.quantityNotReserved"> + <calcop operator="subtract" field="parameters.quantityNotReserved"> + <calcop operator="get" field="parameters.deductAmount"/> + </calcop> + </calculate> + </then> + </if> + <!-- keep track of the last non-serialized inventory item for use if inventory is not required for purchase --> + <!-- use env variable named lastNonSerInventoryItem --> + <set from-field="inventoryItem" field="lastNonSerInventoryItem"/> + </if-compare> + </if-compare> + </simple-method> + <simple-method method-name="getPromisedDateTime" short-description="Get Inventory Promised Date/Time"> + <!-- get the promiseDatetime --> + <get-related-one value-field="inventoryItem" relation-name="ProductFacility" to-value-field="productFacility"/> + <set field="daysToShip" from-field="productFacility.daysToShip"/> + <if-empty field="daysToShip"> + <!-- if the product does not have its own days to ship, use Facility.defaultDaysToShip, if not then use 30 days as a USA industry default --> + <set field="daysToShip" from-field="facility.defaultDaysToShip" type="Long"/> + </if-empty> + <if-empty field="daysToShip"> + <set field="daysToShip" value="30" type="Long"/> + </if-empty> + <!-- TODO: Convert this to a <set-calendar> operation --> + <call-bsh><![CDATA[ + java.sql.Timestamp orderDate = orderHeader.getTimestamp("orderDate"); + com.ibm.icu.util.Calendar cal = com.ibm.icu.util.Calendar.getInstance(); + cal.setTimeInMillis(orderDate.getTime()); + cal.add(com.ibm.icu.util.Calendar.DAY_OF_YEAR, daysToShip.intValue()); + return org.ofbiz.base.util.UtilMisc.toMap("promisedDatetime", new java.sql.Timestamp(cal.getTimeInMillis())); + ]]></call-bsh> + </simple-method> + +</simple-methods> \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml (added) +++ ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml Wed Feb 3 03:16:07 2010 @@ -0,0 +1,231 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd"> + <description>eBay Component Services</description> + <vendor>OFBiz</vendor> + <version>1.0</version> + + <service name="createEbayAccount" engine="simple" + location="component://ebaystore/script/org/ofbiz/ebaystore/EbayServices.xml" invoke="createEbayAccount" auth="true"> + <attribute name="salutation" mode="IN" type="String" optional="true"/> + <attribute name="firstName" mode="IN" type="String" optional="false"/> + <attribute name="middleName" mode="IN" type="String" optional="true"/> + <attribute name="lastName" mode="IN" type="String" optional="false"/> + <attribute name="gender" mode="IN" type="String" optional="true"/> + <attribute name="userLoginId" mode="IN" type="String" optional="false"/> + <attribute name="currentPassword" mode="IN" type="String" optional="false"/> + <attribute name="currentPasswordVerify" mode="IN" type="String" optional="false"/> + <attribute name="statusId" mode="IN" type="String" optional="true"/> + <attribute name="productStoreId" mode="OUT" type="String" optional="false"/> + </service> + + <service name="exportCategoriesSelectedToEbayStore" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStore" invoke="exportCategoriesSelectedToEbayStore" auth="true"> + <description>Export categories in store to eBay store</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="prodCatalogId" type="String" mode="IN" optional="false"/> + </service> + + <!-- Store output --> + <service name="getEbayStoreOutput" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStore" invoke="getEbayStoreOutput" auth="true"> + <description>get ebay store description</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="ebayStore" type="Map" mode="OUT" optional="true"/> + </service> + <service name="retrievePredesignedLogoOption" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStore" invoke="retrievePredesignedLogoOption" auth="true"> + <description>get ebay store logos description</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="storeLogoOptList" type="List" mode="OUT" optional="true"/> + </service> + <service name="retrieveBasicThemeArray" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStore" invoke="retrieveBasicThemeArray" auth="true"> + <description>get ebay store Basic theme Array description</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="storeThemeList" type="List" mode="OUT" optional="true"/> + </service> + <service name="retrieveAdvancedThemeArray" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStore" invoke="retrieveAdvancedThemeArray" auth="true"> + <description>get ebay store Advanced theme Array description</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="storeThemeList" type="List" mode="OUT" optional="true"/> + <attribute name="storeAdvancedThemeColorOptList" type="List" mode="OUT" optional="true"/> + </service> + <service name="retrieveStoreFontTheme" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStore" invoke="retrieveStoreFontTheme" auth="true"> + <description>get ebay store Advanced theme Array description</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="advanceFontTheme" type="Map" mode="OUT" optional="true"/> + </service> + <service name="setEbayStoreInput" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStore" invoke="setEbayStoreInput" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="themeType" mode="IN" type="String" optional="false"/> + <attribute name="storeName" mode="IN" type="String" optional="false"/> + <attribute name="storeDesc" mode="IN" type="String" optional="false"/> + <attribute name="storeUrl" mode="IN" type="String" optional="false"/> + <attribute name="storeLogoId" mode="IN" type="String" optional="true"/> + <attribute name="storeLogoName" mode="IN" type="String" optional="true"/> + <attribute name="storeLogoURL" mode="IN" type="String" optional="true"/> + <attribute name="storeAdvancedTheme" mode="IN" type="String" optional="true"/> + <attribute name="storeAdvancedThemeColor" mode="IN" type="String" optional="true"/> + <attribute name="storeBasicTheme" mode="IN" type="String" optional="true"/> + <attribute name="storePrimaryColor" mode="IN" type="String" optional="true"/> + <attribute name="storeSecondaryColor" mode="IN" type="String" optional="true"/> + <attribute name="storeAccentColor" mode="IN" type="String" optional="true"/> + <attribute name="storeNameFont" mode="IN" type="String" optional="true"/> + <attribute name="storeNameFontSize" mode="IN" type="String" optional="true"/> + <attribute name="storeNameFontColor" mode="IN" type="String" optional="true"/> + <attribute name="storeTitleFont" mode="IN" type="String" optional="true"/> + <attribute name="storeTitleFontSize" mode="IN" type="String" optional="true"/> + <attribute name="storeTitleFontColor" mode="IN" type="String" optional="true"/> + <attribute name="storeDescFont" mode="IN" type="String" optional="true"/> + <attribute name="storeDescFontSize" mode="IN" type="String" optional="true"/> + <attribute name="storeDescFontColor" mode="IN" type="String" optional="true"/> + <attribute name="storeCustomHeaderLayout" mode="IN" type="String" optional="false"/> + <attribute name="storeCustomHeader" mode="IN" type="String" optional="false"/> + <attribute name="storeHeaderStyle" mode="IN" type="String" optional="false"/> + <attribute name="storeItemLayout" mode="IN" type="String" optional="false"/> + <attribute name="storeItemSortOrder" mode="IN" type="String" optional="false"/> + <attribute name="storeMerchDisplay" mode="IN" type="String" optional="false"/> + <attribute name="storeSubscriptionDisplay" mode="IN" type="String" optional="false"/> + <attribute name="ebayStore" type="Map" mode="OUT" optional="true"/> + </service> + <!-- eBay account --> + <service name="getEbayStoreUser" engine="java" location="org.ofbiz.ebaystore.EbayStore" invoke="getEbayStoreUser" auth="true" transaction-timeout="3600"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="userLoginId" mode="OUT" type="String" optional="true"/> + </service> + <service name="getEbayUser" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayAccount" invoke="getEbayUser" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="email" mode="OUT" type="String" optional="true"/> + <attribute name="registrationAddress" mode="OUT" type="Map" optional="true"/> + <attribute name="status" mode="OUT" type="String" optional="true"/> + </service> + <service name="getEbayAccount" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayAccount" invoke="getEbayAccount" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="accountList" mode="OUT" type="List" optional="true"/> + </service> + <service name="getEbayUserPreference" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayAccount" invoke="getEbayUserPreference" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="userPreferenceList" mode="OUT" type="List" optional="true"/> + </service> + <!-- eBay Feedback --> + <service name="loadFeedback" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayFeedback" invoke="loadFeedback" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + </service> + <service name="getItemsAwaitingFeedback" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayFeedback" invoke="getItemsAwaitingFeedback" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="itemsAwaitingFeedback" mode="OUT" type="List" optional="true"/> + </service> + <service name="leaveFeedback" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayFeedback" invoke="leaveFeedback" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="transactionId" mode="IN" type="String" optional="false"/> + <attribute name="itemId" mode="IN" type="String" optional="false"/> + <attribute name="targetUser" mode="IN" type="String" optional="false"/> + <attribute name="commentingUser" mode="IN" type="String" optional="false"/> + <attribute name="role" mode="IN" type="String" optional="false"/> + <attribute name="commentType" mode="IN" type="String" optional="false"/> + <attribute name="commentText" mode="IN" type="String" optional="false"/> + <attribute name="ratingItem" mode="IN" type="String" optional="true"/> + <attribute name="ratingComm" mode="IN" type="String" optional="true"/> + <attribute name="ratingShip" mode="IN" type="String" optional="true"/> + <attribute name="ratingShipHand" mode="IN" type="String" optional="true"/> + <attribute name="AqItemAsDescribedId" mode="IN" type="String" optional="true"></attribute> + </service> + <service name="getEbayActiveItems" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStore" invoke="getEbayActiveItems" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="activeItems" mode="OUT" type="List" optional="true"/> + </service> + <service name="getEbaySoldItems" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStore" invoke="getEbaySoldItems" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="soldItems" mode="OUT" type="List" optional="true"/> + </service> + <service name="automaticEbayRelistSoldItems" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStore" invoke="automaticEbayRelistSoldItems" auth="true"> + </service> + <service name="createEbayAutomaticRelistItems" engine="entity-auto" default-entity-name="JobSandbox" invoke="create"> + <description>create eBay automatic re-list items</description> + <auto-attributes mode="IN" include="pk"/> + <auto-attributes mode="IN" optional="true" include="nonpk"/> + </service> + <service name="updateEbayAutomaticRelistItems" engine="entity-auto" default-entity-name="JobSandbox" invoke="update"> + <description>create eBay automatic re-list items</description> + <auto-attributes mode="IN" include="pk"/> + <auto-attributes mode="IN" optional="true" include="nonpk"/> + </service> + <!-- block out of stock items --> + <service name="getSellingInventory" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStore" invoke="getSellingInventory" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="itemBlocked" type="Map" mode="OUT" optional="true"/> + </service> + <!-- ebay inventory --> + <service name="reserveEbayStoreInventory" engine="simple" + location="component://ebaystore/script/org/ofbiz/ebaystore/EbayServices.xml" invoke="reserveEbayStoreInventory"> + <description>Reserve Inventory in a Product Store</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"></attribute> + <attribute name="productId" type="String" mode="IN" optional="false"></attribute> + <attribute name="facilityId" type="String" mode="IN" optional="false"></attribute> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="false"></attribute> + <attribute name="quantityNotReserved" type="BigDecimal" mode="OUT" optional="false"></attribute> + </service> + <service name="reserveEbayProductInventoryByStoreFacility" engine="simple" + location="component://ebaystore/script/org/ofbiz/ebaystore/EbayServices.xml" invoke="reserveEbayProductInventory" auth="true"> + <description>Reserve Inventory for a Product By Facility + If requireInventory is Y the quantity not reserved is returned, if N then a negative + availableToPromise will be used to track quantity ordered beyond what is in stock. + </description> + <attribute name="productId" type="String" mode="IN" optional="false"/> + <attribute name="facilityId" type="String" mode="IN" optional="false"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="false"/> + <attribute name="reservedDatetime" type="Timestamp" mode="IN" optional="true"/> + <attribute name="requireInventory" type="String" mode="IN" optional="false"/> + <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/> + <attribute name="sequenceId" type="Long" mode="IN" optional="true"/> + <attribute name="quantityNotReserved" type="BigDecimal" mode="OUT" optional="false"/> + </service> + <service name="updateEbayStoreInventory" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStoreInventoryServices" invoke="updateEbayStoreInventory" auth="true"> + <description>update Inventory on ebay store inventory</description> + <attribute name="productStoreId" type="String" mode="INOUT" optional="false"></attribute> + <attribute name="productId" type="String" mode="IN" optional="false"></attribute> + <attribute name="folderId" type="String" mode="INOUT" optional="false"></attribute> + <attribute name="facilityId" type="String" mode="INOUT" optional="false"></attribute> + </service> + <service name="getFolderInEbayStoreInventory" engine="java" transaction-timeout="7200" + location="org.ofbiz.ebaystore.EbayStoreInventoryServices" invoke="getFolderInEbayStoreInventory" auth="true"> + <description>get ebay folder in ebay store inventory</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="folderId" type="String" mode="OUT" optional="false"></attribute> + </service> + +</services> \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayAccount.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayAccount.java?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayAccount.java (added) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayAccount.java Wed Feb 3 03:16:07 2010 @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.ebaystore; + +import java.util.Locale; +import java.util.Map; +import javolution.util.FastMap; + +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceUtil; + +import com.ebay.sdk.ApiContext; +import com.ebay.sdk.call.*; +import com.ebay.soap.eBLBaseComponents.AddressType; +import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; +import com.ebay.soap.eBLBaseComponents.UserType; + +public class EbayAccount { + private static final String resource = "EbayUiLabels"; + private static final String configFileName = "ebayExport.properties"; + private static final String module = EbayAccount.class.getName(); + + public static Map<String, Object> getEbayUser(DispatchContext dctx, Map<String, ? extends Object> context){ + Map<String, Object>result = FastMap.newInstance(); + String errorMsg = null; + 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"); + + // Output Variable + String email = null, + cityName = null, + companyName = null, + country = null, + firstName = null, + lastName = null, + name = null, + phone = null, + postalCode = null, + stateOrProvince = null, + street = null, + street1 = null, + street2 = null, + status = null; + Map<String, Object>registrationAddress = FastMap.newInstance(); + + try{ + Map<String, Object>infoMap = FastMap.newInstance(); + ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); + GetUserCall getUserCall = new GetUserCall(apiContext); + DetailLevelCodeType[] detailLevel = {DetailLevelCodeType.RETURN_ALL}; + getUserCall.setDetailLevel(detailLevel); + UserType user = getUserCall.getUser(); + if(user != null){ + email = user.getEmail(); + AddressType regAddress = user.getRegistrationAddress(); + if(regAddress != null){ + cityName = regAddress.getCityName(); + companyName = regAddress.getCompanyName(); + country = regAddress.getCountryName(); + firstName = regAddress.getFirstName(); + lastName = regAddress.getLastName(); + name = regAddress.getName(); + phone = regAddress.getPhone(); + postalCode = regAddress.getPostalCode(); + stateOrProvince = regAddress.getStateOrProvince(); + street = regAddress.getStreet(); + street1 = regAddress.getStreet1(); + street2 = regAddress.getStreet2(); + } + if(firstName == null && lastName == null && name !=null){ + String nameArray[] = name.split(" "); + firstName = nameArray[0]; + lastName = nameArray[1]; + } + registrationAddress.put("cityName", cityName); + registrationAddress.put("companyName", companyName); + registrationAddress.put("country", country); + registrationAddress.put("firstName", firstName); + registrationAddress.put("lastName", lastName); + registrationAddress.put("phone", phone); + registrationAddress.put("postalCode", postalCode); + registrationAddress.put("stateOrProvince", stateOrProvince); + registrationAddress.put("street", street); + registrationAddress.put("street1", street1); + registrationAddress.put("street2", street2); + status = user.getStatus().toString(); + } + result.put("email", email); + result.put("registrationAddress", registrationAddress); + result.put("status", status); + }catch(Exception e){ + // TODO Auto-generated catch block + return ServiceUtil.returnError(e.getMessage()); + } + return result; + } +} Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java?rev=905876&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java (added) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java Wed Feb 3 03:16:07 2010 @@ -0,0 +1,70 @@ +package org.ofbiz.ebaystore; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import javolution.util.FastMap; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.webapp.taglib.ServiceTag; + +public class EbayEvents { + + public static final String module = ServiceTag.class.getName(); + + public static String sendLeaveFeedback(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(true); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + Map requestParams = UtilHttp.getParameterMap(request); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + int feedbackSize = Integer.parseInt((String)requestParams.get("feedbackSize")); + String productStoreId = (String)requestParams.get("productStoreId"); + for(int i=1;i<=feedbackSize;i++){ + String commentType = (String)requestParams.get("commentType"+i); + String commentText = (String)requestParams.get("commentText"+i); + if(!commentType.equals("none") && commentText != null){ + String itemId = (String)requestParams.get("itemId"+i); + String transactionId = (String)requestParams.get("transactionId"+i); + String targetUser = (String)requestParams.get("targetUser"+i); + String commentingUser = (String)requestParams.get("commentingUser"+i); + String role = (String)requestParams.get("role"+i); + String ratingItem = (String)requestParams.get("ratingItem"+i); + String ratingComm = (String)requestParams.get("ratingComm"+i); + String ratingShip = (String)requestParams.get("ratingShip"+i); + String ratingShipHand = (String)requestParams.get("ratingShipHand"+i); + String AqItemAsDescribedId = (String)requestParams.get("AqItemAsDescribedId"+i); + + Map leavefeedback = FastMap.newInstance(); + leavefeedback.put("productStoreId", productStoreId); + leavefeedback.put("userLogin", userLogin); + leavefeedback.put("itemId", itemId); + leavefeedback.put("transactionId", transactionId); + leavefeedback.put("targetUser", targetUser); + leavefeedback.put("commentingUser", commentingUser); + leavefeedback.put("role", role); + leavefeedback.put("commentText", commentText); + leavefeedback.put("commentType", commentType); + leavefeedback.put("ratingItem", ratingItem); + leavefeedback.put("ratingComm", ratingComm); + leavefeedback.put("ratingShip", ratingShip); + leavefeedback.put("ratingShipHand", ratingShipHand); + leavefeedback.put("AqItemAsDescribedId", AqItemAsDescribedId); + // Call service + try{ + Map result = dispatcher.runSync("leaveFeedback", leavefeedback); + } catch (GenericServiceException e) { + Debug.logError(e, module); + return "error"; + } + } + } + return "success"; + } + +} |
| Free forum by Nabble | Edit this page |
