svn commit: r682706 - /ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r682706 - /ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml

mor-2
Author: mor
Date: Tue Aug  5 06:18:24 2008
New Revision: 682706

URL: http://svn.apache.org/viewvc?rev=682706&view=rev
Log:
Adding back <check-errors/> tag in individual methods as adding <error_list> check contradicts with the purpose of splitting event into smaller methods. This way individual method can be called as a separate entity doing error checks.

Modified:
    ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml

Modified: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?rev=682706&r1=682705&r2=682706&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml (original)
+++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml Tue Aug  5 06:18:24 2008
@@ -874,20 +874,18 @@
         </if-empty>
 
         <call-simple-method method-name="createUpdatePerson"/>
-        <if-empty field="error_list">
-            <call-simple-method method-name="setAnonUserLogin"/>
-            
-            <set field="partyRoleContext.partyId" from-field="partyId"/>
-            <set field="partyRoleContext.roleTypeId" from-field="parameters.roleTypeId"/>
-            <set field="partyRoleContext.userLogin" from-field="userLogin"/>
-            <call-service service-name="createPartyRole" in-map-name="partyRoleContext"/>
-        </if-empty>
+        <call-simple-method method-name="setAnonUserLogin"/>
+        
+        <set field="partyRoleContext.partyId" from-field="partyId"/>
+        <set field="partyRoleContext.roleTypeId" from-field="parameters.roleTypeId"/>
+        <set field="partyRoleContext.userLogin" from-field="userLogin"/>
+        <call-service service-name="createPartyRole" in-map-name="partyRoleContext"/>
+        
         <call-simple-method method-name="createUpdateShippingAddress"/>
         <set field="parameters.phoneContactMechPurposeTypeId" value="PRIMARY_PHONE"/>
         <call-simple-method method-name="createUpdateTelecomNumber"/>
         <set field="parameters.emailContactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
         <call-simple-method method-name="createUpdateEmailAddress"/>
-        <check-errors/>
         <!-- Set partyId, in shoppingCart -->
         <call-object-method obj-field-name="shoppingCart" method-name="setUserLogin">
             <field field-name="userLogin" type="org.ofbiz.entity.GenericValue"/>
@@ -909,7 +907,7 @@
     <simple-method method-name="createUpdatePerson" short-description="Create and update a person" login-required="false">
         <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
                 processor-name="person" in-map-name="parameters" out-map-name="personMap"/>
-        <if-empty field="error_list">        
+        <check-errors/>        
             <set-service-fields service-name="createPerson"  map-name="personMap" to-map-name="personContext"/>
             <if-empty field="partyId">
                 <call-service service-name="createPerson" in-map-name="personContext">
@@ -923,7 +921,6 @@
             </if-empty>
             <field-to-request field-name="partyId" request-name="partyId"/>
             <set field="parameters.partyId" from-field="partyId"/>
-        </if-empty>
     </simple-method>
     
     <simple-method method-name="createUpdateUserLogin" short-description="Create and update a user login" login-required="false">
@@ -950,35 +947,33 @@
                 String passwordHint = (String) userLoginMap.get("passwordHint");
                 org.ofbiz.common.login.LoginServices.checkNewPassword(newUserLogin, null, password, confirmPassword, passwordHint, error_list, true, locale);
             ]]></call-bsh>
