[ofbiz-framework] branch trunk updated: Improved: Convert AutoPaymentTests.xml to Groovy (OFBIZ-11535)

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

[ofbiz-framework] branch trunk updated: Improved: Convert AutoPaymentTests.xml to Groovy (OFBIZ-11535)

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

akashjain 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 f3997f1  Improved: Convert AutoPaymentTests.xml to Groovy (OFBIZ-11535)
f3997f1 is described below

commit f3997f1feb085c0f18b9a7aeb671f6f82ebc3637
Author: Akash Jain <[hidden email]>
AuthorDate: Sat Jul 4 17:23:34 2020 +0530

    Improved: Convert AutoPaymentTests.xml to Groovy (OFBIZ-11535)
   
    Thanks, Rohit Hukkeri for report and Pawan Verma for review.
---
 .../accounting/minilang/test/AutoPaymentTests.xml  | 560 ---------------------
 .../ofbiz/accounting/AutoPaymentTests.groovy       | 537 ++++++++++++++++++++
 applications/accounting/testdef/paymenttests.xml   |   2 +-
 3 files changed, 538 insertions(+), 561 deletions(-)

diff --git a/applications/accounting/minilang/test/AutoPaymentTests.xml b/applications/accounting/minilang/test/AutoPaymentTests.xml
deleted file mode 100644
index 13c316a..0000000
--- a/applications/accounting/minilang/test/AutoPaymentTests.xml
+++ /dev/null
@@ -1,560 +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">
-
-    <!-- Test case for Batching Payments process-->
-    <simple-method method-name="testCreatePaymentGroupAndMember" short-description="auto test createPaymentGroupAndMember service" login-required="false">
-        <set field="paymentIds[]" value="demo10001"/>
-        <set field="paymentIds[]" value="demo10000"/>
-        <set field="paymentGroupTypeId" value="BATCH_PAYMENT"/>
-        <set field="paymentGroupName" value="Payment Batch"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceInMap.paymentIds" from-field="paymentIds"/>
-        <set field="serviceInMap.paymentGroupTypeId" from-field="paymentGroupTypeId"/>
-        <set field="serviceInMap.paymentGroupName" from-field="paymentGroupName"/>
-        <set field="serviceInMap.userLogin" from-field="userLogin"/>
-        <call-service service-name="createPaymentGroupAndMember" in-map-name="serviceInMap">
-            <result-to-field result-name="paymentGroupId"/>
-        </call-service>
-        <entity-one entity-name="PaymentGroup" value-field="paymentGroup"/>
-        <entity-and entity-name="PaymentGroupMember" list="paymentGroupMemberList">
-            <field-map field-name="paymentGroupId"/>
-        </entity-and>
-        <assert>
-            <not><if-empty field="paymentGroupMemberList"/></not>
-            <if-compare-field field="paymentGroupName" operator="equals" to-field="paymentGroup.paymentGroupName"/>
-            <if-compare-field field="paymentGroupTypeId" operator="equals" to-field="paymentGroup.paymentGroupTypeId"/>
-        </assert>
-        <check-errors/>
-        <iterate list="paymentGroupMemberList" entry="paymentGroupMember">
-            <assert>
-                <or>
-                    <if-compare-field field="paymentGroupMember.paymentId" operator="equals" to-field="paymentIds[0]"/>
-                    <if-compare-field field="paymentGroupMember.paymentId" operator="equals" to-field="paymentIds[1]"/>
-                </or>
-            </assert>
-            <check-errors/>
-        </iterate>
-        <log level="info" message="Payment Group ${paymentGroupId} is created successfully for payments"/>
-    </simple-method>
-
-    <!--Test case for voiding payments -->
-    <simple-method method-name="testVoidPayment" short-description="Test case for voiding payments" login-required="false">
-        <!-- Precondition : payment is in sent status and invoice is in ready for posting status
-                            Credit in account 213000 - CUSTOMER CREDIT
-                            Debit in account 210000 - ACCOUNTS PAYABLE -->
-
-        <!-- Post condition : payment status changes to void.
-                              removes PaymentApplication if any associated.
-                              Credit in account 210000- ACCOUNTS PAYABLE
-                              Debit in account 213000 - CUSTOMER CREDIT-->
-
-        <set field="paymentId" value="8000"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="voidPaymentMap.userLogin" from-field="userLogin"/>
-        <set field="voidPaymentMap.paymentId" from-field="paymentId"/>
-        <call-service service-name="voidPayment" in-map-name="voidPaymentMap"/>
-
-        <entity-one entity-name="Payment" value-field="payment"/>
-        <assert>
-            <if-compare field="payment.statusId" operator="equals" value="PMNT_VOID"/>
-        </assert>
-        <check-errors/>
-        <set field="orderBy[]" value="-transactionDate"/>
-        <get-related relation-name="AcctgTrans" value-field="payment" list="acctgTransList" order-by-list="orderBy"/>
-        <first-from-list list="acctgTransList" entry="acctgTrans"/>
-        <get-related relation-name="AcctgTransEntry" value-field="acctgTrans" list="acctgTransEntries"/>
-        <iterate list="acctgTransEntries" entry="acctgTransEntry">
-            <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
-                <assert>
-                    <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="213000"/>
-                </assert>
-            </if-compare>
-            <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
-                <assert>
-                    <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="210000"/>
-                    <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="ACCOUNTS_PAYABLE"/>
-                </assert>
-            </if-compare>
-        </iterate>
-        <check-errors/>
-    </simple-method>
-
-    <!--Test case for canceling invoices-->
-    <simple-method method-name="testCancelInvoice" short-description="Test case for canceling invoices" login-required="false">
-        <!-- Precondition : invoice is in ready status
-                            Credit in account 210000 - ACCOUNTS PAYABLE
-                            Debit in account 516100 -->
-
-        <!-- Post condition : invoice status changes to cancelled.
-                              removes PaymentApplication if any associated.
-                              Credit in account 516100
-                              Debit in account 210000 - ACCOUNTS PAYABLE -->
-
-        <set field="invoiceId" value="8001"/>
-        <set field="statusId" value="INVOICE_CANCELLED"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="setInvoiceStatusMap.userLogin" from-field="userLogin"/>
-        <set field="setInvoiceStatusMap.invoiceId" from-field="invoiceId"/>
-        <set field="setInvoiceStatusMap.statusId" from-field="statusId"/>
-        <call-service service-name="setInvoiceStatus" in-map-name="setInvoiceStatusMap"/>
-
-        <entity-one entity-name="Invoice" value-field="invoice"/>
-        <assert>
-            <if-compare field="invoice.statusId" operator="equals" value="INVOICE_CANCELLED"/>
-        </assert>
-        <check-errors/>
-        <set field="orderBy[]" value="-transactionDate"/>
-        <get-related relation-name="AcctgTrans" value-field="invoice" list="acctgTransList" order-by-list="orderBy"/>
-        <first-from-list list="acctgTransList" entry="acctgTrans"/>
-        <get-related relation-name="AcctgTransEntry" value-field="acctgTrans" list="acctgTransEntries"/>
-        <iterate list="acctgTransEntries" entry="acctgTransEntry">
-            <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
-                <assert>
-                    <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="516100"/>
-                </assert>
-            </if-compare>
-            <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
-                <assert>
-                    <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="210000"/>
-                    <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="ACCOUNTS_PAYABLE"/>
-                </assert>
-            </if-compare>
-        </iterate>
-        <check-errors/>
-    </simple-method>
-
-    <!--Test case for process mass check run-->
-    <simple-method method-name="testCreatePaymentAndPaymentGroupForInvoices" short-description="Test case for validate service which is creating payment and payment group" login-required="false">
-        <!-- Precondition : Invoice is in ready status.
-                            Invoice outstanding amount should be greater than zero -->
-
-        <!-- Following process is tested by test case:
-                This will call createPaymentAndPaymentGroupForInvoices service and return a paymentGroupId;
-             1. Checked for paymentGroupId for not empty
-             2. Checked for associated paymentGroupMembers for not empty -->
-
-        <!-- Post condition : Invoice status should be changed to paid.
-                              Payment should be created with PaymentApplications.
-                              PaymentGroup and PaymentGroupMembers should be created. -->
-
-        <entity-one entity-name="UserLogin" value-field="createPaymentAndPaymentGroupForInvoicesMap.userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.organizationPartyId" value="Company"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.checkStartNumber" type="Long" value="100101"/>
-        <string-to-list string="8000" list="invoiceIds"/>
-        <string-to-list string="8008" list="invoiceIds"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.invoiceIds" from-field="invoiceIds"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.paymentMethodTypeId" value="COMPANY_CHECK"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.paymentMethodId" value="SC_CHECKING"/>
-        <call-service service-name="createPaymentAndPaymentGroupForInvoices" in-map-name="createPaymentAndPaymentGroupForInvoicesMap">
-            <result-to-field result-name="paymentGroupId"/>
-        </call-service>
-        <assert>
-            <not>
-                <if-empty field="paymentGroupId"/>
-            </not>
-        </assert>
-        <check-errors/>
-        <entity-condition entity-name="PaymentGroupMember" list="paymentGroupMembers">
-            <condition-expr field-name="paymentGroupId" from-field="paymentGroupId"/>
-        </entity-condition>
-        <assert>
-            <not>
-                <if-empty field="paymentGroupMembers"/>
-            </not>
-        </assert>
-        <check-errors/>
-        <log level="info" message="Test case ran successfully for input - invoiceIds : ${invoiceIds} and output - paymentGroupId : ${paymentGroupId}"/>
-    </simple-method>
-
-    <!--Test case for cancel check run-->
-    <simple-method method-name="testCancelCheckRunPayments" short-description="Test case for cancelCheckRunPayments" login-required="false">
-        <!-- Pre condition : Invoice is in paid status.
-                             Payment should be present.
-                             thruDate for PaymentGroupMember should be Null -->
-
-        <!-- Following process is tested by test case:
-                This will call cancelCheckRunPayments service;
-                1. Checked for thruDate for not empty
-                2. Checked for associated payment status as PMNT_VOID -->
-
-        <!-- Post condition : thruDate for PaymentGroupMember should be Not Null
-                              payment status should be changed to PMNT_VOID. -->
-
-        <set field="paymentGroupId" value="9001"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="cancelCheckRunPaymentsMap.userLogin" from-field="userLogin"/>
-        <set field="cancelCheckRunPaymentsMap.paymentGroupId" from-field="paymentGroupId"/>
-        <call-service service-name="cancelCheckRunPayments" in-map-name="cancelCheckRunPaymentsMap"/>
-        <entity-and entity-name="PmtGrpMembrPaymentAndFinAcctTrans"  list="paymentGroupMemberAndTransList">
-            <field-map field-name="paymentGroupId"/>
-        </entity-and>
-        <first-from-list list="paymentGroupMemberAndTransList" entry="paymentGroupMemberAndTrans"/>
-        <if-compare field="paymentGroupMemberAndTrans.finAccountTransStatusId" operator="not-equals" value="FINACT_TRNS_APPROVED">
-            <iterate list="paymentGroupMemberAndTransList" entry="paymentGroupMemberAndTrans">
-                <assert>
-                    <not>
-                        <if-empty field="paymentGroupMemberAndTrans.thruDate"/>
-                    </not>
-                </assert>
-                <check-errors/>
-                <assert>
-                    <if-compare field="paymentGroupMemberAndTrans.statusId" operator="equals" value="PMNT_VOID"/>
-                </assert>
-                <check-errors/>
-            </iterate>
-        </if-compare>
-        <log level="info" message="Test case for cancelCheckRunPayments ran successfully for paymentGroupId = ${paymentGroupId}"/>
-    </simple-method>
-
-    <!-- Test case for deposit or withdraw payments -->
-    <simple-method method-name="testDepositWithdrawPayments" short-description="test depositWithdrawPayments service" login-required="false">
-        <set field="paymentIds[]" value="demo10010"/>
-        <set field="finAccountId" value="SC_CHECKING"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="depositWithdrawPaymentsMap.paymentIds" from-field="paymentIds"/>
-        <set field="depositWithdrawPaymentsMap.finAccountId" from-field="finAccountId"/>
-        <set field="depositWithdrawPaymentsMap.userLogin" from-field="userLogin"/>
-        <call-service service-name="depositWithdrawPayments" in-map-name="depositWithdrawPaymentsMap"/>
-        <entity-condition entity-name="Payment" list="payments">
-            <condition-expr field-name="paymentId" operator="in" from-field="paymentIds"/>
-        </entity-condition>
-        <iterate list="payments" entry="payment">
-            <get-related-one value-field="payment" relation-name="FinAccountTrans" to-value-field="finAccountTrans"/>
-            <assert><not><if-empty field="finAccountTrans"/></not></assert>
-            <check-errors/>
-            <assert>
-                <or>
-                    <if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="DEPOSIT"/>
-                    <if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="WITHDRAWAL"/>
-                </or>
-                <if-compare-field field="finAccountTrans.amount" operator="equals" to-field="payment.amount"/>
-            </assert>
-            <check-errors/>
-        </iterate>
-        <log level="info" message="fin Account Trans has been created for passed payments"/>
-    </simple-method>
-
-    <simple-method method-name="testDepositWithdrawPaymentsInSingleTrans" short-description="test depositWithdrawPayments service for single transaction" login-required="false">
-        <set field="paymentIds[]" value="8004"/>
-        <set field="finAccountId" value="SC_CHECKING"/>
-        <set field="groupInOneTransaction" value="Y"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="depositWithdrawPaymentsMap.paymentIds" from-field="paymentIds"/>
-        <set field="depositWithdrawPaymentsMap.finAccountId" from-field="finAccountId"/>
-        <set field="depositWithdrawPaymentsMap.groupInOneTransaction" from-field="groupInOneTransaction"/>
-        <set field="depositWithdrawPaymentsMap.paymentGroupTypeId" value="BATCH_PAYMENT"/>
-        <set field="depositWithdrawPaymentsMap.userLogin" from-field="userLogin"/>
-        <call-service service-name="depositWithdrawPayments" in-map-name="depositWithdrawPaymentsMap">
-            <result-to-field result-name="finAccountTransId"/>
-        </call-service>
-        <set field="paymentRunningTotal" type="BigDecimal" value="0"/>
-        <entity-condition entity-name="Payment" list="payments">
-            <condition-expr field-name="paymentId" operator="in" from-field="paymentIds"/>
-        </entity-condition>
-        <iterate list="payments" entry="payment">
-            <set field="paymentRunningTotal" value="${paymentRunningTotal + payment.amount}" type="BigDecimal"/>
-        </iterate>
-        <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans"/>
-        <assert>
-            <if-compare-field field="finAccountTrans.amount" operator="equals" to-field="paymentRunningTotal"/>
-        </assert>
-        <check-errors/>
-        <iterate list="payments" entry="payment">
-            <assert>
-                <if-compare-field field="payment.finAccountTransId" operator="equals" to-field="finAccountTransId"/>
-            </assert>
-            <check-errors/>
-        </iterate>
-        <log level="info" message="fin Account Trans has been created with Id ${finAccountTransId}"/>
-    </simple-method>
-
-    <!--Test case for fin account trans-->
-    <simple-method method-name="testSetFinAccountTransStatus" short-description="test case for setFinAccountTransStatus service" login-required="false">
-        <!-- Precondition : FinAccountTrans should be in CREATED status -->
-
-        <!-- Post condition : FinAccountTrans status changes to CANCELED
-                              Clear finAccountTransId field and update associated Payment record  -->
-        <set field="finAccountTransId" value="9102"/>
-        <set field="statusId" value="FINACT_TRNS_CANCELED"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="setFinAccountTransStatusMap.finAccountTransId" from-field="finAccountTransId"/>
-        <set field="setFinAccountTransStatusMap.statusId" from-field="statusId"/>
-        <set field="setFinAccountTransStatusMap.userLogin" from-field="userLogin"/>
-        <call-service service-name="setFinAccountTransStatus" in-map-name="setFinAccountTransStatusMap"/>
-        <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans"/>
-        <assert>
-            <if-compare-field field="finAccountTrans.statusId" operator="equals" to-field="statusId"/>
-        </assert>
-        <check-errors/>
-        <get-related-one relation-name="Payment" value-field="finAccountTrans" to-value-field="payment"/>
-        <if-not-empty field="payment">
-            <assert>
-                <if-empty field="payment.finAccountTransId"/>
-            </assert>
-            <check-errors/>
-        </if-not-empty>
-    </simple-method>
-
-    <!--Test case to verify GL postings for Void Payment process-->
-    <simple-method method-name="testGlPostingsOnVoidPayment" short-description="Test case to verify GL postings for Void Payment Process" login-required="false">
-        <!-- Precondition :
-            * Payment is in sent status so accounting transaction is already posted to the GL
-            * GL Account associated with Payment :8003 are ACCOUNTS RECEVABLE and UNDEPOSITED RECEIPTS
-            * Credit in account 120000 - ACCOUNTS RECEVABLE ;debitTotal :$754.17 ; creditTotal:$274.18 ; debitCreditDifference : $479.99
-            * Debit in account 112000 UNDEPOSITED RECEIPTS ;debitTotal :$136.85 ; creditTotal:$116.85 ; debitCreditDifference : $20
-        -->
-
-        <!-- Post condition : When status is set to void, an reverse accounting transaction is automatically posted to the GL.
-            * Payment status changes to void.
-            * Credit in account 112000- UNDEPOSITED RECEIPTS  ;debitTotal :$136.85 ; creditTotal: $136.85 ; debitCreditDifference : $0
-            * Debit in account 120000 - ACCOUNTS RECEVABLE debitTotal :$774.17 ; creditTotal: $274.18 ; debitCreditDifference : $ 499.99
-        -->
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-
-        <now-timestamp field="nowTimestamp"/>
-        <set field="findCustomTimePeriodsMap.userLogin" from-field="userLogin"/>
-        <set field="findCustomTimePeriodsMap.findDate" from-field="nowTimestamp" type="Timestamp"/>
-        <set field="findCustomTimePeriodsMap.organizationPartyId" value="Company"/>
-        <call-service service-name="findCustomTimePeriods" in-map-name="findCustomTimePeriodsMap">
-            <result-to-field result-name="customTimePeriodList"/>
-        </call-service>
-        <first-from-list list="customTimePeriodList" entry="customTimePeriod"/>
-
-        <set field="getAcctgTransEntriesAndTransTotalMap.userLogin" from-field="userLogin"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.organizationPartyId" value="Company"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodStartDate" from-field="customTimePeriod.fromDate" type="Timestamp"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodEndDate" from-field="customTimePeriod.thruDate" type="Timestamp"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="120000"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="receivableDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="receivableCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="receivableDebitCreditDifference"/>
-        </call-service>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="112000"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="undepositedDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="undepositedCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="undepositedDebitCreditDifference"/>
-        </call-service>
-        <log level="info" message="BEFORE RUNNING VOID PAYMENT : ACCOUNTS RECEVABLE ;debitTotal :${receivableDebitTotal} ; creditTotal:${receivableCreditTotal} ; debitCreditDifference : ${receivableDebitCreditDifference}"/>
-        <log level="info" message="BEFORE RUNNING VOID PAYMENT : UNDEPOSITED RECEIPTS ;debitTotal :${undepositedDebitTotal} ; creditTotal:${undepositedCreditTotal} ; debitCreditDifference : ${undepositedDebitCreditDifference}"/>
-        <set field="paymentId" value="8003"/>
-        <set field="voidPaymentMap.userLogin" from-field="userLogin"/>
-        <set field="voidPaymentMap.paymentId" from-field="paymentId"/>
-        <call-service service-name="voidPayment" in-map-name="voidPaymentMap"/>
-        <set field="totalReceivableDebitAmount" value="${receivableDebitTotal + 20.00}" type="BigDecimal"/>
-        <set field="totalReceivableDebitCreditDifference" value="${receivableDebitCreditDifference + 20.00}" type="BigDecimal"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="120000"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="receivableDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="receivableCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="receivableDebitCreditDifference"/>
-        </call-service>
-        <assert>
-            <if-compare-field field="totalReceivableDebitAmount" operator="equals" to-field="receivableDebitTotal" type="BigDecimal"/>
-            <if-compare-field field="totalReceivableDebitCreditDifference" operator="equals" to-field="receivableDebitCreditDifference" type="BigDecimal"/>
-        </assert>
-        <check-errors/>
-        <set field="totalUndepositedCreditAmount" value="${undepositedCreditTotal + 20.00}" type="BigDecimal"/>
-        <set field="totalUndepositedDebitCreditDifference" value="${undepositedDebitCreditDifference - 20.00}" type="BigDecimal"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="112000"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="undepositedDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="undepositedCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="undepositedDebitCreditDifference"/>
-        </call-service>
-        <assert>
-            <if-compare-field field="totalUndepositedCreditAmount" operator="equals" to-field="undepositedCreditTotal" type="BigDecimal"/>
-            <if-compare-field field="totalUndepositedDebitCreditDifference" operator="equals" to-field="undepositedDebitCreditDifference" type="BigDecimal"/>
-        </assert>
-        <check-errors/>
-        <log level="info" message="AFTER RUNNING VOID PAYMENT : ACCOUNTS RECEVABLE ;debitTotal :${receivableDebitTotal} ; creditTotal:${receivableCreditTotal}; debitCreditDifference : ${receivableDebitCreditDifference}"/>
-        <log level="info" message="AFTER RUNNING VOID PAYMENT : UNDEPOSITED RECEIPTS ;debitTotal :${undepositedDebitTotal} ; creditTotal:${undepositedCreditTotal} ; debitCreditDifference : ${undepositedDebitCreditDifference}"/>
-    </simple-method>
-
-    <!---Test case to verify GL postings for Check Run process-->
-    <simple-method method-name="testGlPostingOnCheckRun" short-description="Test case to verify GL postings for Check Run functionality" login-required="false">
-        <!-- Precondition :
-            * Invoice is in ready status so accounting transaction is already posted to the GL
-            * GL Accounts associated with Invoice :8007 are ACCOUNTS PAYABLE and UNINVOICED ITEM RECEIPTS
-            * Credit in account 210000 - ACCOUNTS PAYABLE ;debitTotal $430 ; creditTotal:$1955.4 ; debitCreditDifference : $ -1524.85
-            * Debit in account 214000 - UNINVOICED ITEM RECEIPTS;debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360
-            * UNDEPOSITED RECEIPTS 112000 - debitTotal :$136.85 ; creditTotal:$136.85 ; debitCreditDifference : $0
-        -->
-
-        <!-- Post condition : After Check Run process accounting transactions are automatically posted to the GL.
-            * Payment get associated with invoice.
-            * GL Accounts associated with Payment are ACCOUNTS PAYABLE and UNDEPOSITED RECEIPTS.
-            * ACCOUNTS PAYABLE 210000(for Invoice and Payment) - debitTotal $503.41 ; creditTotal:$1991.83 ; debitCreditDifference : $ -1488.42
-            * UNINVOICED ITEM RECEIPTS 214000 - debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360
-            * GENERAL CHECKING ACCOUNT 111100 (for payment)- debitTotal :$136.85 ; creditTotal:$173.28 ; debitCreditDifference : $ -36.43
-        -->
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-
-        <now-timestamp field="nowTimestamp"/>
-        <set field="findCustomTimePeriodsMap.userLogin" from-field="userLogin"/>
-        <set field="findCustomTimePeriodsMap.findDate" from-field="nowTimestamp" type="Timestamp"/>
-        <set field="findCustomTimePeriodsMap.organizationPartyId" value="Company"/>
-        <call-service service-name="findCustomTimePeriods" in-map-name="findCustomTimePeriodsMap">
-            <result-to-field result-name="customTimePeriodList"/>
-        </call-service>
-        <first-from-list list="customTimePeriodList" entry="customTimePeriod"/>
-
-        <set field="getAcctgTransEntriesAndTransTotalMap.userLogin" from-field="userLogin"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.organizationPartyId" value="Company"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodStartDate" from-field="customTimePeriod.fromDate" type="Timestamp"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodEndDate" from-field="customTimePeriod.thruDate" type="Timestamp"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="210000"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="payableDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="payableCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="payableDebitCreditDifference"/>
-        </call-service>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="111100"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="undepositedDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="undepositedCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="undepositedDebitCreditDifference"/>
-        </call-service>
-        <log level="info" message="BEFORE RUNNING CHECK RUN : ACCOUNTS PAYABLE ;debitTotal :${payableDebitTotal} ; creditTotal:${payableCreditTotal} ; debitCreditDifference : ${payableDebitCreditDifference}"/>
-        <log level="info" message="BEFORE RUNNING VOID PAYMENT : GENERAL CHECKING ACCOUNT ;debitTotal :${undepositedDebitTotal} ; creditTotal:${undepositedCreditTotal} ; debitCreditDifference : ${undepositedDebitCreditDifference}"/>
-        <clear-field field="invoiceIds"/>
-        <string-to-list string="8007" list="invoiceIds"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.userLogin" from-field="userLogin"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.organizationPartyId" value="Company"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.checkStartNumber" type="Long" value="100100"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.invoiceIds" from-field="invoiceIds"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.paymentMethodTypeId" value="COMPANY_CHECK"/>
-        <set field="createPaymentAndPaymentGroupForInvoicesMap.paymentMethodId" value="SC_CHECKING"/>
-        <call-service service-name="createPaymentAndPaymentGroupForInvoices" in-map-name="createPaymentAndPaymentGroupForInvoicesMap">
-            <result-to-field result-name="paymentGroupId"/>
-        </call-service>
-        <set field="tempBig" value="36.43" type="BigDecimal"/><!-- Necessary, see OFBIZ-6386 -->
-        <set field="totalPayableDebitAmount" value="${payableDebitTotal + tempBig}" type="BigDecimal"/>
-        <set field="totalPayableCreditAmount" from-field="payableCreditTotal" type="BigDecimal"/>
-        <set field="totalPayableDebitCreditDifference" value="${payableDebitCreditDifference + tempBig}" type="BigDecimal"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="210000"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="payableDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="payableCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="payableDebitCreditDifference"/>
-        </call-service>
-        <assert>
-            <if-compare-field field="totalPayableDebitAmount" operator="equals" to-field="payableDebitTotal" type="BigDecimal"/>
-            <if-compare-field field="totalPayableCreditAmount" operator="equals" to-field="payableCreditTotal" type="BigDecimal"/>
-            <if-compare-field field="totalPayableDebitCreditDifference" operator="equals" to-field="payableDebitCreditDifference" type="BigDecimal"/>
-        </assert>
-        <check-errors/>
-        <set field="totalUndepositedCreditAmount" value="${undepositedCreditTotal + tempBig}" type="BigDecimal"/>
-        <set field="totalUndepositedDebitCreditDifference" value="${undepositedDebitCreditDifference - tempBig}" type="BigDecimal"/>
-        <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="111100"/>
-        <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
-            <result-to-field result-name="debitTotal" field="undepositedDebitTotal"/>
-            <result-to-field result-name="creditTotal" field="undepositedCreditTotal"/>
-            <result-to-field result-name="debitCreditDifference" field="undepositedDebitCreditDifference"/>
-        </call-service>
-        <assert>
-            <if-compare-field field="totalUndepositedCreditAmount" operator="equals" to-field="undepositedCreditTotal" type="BigDecimal"/>
-            <if-compare-field field="totalUndepositedDebitCreditDifference" operator="equals" to-field="undepositedDebitCreditDifference" type="BigDecimal"/>
-        </assert>
-        <check-errors/>
-        <log level="info" message="AFTER RUNNING CHECK RUN : ACCOUNTS PAYABLE ;debitTotal :${payableDebitTotal} ; creditTotal:${payableCreditTotal} ; debitCreditDifference : ${payableDebitCreditDifference}"/>
-        <log level="info" message="AFTER RUNNING VOID PAYMENT : GENERAL CHECKING ACCOUNT ;debitTotal :${undepositedDebitTotal} ; creditTotal:${undepositedCreditTotal} ; debitCreditDifference : ${undepositedDebitCreditDifference}"/>
-    </simple-method>
-
-    <simple-method method-name="disabledTestUpdatePaymentMethodAddress" short-description="Creates a new postal address for Company and then calls updatePaymentMethodAddress with the new contactMechId" login-required="false">
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="flexadmin"/>
-        </entity-one>
-        <!-- Create a new Postal Address, set the bare minimum necessary, this test isn't about the postal address -->
-        <set field="createPartyPostalAddress.userLogin" from-field="userLogin"/>
-        <set field="createPartyPostalAddress.address1" value="2003 Open Blvd"/>
-        <set field="createPartyPostalAddress.city" value="2003 Open Blvd"/>
-        <set field="createPartyPostalAddress.postalCode" value="999999"/>
-        <call-service service-name="createPartyPostalAddress" in-map-name="createPartyPostalAddress">
-            <result-to-field result-name="contactMechId"/>
-        </call-service>
-
-        <!-- Count the number of EftAccounts and CreditCards associated to the oldContactMechId, use to verify at the end -->
-        <entity-count count-field="noEftAccounts9000Before" entity-name="EftAccount">
-            <condition-expr field-name="contactMechId" value="9000"/>
-        </entity-count>
-        <entity-count count-field="noCreditCards9000Before" entity-name="CreditCard">
-            <condition-expr field-name="contactMechId" value="9000"/>
-        </entity-count>
-
-        <!-- Run the actual service to be tested -->
-        <set field="updatePaymentMethodAddress.userLogin" from-field="userLogin"/>
-        <set field="updatePaymentMethodAddress.oldContactMechId" value="9000"/>
-        <set field="updatePaymentMethodAddress.contactMechId" from-field="contactMechId"/>
-        <call-service service-name="updatePaymentMethodAddress" in-map-name="updatePaymentMethodAddress"/>
-
-        <!-- Count the number EftAccounts and CreditCards now associated with the oldContactMechId (should be zero for both)-->
-        <entity-count count-field="noEftAccounts9000After" entity-name="EftAccount">
-            <condition-expr field-name="contactMechId" value="9000"/>
-        </entity-count>
-        <entity-count count-field="noCreditCards9000After" entity-name="CreditCard">
-            <condition-expr field-name="contactMechId" value="9000"/>
-        </entity-count>
-
-        <!-- Count the number of EftAccounts and CreditCards associated to the oldContactMechId, use to verify at the end -->
-        <entity-count count-field="noEftAccountsNewContactMech" entity-name="EftAccount">
-            <condition-expr field-name="contactMechId" from-field="contactMechId"/>
-        </entity-count>
-        <entity-count count-field="noCreditCardsNewContactMech" entity-name="CreditCard">
-            <condition-expr field-name="contactMechId" from-field="contactMechId"/>
-        </entity-count>
-
-        <!-- Verify the results -->
-        <assert>
-            <!-- New contactMech should have the same number of payment methods as the old did -->
-            <if-compare-field field="noEftAccountsNewContactMech" operator="equals" to-field="noEftAccounts9000Before" type="Long"/>
-            <if-compare-field field="noCreditCardsNewContactMech" operator="equals" to-field="noCreditCards9000Before" type="Long"/>
-            <!-- Old contactMech should no longer have any payment methods associated to it -->
-            <if-compare field="noEftAccounts9000After" operator="equals" value="0" type="Long"/>
-            <if-compare field="noCreditCards9000After" operator="equals" value="0" type="Long"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-</simple-methods>
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoPaymentTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoPaymentTests.groovy
new file mode 100644
index 0000000..7901138
--- /dev/null
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoPaymentTests.groovy
@@ -0,0 +1,537 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+
+package org.apache.ofbiz.accounting
+
+import org.apache.ofbiz.base.util.UtilDateTime;
+
+import static org.apache.ofbiz.entity.condition.EntityComparisonOperator.IN
+import static org.apache.ofbiz.entity.condition.EntityCondition.makeCondition
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+
+class AutoPaymentTests extends OFBizTestCase {
+    public AutoPaymentTests(String name) {
+        super(name)
+    }
+
+    // Test case for Batching Payments process
+    void testCreatePaymentGroupAndMember() {
+        String paymentGroupTypeId = 'BATCH_PAYMENT'
+        String paymentGroupName = 'Payment Batch'
+        List paymentIds = ['demo10000', 'demo10001']
+
+        Map serviceCtx = [
+                paymentGroupTypeId: paymentGroupTypeId,
+                paymentGroupName: paymentGroupName,
+                paymentIds: paymentIds,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createPaymentGroupAndMember', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        String paymentGroupId = serviceResult.paymentGroupId
+
+        GenericValue paymentGroup = from('PaymentGroup')
+                .where('paymentGroupId', paymentGroupId)
+                .queryOne()
+        assert paymentGroup
+        assert paymentGroup.paymentGroupTypeId == paymentGroupTypeId
+        assert paymentGroup.paymentGroupName == paymentGroupName
+
+        List<GenericValue> paymentGroupMemberList = from('PaymentGroupMember')
+                .where('paymentGroupId', paymentGroupId)
+                .queryList()
+        assert paymentGroupMemberList
+
+        for (GenericValue paymentGroupMember : paymentGroupMemberList) {
+            assert paymentIds.contains(paymentGroupMember.paymentId)
+        }
+    }
+
+    // Test case for voiding payments
+    void testVoidPayment() {
+        /*
+            Precondition : payment is in sent status and invoice is in ready for posting status
+                           Credit in account 213000 - CUSTOMER CREDIT
+                           Debit in account 210000 - ACCOUNTS PAYABLE
+
+            Post condition : payment status changes to void.
+                             removes PaymentApplication if any associated.
+                             Credit in account 210000- ACCOUNTS PAYABLE
+                             Debit in account 213000 - CUSTOMER CREDIT
+        */
+        String paymentId = '8000'
+
+        Map serviceCtx = [
+                paymentId: paymentId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('voidPayment', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue payment = from('Payment')
+                .where('paymentId', paymentId)
+                .queryOne()
+        assert payment
+        assert payment.statusId == 'PMNT_VOID'
+
+        GenericValue acctgTrans = from('AcctgTrans')
+                .where('paymentId', paymentId)
+                .orderBy('-transactionDate').queryFirst()
+        assert acctgTrans
+
+        List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
+                .where('acctgTransId', acctgTrans.acctgTransId)
+                .queryList()
+        assert acctgTransEntryList
+
+        for (GenericValue acctgTransEntry : acctgTransEntryList) {
+            if (acctgTransEntry.debitCreditFlag == 'C') {
+                assert acctgTransEntry.glAccountTypeId == 'ACCOUNTS_PAYABLE'
+                assert acctgTransEntry.glAccountId == '210000'
+            } else if (acctgTransEntry.debitCreditFlag == 'D') {
+                assert acctgTransEntry.glAccountId == '213000'
+            }
+        }
+    }
+
+    // Test case for canceling invoices
+    void testCancelInvoice() {
+        /*
+            Precondition : invoice is in ready status
+                           Credit in account 210000 - ACCOUNTS PAYABLE
+                           Debit in account 516100 -->
+
+            Post condition : invoice status changes to cancelled.
+                             removes PaymentApplication if any associated.
+                             Credit in account 516100
+                             Debit in account 210000 - ACCOUNTS PAYABLE
+        */
+        String invoiceId = '8001'
+
+        Map serviceCtx = [
+                invoiceId: invoiceId,
+                statusId: 'INVOICE_CANCELLED',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('setInvoiceStatus', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue invoice = from('Invoice')
+                .where('invoiceId', invoiceId)
+                .queryOne()
+        assert invoice
+        assert invoice.statusId == 'INVOICE_CANCELLED'
+
+        GenericValue acctgTrans = from('AcctgTrans')
+                .where('invoiceId', invoiceId)
+                .orderBy('-transactionDate').queryFirst()
+        assert acctgTrans
+
+        List<GenericValue> acctgTransEntryList = from('AcctgTransEntry')
+                .where('acctgTransId', acctgTrans.acctgTransId)
+                .queryList()
+        assert acctgTransEntryList
+
+        for (GenericValue acctgTransEntry : acctgTransEntryList) {
+            if (acctgTransEntry.debitCreditFlag == 'C') {
+                assert acctgTransEntry.glAccountId == '516100'
+            } else if (acctgTransEntry.debitCreditFlag == 'D') {
+                assert acctgTransEntry.glAccountId == '210000'
+                assert acctgTransEntry.glAccountTypeId == 'ACCOUNTS_PAYABLE'
+            }
+        }
+    }
+
+    // Test case for process mass check run
+    void testCreatePaymentAndPaymentGroupForInvoices() {
+        /*
+            Precondition : Invoice is in ready status.
+                           Invoice outstanding amount should be greater than zero -->
+
+            Following process is tested by test case:
+                This will call createPaymentAndPaymentGroupForInvoices service and return a paymentGroupId;
+                1. Checked for paymentGroupId for not empty
+                2. Checked for associated paymentGroupMembers for not empty -->
+
+            Post condition : Invoice status should be changed to paid.
+                             Payment should be created with PaymentApplications.
+                             PaymentGroup and PaymentGroupMembers should be created.
+        */
+        Map serviceCtx = [
+                organizationPartyId: 'Company',
+                checkStartNumber: new Long('100101'),
+                invoiceIds: ['8000', '8008'],
+                paymentMethodTypeId: 'COMPANY_CHECK',
+                paymentMethodId: 'SC_CHECKING',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createPaymentAndPaymentGroupForInvoices', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        String paymentGroupId = serviceResult.paymentGroupId
+        assert paymentGroupId
+
+        List<GenericValue> paymentGroupMemberList = from('PaymentGroupMember')
+                .where('paymentGroupId', paymentGroupId)
+                .queryList()
+        assert paymentGroupMemberList
+    }
+
+    // Test case for cancel check run
+    void testCancelCheckRunPayments() {
+        /*
+            Pre condition : Invoice is in paid status.
+                            Payment should be present.
+                            thruDate for PaymentGroupMember should be Null -->
+
+            Following process is tested by test case:
+                This will call cancelCheckRunPayments service;
+                1. Checked for thruDate for not empty
+                2. Checked for associated payment status as PMNT_VOID -->
+
+            Post condition : thruDate for PaymentGroupMember should be Not Null
+                             payment status should be changed to PMNT_VOID.
+        */
+        String paymentGroupId = '9001'
+
+        Map serviceCtx = [
+                paymentGroupId: paymentGroupId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('cancelCheckRunPayments', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        List<GenericValue> paymentGroupMemberAndTransList = from('PmtGrpMembrPaymentAndFinAcctTrans')
+                .where('paymentGroupId', paymentGroupId)
+                .queryList()
+        GenericValue firstPaymentGroupMemberAndTrans = EntityUtil.getFirst(paymentGroupMemberAndTransList)
+        if (firstPaymentGroupMemberAndTrans && !'FINACT_TRNS_APPROVED'.equals(firstPaymentGroupMemberAndTrans.finAccountTransStatusId)) {
+            for (GenericValue aymentGroupMemberAndTrans : paymentGroupMemberAndTransList) {
+                assert aymentGroupMemberAndTrans.thruDate
+                assert aymentGroupMemberAndTrans.statusId == 'PMNT_VOID'
+            }
+        }
+    }
+
+    // Test case for deposit or withdraw payments
+    void testDepositWithdrawPayments() {
+        //List paymentIds = ['demo10001', 'demo10010']
+        List paymentIds = ['demo10010']
+
+        Map serviceCtx = [
+                paymentIds: paymentIds,
+                finAccountId: 'SC_CHECKING',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('depositWithdrawPayments', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        String
+
+        List<GenericValue> payments = from('Payment')
+                .where(makeCondition('paymentId', IN, paymentIds))
+                .queryList()
+
+        for (GenericValue payment : payments) {
+            GenericValue finAccountTrans = from('FinAccountTrans')
+                    .where('finAccountTransId', payment.finAccountTransId)
+                    .queryOne()
+            assert finAccountTrans
+            assert ['DEPOSIT', 'WITHDRAWAL'].contains(finAccountTrans.finAccountTransTypeId)
+            assert finAccountTrans.amount.compareTo(payment.amount) == 0
+        }
+    }
+
+    void testDepositWithdrawPaymentsInSingleTrans() {
+        List paymentIds = ['8004']
+        BigDecimal paymentRunningTotal = new BigDecimal('0')
+
+        Map serviceCtx = [
+                paymentIds: paymentIds,
+                finAccountId: 'SC_CHECKING',
+                groupInOneTransaction: 'Y',
+                paymentGroupTypeId: 'BATCH_PAYMENT',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('depositWithdrawPayments', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        String finAccountTransId = serviceResult.finAccountTransId
+
+        List<GenericValue> payments = from('Payment')
+                .where(makeCondition('paymentId', IN, paymentIds))
+                .queryList()
+        for (GenericValue payment : payments) {
+            assert finAccountTransId == payment.finAccountTransId
+            paymentRunningTotal = paymentRunningTotal.add(payment.amount)
+        }
+
+        GenericValue finAccountTrans = from('FinAccountTrans')
+                .where('finAccountTransId', finAccountTransId)
+                .queryOne()
+        assert paymentRunningTotal.compareTo(finAccountTrans.amount) == 0
+    }
+
+    // Test case for fin account trans
+    void testSetFinAccountTransStatus() {
+        /*
+            Precondition : FinAccountTrans should be in CREATED status
+
+            Post condition : FinAccountTrans status changes to CANCELED
+                             Clear finAccountTransId field and update associated Payment record
+        */
+        String finAccountTransId = '9102'
+
+        Map serviceCtx = [
+                finAccountTransId: finAccountTransId,
+                statusId: 'FINACT_TRNS_CANCELED',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('setFinAccountTransStatus', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue finAccountTrans = from('FinAccountTrans')
+                .where('finAccountTransId', finAccountTransId)
+                .queryOne()
+        assert finAccountTrans
+        assert finAccountTrans.statusId == 'FINACT_TRNS_CANCELED'
+
+        GenericValue payment = from('Payment')
+                .where('paymentId', finAccountTrans.paymentId)
+                .queryOne()
+        assert payment
+    }
+
+    // Test case to verify GL postings for Void Payment process
+    void testGlPostingsOnVoidPayment() {
+        /*
+            Precondition :
+              * Payment is in sent status so accounting transaction is already posted to the GL
+              * GL Account associated with Payment :8003 are ACCOUNTS RECEVABLE and UNDEPOSITED RECEIPTS
+              * Credit in account 120000 - ACCOUNTS RECEVABLE ;debitTotal :$754.17 ; creditTotal:$274.18 ; debitCreditDifference : $479.99
+              * Debit in account 112000 UNDEPOSITED RECEIPTS ;debitTotal :$136.85 ; creditTotal:$116.85 ; debitCreditDifference : $20
+
+            Post condition : When status is set to void, an reverse accounting transaction is automatically posted to the GL.
+              * Payment status changes to void.
+              * Credit in account 112000- UNDEPOSITED RECEIPTS  ;debitTotal :$136.85 ; creditTotal: $136.85 ; debitCreditDifference : $0
+              * Debit in account 120000 - ACCOUNTS RECEVABLE debitTotal :$774.17 ; creditTotal: $274.18 ; debitCreditDifference : $ 499.99
+        */
+        Map serviceCtx = [
+                organizationPartyId: 'Company',
+                findDate: UtilDateTime.nowTimestamp(),
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('findCustomTimePeriods', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert serviceResult.customTimePeriodList
+        GenericValue customTimePeriod = (serviceResult.customTimePeriodList).get(0)
+
+        serviceCtx.clear()
+        serviceResult.clear()
+        serviceCtx = [
+                organizationPartyId: 'Company',
+                customTimePeriodStartDate: customTimePeriod.fromDate,
+                customTimePeriodEndDate: customTimePeriod.thruDate,
+                glAccountId: '120000',
+                userLogin: userLogin
+        ]
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        BigDecimal receivableDebitTotal = serviceResult.debitTotal
+        BigDecimal receivableCreditTotal = serviceResult.creditTotal
+        BigDecimal receivableDebitCreditDifference = serviceResult.debitCreditDifference
+
+        serviceResult.clear()
+        serviceCtx.glAccountId = '112000'
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        BigDecimal undepositedDebitTotal = serviceResult.debitTotal
+        BigDecimal undepositedCreditTotal = serviceResult.creditTotal
+        BigDecimal undepositedDebitCreditDifference = serviceResult.debitCreditDifference
+
+        serviceResult.clear()
+        Map voidPaymentCtx = [
+                paymentId: '8003',
+                userLogin: userLogin
+        ]
+        serviceResult = dispatcher.runSync('voidPayment', voidPaymentCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        BigDecimal totalReceivableDebitAmount = receivableDebitTotal.add(new BigDecimal('20'))
+        BigDecimal totalReceivableDebitCreditDifference = receivableDebitCreditDifference.add(new BigDecimal('20'))
+        serviceResult.clear()
+        serviceCtx.glAccountId = '120000'
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert serviceResult
+        assert totalReceivableDebitAmount.compareTo(serviceResult.debitTotal) == 0
+        assert totalReceivableDebitCreditDifference.compareTo(serviceResult.debitCreditDifference) == 0
+
+        BigDecimal totalUndepositedCreditAmount = undepositedCreditTotal.add(new BigDecimal('20'))
+        BigDecimal totalUndepositedDebitCreditDifference = undepositedDebitCreditDifference.subtract(new BigDecimal('20'))
+        serviceResult.clear()
+        serviceCtx.glAccountId = '112000'
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert serviceResult
+        assert totalUndepositedCreditAmount.compareTo(serviceResult.creditTotal) == 0
+        assert totalUndepositedDebitCreditDifference.compareTo(serviceResult.debitCreditDifference) == 0
+    }
+
+    // Test case to verify GL postings for Check Run process
+    void testGlPostingOnCheckRun() {
+        /*
+            Precondition :
+              * Invoice is in ready status so accounting transaction is already posted to the GL
+              * GL Accounts associated with Invoice :8007 are ACCOUNTS PAYABLE and UNINVOICED ITEM RECEIPTS
+              * Credit in account 210000 - ACCOUNTS PAYABLE ;debitTotal $430 ; creditTotal:$1955.4 ; debitCreditDifference : $ -1524.85
+              * Debit in account 214000 - UNINVOICED ITEM RECEIPTS;debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360
+              * UNDEPOSITED RECEIPTS 112000 - debitTotal :$136.85 ; creditTotal:$136.85 ; debitCreditDifference : $0
+
+            Post condition : After Check Run process accounting transactions are automatically posted to the GL.
+              * Payment get associated with invoice.
+              * GL Accounts associated with Payment are ACCOUNTS PAYABLE and UNDEPOSITED RECEIPTS.
+              * ACCOUNTS PAYABLE 210000(for Invoice and Payment) - debitTotal $503.41 ; creditTotal:$1991.83 ; debitCreditDifference : $ -1488.42
+              * UNINVOICED ITEM RECEIPTS 214000 - debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360
+              * GENERAL CHECKING ACCOUNT 111100 (for payment)- debitTotal :$136.85 ; creditTotal:$173.28 ; debitCreditDifference : $ -36.43
+        */
+        Map serviceCtx = [
+                organizationPartyId: 'Company',
+                findDate: UtilDateTime.nowTimestamp(),
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('findCustomTimePeriods', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert serviceResult.customTimePeriodList
+        GenericValue customTimePeriod = (serviceResult.customTimePeriodList).get(0)
+
+        serviceCtx.clear()
+        serviceResult.clear()
+        serviceCtx = [
+                organizationPartyId: 'Company',
+                customTimePeriodStartDate: customTimePeriod.fromDate,
+                customTimePeriodEndDate: customTimePeriod.thruDate,
+                glAccountId: '210000',
+                userLogin: userLogin
+        ]
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        BigDecimal payableDebitTotal = serviceResult.debitTotal
+        BigDecimal payableCreditTotal = serviceResult.creditTotal
+        BigDecimal payableDebitCreditDifference = serviceResult.debitCreditDifference
+
+        serviceResult.clear()
+        serviceCtx.glAccountId = '111100'
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        BigDecimal undepositedDebitTotal = serviceResult.debitTotal
+        BigDecimal undepositedCreditTotal = serviceResult.creditTotal
+        BigDecimal undepositedDebitCreditDifference = serviceResult.debitCreditDifference
+
+        serviceResult.clear()
+        Map invoiceServiceCtx = [
+                organizationPartyId: 'Company',
+                checkStartNumber: new Long('100100'),
+                invoiceIds: ['8007'],
+                paymentMethodTypeId: 'COMPANY_CHECK',
+                paymentMethodId: 'SC_CHECKING',
+                userLogin: userLogin
+        ]
+        serviceResult = dispatcher.runSync('createPaymentAndPaymentGroupForInvoices', invoiceServiceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        String paymentGroupId = serviceResult.paymentGroupId
+        assert paymentGroupId
+
+        BigDecimal tempBig = new BigDecimal('36.43')
+
+        BigDecimal totalPayableDebitAmount = tempBig.add(payableDebitTotal)
+        BigDecimal totalPayableDebitCreditDifference = tempBig.add(payableDebitCreditDifference)
+        serviceResult.clear()
+        serviceCtx.glAccountId = '210000'
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert totalPayableDebitAmount.compareTo(serviceResult.debitTotal) == 0
+        assert payableCreditTotal.compareTo(serviceResult.creditTotal) == 0
+        assert totalPayableDebitCreditDifference.compareTo(serviceResult.debitCreditDifference) == 0
+
+        BigDecimal totalUndepositedCreditAmount = tempBig.add(undepositedCreditTotal)
+        BigDecimal totalUndepositedDebitCreditDifference = undepositedDebitCreditDifference.subtract(tempBig)
+        serviceResult.clear()
+        serviceCtx.glAccountId = '111100'
+        serviceResult = dispatcher.runSync('getAcctgTransEntriesAndTransTotal', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert undepositedDebitTotal.compareTo(serviceResult.debitTotal) == 0
+        assert totalUndepositedCreditAmount.compareTo(serviceResult.creditTotal) == 0
+        assert totalUndepositedDebitCreditDifference.compareTo(serviceResult.debitCreditDifference) == 0
+    }
+
+    void disabledTestUpdatePaymentMethodAddress() {
+        // Create a new Postal Address, set the bare minimum necessary, this test isn't about the postal address
+        Map serviceCtx = [
+                address1: '2003 Open Blvd',
+                city: 'Open City',
+                postalCode: '999999',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createPartyPostalAddress', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        String contactMechId = serviceResult.contactMechId
+
+        // Count the number of EftAccounts and CreditCards associated to the oldContactMechId, use to verify at the end
+        long noEftAccounts9000Before = from('EftAccount')
+                .where(makeCondition('contactMechId', '9000'))
+                .queryCount()
+        long noCreditCards9000Before = from('CreditCard')
+                .where(makeCondition('contactMechId', '9000'))
+                .queryCount()
+
+        // Run the actual service to be tested
+        serviceCtx.clear()
+        serviceResult.clear()
+        serviceCtx = [
+                oldContactMechId: '9000',
+                contactMechId: contactMechId,
+                userLogin: userLogin
+        ]
+        serviceResult = dispatcher.runSync('updatePaymentMethodAddress', serviceCtx)
+        assert serviceResult
+
+        // Count the number EftAccounts and CreditCards now associated with the oldContactMechId (should be zero for both)
+        long noEftAccounts9000After = from('EftAccount')
+                .where(makeCondition('contactMechId', '9000'))
+                .queryCount()
+        long noCreditCards9000After = from('CreditCard')
+                .where(makeCondition('contactMechId', '9000'))
+                .queryCount()
+
+        // Old contactMech should no longer have any payment methods associated to it
+        assert noEftAccounts9000After == 0
+        assert noCreditCards9000After == 0
+
+        // Count the number of EftAccounts and CreditCards associated to the oldContactMechId, use to verify at the end
+        long noEftAccountsNewContactMech = from('EftAccount')
+                .where(makeCondition('contactMechId', contactMechId))
+                .queryCount()
+        long noCreditCardsNewContactMech = from('CreditCard')
+                .where(makeCondition('contactMechId', contactMechId))
+                .queryCount()
+
+        // New contactMech should have the same number of payment methods as the old did
+        assert noEftAccountsNewContactMech == noEftAccounts9000Before
+        assert noCreditCardsNewContactMech == noCreditCards9000Before
+    }
+}
\ No newline at end of file
diff --git a/applications/accounting/testdef/paymenttests.xml b/applications/accounting/testdef/paymenttests.xml
index 24e69fa..ab2aa9a 100644
--- a/applications/accounting/testdef/paymenttests.xml
+++ b/applications/accounting/testdef/paymenttests.xml
@@ -23,7 +23,7 @@
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
 
     <test-case case-name="auto-payment-tests">
-        <simple-method-test location="component://accounting/minilang/test/AutoPaymentTests.xml"/>
+        <junit-test-suite class-name="org.apache.ofbiz.accounting.AutoPaymentTests"/>
     </test-case>
     
     <!-- enable when sandbox is available and configured -->