You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/07/08 17:25:46 UTC
svn commit: r792185 - in /ofbiz/trunk/applications/accounting:
data/DemoAcctgTransactionData.xml data/PaymentsInvoices.xml
script/org/ofbiz/accounting/test/AutoPaymentTests.xml
testdef/paymenttests.xml
Author: ashish
Date: Wed Jul 8 15:25:34 2009
New Revision: 792185
URL: http://svn.apache.org/viewvc?rev=792185&view=rev
Log:
Applied patch from jira issue OFBIZ-2711 - Junit test case for Accounting - Void Payment and Cancel Invoice services.
Thanks Surya, Awdesh & Sumit for your contribution on this.
Modified:
ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml
ofbiz/trunk/applications/accounting/data/PaymentsInvoices.xml
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml
ofbiz/trunk/applications/accounting/testdef/paymenttests.xml
Modified: ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml?rev=792185&r1=792184&r2=792185&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml Wed Jul 8 15:25:34 2009
@@ -26,4 +26,16 @@
<AcctgTransEntry acctgTransId="9001" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" description="Unposted accounting transaction entries" voucherRef="Z0001" glAccountId="120000" organizationPartyId="Company" amount="500.00" currencyUomId="USD" origAmount="500.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
<AcctgTransEntry acctgTransId="9001" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" description="Unposted transaction entries" voucherRef="Z0001" glAccountId="400000" organizationPartyId="Company" amount="500.00" currencyUomId="USD" origAmount="500.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
+ <AcctgTrans acctgTransId="8000" acctgTransTypeId="PURCHASE_INVOICE" transactionDate="2009-07-06 16:50:43.806" isPosted="Y" postedDate="2009-07-06 16:50:44.219" glFiscalTypeId="ACTUAL" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" invoiceId="8000"/>
+ <AcctgTransEntry acctgTransId="8000" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-1000" glAccountId="214000" organizationPartyId="Company" amount="60.00" currencyUomId="USD" origAmount="60.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+ <AcctgTransEntry acctgTransId="8000" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="60.00" currencyUomId="USD" origAmount="60.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
+
+ <AcctgTrans acctgTransId="8001" acctgTransTypeId="OUTGOING_PAYMENT" transactionDate="2009-07-06 16:53:49.259" isPosted="Y" postedDate="2009-07-06 16:53:49.741" glFiscalTypeId="ACTUAL" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" paymentId="8000"/>
+ <AcctgTransEntry acctgTransId="8001" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" glAccountId="213000" organizationPartyId="Company" amount="70.00" currencyUomId="USD" origAmount="70.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
+ <AcctgTransEntry acctgTransId="8001" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="60.00" currencyUomId="USD" origAmount="60.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+ <AcctgTransEntry acctgTransId="8001" acctgTransEntrySeqId="00003" acctgTransEntryTypeId="_NA_" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="10.00" currencyUomId="USD" origAmount="10.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+
+ <AcctgTrans acctgTransId="8002" acctgTransTypeId="PURCHASE_INVOICE" transactionDate="2009-07-06 16:50:43.806" isPosted="Y" postedDate="2009-07-06 16:50:44.219" glFiscalTypeId="ACTUAL" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" invoiceId="8001"/>
+ <AcctgTransEntry acctgTransId="8002" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-1000" glAccountId="516100" organizationPartyId="Company" amount="10.00" currencyUomId="USD" origAmount="10.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+ <AcctgTransEntry acctgTransId="8002" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" partyId="AcctBigSupplier" roleTypeId="BILL_FROM_VENDOR" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="10.00" currencyUomId="USD" origAmount="10.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
</entity-engine-xml>
\ No newline at end of file
Modified: ofbiz/trunk/applications/accounting/data/PaymentsInvoices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/PaymentsInvoices.xml?rev=792185&r1=792184&r2=792185&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/PaymentsInvoices.xml (original)
+++ ofbiz/trunk/applications/accounting/data/PaymentsInvoices.xml Wed Jul 8 15:25:34 2009
@@ -64,5 +64,13 @@
<InvoiceItem invoiceId="demo1200" invoiceItemSeqId="00001" invoiceItemTypeId="INV_SPROD_ITEM" uomId="USD" taxableFlag="Y" amount="511.23" description="this was e service for a product"/>
<InvoiceStatus statusId="INVOICE_IN_PROCESS" invoiceId="demo1200" statusDate="2006-04-25 12:46:27.122"/>
<InvoiceStatus statusId="INVOICE_APPROVED" invoiceId="demo1200" statusDate="2006-04-25 12:46:27.122"/>
-
+
+ <!--data for voiding/canceling payments/invoices-->
+ <Invoice invoiceId="8000" invoiceTypeId="PURCHASE_INVOICE" partyIdFrom="AcctBigSupplier" partyId="Company" statusId="INVOICE_READY" invoiceDate="2009-07-06 16:48:40.952" paidDate="2009-07-06 16:52:52.901"/>
+ <InvoiceItem invoiceId="8000" invoiceItemSeqId="1" invoiceItemTypeId="PINV_WE_ITEM" taxableFlag="Y" quantity="3.000000" amount="20.000"/>
+ <Payment paymentId="8000" paymentTypeId="VENDOR_PAYMENT" paymentMethodTypeId="EXT_BILLACT" partyIdFrom="Company" partyIdTo="AcctBigSupplier" statusId="PMNT_SENT" effectiveDate="2009-07-06 16:52:52.901" amount="70.00" currencyUomId="USD" actualCurrencyAmount="70.00" actualCurrencyUomId="USD"/>
+ <PaymentApplication paymentApplicationId="8010" paymentId="8000" invoiceId="8000" amountApplied="60.00"/>
+
+ <Invoice invoiceId="8001" invoiceTypeId="PURCHASE_INVOICE" partyIdFrom="AcctBigSupplier" partyId="Company" statusId="INVOICE_READY" invoiceDate="2009-07-06 16:48:40.952" paidDate="2009-07-06 16:52:52.901"/>
+ <InvoiceItem invoiceId="8001" invoiceItemSeqId="1" invoiceItemTypeId="PINV_SURCHARGE_ADJ" taxableFlag="Y" quantity="1.000000" amount="10.000"/>
</entity-engine-xml>
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml?rev=792185&r1=792184&r2=792185&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml Wed Jul 8 15:25:34 2009
@@ -54,4 +54,92 @@
</iterate>
<log level="info" message="Batch ${paymentGroupId} is created successfully for payments"/>
</simple-method>
+
+ <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>
+
+ <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>
</simple-methods>
\ No newline at end of file
Modified: ofbiz/trunk/applications/accounting/testdef/paymenttests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/paymenttests.xml?rev=792185&r1=792184&r2=792185&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/testdef/paymenttests.xml (original)
+++ ofbiz/trunk/applications/accounting/testdef/paymenttests.xml Wed Jul 8 15:25:34 2009
@@ -25,4 +25,14 @@
<test-case case-name="auto-create-batch-for-payments">
<simple-method-test location="component://accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml" name="testCreateBatchForPayments"/>
</test-case>
+
+ <!--Test case for voiding payments -->
+ <test-case case-name="auto-test-voidPayment">
+ <simple-method-test location="component://accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml" name="testVoidPayment"/>
+ </test-case>
+
+ <!--Test case for canceling invoices-->
+ <test-case case-name="auto-test-cancelInvoice">
+ <simple-method-test location="component://accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml" name="testCancelInvoice"/>
+ </test-case>
</test-suite>
\ No newline at end of file