-            <if-empty field="error_list">
-                 <set-service-fields service-name="createUserLogin"  map-name="userLoginMap" to-map-name="userLoginCtx"/>
-                
-                <!-- call the service with the system account to get around security constraints for this special create -->
-                <entity-one entity-name="UserLogin" value-name="userLoginCtx.userLogin" auto-field-map="false">
-                    <field-map field-name="userLoginId" value="system"/>
-                </entity-one>
-                
-                <call-service service-name="createUserLogin" in-map-name="userLoginCtx"/>
-                <entity-one entity-name="UserLogin" value-name="userLogin">
-                    <field-map field-name="userLoginId" env-name="userLoginMap.userLoginId"/>
-                </entity-one>
-                <set field="parameters.userLogin" from-field="userLogin"/>            
-            </if-empty>
+            <check-errors/>
+            <set-service-fields service-name="createUserLogin"  map-name="userLoginMap" to-map-name="userLoginCtx"/>
+            
+            <!-- call the service with the system account to get around security constraints for this special create -->
+            <entity-one entity-name="UserLogin" value-name="userLoginCtx.userLogin" auto-field-map="false">
+                <field-map field-name="userLoginId" value="system"/>
+            </entity-one>
+            
+            <call-service service-name="createUserLogin" in-map-name="userLoginCtx"/>
+            <entity-one entity-name="UserLogin" value-name="userLogin">
+                <field-map field-name="userLoginId" env-name="userLoginMap.userLoginId"/>
+            </entity-one>
+            <set field="parameters.userLogin" from-field="userLogin"/>            
         <else>
             <call-map-processor xml-resource="org/ofbiz/securityext/login/LoginMapProcs.xml"
                 processor-name="updatePassword" in-map-name="parameters" out-map-name="passwordMap"/>
-            <if-empty field="error_list">    
-                <set-service-fields service-name="updatePassword"  map-name="passwordMap" to-map-name="passwordCtx"/>
-                <call-service service-name="updatePassword" in-map-name="passwordCtx">
-                    <result-to-field result-name="updatedUserLogin"/>
-                </call-service>
-                <set-current-user-login value-name="updatedUserLogin"/>
-                <session-to-field field-name="userLogin"/>
-                <if-compare field="userLogin.userLoginId" operator="equals" value="${updatedUserLogin.userLoginId}">
-                    <field-to-session field-name="updatedUserLogin" session-name="userLogin"/>
-                </if-compare>
-                <session-to-field field-name="userLogin"/>
-            </if-empty>
+            <check-errors/>
+            <set-service-fields service-name="updatePassword"  map-name="passwordMap" to-map-name="passwordCtx"/>
+            <call-service service-name="updatePassword" in-map-name="passwordCtx">
+                <result-to-field result-name="updatedUserLogin"/>
+            </call-service>
+            <set-current-user-login value-name="updatedUserLogin"/>
+            <session-to-field field-name="userLogin"/>
+            <if-compare field="userLogin.userLoginId" operator="equals" value="${updatedUserLogin.userLoginId}">
+                <field-to-session field-name="updatedUserLogin" session-name="userLogin"/>
+            </if-compare>
+            <session-to-field field-name="userLogin"/>
         </else>
         </if-empty>
     </simple-method>
@@ -1004,113 +999,110 @@
     <simple-method method-name="createUpdateTelecomNumber" short-description="Create and update phone number" login-required="false">
         <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
                 processor-name="phoneNumber" in-map-name="parameters" out-map-name="phoneContext"/>
-        <if-empty field="error_list">
-            <set field="phoneContext.partyId" from-field="partyId"/>
-            <set field="phoneContext.roleTypeId" from-field="parameters.roleTypeId"/>
-            <set field="phoneContext.userLogin" from-field="userLogin"/>
-            <if-empty field="parameters.phoneContactMechId">
-                <set field="phoneContext.contactMechPurposeTypeId" from-field="parameters.phoneContactMechPurposeTypeId"/>
-                <call-service service-name="createPartyTelecomNumber" in-map-name="phoneContext">
-                    <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/>
-                </call-service>
-                <log level="info" message="Phone Contact created phoneContactMechId is ${parameters.phoneContactMechId}"></log>
-            <else>
-                <set field="phoneContext.contactMechId" from-field="parameters.phoneContactMechId"/>
-                <log level="info" message="Updating phoneContactMechId is ${parameters.phoneContactMechId}"></log>
-                <call-service service-name="updatePartyTelecomNumber" in-map-name="phoneContext">
-                    <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/>
-                </call-service>
-                <log level="info" message="Phone Contact updated phoneContactMechId is ${parameters.phoneContactMechId}"></log>
-            </else>
-            </if-empty>
-            <field-to-request field-name="parameters.phoneContactMechId" request-name="phoneContactMechId"/>
+        <check-errors/>
+        <set field="phoneContext.partyId" from-field="partyId"/>
+        <set field="phoneContext.roleTypeId" from-field="parameters.roleTypeId"/>
+        <set field="phoneContext.userLogin" from-field="userLogin"/>
+        <if-empty field="parameters.phoneContactMechId">
+            <set field="phoneContext.contactMechPurposeTypeId" from-field="parameters.phoneContactMechPurposeTypeId"/>
+            <call-service service-name="createPartyTelecomNumber" in-map-name="phoneContext">
+                <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/>
+            </call-service>
+            <log level="info" message="Phone Contact created phoneContactMechId is ${parameters.phoneContactMechId}"></log>
+        <else>
+            <set field="phoneContext.contactMechId" from-field="parameters.phoneContactMechId"/>
+            <log level="info" message="Updating phoneContactMechId is ${parameters.phoneContactMechId}"></log>
+            <call-service service-name="updatePartyTelecomNumber" in-map-name="phoneContext">
+                <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/>
+            </call-service>
+            <log level="info" message="Phone Contact updated phoneContactMechId is ${parameters.phoneContactMechId}"></log>
+        </else>
         </if-empty>
