You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2021/03/15 10:11:56 UTC

[ofbiz-framework] branch trunk updated: Improved: Convert CheckoutServices.xml minilang to groovy (#75)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b1d4dc6  Improved: Convert CheckoutServices.xml minilang to groovy (#75)
b1d4dc6 is described below

commit b1d4dc6ea01e961c1c7d70d5fae356f218b5149c
Author: SebastianEcomify <60...@users.noreply.github.com>
AuthorDate: Mon Mar 15 11:11:47 2021 +0100

    Improved: Convert CheckoutServices.xml minilang to groovy (#75)
    
    (OFBIZ-11599)
---
 .../groovyScripts/order/CheckoutServices.groovy    | 199 +++++++++++++++++++
 .../order/minilang/order/CheckoutServices.xml      | 215 ---------------------
 .../order/servicedef/services_checkout.xml         |   6 +-
 3 files changed, 202 insertions(+), 218 deletions(-)

diff --git a/applications/order/groovyScripts/order/CheckoutServices.groovy b/applications/order/groovyScripts/order/CheckoutServices.groovy
new file mode 100644
index 0000000..0bb75ce
--- /dev/null
+++ b/applications/order/groovyScripts/order/CheckoutServices.groovy
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.ofbiz.base.util.StringUtil
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.minilang.SimpleMapProcessor
+import org.apache.ofbiz.order.shoppingcart.CheckOutHelper
+import org.apache.ofbiz.order.shoppingcart.ShoppingCart
+import org.apache.ofbiz.order.shoppingcart.ShoppingCart.CartPaymentInfo
+import org.apache.ofbiz.service.ServiceUtil
+
+
+/**
+ * Create/Update Customer, Shipping Address and other contact details.
+ * @return
+ */
+def createUpdateCustomerAndShippingAddress() {
+    Map result = success()
+
+    List<String> messages = []
+    Map shipToPhoneCtx = [:]
+    Map emailAddressCtx = [:]
+    // TODO need to convert from MapProcessor
+    SimpleMapProcessor.runSimpleMapProcessor('component://order/minilang/customer/CheckoutMapProcs.xml', 'shipToPhone', parameters, shipToPhoneCtx, messages, context.locale)
+    SimpleMapProcessor.runSimpleMapProcessor('component://party/minilang/contact/PartyContactMechMapProcs.xml', 'emailAddress', parameters, emailAddressCtx, messages, context.locale)
+    // Check errors
+    if (messages) return error(StringUtil.join(messages, ','))
+
+    ShoppingCart shoppingCart = parameters.shoppingCart
+    String partyId = parameters.partyId
+    GenericValue userLogin = shoppingCart.getUserLogin()
+    // If registered user is coming then take partyId from userLogin
+    if (userLogin && userLogin.partyId && !partyId) {
+        partyId = userLogin.partyId
+    }
+    Map createUpdatePersonCtx = parameters
+    createUpdatePersonCtx.userLogin = userLogin
+    createUpdatePersonCtx.partyId = partyId
+    Map serviceResultCUP = run service: "createUpdatePerson", with: createUpdatePersonCtx
+    partyId = serviceResultCUP.partyId
+
+    Map partyRoleCtx = [partyId: partyId, roleTypeId: "CUSTOMER"]
+    if (userLogin) {
+        if (userLogin.userLoginId == "anonymos") {
+            userLogin.partyId = partyId
+        }
+        partyRoleCtx.userLogin = userLogin
+    }
+    run service: "ensurePartyRole", with: partyRoleCtx
+
+    // Create Update Shipping address
+    Map shipToAddressCtx = parameters
+    shipToAddressCtx.userLogin = userLogin
+    Map serviceResultCUSA = run service: "createUpdateShippingAddress", with: shipToAddressCtx
+    parameters.shipToContactMechId = serviceResultCUSA.contactMechId
+    result.contactMechId = serviceResultCUSA.contactMechId
+
+    // Create Update Shipping Telecom Number
+    Map createUpdatePartyTelecomNumberCtx = shipToPhoneCtx
+    createUpdatePartyTelecomNumberCtx.userLogin = userLogin
+    createUpdatePartyTelecomNumberCtx.partyId = partyId
+    createUpdatePartyTelecomNumberCtx.roleTypeId = "CUSTOMER"
+    createUpdatePartyTelecomNumberCtx.contactMechPurposeTypeId = "PHONE_SHIPPING"
+    createUpdatePartyTelecomNumberCtx.contactMechId = parameters.shipToPhoneContactMechId
+    Map serviceResultCUPTN = run service: "createUpdatePartyTelecomNumber", with: createUpdatePartyTelecomNumberCtx
+    String shipToPhoneContactMechId = serviceResultCUPTN.contactMechId
+    result.shipToPhoneContactMechId = serviceResultCUPTN.contactMechId
+
+    if (shipToPhoneContactMechId) {
+        shoppingCart.addContactMech("PHONE_SHIPPING", shipToPhoneContactMechId)
+    }
+    // Create Update email address
+    Map createUpdatePartyEmailCtx = emailAddressCtx
+    createUpdatePartyEmailCtx.contactMechPurposeTypeId = "PRIMARY_EMAIL"
+    createUpdatePartyEmailCtx.userLogin = userLogin
+    createUpdatePartyEmailCtx.partyId = partyId
+    Map serviceResultCUPEM = run service: "createUpdatePartyEmailAddress", with: createUpdatePartyEmailCtx
+    parameters.emailContactMechId = serviceResultCUPEM.contactMechId
+    result.emailContactMechId = serviceResultCUPEM.contactMechId
+    result.partyId = partyId
+    if (parameters.emailContactMechId) {
+        shoppingCart.addContactMech("ORDER_EMAIL", parameters.emailContactMechId)
+    }
+    shoppingCart.setUserLogin(userLogin, dispatcher)
+    shoppingCart.addContactMech("SHIPPING_LOCATION", parameters.shipToContactMechId)
+    shoppingCart.setAllShippingContactMechId(parameters.shipToContactMechId)
+    shoppingCart.setOrderPartyId(partyId)
+    return result
+}
+
+/**
+ * Create/update billing address and payment information
+ * @return
+ */
+def createUpdateBillingAddressAndPaymentMethod() {
+    Map result = success()
+    List<String> messages = []
+    Map billToPhoneContext = [:]
+    // TODO need to convert from MapProcessor
+    SimpleMapProcessor.runSimpleMapProcessor('component://order/minilang/customer/CheckoutMapProcs.xml', 'billToPhone', parameters, billToPhoneContext, messages, context.locale)
+    // Check Errors
+    if (messages) return error(StringUtil.join(messages, ','))
+
+    ShoppingCart shoppingCart = parameters.shoppingCart
+    GenericValue userLogin = shoppingCart.getUserLogin()
+    String partyId = parameters.partyId
+    // If registered user is coming then take partyId from userLogin
+    if (userLogin && !partyId) {
+        partyId = userLogin.partyId
+    }
+    String shipToContactMechId = parameters.shipToContactMechId
+    if (shoppingCart) {
+        if (!partyId) {
+            partyId = shoppingCart.getPartyId()
+        }
+        if (!shipToContactMechId) {
+            shipToContactMechId = shoppingCart.getShippingContactMechId()
+        }
+    }
+    if (partyId) {
+        if (userLogin.userLoginId == "anonymous") {
+            userLogin.partyId = partyId
+        }
+    }
+    // Create Update Billing address
+    Map billToAddressCtx = parameters
+    billToAddressCtx.userLogin = userLogin
+    Map serviceResultCUBA = run service: "createUpdateBillingAddress", with: billToAddressCtx
+    if (ServiceUtil.isError(serviceResultCUBA)) return serviceResultCUBA
+    parameters.billToContactMechId = serviceResultCUBA.contactMechId
+    result.contactMechId = serviceResultCUBA.contactMechId
+    if (parameters.billToContactMechId) {
+        shoppingCart.addContactMech("BILLING_LOCATION", parameters.billToContactMechId)
+    }
+    // Create Update Billing Telecom Number
+    Map createUpdatePartyTelecomNumberCtx = billToPhoneContext
+    createUpdatePartyTelecomNumberCtx.userLogin = userLogin
+    createUpdatePartyTelecomNumberCtx.partyId = partyId
+    createUpdatePartyTelecomNumberCtx.roleTypeId = "CUSTOMER"
+    createUpdatePartyTelecomNumberCtx.contactMechPurposeTypeId = "PHONE_BILLING"
+    createUpdatePartyTelecomNumberCtx.contactMechId = parameters.billToPhoneContactMechId
+    Map serviceResultCUPTN = run service: "createUpdatePartyTelecomNumber", with: createUpdatePartyTelecomNumberCtx
+    if (ServiceUtil.isError(serviceResultCUPTN)) return serviceResultCUPTN
+    String billToPhoneContactMechId = serviceResultCUPTN.contactMechId
+    result.billToPhoneContactMechId = serviceResultCUPTN.contactMechId
+    if (billToPhoneContactMechId) {
+        shoppingCart.addContactMech("PHONE_BILLING", billToPhoneContactMechId)
+    }
+    // Create Update credit card
+    Map creditCartCtx = parameters
+    creditCartCtx.contactMechId = parameters.billToContactMechId
+    creditCartCtx.userLogin = userLogin
+    Map serviceResultCUCC = run service: "createUpdateCreditCard", with: creditCartCtx
+    if (ServiceUtil.isError(serviceResultCUCC)) return serviceResultCUCC
+    String paymentMethodId = serviceResultCUCC.paymentMethodId
+    result.paymentMethodId = serviceResultCUCC.paymentMethodId
+    // Set Payment Method
+    String cardSecurityCode = parameters.billToCardSecurityCode
+    CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, shoppingCart)
+    Map callResult = checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, false, false)
+    CartPaymentInfo cartPaymentInfo = shoppingCart.getPaymentInfo(paymentMethodId, null, null, null, true)
+    cartPaymentInfo.securityCode = cardSecurityCode
+    return result
+}
+
+/**
+ * Set user login in the session
+ * @return
+ */
+def setAnonUserLogin() {
+    ShoppingCart shoppingCart = parameters.shoppingCart
+    GenericValue userLogin = shoppingCart.getUserLogin()
+    if (!userLogin) {
+        userLogin = from("UserLogin").where(userLoginId: "anonymous").queryOne()
+    } else {
+        // If an anonymous user is coming back, update the party id in the userLogin object
+        if (userLogin.userLoginId == "anonymous" && parameters.partyId) {
+            userLogin.partyId = parameters.partyId
+        }
+    }
+    shoppingCart.setUserLogin(userLogin, dispatcher)
+    return success()
+}
diff --git a/applications/order/minilang/order/CheckoutServices.xml b/applications/order/minilang/order/CheckoutServices.xml
deleted file mode 100644
index 3c0a51d..0000000
--- a/applications/order/minilang/order/CheckoutServices.xml
+++ /dev/null
@@ -1,215 +0,0 @@
-<?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" 
-        xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
-
-    <simple-method method-name="createUpdateCustomerAndShippingAddress" short-description="Create/Update Customer, Shipping Address and other contact details." login-required="false">
-        <call-map-processor xml-resource="component://order/minilang/customer/CheckoutMapProcs.xml"
-                processor-name="shipToPhone" in-map-name="parameters" out-map-name="shipToPhoneCtx"/>
-        <call-map-processor xml-resource="component://party/minilang/contact/PartyContactMechMapProcs.xml"
-                processor-name="emailAddress" in-map-name="parameters" out-map-name="emailAddressCtx"/>
-        <check-errors/>
-        <set field="shoppingCart" from-field="parameters.shoppingCart"/>
-        <set field="partyId" from-field="parameters.partyId"/>
-        <call-object-method obj-field="shoppingCart" method-name="getUserLogin" ret-field="userLogin"/>
-        <!-- If registered user is coming then take partyId from userLogin -->
-        <if-compare field="userLogin != null @and userLogin.partyId != null @and partyId == null" operator="equals" value="true" type="Boolean">
-            <set field="partyId" from-field="userLogin.partyId"/>
-        </if-compare>
-        <set-service-fields service-name="createUpdatePerson" map="parameters" to-map="createUpdatePersonCtx"/>
-        <set field="createUpdatePersonCtx.userLogin" from-field="userLogin"/>
-        <set field="createUpdatePersonCtx.partyId" from-field="partyId"/>
-        <call-service service-name="createUpdatePerson" in-map-name="createUpdatePersonCtx">
-            <result-to-field result-name="partyId"/>
-        </call-service>
-
-        <if-not-empty field="userLogin">
-            <if-compare field="userLogin.userLoginId" operator="equals" value="anonymous">
-                <set field="userLogin.partyId" from-field="partyId"/>
-            </if-compare>
-        </if-not-empty>
-
-        <set field="partyRoleCtx.partyId" from-field="partyId"/>
-        <set field="partyRoleCtx.roleTypeId" value="CUSTOMER"/>
-        <set field="partyRoleCtx.userLogin" from-field="userLogin"/>
-
-        <call-service service-name="ensurePartyRole" in-map-name="partyRoleCtx"/>
-
-        <!-- Create Update Shipping address -->
-        <set-service-fields service-name="createUpdateShippingAddress" map="parameters" to-map="shipToAddressCtx"/>
-        <set field="shipToAddressCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createUpdateShippingAddress" in-map-name="shipToAddressCtx">
-            <result-to-field result-name="contactMechId" field="parameters.shipToContactMechId"/>
-            <result-to-result result-name="contactMechId"/>
-        </call-service>
-
-        <!-- Create Update Shipping Telecom Number -->
-        <set-service-fields service-name="createUpdatePartyTelecomNumber" map="shipToPhoneCtx" to-map="createUpdatePartyTelecomNumberCtx"/>
-        <set field="createUpdatePartyTelecomNumberCtx.userLogin" from-field="userLogin"/>
-        <set field="createUpdatePartyTelecomNumberCtx.partyId" from-field="partyId"/>
-        <set field="createUpdatePartyTelecomNumberCtx.roleTypeId" value="CUSTOMER"/>
-        <set field="createUpdatePartyTelecomNumberCtx.contactMechPurposeTypeId" value="PHONE_SHIPPING"/>
-        <set field="createUpdatePartyTelecomNumberCtx.contactMechId" from-field="parameters.shipToPhoneContactMechId" />
-        <call-service service-name="createUpdatePartyTelecomNumber" in-map-name="createUpdatePartyTelecomNumberCtx">
-            <result-to-field result-name="contactMechId" field="shipToPhoneContactMechId"/>
-            <result-to-result result-name="contactMechId" service-result-name="shipToPhoneContactMechId"/>
-        </call-service>
-
-        <if-not-empty field="shipToPhoneContactMechId">
-            <call-object-method obj-field="shoppingCart" method-name="addContactMech">
-                <string value="PHONE_SHIPPING"/>
-                <field field="shipToPhoneContactMechId"/>
-            </call-object-method>
-        </if-not-empty>
-
-        <!-- Create Update email address -->
-        <set-service-fields service-name="createUpdatePartyEmailAddress" map="emailAddressCtx" to-map="createUpdatePartyEmailCtx"/>
-        <set field="createUpdatePartyEmailCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
-        <set field="createUpdatePartyEmailCtx.userLogin" from-field="userLogin"/>
-        <set field="createUpdatePartyEmailCtx.partyId" from-field="partyId"/>
-        <call-service service-name="createUpdatePartyEmailAddress" in-map-name="createUpdatePartyEmailCtx">
-            <result-to-field result-name="contactMechId" field="parameters.emailContactMechId"/>
-            <result-to-result result-name="contactMechId" service-result-name="emailContactMechId"/>
-        </call-service>
-        <field-to-result field="partyId"/>
-        <if-not-empty field="parameters.emailContactMechId">
-            <call-object-method obj-field="shoppingCart" method-name="addContactMech">
-                <string value="ORDER_EMAIL"/>
-                <field field="parameters.emailContactMechId"/>
-            </call-object-method>
-        </if-not-empty>
-
-        <call-object-method obj-field="shoppingCart" method-name="setUserLogin">
-            <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
-            <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
-        </call-object-method>
-        <call-object-method obj-field="shoppingCart" method-name="addContactMech">
-            <string value="SHIPPING_LOCATION"/>
-            <field field="parameters.shipToContactMechId"/>
-        </call-object-method>
-        <call-object-method obj-field="shoppingCart" method-name="setAllShippingContactMechId">
-            <field field="parameters.shipToContactMechId"/>
-        </call-object-method>
-        <call-object-method obj-field="shoppingCart" method-name="setOrderPartyId">
-            <field field="partyId"/>
-        </call-object-method>
-    </simple-method>
-
-    <simple-method method-name="createUpdateBillingAddressAndPaymentMethod" short-description="Create/update billing address and payment information" login-required="false">
-        <call-map-processor xml-resource="component://order/minilang/customer/CheckoutMapProcs.xml"
-                processor-name="billToPhone" in-map-name="parameters" out-map-name="billToPhoneContext"/>
-        <check-errors/>
-        <set field="shoppingCart" from-field="parameters.shoppingCart"/>
-        <call-object-method obj-field="shoppingCart" method-name="getUserLogin" ret-field="userLogin"/>
-        <set field="partyId" from-field="parameters.partyId"/>
-         <!-- If registered user is coming then take partyId from userLogin -->
-        <if-compare field="userLogin != null @and partyId == null" operator="equals" value="true" type="Boolean">
-            <set field="partyId" from-field="userLogin.partyId"/>
-        </if-compare>
-
-        <set field="shipToContactMechId" from-field="parameters.shipToContactMechId"/>
-        <if-not-empty field="shoppingCart">
-            <if-empty field="partyId">
-                <call-object-method obj-field="shoppingCart" method-name="getPartyId" ret-field="partyId"/>
-            </if-empty>
-            <if-empty field="shipToContactMechId">
-                <call-object-method obj-field="shoppingCart" method-name="getShippingContactMechId" ret-field="shipToContactMechId"/>
-            </if-empty>
-        </if-not-empty>
-        <if-not-empty field="partyId">
-            <if-compare field="userLogin.userLoginId" operator="equals" value="anonymous">
-                <set field="userLogin.partyId" from-field="partyId"/>
-            </if-compare>
-        </if-not-empty>
-
-        <!-- Create Update Billing address -->
-        <set-service-fields service-name="createUpdateBillingAddress" map="parameters" to-map="billToAddressCtx"/>
-        <set field="billToAddressCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createUpdateBillingAddress" in-map-name="billToAddressCtx">
-            <result-to-field result-name="contactMechId" field="parameters.billToContactMechId"/>
-            <result-to-result result-name="contactMechId"/>
-        </call-service>
-
-        <if-not-empty field="parameters.billToContactMechId">
-            <call-object-method obj-field="shoppingCart" method-name="addContactMech">
-                <string value="BILLING_LOCATION"/>
-                <field field="parameters.billToContactMechId"/>
-            </call-object-method>
-        </if-not-empty>
-
-        <!-- Create Update Billing Telecom Number -->
-        <set-service-fields service-name="createUpdatePartyTelecomNumber" map="billToPhoneContext" to-map="createUpdatePartyTelecomNumberCtx"/>
-        <set field="createUpdatePartyTelecomNumberCtx.userLogin" from-field="userLogin"/>
-        <set field="createUpdatePartyTelecomNumberCtx.partyId" from-field="partyId"/>
-        <set field="createUpdatePartyTelecomNumberCtx.roleTypeId" value="CUSTOMER"/>
-        <set field="createUpdatePartyTelecomNumberCtx.contactMechPurposeTypeId" value="PHONE_BILLING"/>
-        <set field="createUpdatePartyTelecomNumberCtx.contactMechId" from-field="parameters.billToPhoneContactMechId" />
-        <call-service service-name="createUpdatePartyTelecomNumber" in-map-name="createUpdatePartyTelecomNumberCtx">
-            <result-to-field result-name="contactMechId" field="billToPhoneContactMechId"/>
-            <result-to-result result-name="contactMechId" service-result-name="billToPhoneContactMechId"/>
-        </call-service>
-        <if-not-empty field="billToPhoneContactMechId">
-            <call-object-method obj-field="shoppingCart" method-name="addContactMech">
-                <string value="PHONE_BILLING"/>
-                <field field="billToPhoneContactMechId"/>
-            </call-object-method>
-        </if-not-empty>
-
-        <!-- Create Update credit card -->
-        <set-service-fields service-name="createUpdateCreditCard" map="parameters" to-map="creditCardCtx"/>
-        <set field="creditCardCtx.contactMechId" from-field="parameters.billToContactMechId"/>
-        <set field="creditCardCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createUpdateCreditCard" in-map-name="creditCardCtx">
-            <result-to-field result-name="paymentMethodId"/>
-            <result-to-result result-name="paymentMethodId"/>
-        </call-service>
-        <!-- Set Payment Method-->
-        <set field="cardSecurityCode" from-field="parameters.billToCardSecurityCode" set-if-null="true" set-if-empty="true"/>
-        <create-object class-name="org.apache.ofbiz.order.shoppingcart.CheckOutHelper" field="checkOutHelper">
-            <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
-            <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
-            <field field="shoppingCart" type="org.apache.ofbiz.order.shoppingcart.ShoppingCart"/>
-        </create-object>
-        <set field="callResult" value="${groovy:checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, false, false)}"/>
-        <set field="cartPaymentInfo" value="${groovy: org.apache.ofbiz.order.shoppingcart.ShoppingCart.CartPaymentInfo cpi = shoppingCart.getPaymentInfo(paymentMethodId, null, null, null, true); cpi.securityCode = cardSecurityCode; return cpi;}"/>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="setAnonUserLogin" short-description="Set user login in the session" login-required="false">
-        <set field="shoppingCart" from-field="parameters.shoppingCart"/>
-        <call-object-method obj-field="shoppingCart" method-name="getUserLogin" ret-field="userLogin"/>
-        <if-empty field="userLogin">
-            <entity-one entity-name="UserLogin" value-field="userLogin">
-                <field-map field-name="userLoginId" value="anonymous"/>
-            </entity-one>
-        <else>
-            <!-- If an anonymous user is coming back, update the party id in the userLogin object -->
-            <if-compare field="userLogin.userLoginId" operator="equals" value="anonymous">
-                <set field="userLogin.partyId" from-field="parameters.partyId"/>
-            </if-compare>
-        </else>
-        </if-empty>
-        <call-object-method obj-field="shoppingCart" method-name="setUserLogin">
-            <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
-            <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
-        </call-object-method>
-    </simple-method>
-</simple-methods>
diff --git a/applications/order/servicedef/services_checkout.xml b/applications/order/servicedef/services_checkout.xml
index 13e63d9..ec7ce54 100644
--- a/applications/order/servicedef/services_checkout.xml
+++ b/applications/order/servicedef/services_checkout.xml
@@ -21,7 +21,7 @@ under the License.
 <services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/services.xsd">
 
