blob: 0fca655a5a313698d73a7839e553c8bd9a4afb01 [file] [log] [blame]
<?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-v2.xsd">
<simple-method method-name="testCreateShoppingCart" short-description="Test create shopping cart" login-required="false">
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<!-- Shopping Cart new Instance -->
<set field="delegator" from-field="parameters.delegator" type="Object"/>
<set field="dispatcher" from-field="parameters.dispatcher" type="Object"/>
<set field="locale" from-field="parameters.locale" type="Object" />
<set field="productStoreId" value="9000" type="String"/>
<set field="currencyUom" value="USD" type="String"/>
<call-bsh><![CDATA[
shoppingCart = new org.ofbiz.order.shoppingcart.ShoppingCart(delegator, productStoreId, locale, currencyUom);
parameters.put("shoppingCart", shoppingCart);
]]></call-bsh>
<set field="orderTypeId" value="SALES_ORDER" type="String"/>
<set field="paymentMethodTypeId" value="CREDIT_CARD" type="String"/>
<set field="maxAmount" value="49.26" type="BigDecimal"/>
<set field="partyId" value="DemoCustomer" type="String"/>
<set field="placingCustomerPartyId" value="DemoCustomer" type="String"/>
<set field="endUserCustomerPartyId" value="DemoCustomer" type="String"/>
<set field="shipToCustomerPartyId" value="DemoCustomer" type="String"/>
<set field="billToCustomerPartyId" value="DemoCustomer" type="String"/>
<set field="billFromVendorPartyId" value="Company" type="String"/>
<set field="shoppingCart" from-field="parameters.shoppingCart"/>
<!-- ShoppingCart Set Order Type -->
<call-object-method method-name="setOrderType" obj-field="shoppingCart">
<field field="orderTypeId" type="String"/>
</call-object-method>
<!-- ShoppingCart Set User Login -->
<call-object-method method-name="setUserLogin" obj-field="shoppingCart">
<field field="userLogin" type="org.ofbiz.entity.GenericValue"/>
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
</call-object-method>
<!-- ShoppingCart Set ProductStore ID -->
<call-object-method method-name="setProductStoreId" obj-field="shoppingCart">
<field field="productStoreId" type="String"/>
</call-object-method>
<!-- ShoppingCart Add Payment Amount -->
<call-object-method method-name="addPaymentAmount" obj-field="shoppingCart">
<field field="paymentMethodTypeId" type="String"/>
<field field="maxAmount" type="BigDecimal"/>
</call-object-method>
<!-- ShoppingCart Set Order Party ID -->
<call-object-method method-name="setOrderPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<!-- Add Product Item to Shopping Cart -->
<set field="prodCatalogId" value="DemoCatalog" type="String"/>
<set field="index" value="0" type="Integer"/>
<set field="productId" value="GZ-2644" type="String"/>
<set field="quantity" value="1" type="BigDecimal"/>
<set field="selectedAmount" value="0" type="BigDecimal"/>
<set field="unitPrice" value="38.4" type="BigDecimal"/>
<set field="itemType" value="PRODUCT_ORDER_ITEM" type="String"/>
<set field="triggerExternalOpsBool" type="Boolean" value="false"/>
<set field="triggerPriceRulesBool" type="Boolean" value="true"/>
<set field="skipInventoryChecks" type="Boolean" value="true"/>
<set field="skipProductChecks" type="Boolean" value="true"/>
<call-object-method method-name="addItemToEnd" obj-field="shoppingCart" ret-field="itemIdex">
<field field="productId" type="String"/>
<field field="selectedAmount" type="BigDecimal"/>
<field field="quantity" type="BigDecimal"/>
<field field="unitPrice" type="BigDecimal"/>
<field field="features" type="java.util.HashMap"/>
<field field="attributes" type="java.util.HashMap"/>
<field field="prodCatalogId" type="String"/>
<field field="itemType" type="String"/>
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
<field field="triggerExternalOpsBool" type="Boolean"/>
<field field="triggerPriceRulesBool" type="Boolean"/>
<field field="skipInventoryChecks" type="Boolean"/>
<field field="skipProductChecks" type="Boolean"/>
</call-object-method>
<set field="itemIdex" from-field="itemIdex" type="Integer"/>
<call-object-method method-name="findCartItem" obj-field="shoppingCart" ret-field="cartItem">
<field field="itemIdex" type="int"/>
</call-object-method>
<set field="groupIdx" value="0" type="Integer"/>
<call-object-method method-name="setItemShipGroupQty" obj-field="shoppingCart">
<field field="cartItem" type="org.ofbiz.order.shoppingcart.ShoppingCartItem"/>
<field field="quantity" type="BigDecimal"/>
<field field="groupIdx" type="int"/>
</call-object-method>
<!-- Make OrderAdjustment Promotion to Shopping Cart -->
<make-value entity-name="OrderAdjustment" value-field="orderAdjustmentPromotion"/>
<set field="orderAdjustmentPromotion.orderAdjustmentTypeId" value="PROMOTION_ADJUSTMENT"/>
<set field="orderAdjustmentPromotion.shipGroupSeqId" value="_NA_"/>
<set field="orderAdjustmentPromotion.amount" value="-3.84" type="BigDecimal"/>
<set field="orderAdjustmentPromotion.productPromoId" value="9011"/>
<set field="orderAdjustmentPromotion.productPromoRuleId" value="01"/>
<set field="orderAdjustmentPromotion.productPromoActionSeqId" value="01"/>
<call-object-method method-name="addAdjustment" obj-field="shoppingCart">
<field field="orderAdjustmentPromotion" type="org.ofbiz.entity.GenericValue"/>
</call-object-method>
<!-- Make OrderAdjustment Shipping Charges to Shopping Cart -->
<make-value entity-name="OrderAdjustment" value-field="orderAdjustmentShipping"/>
<set field="orderAdjustmentShipping.orderAdjustmentTypeId" value="SHIPPING_CHARGES"/>
<set field="orderAdjustmentShipping.shipGroupSeqId" value="00001"/>
<set field="orderAdjustmentShipping.amount" value="12.10" type="BigDecimal"/>
<call-object-method method-name="addAdjustment" obj-field="shoppingCart">
<field field="orderAdjustmentShipping" type="org.ofbiz.entity.GenericValue"/>
</call-object-method>
<!-- Make OrderAdjustment Sales Tax to Shopping Cart -->
<make-value entity-name="OrderAdjustment" value-field="orderAdjustmentSalesTax"/>
<set field="orderAdjustmentSalesTax.orderAdjustmentTypeId" value="SALES_TAX"/>
<set field="orderAdjustmentSalesTax.orderItemSeqId" value="00001"/>
<set field="orderAdjustmentSalesTax.shipGroupSeqId" value="00001"/>
<set field="orderAdjustmentSalesTax.amount" value="1.824" type="BigDecimal"/>
<set field="orderAdjustmentSalesTax.sourcePercentage" value="0.100000" type="BigDecimal"/>
<set field="orderAdjustmentSalesTax.taxAuthorityRateSeqId" value="9004"/>
<set field="orderAdjustmentSalesTax.primaryGeoId" value="UT"/>
<set field="orderAdjustmentSalesTax.taxAuthGeoId" value="UT"/>
<set field="orderAdjustmentSalesTax.taxAuthPartyId" value="UT_TAXMAN"/>
<set field="orderAdjustmentSalesTax.overrideGlAccountId" value="224153"/>
<set field="orderAdjustmentSalesTax.comments" value="Utah State Sales Tax"/>
<call-object-method method-name="addAdjustment" obj-field="shoppingCart">
<field field="orderAdjustmentSalesTax" type="org.ofbiz.entity.GenericValue"/>
</call-object-method>
<make-value entity-name="OrderAdjustment" value-field="orderAdjustmentSalesTax1"/>
<set field="orderAdjustmentSalesTax1.orderAdjustmentTypeId" value="SALES_TAX"/>
<set field="orderAdjustmentSalesTax1.orderItemSeqId" value="00001"/>
<set field="orderAdjustmentSalesTax1.shipGroupSeqId" value="00001"/>
<set field="orderAdjustmentSalesTax1.amount" value="0.039" type="BigDecimal"/>
<set field="orderAdjustmentSalesTax1.sourcePercentage" value="0.100000" type="BigDecimal"/>
<set field="orderAdjustmentSalesTax1.taxAuthorityRateSeqId" value="9005"/>
<set field="orderAdjustmentSalesTax1.primaryGeoId" value="UT-UTAH"/>
<set field="orderAdjustmentSalesTax1.taxAuthGeoId" value="UT-UTAH"/>
<set field="orderAdjustmentSalesTax1.taxAuthPartyId" value="UT_UTAH_TAXMAN"/>
<set field="orderAdjustmentSalesTax1.overrideGlAccountId" value="224153"/>
<set field="orderAdjustmentSalesTax1.comments" value="Utah County, Utah Sales Tax"/>
<call-object-method method-name="addAdjustment" obj-field="shoppingCart">
<field field="orderAdjustmentSalesTax1" type="org.ofbiz.entity.GenericValue"/>
</call-object-method>
<make-value entity-name="OrderAdjustment" value-field="orderAdjustmentSalesTax2"/>
<set field="orderAdjustmentSalesTax2.orderAdjustmentTypeId" value="SALES_TAX"/>
<set field="orderAdjustmentSalesTax2.orderItemSeqId" value="00001"/>
<set field="orderAdjustmentSalesTax2.shipGroupSeqId" value="00001"/>
<set field="orderAdjustmentSalesTax2.amount" value="0.384" type="BigDecimal"/>
<set field="orderAdjustmentSalesTax2.sourcePercentage" value="1" type="BigDecimal"/>
<set field="orderAdjustmentSalesTax2.taxAuthorityRateSeqId" value="9000"/>
<set field="orderAdjustmentSalesTax2.primaryGeoId" value="_NA_"/>
<set field="orderAdjustmentSalesTax2.taxAuthGeoId" value="_NA_"/>
<set field="orderAdjustmentSalesTax2.taxAuthPartyId" value="_NA_"/>
<set field="orderAdjustmentSalesTax2.overrideGlAccountId" value="224000"/>
<set field="orderAdjustmentSalesTax2.comments" value="1% OFB _NA_ Tax"/>
<call-object-method method-name="addAdjustment" obj-field="shoppingCart">
<field field="orderAdjustmentSalesTax2" type="org.ofbiz.entity.GenericValue"/>
</call-object-method>
<!-- Shopping Cart Set ShippingContactMechId-->
<set field="contactMechId" value="9015"/>
<call-object-method method-name="setAllShippingContactMechId" obj-field="shoppingCart">
<field field="contactMechId" type="String"/>
</call-object-method>
<!-- Shopping Cart Set Method Type ID-->
<set field="shipmentMethodTypeId" value="NEXT_DAY" type="String"/>
<call-object-method method-name="setAllShipmentMethodTypeId" obj-field="shoppingCart">
<field field="shipmentMethodTypeId" type="String"/>
</call-object-method>
<!-- Shopping Cart Set Carrier Party ID-->
<set field="carrierPartyId" value="UPS" type="String"/>
<call-object-method method-name="setAllCarrierPartyId" obj-field="shoppingCart">
<field field="carrierPartyId" type="String"/>
</call-object-method>
<!-- Shopping Cart Set Is Gift-->
<set field="isGift" value="false" type="Boolean"/>
<call-object-method method-name="setAllIsGift" obj-field="shoppingCart">
<field field="isGift" type="Boolean"/>
</call-object-method>
<!-- Shopping Cart Set May Split-->
<set field="maySplit" value="false" type="Boolean"/>
<call-object-method method-name="setAllMaySplit" obj-field="shoppingCart">
<field field="maySplit" type="Boolean"/>
</call-object-method>
<!-- Shopping Cart Set Billing and Ship to customers -->
<call-object-method method-name="setBillFromVendorPartyId" obj-field="shoppingCart">
<field field="billFromVendorPartyId" type="String"/>
</call-object-method>
<call-object-method method-name="setPlacingCustomerPartyId" obj-field="shoppingCart">
<field field="placingCustomerPartyId" type="String"/>
</call-object-method>
<call-object-method method-name="setBillToCustomerPartyId" obj-field="shoppingCart">
<field field="billToCustomerPartyId" type="String"/>
</call-object-method>
<call-object-method method-name="setShipToCustomerPartyId" obj-field="shoppingCart">
<field field="shipToCustomerPartyId" type="String"/>
</call-object-method>
<call-object-method method-name="setEndUserCustomerPartyId" obj-field="shoppingCart">
<field field="endUserCustomerPartyId" type="String"/>
</call-object-method>
<!-- Shopping Cart Make all ShipGroupInfos -->
<call-object-method method-name="makeAllShipGroupInfos" obj-field="shoppingCart"/>
<!-- Shopping Cart checkout and create order -->
<call-bsh><![CDATA[
checkOutHelper = new org.ofbiz.order.shoppingcart.CheckOutHelper(dispatcher, delegator, shoppingCart);
java.util.Map orderCreate = checkOutHelper.createOrder(userLogin);
parameters.put("orderMap", orderCreate);
]]></call-bsh>
<!-- Clear Shopping Cart -->
<call-object-method method-name="clear" obj-field="shoppingCart"/>
<set field="orderMap" from-field="parameters.orderMap"/>
<if-not-empty field="orderMap">
<log level="info" message="------------ ORDERID : [${orderMap.orderId}] ------------"/>
</if-not-empty>
<assert><not><if-empty field="orderMap.orderId"/></not></assert>
<check-errors/>
</simple-method>
<simple-method method-name="testCreateOrderRentalProduct" short-description="Test create order rental of product" login-required="false">
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="DemoCustomer"/>
</entity-one>
<!-- Shopping Cart new Instance -->
<set field="delegator" from-field="parameters.delegator" type="Object"/>
<set field="dispatcher" from-field="parameters.dispatcher" type="Object"/>
<set field="locale" from-field="parameters.locale" type="Object" />
<set field="productStoreId" value="9000" type="String"/>
<set field="currencyUom" value="USD" type="String"/>
<set field="salesChannel" value="WEB_SALES_CHANNEL" type="String"/>
<set field="partyId" value="DemoCustomer" type="String"/>
<create-object class-name="org.ofbiz.order.shoppingcart.ShoppingCart" field="shoppingCart">
<field field="delegator" type="org.ofbiz.entity.Delegator"/>
<field field="productStoreId" type="String"/>
<field field="locale" type="java.util.Locale"/>
<field field="currencyUom" type="String"/>
</create-object>
<set field="orderType" value="SALES_ORDER" type="String"/>
<call-object-method method-name="setOrderType" obj-field="shoppingCart">
<field field="orderType" type="String"/>
</call-object-method>
<call-object-method method-name="setChannelType" obj-field="shoppingCart">
<field field="salesChannel" type="String"/>
</call-object-method>
<call-object-method method-name="setProductStoreId" obj-field="shoppingCart">
<field field="productStoreId" type="String"/>
</call-object-method>
<!-- Shopping Cart Set Billing and Ship to customers -->
<call-object-method method-name="setBillToCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setPlacingCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setShipToCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setEndUserCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setUserLogin" obj-field="shoppingCart">
<field field="userLogin" type="org.ofbiz.entity.GenericValue"/>
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
</call-object-method>
<!-- Add Product Item to Shopping Cart -->
<set field="nextDate" value="${groovy:org.ofbiz.base.util.UtilDateTime.addDaysToTimestamp(org.ofbiz.base.util.UtilDateTime.nowTimestamp(), +1)}" type="Timestamp"/>
<set field="prodCatalogId" value="DemoCatalog" type="String"/>
<set field="productId" value="RentalShip" type="String"/>
<set field="reservStart" from-field="nextDate" type="Timestamp"/>
<set field="reservLength" value="3" type="BigDecimal"/>
<set field="reservPersons" value="1" type="BigDecimal"/>
<set field="quantity" value="1" type="BigDecimal"/>
<set field="unitPrice" value="15.99" type="BigDecimal"/>
<set field="itemType" value="RENTAL_ORDER_ITEM" type="String"/>
<call-object-method method-name="addOrIncreaseItem" obj-field="shoppingCart">
<field field="productId" type="String"/>
<field field="selectedAmount" type="BigDecimal"/>
<field field="quantity" type="BigDecimal"/>
<field field="reservStart" type="Timestamp"/>
<field field="reservLength" type="BigDecimal"/>
<field field="reservPersons" type="BigDecimal"/>
<field field="accommodationMapId" type="String"/>
<field field="accommodationSpotId" type="String"/>
<field field="shipBeforeDate" type="Timestamp"/>
<field field="shipAfterDate" type="Timestamp"/>
<field field="features" type="Map"/>
<field field="attributes" type="Map"/>
<field field="prodCatalogId" type="String"/>
<field field="configWrapper" type="org.ofbiz.product.config.ProductConfigWrapper"/>
<field field="itemType" type="String"/>
<field field="itemGroupNumber" type="String"/>
<field field="parentProductId" type="String"/>
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
</call-object-method>
<call-object-method method-name="setDefaultCheckoutOptions" obj-field="shoppingCart">
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
</call-object-method>
<!-- Create order -->
<create-object class-name="org.ofbiz.order.shoppingcart.CheckOutHelper" field="checkOutHelper">
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
<field field="delegator" type="org.ofbiz.entity.Delegator"/>
<field field="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart"/>
</create-object>
<call-object-method method-name="createOrder" obj-field="checkOutHelper" ret-field="orderCreateResult">
<field field="userLogin" type="org.ofbiz.entity.GenericValue"/>
</call-object-method>
<set field="orderId" from-field="orderCreateResult.orderId" type="String"/>
<if-not-empty field="orderId">
<log level="info" message="------------ ORDERID : [${orderId}] ------------"/>
<!-- Change order status to approved -->
<call-class-method method-name="approveOrder" class-name="org.ofbiz.order.order.OrderChangeHelper" ret-field="approved">
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
<field field="userLogin" type="org.ofbiz.entity.GenericValue"/>
<field field="orderId" type="String"/>
</call-class-method>
<log level="info" message="----Test order with id: [${orderId}] has been approved: [${approved}]----"/>
<entity-one entity-name="UserLogin" value-field="userLoginSystem">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<!-- Quick Ship Entire Order -->
<set field="quickShipEntireOrderMap.orderId" from-field="orderId"/>
<set field="quickShipEntireOrderMap.userLogin" from-field="userLoginSystem"/>
<call-service service-name="quickShipEntireOrder" in-map-name="quickShipEntireOrderMap"/>
<log level="info" message="----Test sales order with id: [${orderId}] has been shipped----"/>
</if-not-empty>
<assert><not><if-empty field="orderId"/></not></assert>
<check-errors/>
</simple-method>
<simple-method method-name="testCreateOrderServiceProduct" short-description="Test create an order using a service product" login-required="false">
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="DemoCustomer"/>
</entity-one>
<!-- Shopping Cart new Instance -->
<set field="delegator" from-field="parameters.delegator" type="Object"/>
<set field="dispatcher" from-field="parameters.dispatcher" type="Object"/>
<set field="locale" from-field="parameters.locale" type="Object" />
<set field="productStoreId" value="9000" type="String"/>
<set field="currencyUom" value="USD" type="String"/>
<set field="salesChannel" value="WEB_SALES_CHANNEL" type="String"/>
<set field="partyId" value="DemoCustomer" type="String"/>
<create-object class-name="org.ofbiz.order.shoppingcart.ShoppingCart" field="shoppingCart">
<field field="delegator" type="org.ofbiz.entity.Delegator"/>
<field field="productStoreId" type="String"/>
<field field="locale" type="java.util.Locale"/>
<field field="currencyUom" type="String"/>
</create-object>
<set field="orderType" value="SALES_ORDER" type="String"/>
<call-object-method method-name="setOrderType" obj-field="shoppingCart">
<field field="orderType" type="String"/>
</call-object-method>
<call-object-method method-name="setChannelType" obj-field="shoppingCart">
<field field="salesChannel" type="String"/>
</call-object-method>
<call-object-method method-name="setProductStoreId" obj-field="shoppingCart">
<field field="productStoreId" type="String"/>
</call-object-method>
<call-object-method method-name="setBillToCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setPlacingCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setShipToCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setEndUserCustomerPartyId" obj-field="shoppingCart">
<field field="partyId" type="String"/>
</call-object-method>
<call-object-method method-name="setUserLogin" obj-field="shoppingCart">
<field field="userLogin" type="org.ofbiz.entity.GenericValue"/>
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
</call-object-method>
<set field="productId" value="SV-1001" type="String"/>
<set field="prodCatalogId" value="DemoCatalog" type="String"/>
<set field="quantity" value="1" type="BigDecimal"/>
<call-object-method method-name="addOrIncreaseItem" obj-field="shoppingCart">
<field field="productId" type="String"/>
<field field="selectedAmount" type="BigDecimal"/>
<field field="quantity" type="BigDecimal"/>
<field field="reservStart" type="Timestamp"/>
<field field="reservLength" type="BigDecimal"/>
<field field="reservPersons" type="BigDecimal"/>
<field field="shipBeforeDate" type="Timestamp"/>
<field field="shipAfterDate" type="Timestamp"/>
<field field="features" type="Map"/>
<field field="attributes" type="Map"/>
<field field="prodCatalogId" type="String"/>
<field field="configWrapper" type="org.ofbiz.product.config.ProductConfigWrapper"/>
<field field="itemType" type="String"/>
<field field="itemGroupNumber" type="String"/>
<field field="parentProductId" type="String"/>
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
</call-object-method>
<call-object-method method-name="setDefaultCheckoutOptions" obj-field="shoppingCart">
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
</call-object-method>
<create-object class-name="org.ofbiz.order.shoppingcart.CheckOutHelper" field="checkOutHelper">
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
<field field="delegator" type="org.ofbiz.entity.Delegator"/>
<field field="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart"/>
</create-object>
<call-object-method method-name="createOrder" obj-field="checkOutHelper" ret-field="orderCreateResult">
<field field="userLogin" type="org.ofbiz.entity.GenericValue"/>
</call-object-method>
<set field="orderId" from-field="orderCreateResult.orderId" type="String"/>
<if-not-empty field="orderId">
<call-class-method method-name="approveOrder" class-name="org.ofbiz.order.order.OrderChangeHelper" ret-field="approved">
<field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/>
<field field="userLogin" type="org.ofbiz.entity.GenericValue"/>
<field field="orderId" type="String"/>
</call-class-method>
<log level="info" message="======== Test order with id: [${orderId}] has been approved: [${approved}]========"/>
<entity-one entity-name="UserLogin" value-field="systemUserLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="quickShipEntireOrderMap.orderId" from-field="orderId"/>
<set field="quickShipEntireOrderMap.userLogin" from-field="systemUserLogin"/>
<call-service service-name="quickShipEntireOrder" in-map-name="quickShipEntireOrderMap"/>
<log level="info" message="========Test order with id: [${orderId}] has been shipped"/>
</if-not-empty>
<assert><not><if-empty field="orderId"/></not></assert>
<check-errors/>
</simple-method>
<simple-method method-name="testLoadCartFromQuote" short-description="Test loading shopping cart from quote" login-required="false">
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="createQuoteMap.userLogin" from-field="userLogin"/>
<set field="createQuoteMap.partyId" value="DemoCustomer"/>
<set field="createQuoteMap.currencyUomId" value="USD"/>
<set field="createQuoteMap.description" value="Test quote"/>
<set field="createQuoteMap.issueDate" value="2011-11-01 10:00:00.0" type="Timestamp"/>
<set field="createQuoteMap.productStoreId" value="9000"/>
<set field="createQuoteMap.quoteName" value="Test quote"/>
<set field="createQuoteMap.quoteTypeId" value="PRODUCT_QUOTE"/>
<set field="createQuoteMap.statusId" value="QUO_APPROVED"/>
<set field="createQuoteMap.validFromDate" value="2011-11-01 10:00:00.0" type="Timestamp"/>
<call-service service-name="createQuote" in-map-name="createQuoteMap">
<result-to-field result-name="quoteId"/>
</call-service>
<check-errors/>
<set field="createQuoteItemMap.userLogin" from-field="userLogin"/>
<set field="createQuoteItemMap.quoteId" from-field="quoteId"/>
<set field="createQuoteItemMap.productId" value="GZ-1000"/>
<set field="createQuoteItemMap.quantity" value="10" type="BigDecimal"/>
<set field="createQuoteItemMap.quoteUnitPrice" value="15.00" type="BigDecimal"/>
<call-service service-name="createQuoteItem" in-map-name="createQuoteItemMap">
<result-to-field result-name="quoteItemSeqNo"/>
</call-service>
<check-errors/>
<set field="createQuoteAdjustmentMap.userLogin" from-field="userLogin"/>
<set field="createQuoteAdjustmentMap.quoteId" from-field="quoteId"/>
<set field="createQuoteAdjustmentMap.quoteItemSeqId" from-field="quoteItemSeqId"/>
<set field="createQuoteAdjustmentMap.amount" value="15.00" type="BigDecimal"/>
<set field="createQuoteAdjustmentMap.includeInShipping" value="N"/>
<set field="createQuoteAdjustmentMap.includeInTax" value="Y"/>
<set field="createQuoteAdjustmentMap.quoteAdjustmentTypeId" value="SALES_TAX"/>
<set field="createQuoteAdjustmentMap.taxAuthGeoId" value="UT"/>
<set field="createQuoteAdjustmentMap.taxAuthPartyId" value="UT_TAXMAN"/>
<call-service service-name="createQuoteAdjustment" in-map-name="createQuoteAdjustmentMap">
<result-to-field result-name="quoteAdjustmentId"/>
</call-service>
<check-errors/>
<set field="loadCartFromQuoteMap.userLogin" from-field="userLogin"/>
<set field="loadCartFromQuoteMap.quoteId" from-field="quoteId"/>
<set field="loadCartFromQuoteMap.applyQuoteAdjustments" value="true"/>
<call-service service-name="loadCartFromQuote" in-map-name="loadCartFromQuoteMap">
<result-to-field result-name="shoppingCart"/>
</call-service>
<check-errors/>
<set field="expected" value="15.00" type="BigDecimal"/>
<call-object-method obj-field="shoppingCart" method-name="getTotalSalesTax" ret-field="totalSalesTax"/>
<assert><if-compare-field operator="equals" field="totalSalesTax" to-field="expected"/></assert>
<set field="shipGroupNumber" value="0" type="Integer"/>
<call-object-method obj-field="shoppingCart" method-name="getTotalSalesTax" ret-field="totalSalesTax">
<field field="shipGroupNumber" type="int"/>
</call-object-method>
<assert><if-compare-field operator="equals" field="totalSalesTax" to-field="expected"/></assert>
<set field="expected" value="165.00" type="BigDecimal"/>
<call-object-method obj-field="shoppingCart" method-name="getGrandTotal" ret-field="grandTotal"/>
<assert><if-compare-field operator="equals" field="grandTotal" to-field="expected"/></assert>
<check-errors/>
</simple-method>
<simple-method method-name="testCreateOrderConfigurableServiceProduct" short-description="Test create an order using a configurable service product" login-required="false">
<set field="request" from-field="parameters.request"/>
<set field="response" from-field="parameters.response"/>
<call-class-method method-name="routeOrderEntry" class-name="org.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : routeOrderEntry, Response : ${result}"/>
<!-- Set parameters -->
<set field="testParams.add_product_id" value="CFSV1001"/>
<set field="testParams.product_id" value="CFSV1001"/>
<set field="testParams.FT0_0_0TYPE" value="SCAN_TYPE"/>
<set field="testParams.product_id0_0_0" value="SCAN_TYPE"/>
<set field="testParams.0" value="0"/>
<set field="testParams.add_product_id0_0_0" value="SCAN-EC"/>
<set field="testParams.productStoreId" value="9000"/>
<set field="testParams.currencyUom" value="USD"/>
<set field="testParams.quantity" value="1"/>
<set field="testParams.orderMode" value="SALES_ORDER"/>
<set field="testParams.partyId" value="DemoCustomer"/>
<set field="testParams.checkoutpage" value="quick"/>
<set field="testParams.shipping_contact_mech_id" value="9015"/>
<set field="testParams.shipping_method" value="GROUND@UPS"/>
<set field="testParams.checkOutPaymentId" value="EXT_COD"/>
<set field="testParams.is_gift" value="false"/>
<set field="testParams.may_split" value="false"/>
<call-object-method method-name="addParameters" obj-field="request">
<field field="testParams" type="java.util.Map"/>
</call-object-method>
<entity-one value-field="userLogin" entity-name="UserLogin">
<field-map field-name="userLoginId" value="DemoCustomer"/>
</entity-one>
<call-bsh><![CDATA[
session = request.getSession();
session.setAttribute("userLogin", userLogin);
]]></call-bsh>
<call-class-method method-name="initializeOrderEntry" class-name="org.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : initializeOrderEntry, Response : ${result}"/>
<call-class-method method-name="setOrderCurrencyAgreementShipDates" class-name="org.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : setOrderCurrencyAgreementShipDates, Response : ${result}"/>
<call-class-method method-name="addToCart" class-name="org.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : addToCart, Response : ${result}"/>
<field-to-request field="nullField" request-name="shoppingCart"/>
<call-class-method method-name="setQuickCheckOutOptions" class-name="org.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : setQuickCheckOutOptions, Response : ${result}"/>
<call-class-method method-name="createOrder" class-name="org.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="orderCreateResult">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : createOrder, Response : ${orderCreateResult}"/>
<call-class-method method-name="processPayment" class-name="org.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : processPayment, Response : ${result}"/>
<call-service-asynch service-name="sendOrderConfirmation"/>
<call-class-method method-name="destroyCart" class-name="org.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="response" type="javax.servlet.http.HttpServletResponse"/>
</call-class-method>
<log level="info" message="===== >>> Event : destroyCart, Response = ${result}"/>
<entity-condition list="orderHeaders" entity-name="OrderHeader">
<condition-expr field-name="orderTypeId" value="SALES_ORDER"/>
<order-by field-name="-entryDate"/>
</entity-condition>
<first-from-list entry="orderHeader" list="orderHeaders"/>
<set field="orderId" from-field="orderHeader.orderId"/>
<log level="info" message="======== Test order with id: [${orderId}] has been approved: [${approved}]========"/>
<entity-one entity-name="UserLogin" value-field="systemUserLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="quickShipEntireOrderMap.orderId" from-field="orderId"/>
<set field="quickShipEntireOrderMap.userLogin" from-field="systemUserLogin"/>
<call-service service-name="quickShipEntireOrder" in-map-name="quickShipEntireOrderMap"/>
<log level="info" message="========Test order with id: [${orderId}] has been shipped"/>
<assert><not><if-empty field="orderId"/></not></assert>
<check-errors/>
</simple-method>
</simple-methods>