+        <field-to-request field-name="parameters.phoneContactMechId" request-name="phoneContactMechId"/>
     </simple-method>
 
     <simple-method method-name="createUpdateEmailAddress" short-description="Create and update phone number" login-required="false">
         <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
                 processor-name="emailAddress" in-map-name="parameters" out-map-name="emailAddressContext"/>
-        <if-empty field="error_list">
-            <!-- Create Or Update email address -->
-            <set  field="emailAddressContext.partyId" from-field="partyId"/>
-            <set field="emailAddressContext.userLogin" from-field="userLogin"/>
-            <if-empty field="parameters.emailContactMechId">
-                <set field="emailAddressContext.contactMechPurposeTypeId" from-field="parameters.emailContactMechPurposeTypeId"/>
-                <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext">
-                    <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
-                </call-service>
-                <log level="info" message="Email Contact Created emailContactMechId is ${parameters.emailContactMechId}"></log>
-            <else>
-                <set field="emailAddressContext.contactMechId" from-field="parameters.emailContactMechId"/>
-                <!-- call update Email address -->
-                <call-service service-name="updatePartyEmailAddress" in-map-name="emailAddressContext">
-                    <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
-                </call-service>
-                <log level="info" message="Email Contact updated emailContactMechId is ${parameters.emailContactMechId}"></log>
-            </else>
-            </if-empty>
-            <field-to-request field-name="parameters.emailContactMechId" request-name="emailContactMechId"/>
+        <check-errors/>        
+        <!-- Create Or Update email address -->
+        <set  field="emailAddressContext.partyId" from-field="partyId"/>
+        <set field="emailAddressContext.userLogin" from-field="userLogin"/>
+        <if-empty field="parameters.emailContactMechId">
+            <set field="emailAddressContext.contactMechPurposeTypeId" from-field="parameters.emailContactMechPurposeTypeId"/>
+            <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext">
+                <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
+            </call-service>
+            <log level="info" message="Email Contact Created emailContactMechId is ${parameters.emailContactMechId}"></log>
+        <else>
+            <set field="emailAddressContext.contactMechId" from-field="parameters.emailContactMechId"/>
+            <!-- call update Email address -->
+            <call-service service-name="updatePartyEmailAddress" in-map-name="emailAddressContext">
+                <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/>
+            </call-service>
+            <log level="info" message="Email Contact updated emailContactMechId is ${parameters.emailContactMechId}"></log>
+        </else>
         </if-empty>
+        <field-to-request field-name="parameters.emailContactMechId" request-name="emailContactMechId"/>
     </simple-method>
 
     <simple-method method-name="createUpdateShippingAddress" short-description="create and update shipping address" login-required="false">
         <set field="keepAddressBook" from-field="parameters.keepAddressBook" default-value="Y"/>
         <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
             processor-name="shipToAddress" in-map-name="parameters" out-map-name="shipToAddressCtx"/>