-    <service name="createUpdateCustomerAndShippingAddress" engine="simple" location="component://order/minilang/order/CheckoutServices.xml" auth="false" invoke="createUpdateCustomerAndShippingAddress">
+    <service name="createUpdateCustomerAndShippingAddress" engine="groovy" location="component://order/groovyScripts/order/CheckoutServices.groovy" auth="false" invoke="createUpdateCustomerAndShippingAddress">
         <implements service="createUpdateShippingAddress"/>
         <attribute name="shoppingCart" type="org.apache.ofbiz.order.shoppingcart.ShoppingCart" mode="IN" optional="false"/>
         <attribute name="firstName" type="String" mode="IN" optional="true"/>
@@ -37,7 +37,7 @@ under the License.
         <attribute name="shipToPhoneContactMechId" type="String" mode="INOUT" optional="true"/>
     </service>
 
-    <service name="createUpdateBillingAddressAndPaymentMethod" engine="simple" location="component://order/minilang/order/CheckoutServices.xml" auth="false" invoke="createUpdateBillingAddressAndPaymentMethod">
+    <service name="createUpdateBillingAddressAndPaymentMethod" engine="groovy" location="component://order/groovyScripts/order/CheckoutServices.groovy" auth="false" invoke="createUpdateBillingAddressAndPaymentMethod">
         <implements service="createUpdateBillingAddress"/>
         <implements service="createUpdateCreditCard"/>
         <attribute name="shoppingCart" type="org.apache.ofbiz.order.shoppingcart.ShoppingCart" mode="IN" optional="false"/>
@@ -51,7 +51,7 @@ under the License.
         <attribute name="billToPhoneContactMechId" mode="INOUT" type="String" optional="true"/>
     </service>
 
-    <service name="setAnonUserLogin" engine="simple" location="component://order/minilang/order/CheckoutServices.xml" auth="false" invoke="setAnonUserLogin">
+    <service name="setAnonUserLogin" engine="groovy" location="component://order/groovyScripts/order/CheckoutServices.groovy" auth="false" invoke="setAnonUserLogin">
          <attribute name="shoppingCart" type="org.apache.ofbiz.order.shoppingcart.ShoppingCart" mode="IN" optional="false"/>
          <attribute name="partyId" type="String" mode="IN" optional="true"/>
     </service>