-        <if-empty field="error_list">
-            <set field="shipToAddressCtx.partyId" from-field="partyId"/>
-            <set field="shipToAddressCtx.contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
-            <if-empty field="parameters.shipToContactMechId">
-                <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
-                    <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
-                </call-service>
-                <log level="info" message="Shipping address created with contactMechId ${parameters.shipToContactMechId}"/>
-            <else>
-                <if-compare field="keepAddressBook" operator="equals" value="Y">
+        <check-errors/>
+        <set field="shipToAddressCtx.partyId" from-field="partyId"/>
+        <set field="shipToAddressCtx.contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+        <if-empty field="parameters.shipToContactMechId">
+            <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
+                <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+            </call-service>
+            <log level="info" message="Shipping address created with contactMechId ${parameters.shipToContactMechId}"/>
+        <else>
+            <if-compare field="keepAddressBook" operator="equals" value="Y">
+                <make-value entity-name="PostalAddress" value-name="newValue"/>
+                <set-pk-fields value-name="newValue" map-name="shipToAddressCtx"/>
+                <find-by-primary-key entity-name="PostalAddress" map-name="newValue" value-name="oldValue"/>
+                <set-nonpk-fields map-name="shipToAddressCtx" value-name="newValue"/>
+                <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
+                    <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
+                        <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+                    </call-service>                        
+                </if-compare-field>              
+            </if-compare>
+            <if-compare field="keepAddressBook" operator="equals" value="N">
+                <if-compare-field field="parameters.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
                     <make-value entity-name="PostalAddress" value-name="newValue"/>
                     <set-pk-fields value-name="newValue" map-name="shipToAddressCtx"/>
                     <find-by-primary-key entity-name="PostalAddress" map-name="newValue" value-name="oldValue"/>
                     <set-nonpk-fields map-name="shipToAddressCtx" value-name="newValue"/>
-                    <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
+                    <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
+                        <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
+                            <field-map field-name="contactMechId" env-name="parameters.shipToContactMechId"/>
+                            <field-map field-name="partyId" env-name="partyId"/>
+                            <field-map field-name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
+                        </entity-and>
+                        <first-from-list list-name="pcmpList" entry-name="pcmp"/>
+                        <if-not-empty field="pcmp">
+                            <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
+                            <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                        </if-not-empty>
                         <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
                             <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
-                        </call-service>                        
-                    </if-compare-field>              
-                </if-compare>
-                <if-compare field="keepAddressBook" operator="equals" value="N">
-                    <if-compare-field field="parameters.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
-                        <make-value entity-name="PostalAddress" value-name="newValue"/>
-                        <set-pk-fields value-name="newValue" map-name="shipToAddressCtx"/>
-                        <find-by-primary-key entity-name="PostalAddress" map-name="newValue" value-name="oldValue"/>
-                        <set-nonpk-fields map-name="shipToAddressCtx" value-name="newValue"/>
-                        <if-compare-field field="oldValue" to-field="newValue" operator="not-equals" type="Object">
-                            <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
-                                <field-map field-name="contactMechId" env-name="parameters.shipToContactMechId"/>
-                                <field-map field-name="partyId" env-name="partyId"/>
-                                <field-map field-name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/>
-                            </entity-and>
-                            <first-from-list list-name="pcmpList" entry-name="pcmp"/>
-                            <if-not-empty field="pcmp">
-                                <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
-                                <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
-                            </if-not-empty>
-                            <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressCtx">
-                                <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
-                            </call-service>
-                            <log level="info" message="Shipping address updated with contactMechId ${parameters.shipToContactMechId}"/>
-                        </if-compare-field>
-                    <else>
-                        <call-service service-name="updatePartyPostalAddress" in-map-name="shipToAddressCtx">
-                            <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
                         </call-service>
                         <log level="info" message="Shipping address updated with contactMechId ${parameters.shipToContactMechId}"/>
-                    </else>
                     </if-compare-field>
-                </if-compare>
-            </else>
-            </if-empty>
-            <field-to-request field-name="parameters.shipToContactMechId" request-name="shipToContactMechId"/>
+                <else>
+                    <call-service service-name="updatePartyPostalAddress" in-map-name="shipToAddressCtx">
+                        <result-to-field result-name="contactMechId" field-name="parameters.shipToContactMechId"/>
+                    </call-service>
+                    <log level="info" message="Shipping address updated with contactMechId ${parameters.shipToContactMechId}"/>
+                </else>
+                </if-compare-field>
+            </if-compare>
+        </else>
         </if-empty>
+        <field-to-request field-name="parameters.shipToContactMechId" request-name="shipToContactMechId"/>
     </simple-method>
 
     <simple-method method-name="getShipOptions" short-description="Get shipping options" login-required="false">
@@ -1250,7 +1242,6 @@
 
         <call-simple-method method-name="createUpdateBillingAddress"/>
         <call-simple-method method-name="createUpdateCreditCard"/>
-        <check-errors/>
         <!--============== Set Payment Method ================-->
         <set field="paymentMethodId" from-field="parameters.paymentMethodId"/>
         <set field="cardSecurityCode" from-field="parameters.cardSecurityCode"/>
@@ -1271,81 +1262,80 @@
             <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
                 processor-name="billToAddress" in-map-name="parameters" out-map-name="billToAddressCtx"/>
         </if-compare>
-        <if-empty field="error_list">
-            <set field="billToAddressCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
-            <set field="billToAddressCtx.partyId" from-field="partyId"/>
-    
-            <if-compare field="parameters.useShippingAddressForBilling" operator="equals" value="Y">
-                <if-empty field="parameters.billToContactMechId">
-                    <set-service-fields service-name="createPartyContactMechPurpose" map-name="billToAddressCtx" to-map-name="serviceInMap"/>
+        <check-errors/>
+        <set field="billToAddressCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+        <set field="billToAddressCtx.partyId" from-field="partyId"/>
+
+        <if-compare field="parameters.useShippingAddressForBilling" operator="equals" value="Y">
+            <if-empty field="parameters.billToContactMechId">
+                <set-service-fields service-name="createPartyContactMechPurpose" map-name="billToAddressCtx" to-map-name="serviceInMap"/>
+                <set field="serviceInMap.contactMechId" from-field="parameters.shipToContactMechId"/>
+                <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap"/>
+            <else>
+                <if-compare-field field="parameters.shipToContactMechId" operator="not-equals" to-field="parameters.billToContactMechId">
+                    <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
+                        <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
+                        <field-map field-name="partyId" env-name="partyId"/>
+                        <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                    </entity-and>
+                    <first-from-list entry-name="pcmp" list-name="pcmpList"/>
+                    <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
+                    <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                    <clear-field field-name="serviceInMap"/>
+                    
+                    <set-service-fields service-name="deletePartyContactMech" map-name="pcmp" to-map-name="serviceInMap"/>
+                    <call-service service-name="deletePartyContactMech" in-map-name="serviceInMap"/>
+                    <clear-field field-name="serviceInMap"/>
+                    
+                    <set-service-fields service-name="createPartyContactMechPurpose" map-name="pcmp" to-map-name="serviceInMap"/>
                     <set field="serviceInMap.contactMechId" from-field="parameters.shipToContactMechId"/>
-                    <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap"/>
-                <else>
-                    <if-compare-field field="parameters.shipToContactMechId" operator="not-equals" to-field="parameters.billToContactMechId">
-                        <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
-                            <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
-                            <field-map field-name="partyId" env-name="partyId"/>
-                            <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
-                        </entity-and>
-                        <first-from-list entry-name="pcmp" list-name="pcmpList"/>
-                        <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
-                        <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
-                        <clear-field field-name="serviceInMap"/>
-                        
-                        <set-service-fields service-name="deletePartyContactMech" map-name="pcmp" to-map-name="serviceInMap"/>
-                        <call-service service-name="deletePartyContactMech" in-map-name="serviceInMap"/>
-                        <clear-field field-name="serviceInMap"/>
-                        
-                        <set-service-fields service-name="createPartyContactMechPurpose" map-name="pcmp" to-map-name="serviceInMap"/>
-                        <set field="serviceInMap.contactMechId" from-field="parameters.shipToContactMechId"/>
-                        <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap">
-                        </call-service>
-                        <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
-                    </if-compare-field>
-                </else>
-                </if-empty>
-                <set field="parameters.billToContactMechId" from-field="parameters.shipToContactMechId"/>
-            </if-compare>
-            <if-compare field="parameters.useShippingAddressForBilling" operator="not-equals" value="Y">
-                <if-empty field="parameters.billToContactMechId">
+                    <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceInMap">
+                    </call-service>
+                    <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
+                </if-compare-field>
+            </else>
+            </if-empty>
+            <set field="parameters.billToContactMechId" from-field="parameters.shipToContactMechId"/>
+        </if-compare>
+        <if-compare field="parameters.useShippingAddressForBilling" operator="not-equals" value="Y">
+            <if-empty field="parameters.billToContactMechId">
+                <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
+                    <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+                </call-service>
+                <log level="info" message="Billing address created with contactmechId ${parameters.billToContactMechId}"/>
+            <else>
+                <if-compare-field field="parameters.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
+                    <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
+                        <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
+                        <field-map field-name="partyId" env-name="partyId"/>
+                        <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+                    </entity-and>
+                    <first-from-list entry-name="pcmp" list-name="pcmpList"/>
+                
+                    <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
+                    <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                    
                     <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
                         <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
                     </call-service>
-                    <log level="info" message="Billing address created with contactmechId ${parameters.billToContactMechId}"/>
+                    <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
                 <else>
-                    <if-compare-field field="parameters.shipToContactMechId" operator="equals" to-field="parameters.billToContactMechId">
-                        <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList" filter-by-date="true">
-                            <field-map field-name="contactMechId" env-name="parameters.billToContactMechId"/>
-                            <field-map field-name="partyId" env-name="partyId"/>
-                            <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
-                        </entity-and>
-                        <first-from-list entry-name="pcmp" list-name="pcmpList"/>
-                    
-                        <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="serviceInMap"/>
-                        <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
-                        
-                        <call-service service-name="createPartyPostalAddress" in-map-name="billToAddressCtx">
-                            <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
-                        </call-service>
-                        <log level="info" message="Billing address updated with contactMechId ${parameters.billToContactMechId}"/>
-                    <else>
-                        <call-service service-name="updatePartyPostalAddress" in-map-name="billToAddressCtx">
-                            <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
-                        </call-service>
-                        <log level="info" message="Billing Postal Address created billToContactMechId is ${parameters.billToContactMechId}"/>
-                    </else>
-                    </if-compare-field>
+                    <call-service service-name="updatePartyPostalAddress" in-map-name="billToAddressCtx">
+                        <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+                    </call-service>
+                    <log level="info" message="Billing Postal Address created billToContactMechId is ${parameters.billToContactMechId}"/>
                 </else>
-                </if-empty>
-            </if-compare>
-            <field-to-request field-name="parameters.billToContactMechId" request-name="billToContactMechId"/>
-        </if-empty>
+                </if-compare-field>
+            </else>
+            </if-empty>
+        </if-compare>
+        <field-to-request field-name="parameters.billToContactMechId" request-name="billToContactMechId"/>
     </simple-method>
 
     <simple-method method-name="createUpdateCreditCard" short-description="create and update credit card">
         <call-map-processor xml-resource="org/ofbiz/accounting/payment/PaymentMapProcs.xml"
                 processor-name="createCreditCard" in-map-name="parameters" out-map-name="creditCardContext"/>
-        <if-empty field="error_list">
+        <check-errors/>        
             <set field="creditCardContext.partyId" from-field="partyId"/>
             <set field="creditCardContext.contactMechId" from-field="parameters.billToContactMechId"/>
             <if-empty field="parameters.paymentMethodId">
@@ -1368,7 +1358,5 @@
             </if-empty>
             <set field="paymentMethodId" from-field="parameters.paymentMethodId"/>
             <field-to-request field-name="parameters.paymentMethodId" request-name="paymentMethodId"/>
-        </if-empty>
     </simple-method>
-
-</simple-methods>
+</simple-methods>
\ No newline at end of file