Compare commits

...
504 Commits
Author SHA1 Message Date
Vishwas Babu A J 9f78554972 Merge pull request #1164 from Nayan/MIFOSX-1680
#MIFOSX-1680 Option to change center meeting frequency and intervals
2014-12-05 22:14:50 -08:00
Markus Geiß 629508dcab Merge pull request #1167 from MegaAlex/MIFOSX-1630
Merged and Closed (y)
2014-12-05 12:46:27 +01:00
Alex Ivanov c6a74a1d64 MIFOSX-1630 Bit and DateTime data type support in DataTable API 2014-12-05 13:29:40 +02:00
Vishwas Babu A J 7105d688bc sql patch for client statuses 2014-12-05 00:45:11 -08:00
Vishwas Babu A J 642b45def8 Merge pull request #1168 from binaryking/MIFOSX-1550
MIFOSX-1550 Check for null principal amount when creating journal entry for loan write-off
2014-12-05 00:31:50 -08:00
Vishwas Babu A J 27b8761011 cleaning up client lifecycle additions 2014-12-05 00:30:23 -08:00
Mohammed Nafees 42ff4c1b1c MIFOSX-1550 Check for null principal amount when creating journal entry for loan write-off 2014-12-05 12:59:39 +05:30
Vishwas Babu A J 6515d18b73 Merge branch 'Nagaraj12-clientReject' into develop 2014-12-04 17:27:42 -08:00
Vishwas Babu A J 2212618256 fix failing integration tests due to enabling optimistic locking on loans 2014-12-04 17:26:46 -08:00
Vishwas Babu A J 8acb08c526 Merge branch 'clientReject' of git://github.com/Nagaraj12/mifosx into Nagaraj12-clientReject 2014-12-04 16:23:57 -08:00
Vishwas Babu A J 09e2d04a6e Merge pull request #1163 from pramodn02/develop
MIFOSX-1709 : corrected condition to add and delete guarantor
2014-12-04 08:35:43 -08:00
Markus Geiß d69e2de0ac Merge pull request #1165 from binaryking/MIFOSX-1284
Closed
2014-12-04 16:27:08 +01:00
Mohammed Nafees cea6436470 MIFOSX-1284 Add the ability to sort offices 2014-12-04 20:02:14 +05:30
Nayan bae2a7088e Option to change center meeting frequency and intervals 2014-12-04 15:02:13 +05:30
Pramod Nuthakki 65d9ca11bf MIFOSX-1709 : corrected condition to add and delete guarantor 2014-12-04 14:46:05 +05:30
Vishwas Babu A J 34a9ec41c5 missing response data parameters for code values 2014-12-04 01:14:46 -08:00
Vishwas Babu A J 64c642656f enable optimistic locking for m_loan 2014-12-04 01:12:21 -08:00
Vishwas Babu A J 8298a8f86a Merge pull request #1161 from pramodn02/develop
MIFOSX-1709 : guarantor on hold funds functionality
2014-12-03 22:52:11 -08:00
Pramod Nuthakki 118f4904c6 MIFOSX-1709 : guarantor on hold funds functionality 2014-12-04 11:31:12 +05:30
Vishwas Babu A J f197fe572a Ignore failing test case on Jenkins 2014-12-03 21:36:46 -08:00
Vishwas Babu A J d5ce6f2c98 Merge pull request #1146 from emmanuelnnaa/MIFOSX-1671
commit for MIFOSX-1671 (User with 'ALL_FUNCTIONS_READ' permission does not have access to /users/{userId} resource)
2014-12-03 20:54:28 -08:00
Vishwas Babu A J 2fc3c9c7ee Merge pull request #1155 from MithunKashyap/MIFOSX-1674
MIFOSX-1674:The description field added to m_code_value can be edited/en...
2014-12-03 20:51:34 -08:00
Vishwas Babu A J 4ec1173bc3 Merge pull request #1159 from vorburger/MariaDB4jUpgrade
Upgraded MariaDB4j from v2.1.0 to v2.1.1
2014-12-03 20:47:29 -08:00
Vishwas Babu A J 4f67c8bf7f Merge pull request #1160 from vorburger/ReactivateMariaD4jSpringBootServerLoginTest
Un-@Igore SpringBootServerLoginTest
2014-12-03 20:47:11 -08:00
Michael Vorburger 77dbe27281 Un-@Igore SpringBootServerLoginTest 2014-12-04 00:15:57 +01:00
Michael Vorburger 91fc23e92a Upgraded MariaDB4j from v2.1.0 to v2.1.1, see https://github.com/vorburger/MariaDB4j/blob/master/CHANGES.md 2014-12-04 00:13:46 +01:00
Vishwas Babu A J 8ef61f3275 MIFOSX-1704 2014-12-03 12:31:59 -08:00
Vishwas Babu A J 4c6ea532e9 Merge pull request #1157 from binaryking/MIFOSX-1533
MIFOSX-1533: Fix advanced search exception
2014-12-03 09:29:40 -08:00
Mohammed Nafees 589b1c2dbb Merge branch develop of upstream 2014-12-03 22:21:30 +05:30
Mohammed Nafees 2f5dc2875f MIFOSX-1533 Fix advanced search exception 2014-12-03 22:17:20 +05:30
Vishwas Babu A J 466a691e56 Merge pull request #1154 from MegaAlex/bug/MIFOSX-1575
MIFOSX-1575 Add optional 'comments' parameter to Journal Reverse command
2014-12-03 08:37:00 -08:00
Markus Geiß c80265124b Merge pull request #1156 from binaryking/FundsIntegrationTest
[GCI Task] Funds Integration Test Suite
2014-12-03 14:09:07 +01:00
Mohammed Nafees 8ad5324fb6 Rename global response spec to be more clear 2014-12-03 18:23:43 +05:30
Mohammed Nafees c4db5b811a Change method names 2014-12-03 18:09:30 +05:30
Mohammed Nafees 4dcb979b78 Distribute testing logic in separate methods 2014-12-03 17:48:51 +05:30
Mohammed Nafees aaf7025d79 Add test for duplicate creation 2014-12-03 15:00:11 +05:30
Mohammed Nafees eb8c7103ae Create test cases to cover funds modifications, covering faulty behaviour 2014-12-03 14:26:43 +05:30
Mohammed Nafees ba04ea535e Merge branch develop of upstream 2014-12-03 12:44:21 +05:30
Mohammed Nafees d0f214c834 Directly return list of funds helpers from retrieveAllFunds() 2014-12-03 12:21:49 +05:30
Mohammed Nafees a51390ae37 Improve testing patterns for funds retrieval 2014-12-03 12:07:29 +05:30
Vishwas Babu A J 07052f983e cath database errors related to savings withdrawals 2014-12-02 17:33:19 -08:00
Vishwas Babu A J f58fc1c116 add optimistic locking for savings account 2014-12-02 13:24:55 -08:00
Alex Ivanov 9b826ea98e MIFOSX-1575 Add optional 'comments' parameter to Journal Reverse command 2014-12-02 21:06:53 +02:00
Vishwas Babu A J 78b6f2a3e6 updating licences 2014-12-02 08:35:59 -08:00
Vishwas Babu A J 637f062ce3 MIFOSX-1511 custom formats for client, loan and savings account numbers 2014-12-02 08:34:08 -08:00
Mohammed Nafees 8f13a96f61 Add test cases for funds retrieval 2014-12-02 21:26:16 +05:30
Mohammed Nafees a15ce5ce8b Create integration test suite for Funds API 2014-12-02 19:00:16 +05:30
MithunKashyap d644fa9123 MIFOSX-1674:The description field added to m_code_value can be edited/entered 2014-12-02 16:18:29 +05:30
Nagaraj Reddy 0d85d4b9de MIFOSX-1662:Client life cycle and adding new statuses 2014-11-28 16:12:25 +05:30
Vishwas Babu A J 06dfb9d732 Merge pull request #1149 from pramodn02/latest
MIFOSX-1676 : changed AppUser to nullable in savings transactions
2014-11-25 19:58:43 +05:30
Pramod Nuthakki e25ddfd18a MIFOSX-1676 : changed AppUser to nullable in savings transactions 2014-11-25 18:14:41 +05:30
Vishwas Babu A J f93bb4a7ba Merge pull request #1148 from pramodn02/develop
MIFOSX-1675 : Added support to capture guarantor funding details for loan account
2014-11-24 19:17:56 +05:30
Pramod Nuthakki 958fb33db2 added licences 2014-11-24 13:17:07 +05:30
Pramod Nuthakki 6646ab57db MIFOSX-1675 : Added support to capture guarantor funding details for loan account 2014-11-24 12:23:08 +05:30
Vishwas Babu A J cd76d1d543 fixing failing Client integration tests 2014-11-22 03:10:49 +05:30
Vishwas Babu A J 1dee8c14ee fixing failing Client integration tests 2014-11-22 02:47:53 +05:30
Vishwas Babu A J c7a6d93bc4 fixing batch job failures 2014-11-22 00:54:22 +05:30
Emmanuel Nnaa cc487116bb commit for MIFOSX-1671 (User with 'ALL_FUNCTIONS_READ' permission does not have access to /users/{userId} resource) 2014-11-20 13:22:00 +01:00
Vishwas Babu A J 9dadb669a4 resolving compilation issue and bumping up sql patch number 2014-11-20 06:15:48 +05:30
Vishwas Babu A J ff8f116b96 Merge branch 'binnygopinath-MIFOSX-1628' into develop 2014-11-20 06:09:27 +05:30
Vishwas Babu A J 555839df31 Merge branch 'MIFOSX-1628' of git://github.com/binnygopinath/mifosx into binnygopinath-MIFOSX-1628 2014-11-20 06:09:17 +05:30
Vishwas Babu A J 66c6ddc82e Merge branch 'MithunKashyap-ClientSubStatus_MIFOSX-1642' into develop 2014-11-20 06:07:01 +05:30
Vishwas Babu A J 094c205018 Merge branch 'ClientSubStatus_MIFOSX-1642' of git://github.com/MithunKashyap/mifosx into MithunKashyap-ClientSubStatus_MIFOSX-1642 2014-11-20 06:06:20 +05:30
Vishwas Babu A J e420a56986 Merge branch 'emmanuelnnaa-MIFOSX-1638' into develop 2014-11-20 06:00:55 +05:30
Vishwas Babu A J 5a21aa6bfd Merge branch 'MIFOSX-1638' of git://github.com/emmanuelnnaa/mifosx into emmanuelnnaa-MIFOSX-1638
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java
2014-11-20 06:00:32 +05:30
Vishwas Babu A J 1c83f181ab Merge pull request #1140 from Musoni/MIFOSX-1655
fixed MIFOSX-1655 issue with updating a loan with a charge
2014-11-20 04:15:33 +05:30
Binny G Sreevas 99dfadf990 MIFOSX-1628 - Added DB upgrade script 2014-11-20 02:08:00 +05:30
Binny G Sreevas c11f3af180 MIFOSX-1628 - Added User ID and Datetime to Loan and Savings Transactions 2014-11-20 02:03:21 +05:30
Vishwas Babu A J 180c49fce9 initial work around MIFOSX-1634 2014-11-19 03:17:34 +05:30
MithunKashyap eb2741a0e2 MIFOSX-1642: Added sub status to client resource 2014-11-18 16:59:03 +05:30
andrew-dzak e1313fd254 fixed MIFOSX-1655 issue with updating a loan with a charge 2014-11-16 20:54:55 +01:00
Vishwas Babu A J 61a096f33c Merge branch 'MIFOSX-1068' of git://github.com/Nayan/mifosx into Nayan-MIFOSX-1068
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/data/LoanAccountData.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java
2014-11-13 21:35:54 +05:30
Vishwas Babu A J 7db8147f9d bump up gurantors sql 2014-11-13 21:13:40 +05:30
Vishwas Babu A J 77e08d11c8 fixing error messages for min days between loan disbursal and repayment 2014-11-13 21:10:16 +05:30
Vishwas Babu A J 95447d21b7 Merge branch 'develop' of git://github.com/pramodn02/mifosx into pramodn02-develop
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccount.java
2014-11-13 20:25:48 +05:30
Vishwas Babu A J 10f22ab3eb Merge branch 'MIFOSX-1639' of git://github.com/emmanuelnnaa/mifosx into emmanuelnnaa-MIFOSX-1639
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/data/LoanAccountData.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
2014-11-13 20:20:00 +05:30
Vishwas Babu A J 1573b5a6b3 cleaning up API docs for standing instructions 2014-11-13 20:05:45 +05:30
Vishwas Babu A J c4ef820ad0 fix failing test cases 2014-11-13 19:23:04 +05:30
Vishwas Babu A J 5f5f94d5f2 updates to nth day logic 2014-11-13 17:57:41 +05:30
Vishwas Babu A J 580eec5064 updates to nth day logic 2014-11-13 17:55:01 +05:30
Vishwas Babu A J 03898052a0 Merge branch 'develop' of github.com:openMF/mifosx into develop 2014-11-13 14:56:20 +05:30
Vishwas Babu A J 7218ac354e updating api docs with detail s of newly added parameter for loan products minimumDaysBetweenDisbursalAndFirstRepayment 2014-11-13 14:55:51 +05:30
Vishwas Babu A J dc72c8c5f0 fixing test failures due to minimum days between disbursal and first repayment parameter being introduced in integration tests 2014-11-13 14:27:55 +05:30
Vishwas Babu A J b8b45620b4 Merge pull request #1136 from Nayan/MIFOSX-1650
Fix for client activation within a group and JLG loan 500 error #MIFOSX-1650 #MIFOSX-1647
2014-11-13 12:15:11 +05:30
Nayan 8758d6f669 Fix for client activation withing a group and JLG loan 500 error 2014-11-13 09:50:13 +05:30
Vishwas Babu A J b27e0a9581 Merge branch 'MIFOSX-1461' of git://github.com/cgninan/mifosx into cgninan-MIFOSX-1461
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/DefaultScheduledDateGenerator.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/ScheduledDateGenerator.java
2014-11-11 18:53:09 +05:30
Emmanuel Nnaa 0664aca901 commit for MIFOSX-1639 (Auto create standing instruction at loan disbursement) 2014-11-10 13:55:29 +01:00
Emmanuel Nnaa ef3d19c387 commit for MIFOSX-1638 (Waiving charges attached to zero balance instalments - Loan Rescheduling) 2014-11-10 13:46:29 +01:00
Nayan 131b07318e Option to change approved amount during loan approval 2014-11-08 19:01:00 +05:30
Pramod Nuthakki c3e66a6bff Corrected test cases 2014-11-07 15:58:38 +05:30
Pramod Nuthakki 915f187bef MIFOSX-1643 : modified charge payment to bypass running balance check 2014-11-07 15:56:33 +05:30
Pramod Nuthakki 2418c09701 MIFOSX-1641: Added capture of guarantee details for loan product and added constrain on savings withdraw 2014-11-07 13:15:27 +05:30
Vishwas Babu A J 99b3bf1b4d bumping up sql patch number 2014-11-06 00:00:21 +05:30
Vishwas Babu A J f1e9c2800b cleaning up MIFOSX-1584 2014-11-05 23:58:03 +05:30
Vishwas Babu A J a8c733100b Merge branch 'MIFOSX-1584' of git://github.com/Nayan/mifosx into Nayan-MIFOSX-1584 2014-11-05 18:53:31 +05:30
Vishwas Babu A J 1c49096881 updates to accounting section of api-docs 2014-11-05 18:09:46 +05:30
Vishwas Babu A J b2e9ab4a9c Merge branch 'MIFOSX-1175' of git://github.com/Musoni/mifosx into Musoni-MIFOSX-1175
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java
2014-11-05 17:33:49 +05:30
Vishwas Babu A J 16d974ded7 Update Contributing.md 2014-11-05 10:56:03 +05:30
Vishwas Babu A J c5c34138a7 cleaning up MIFOSX-1463 2014-11-04 19:05:03 +05:30
Vishwas Babu A J 2b93590c5c Merge pull request #1124 from pramodn02/develop
changed future installments date not to use rest frequency
2014-11-04 18:01:38 +05:30
Pramod Nuthakki c8ccc96309 changed future installments date not to use rest frequency 2014-11-04 17:06:32 +05:30
Vishwas Babu A J 80dfd752d7 issues with latest sql patch name, removing few deprecated statement calls and other warnings 2014-11-04 16:03:21 +05:30
Vishwas Babu A J 630694c133 Merge pull request #1123 from sughosh88/ReportPermissions
Added all reports in permission table
2014-11-04 14:22:14 +05:30
Sughosh db9278d1b2 Added all reports in permission table 2014-11-04 12:28:56 +05:30
Vishwas Babu A J 34fb6acc44 fixing null pointer exception during client creation 2014-11-04 12:18:20 +05:30
Vishwas Babu A J 702ecd480f cleaning up group validations 2014-11-03 21:09:02 +05:30
Vishwas Babu A J 7d0ac6bf29 Merge branch 'MIFOSX-1566' of git://github.com/Nayan/mifosx into Nayan-MIFOSX-1566 2014-11-03 14:13:49 +05:30
Vishwas Babu A J 642417166c moving all config files directly under config folder 2014-11-03 09:48:10 +05:30
Vishwas Babu A J 9072556925 Merge pull request #1116 from Nayan/MIFOSX-1619
#MIFOSX-1619 Added MifosX Eclipse preferences file into source control
2014-11-03 09:44:23 +05:30
Vishwas Babu A J 9174a9406c updating database dump 2014-11-02 19:25:01 +05:30
Vishwas Babu A J 2aa18a32da Update INSTALL.md 2014-11-02 17:03:53 +05:30
Vishwas Babu A J f05b3585e1 Update INSTALL.md
adding emphasis
2014-11-02 16:56:01 +05:30
Vishwas Babu A J d576c73dbb Update INSTALL.md
got updating from a version lower than 1.25
2014-11-02 16:52:41 +05:30
Vishwas Babu A J 61db1cee89 Update INSTALL.md
with minor cleanups
2014-11-02 16:45:57 +05:30
Vishwas Babu A J 48528bc75e Update CHANGELOG.md 2014-11-01 19:56:54 +05:30
Vishwas Babu A J ec51ca3007 Update CHANGELOG.md
for 1.25.1 release
2014-11-01 19:56:14 +05:30
Vishwas Babu A J 77e9549a54 updating properties for 1.26.1 release 2014-11-01 18:43:13 +05:30
Vishwas Babu A J 9a8bb71235 Merge pull request #1119 from pramodn02/develop
MIFOSX-1631 : added constrains for charges with interest recalculation
2014-11-01 11:26:49 +05:30
Pramod Nuthakki 784c180154 MIFOSX-1631 : added constrains for charges with interest recalculation 2014-10-31 23:43:53 +05:30
Vishwas Babu A J c7cd28c340 Merge pull request #1118 from pramodn02/develop
Develop
2014-10-31 00:49:05 -07:00
Pramod Nuthakki 3bba3b9192 corrected standing instruction testcase for edge case scenario 2014-10-31 12:42:40 +05:30
Pramod Nuthakki 1164bf40a3 MIFOSX-1632 : corrected accruals(intriduced with fine tune) for specific due date 2014-10-31 11:11:44 +05:30
Vishwas Babu A J 8a9c05e212 removing eclipse warnings 2014-10-28 02:31:26 -07:00
Nayan 2134dda13f Added MifosX Eclipse preferences file into source control 2014-10-27 12:17:05 +05:30
Nayan cf085c6a8d Added min/max number of clients per group rule for activate/activating
group
2014-10-27 06:13:52 +05:30
Vishwas Babu A J b3424921d5 Merge pull request #1114 from pramodn02/MIFOSX-1586
MIFOSX-1586 : corrected overdue charges with interest calculation
2014-10-26 15:22:47 -07:00
Pramod Nuthakki 659ffa3e9a MIFOSX-1586 : corrected overdue charges with interest calculation 2014-10-26 13:47:48 +05:30
Vishwas Babu A J 9863f8d6a3 fix for MIFOSX-1615 2014-10-25 13:00:41 -07:00
Nayan 1c5364ac7f MIFOSX-1584 Added business logic for minimum number of days between disbursal day and first repayment date 2014-10-24 16:20:41 +05:30
Vishwas Babu A J e61abec3de Updates to Charge services to filter charges based on currency used in loan/ savings products 2014-10-23 21:51:43 -07:00
Vishwas Babu A J 5c76d3d377 Cleaning up a few more method signatures on Charge Read Service 2014-10-23 19:19:57 -07:00
Vishwas Babu A J ba4154d8df updating properties for 1.26 release 2014-10-23 19:05:03 -07:00
Vishwas Babu A J 8067a288d0 cleaning up method signatures in Charge read platform service 2014-10-23 19:02:01 -07:00
Vishwas Babu A J a09da301c1 removing unnecessary authentication from ChargesRead services 2014-10-23 16:27:00 -07:00
andrew-dzak 4cb8ca8c71 MIFOSX-1175 add extra param to assign staff to group with integration test 2014-10-22 20:38:21 +02:00
Vishwas Babu A J 263a32a83a fixing failures for Hook integration test 2014-10-21 19:25:54 -07:00
Vishwas Babu A J 546981a514 Merge pull request #1091 from avikganguly01/MifosX-1466
MifosX-1466 - Flexible Savings Interest Posting
2014-10-21 16:34:29 -07:00
avikganguly01 c04cebc5b6 MifosX-1466-Flexible Savings Interest Posting 2014-10-20 13:43:31 +05:30
Vishwas Babu A J 21c4cdf002 possible fix for hooks related integration test failure 2014-10-18 16:19:45 -07:00
Vishwas Babu A J 733656685d Merge pull request #1109 from Musoni/MIFOSX-1606
fixed null pointer bug when closing savings account
2014-10-17 22:24:24 -07:00
Vishwas Babu A J 7c26fd7723 Merge pull request #1107 from avikganguly01/develop
Hooks - Validation and Caching
2014-10-16 19:16:49 -07:00
andrew-dzak 1646995525 fixed null pointer bug when closing savings account 2014-10-16 16:46:16 +02:00
avikganguly01 84c321cfe8 Hooks - Validation and Caching 2014-10-16 18:18:47 +05:30
Vishwas Babu A J e9d50e09db Merge pull request #1108 from pramodn02/develop
MIFOSX-1595 : corrected interest posting if run 2 times in a period
2014-10-16 02:43:09 -07:00
Pramod Nuthakki 32746c0981 MIFOSX-1595 : corrected interest posting if run 2 times in a period 2014-10-16 14:17:30 +05:30
Vishwas Babu A J d4f8c632d5 Merge pull request #1106 from pramodn02/develop
MIFOSX-1589 : accounting changes for waive interest and waive charge
2014-10-15 07:48:41 -07:00
Vishwas Babu A J 3847186f2b Merge branch 'master' into develop 2014-10-14 16:25:39 -07:00
Vishwas Babu A J a1cbaf7927 updating sample data for 1.25.0 release 2014-10-14 16:24:46 -07:00
Pramod Nuthakki f9a78d8d28 MIFOSX-1589 : accounting changes for waive interest and waive charge 2014-10-14 21:10:55 +05:30
Vishwas Babu A J 76e1c819a4 undo temporary bug fixes made for 1.25 release 2014-10-13 00:42:03 -07:00
Vishwas Babu A J 07d054cbec Merge branch 'develop' 2014-10-12 23:54:42 -07:00
Vishwas Babu A J 59622daae4 Update INSTALL.md 2014-10-12 23:53:43 -07:00
Vishwas Babu A J 8f96e18225 Update INSTALL.md 2014-10-12 23:47:23 -07:00
Vishwas Babu A J d5d53ea84b Update INSTALL.md
to fix typo caused by a github bug
2014-10-12 23:44:06 -07:00
Vishwas Babu A J cc712e71a4 Update INSTALL.md
with special instructions for 1.25 or higher upgrade
2014-10-12 23:38:59 -07:00
Vishwas Babu A J eb6af6a6a3 updating schema version number for first install of mifosplatform-tenants database 2014-10-12 22:36:20 -07:00
Vishwas Babu A J 8b36f6f27e Merge branch 'develop' 2014-10-12 21:46:55 -07:00
Vishwas Babu A J f5077ef2b9 disable charge and interest waivers for periodic accrual accounting 2014-10-12 21:05:55 -07:00
Vishwas Babu A J 511a0d89c0 Update CHANGELOG.md
removing issues that have not yet passed a round of testing from 1.25 release
2014-10-12 20:37:44 -07:00
Vishwas Babu A J 30c73e32ab Update CHANGELOG.md
for 1.25.0 Release
2014-10-12 20:17:46 -07:00
Vishwas Babu A J 9f739ee476 Merge pull request #1102 from pramodn02/develop
corrected charge payment accouting for accruals
2014-10-11 08:48:56 -07:00
pramod 0262d89727 corrected charge payment accouting for accruals 2014-10-11 21:13:59 +05:30
Vishwas Babu A J 780bdfb01d updating dump for 1.25 2014-10-10 07:12:30 -07:00
Vishwas Babu A J 0bf2557cfa fixing failing test case 2014-10-09 21:59:31 -07:00
Vishwas Babu A J 7c6485a968 formatting searchReadPlatformService 2014-10-09 20:52:42 -07:00
Vishwas Babu A J e361c913ee Update CHANGELOG.md
updating 1.25 release with Batch API and community app fixes
2014-10-09 20:24:03 -07:00
Vishwas Babu A J b18a403314 fix for issues while converting fortuna date to localdate 2014-10-09 05:25:48 -07:00
Vishwas Babu A J 7abec8a1c9 Merge pull request #1099 from pramodn02/develop
script to insert charges paid by for accruals
2014-10-07 21:01:43 -07:00
Vishwas Babu A J d1039c1929 Merge pull request #1100 from chandrikamohith/MIFOSX-1480
MIFOSX-1480 Group member changes
2014-10-07 20:14:09 -07:00
Chandrika 872843a327 MIFOSX-1480 Group member changes 2014-10-07 19:06:26 -04:00
Pramod Nuthakki 0553cda5e3 script to insert charges paid by for accruals 2014-10-07 15:37:48 +05:30
Vishwas Babu A J 5841e8f957 updating release numbers for 1.25 release 2014-10-06 05:03:41 -07:00
Vishwas Babu A J 8db27ccb0b Update CHANGELOG.md
for 1.25 release
2014-10-06 04:52:14 -07:00
Vishwas Babu A J ba8710fd51 Merge pull request #1098 from pramodn02/develop
MIFOSX-1513 : corrected reprocess check for loan repayment schedule
2014-10-06 03:25:51 -07:00
Pramod Nuthakki f30ad4ca0b MIFOSX-1513 : corrected reprocess check for loan repayment schedule 2014-10-06 14:09:59 +05:30
Vishwas Babu A J b796cae43c Merge pull request #1097 from pramodn02/testcase
periodic accounting API changes
2014-10-06 00:05:29 -07:00
Pramod Nuthakki 47afc0e8a4 periodic accounting API changes 2014-10-06 12:25:53 +05:30
Vishwas Babu A J 9a817c0495 clean up of verbiage in API docs (round 1, upto Loan rescheduling) 2014-10-05 10:40:51 -07:00
Vishwas Babu A J d7082eebfd Merge pull request #1096 from vishwasbabu/develop
fixing a few failing test cases due to submitted date not being set
2014-10-03 22:21:59 -07:00
Vishwas Babu A J b52ed04fec fixing a few failing test cases due to submitted date not being set 2014-10-03 22:20:45 -07:00
Vishwas Babu A J fce91a51d3 Merge pull request #1004 from Musoni/MIFOSX-1400
abillity to modify client submission date
2014-10-03 21:50:25 -07:00
Vishwas Babu A J e458dd0a4e Merge pull request #1095 from pramodn02/develop
removed unnecessary save of loan
2014-10-03 21:41:40 -07:00
pramod ab14373f35 removed unnecessary save of loan 2014-10-04 09:48:14 +05:30
Vishwas Babu A J 856beec760 bumping up version number for MIFOSX-1397 sql patch 2014-10-03 12:51:26 -07:00
Vishwas Babu A J 3a525ac671 merging pull request for MIFOSX-1397 2014-10-03 12:47:42 -07:00
Vishwas Babu A J 4ddf99498e merging localization changes for dates in unit test cases 2014-10-03 10:41:34 -07:00
Vishwas Babu A J 430977306b Merge pull request #1090 from vorburger/warFinalizedByBootRepackage
MIFOSX-1552 Fix which makes gradlew war produce an executable WAR, just like standard gradlew build does
2014-10-01 13:22:11 -07:00
Vishwas Babu A J f7be3555c4 Merge pull request #1092 from pramodn02/develop
MIFOSX-1557 : added check for disbursement fee
2014-10-01 13:20:56 -07:00
Vishwas Babu A J 3e433a12c2 Merge pull request #1093 from pramodn02/MIFOSX-1561
MIFOSX-1561 : added check to validate principal collected
2014-10-01 13:20:02 -07:00
Pramod Nuthakki 1cac15959c MIFOSX-1561 : added check to validate principal collected 2014-10-01 18:33:41 +05:30
Pramod Nuthakki adc99d2dec MIFOSX-1557 : added check for disbursement fee 2014-10-01 14:26:41 +05:30
Michael Vorburger 0b501d1dcd MIFOSX-1552 war { ... war.finalizedBy(bootRepackage) } makes gradlew war
produce an executable WAR, just like standard gradlew build does (this
resolves the problem mentioned in the PS on
http://blog2.vorburger.ch/2014/09/mifos-executable-war-with-mariadb4j.html)

Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-09-30 01:01:17 +02:00
Michael Vorburger 00309de7e0 MIFOSX-1552 Upgrading rest-assured from v1.7.2 to v2.3.3 (incl.
reverting httpcomponents change from
848797985a +
b9cfcce1f9 as that wasn't the cause), as
that fixes the "java.lang.IllegalStateException: Unsupported cookie
spec: default at
org.apache.http.cookie.CookieSpecRegistry.getCookieSpec(CookieSpecRegistry.java:110)"

Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-09-29 23:55:44 +02:00
Vishwas Babu A J ccb5717bd6 Merge pull request #1089 from chandrikamohith/MIFOSX-1252Java
MIFOSX-1252 Changes for Savings Officer API Doc
2014-09-29 11:52:59 -07:00
Chandrika b760624cd4 MIFOSX-1252 Changes for Savings Officer API Doc 2014-09-29 14:47:56 -04:00
mplescano 15a9804427 Fixing for locale differents of English 2014-09-29 11:24:28 -05:00
Vishwas Babu A J a4465fbc15 Merge pull request #1086 from pramodn02/develop
MIFOSX-1557 : corrected journal entries for advanced accounting with acc...
2014-09-26 19:21:26 -07:00
Vishwas Babu A J 848797985a commenting out apache httpcomponents to see if it makes any difference on the Cloudbees server 2014-09-26 18:12:44 -07:00
Vishwas Babu A J b9cfcce1f9 adding httpclient 3.1 as a dependency to check if this solves integration test failures on cloudbees 2014-09-26 16:01:33 -07:00
Vishwas Babu A J 3a7c8d8ebb Merge branch 'develop' of github.com:openMF/mifosx into develop 2014-09-26 12:56:37 -07:00
Vishwas Babu A J e7aadae9fa removing dependency on httpclient 4.2.3 2014-09-26 12:56:11 -07:00
Vishwas Babu A J 192d690240 Merge pull request #1087 from pramodn02/MIFOSX-1563
MIFOSX-1563 : excluded disburse charge transaction on recalculation
2014-09-26 12:27:18 -07:00
Pramod Nuthakki 7ed6705f74 MIFOSX-1563 : excluded disburse charge transaction on recalculation 2014-09-26 19:50:32 +05:30
Pramod Nuthakki 71517d87c6 MIFOSX-1557 : corrected journal entries for advanced accounting with accrual 2014-09-26 16:02:59 +05:30
Vishwas Babu A J 276e6b1864 Ignoring hasMifosPlatformStarted test case and shorter file name for Windows 2014-09-26 01:42:46 -07:00
Vishwas Babu A J 68f6ecc60d moving sql files to new folder 2014-09-24 21:23:56 -07:00
Vishwas Babu A J bda10bbf78 Merge pull request #1079 from vorburger/SpringBootAndMariaDB4j
MIFOSX-1552 Spring Boot + MariaDB4j
2014-09-24 21:06:48 -07:00
Vishwas Babu A J a41f926dbe Merge pull request #1085 from chandrikamohith/MIFOSX-1252Java
MIFOSX-1252 Squashing all previous commits.Savings Officer changes
2014-09-24 14:49:08 -07:00
Chandrika 253c444a45 MIFOSX-1252 Squashing all previous commits.Savings Officer changes 2014-09-24 17:39:11 -04:00
Vishwas Babu A J 114f17e300 Merge pull request #1083 from pramodn02/develop
MIFOSX-1554 : added min balance check only for withdrawal transactions
2014-09-24 14:32:39 -07:00
Pramod Nuthakki d19ab1c8e4 MIFOSX-1554 : added min balance check only for withdrawal transactions 2014-09-24 14:57:37 +05:30
Vishwas Babu A J 57f014a8b0 Merge pull request #1082 from pramodn02/develop
interest recalculation test cases + fixes
2014-09-23 14:56:10 -07:00
Pramod Nuthakki 6d5830e232 added accrual test case for interest recalculation 2014-09-23 19:27:48 +05:30
Pramod Nuthakki 4266e5d705 corrected early payment related issues 2014-09-23 16:42:37 +05:30
Vishwas Babu A J ad51032aec Merge pull request #1078 from vorburger/CronMethodParserDoubleSlashProblemWithWAR
Fix for start-up problem if WAR is NOT unpacked
2014-09-22 13:43:15 -07:00
Vishwas Babu A J 4a83cb3d17 Merge pull request #1077 from vorburger/FlywayCoreInsteadMaven
Fix Flyway Core vs. Maven plug-in mess
2014-09-22 13:41:58 -07:00
Vishwas Babu A J 0b22529bb9 Merge pull request #1080 from pramodn02/develop
recalculation test cases and some corrections
2014-09-22 13:41:34 -07:00
Pramod Nuthakki 598f0ba4b1 recalculation test cases and some corrections 2014-09-23 01:37:36 +05:30
Michael Vorburger 4b0658a685 MIFOSX-1552 Spring Boot + MariaDB4j, read
http://blog2.vorburger.ch/2014/09/mifos-executable-war-with-mariadb4j.html

Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-09-22 04:04:15 +02:00
Michael Vorburger 0e2f0eb85c Fix for start-up problem if WAR is NOT unpacked (relevant e.g. for upcoming Spring Boot + MariaDB4j java -jar mifos.war 2014-09-22 01:03:36 +02:00
Michael Vorburger 4eb2cf6e21 Fix Flyway Core vs. Maven plug-in mess
Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-09-19 00:32:42 +02:00
Vishwas Babu A J 0d8bd285dc Merge pull request #1075 from pramodn02/develop
MIFOSX-1549 : corrected first repayment date
2014-09-18 03:46:48 -07:00
Pramod Nuthakki 7e0742b576 MIFOSX-1549 : corrected first repayment date 2014-09-18 15:15:21 +05:30
Vishwas Babu A J 9e1313226a Merge pull request #1074 from pramodn02/develop
Develop
2014-09-17 22:28:45 -07:00
Pramod Nuthakki 2e4203614c updated API documentation 2014-09-18 10:09:26 +05:30
Vishwas Babu A J 5356f5b45f Merge pull request #1063 from avikganguly01/develop
Hooks
2014-09-17 17:20:21 -07:00
Pramod Nuthakki 5b0dc5b77b MIFOSX-1541 : corrected prepayment and interest calculation on date change 2014-09-17 20:19:59 +05:30
avikganguly01 68e0b873fe Hooks 2014-09-17 19:46:01 +05:30
Pramod Nuthakki 7da550fe7c MIFOSX-1535 : added condition to set the default value 2014-09-17 13:23:13 +05:30
Pramod Nuthakki 91ea2f0e2e MIFOSX-1524 : corrected Interest waiver 2014-09-17 12:20:41 +05:30
Christy Ninan 8535b14646 Christy - MIFOSX-1461 - Allow a monthly loan to be scheduled on n-th weekday of every month 2014-09-16 22:04:32 -05:00
Vishwas Babu A J 7889254e78 Merge pull request #1072 from chandrikamohith/MIFOSX-1252Java
MIFOSX-1252Java API documentation added for Loan officer and Savings Off...
2014-09-15 15:03:12 -07:00
Chandrika 18fda5d5d7 MIFOSX-1252Java API documentation added for Loan officer and Savings Officer 2014-09-15 17:29:28 -04:00
Vishwas Babu A J e7abf6601f Merge pull request #1071 from vishwasbabu/develop
updating fix to include update of deposit product , MIFOSX-1483
2014-09-14 20:04:55 -07:00
Vishwas Babu A J a4fae7efca updating fix to include update of deposit product , MIFOSX-1483 2014-09-14 20:04:19 -07:00
Vishwas Babu A J d3b8b02425 Merge pull request #1070 from vishwasbabu/develop
fix for MIFOSX-1483
2014-09-14 19:49:49 -07:00
Vishwas Babu A J 66e9a570dd fix for MIFOSX-1483 2014-09-14 19:48:44 -07:00
Vishwas Babu A J 46c51f2ff5 Merge pull request #1069 from vishwasbabu/develop
bumping up number of sql patch
2014-09-14 11:25:47 -07:00
Vishwas Babu A J 39c628ddf2 bumping up number of sql patch 2014-09-14 11:22:56 -07:00
Vishwas Babu A J 1385588083 Merge pull request #1068 from vishwasbabu/develop
Develop
2014-09-14 10:40:25 -07:00
Vishwas Babu A J b098f53627 applying licence headers 2014-09-14 10:39:14 -07:00
Vishwas Babu A J 4b9f6f3042 formatting source code 2014-09-14 10:36:06 -07:00
Vishwas Babu A J 3e5db84702 Merge pull request #1065 from avikganguly01/startinterest
Start Interest Calculation Date
2014-09-14 10:23:44 -07:00
Vishwas Babu A J b66cce870a Merge pull request #1067 from pramodn02/develop
MIFOSX-1537 : added original schedule to history
2014-09-14 10:11:38 -07:00
Pramod Nuthakki cb745a196d MIFOSX-1537 : added original schedule to history 2014-09-14 22:26:04 +05:30
Vishwas Babu A J f6853f681a Merge pull request #1066 from pramodn02/develop
MIFOSX-1517 : corrected recalculation for tranche loans
2014-09-12 14:13:44 -07:00
Pramod Nuthakki 45cd2e7602 MIFOSX-1517 : corrected recalculation for tranche loans 2014-09-12 19:27:06 +05:30
avikganguly01 933ede2c06 Start Interest Calculation Date 2014-09-12 11:37:46 +05:30
Vishwas Babu A J ba1373acae bumping version number of sql patch 2014-09-11 17:16:56 -07:00
Vishwas Babu A J ee3adc05ce Merge pull request #1064 from emmanuelnnaa/MIFOSX-1523
commit for MIFOSX-1523, Loan Rescheduling module
2014-09-11 16:48:10 -07:00
emmanuel a630d89549 commit for MIFOSX-1523, Loan Rescheduling module 2014-09-11 16:37:22 +02:00
Vishwas Babu A J 5130fba303 Merge pull request #1062 from vishwasbabu/develop
handle eclipse warning in portfolio packages
2014-09-10 12:47:14 -07:00
Vishwas Babu A J 74c36e810d handle eclipse warning in portfolio packages 2014-09-10 12:45:43 -07:00
Vishwas Babu A J 80e3a24742 Merge pull request #1060 from chandrikamohith/MIFOSX-1252Java
MIFOSX-1252 Assign/Unassign staff for Savings account-java srcs.MIFOSX-1...
2014-09-10 12:37:31 -07:00
Vishwas Babu A J 58a15a0382 Merge pull request #1061 from vishwasbabu/develop
clean up for MIFOSX-1145
2014-09-10 00:08:17 -07:00
Vishwas Babu A J 84ec7cd7b9 clean up for MIFOSX-1145 2014-09-10 00:06:25 -07:00
Vishwas Babu A J e27613550f Merge pull request #1056 from emmanuelnnaa/MIFOSX-1145
commit for 'MIFOSX-1145': updating datatable throws 'Data truncation: Invalid use of NULL value' SQL error
2014-09-09 23:49:30 -07:00
Chandrika efdccfbb81 MIFOSX-1252 Assign/Unassign staff for Savings account-java srcs.MIFOSX-1500 populating loan fields in client page-java srcs 2014-09-09 11:21:23 -04:00
Vishwas Babu A J 9c3b40b00a Merge pull request #1059 from pramodn02/develop
MIFOSX-1526 : added future instalments calculation
2014-09-09 07:30:34 -07:00
Pramod Nuthakki 6247385227 MIFOSX-1526 : added future instalments calculation 2014-09-09 19:56:19 +05:30
Vishwas Babu A J 527a0bea5f Merge pull request #1057 from pramodn02/develop
MIFOSX-1522 : added outstanding running balance for transactions
2014-09-06 16:29:23 -07:00
Pramod Nuthakki d846886508 MIFOSX-1522 : added outstanding running balance for transactions 2014-09-04 13:41:03 +05:30
Vishwas Babu A J 821a879610 Merge pull request #1055 from pramodn02/develop
MIFOSX-1419 : moved capturing of rest frequency to product
2014-09-03 06:58:27 -07:00
Pramod Nuthakki 5fc958f2bc corrected junits 2014-09-03 17:03:40 +05:30
Pramod Nuthakki f324f9ee8a MIFOSX-1419 : moved capturing of rest frequency to product 2014-09-03 16:12:07 +05:30
emmanuel c96980c457 commit for 'MIFOSX-1145': updating datatable throws 'Data truncation: Invalid use of NULL value' SQL error 2014-09-03 11:39:28 +02:00
Michael Vorburger d55c3d4521 Merge pull request #1053 from vorburger/TravisLicenseTest
Travis will now test presence of MPL license headers for each pull request it builds
2014-08-31 15:27:24 +02:00
Michael Vorburger 8aceac3860 Updated Contributing.md with clarification that license header presence is verified on pull requests 2014-08-31 15:22:15 +02:00
Michael Vorburger e644d6f53d license-gradle-plugin updated + license header presence verified for each pull request via travis_build.sh now 2014-08-31 14:10:34 +02:00
Michael Vorburger 9730f9cc65 added correct / missing license MPL headers
Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-08-31 14:05:34 +02:00
Vishwas Babu A J 79097ca7b9 Merge pull request #1052 from pramodn02/develop
MIFOSX-1490 : added interest schedule for interest first repayment strat...
2014-08-28 23:06:16 -07:00
Pramod Nuthakki 0caed4ac23 MIFOSX-1502 : corrected existing transaction ids 2014-08-29 11:23:25 +05:30
Pramod Nuthakki 6c6362bf34 MIFOSX-1490 : added interest schedule for interest first repayment strategies 2014-08-28 22:38:20 +05:30
Michael Vorburger 76f064503b Merge pull request #1026 from vorburger/RemoveTestContextXML
removing (now?) apparently un-used testContext.xml
2014-08-26 23:23:55 +02:00
Michael Vorburger 8a9a57a0f4 Removed apparently not (no longer?) used old testContext.xml
Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-08-26 23:11:33 +02:00
Michael Vorburger e68cba5929 Merge pull request #1024 from vorburger/SpringConfigurationTest
New SpringConfigurationTest; the first @RunWith(SpringJUnit4ClassRunner)
@vishwasbabu and @mgeiss I'm assuming you have no objection to this one, so I've merged it.
2014-08-26 22:52:43 +02:00
Markus Geiß 3103f20fdb Merge pull request #1050 from khatwaniNikhil/FIX_Server_Clean_Shutdown
MIFOSX-1501 #comment Fixed Issues related to AbandonedCleanupThread and
2014-08-23 17:11:52 +02:00
Nikhil Khatwani 2a8cbfdbf9 MIFOSX-1501 #comment Fixed Issues related to AbandonedCleanupThread and
Quartz scheduler worker Threads not stopping on mifos server shut-down.
2014-08-23 18:21:50 +05:30
Vishwas Babu A J 350f313411 Merge pull request #1049 from pramodn02/develop
MIFOSX-1418 : added regeneration of accrual entries
2014-08-16 02:38:41 -07:00
Pramod Nuthakki 87217fb29e MIFOSX-1418 : added regeneration of accrual entries 2014-08-16 14:28:53 +05:30
Vishwas Babu A J e2645b6461 Merge pull request #1048 from pramodn02/develop
fixes for MIFOSX-1487,MIFOSX-1486
2014-08-15 14:45:58 -07:00
Pramod Nuthakki c62bd61222 MIFOSX-1486 : changed the accured till date 2014-08-15 18:18:22 +05:30
Pramod Nuthakki debd298a13 MIFOSX-1487 : changed logic to fetch accrued till 2014-08-15 18:17:05 +05:30
Michael Vorburger df4a070123 Better error handling in case a scheduler job name listed in database
cannot be found in the code (instead of the NPE currently happenig in
such cases)
 
Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-08-14 23:05:10 +02:00
Vishwas Babu A J 9893563865 Merge pull request #1046 from pramodn02/develop
MIFOSX-1421 : fixed interest recalculation with RBI strategy
2014-08-13 16:02:20 -07:00
Pramod Nuthakki 80e1d67862 MIFOSX-1421 : fixed interest recalculation with RBI strategy 2014-08-14 01:17:44 +05:30
Vishwas Babu A J f2e9aa7cb0 Merge pull request #1045 from binnygopinath/savingsexternalID
MIFOSX-1265 - added External ID on UI for Savings Account and added vali...
2014-08-13 09:02:20 -07:00
Binny G Sreevas 818e085d3a MIFOSX-1265 - added External ID on UI for Savings Account and added validation for duplicate External ID 2014-08-12 10:47:58 +05:30
Vishwas Babu A J 1d1217accf Merge pull request #1044 from pramodn02/develop
MIFOSX-1421 : corrected remove installment charge and add a new installm...
2014-08-08 16:22:08 -07:00
Pramod Nuthakki 827c4c5a0d MIFOSX-1421 : corrected interest for extra repayments 2014-08-08 22:28:16 +05:30
Pramod Nuthakki 103a4a0ee1 MIFOSX-1421 : corrected remove installment charge and add a new installment charge issues 2014-08-08 10:35:42 +05:30
Vishwas Babu A J 0ef30f4124 Merge pull request #1025 from vorburger/ImprovedTravisGradleConsoleLog
Improved the logging of test failures on TravisCI
2014-08-07 17:51:52 -07:00
Vishwas Babu A J 6fc9a99945 Merge pull request #1043 from pramodn02/develop
MIFOSX-1421 : corrected interest calculation for different interest comp...
2014-08-07 15:11:09 -07:00
Pramod Nuthakki 15c4668583 MIFOSX-1421 : corrected interest calculation for different interest compounding types and corrected installment charges 2014-08-08 03:37:19 +05:30
Vishwas Babu A J fca9659de7 Merge pull request #1010 from Musoni/MIFOSX-1429
#MIFOSX-1429 - Loans incorrectly classified as NPA
2014-08-06 03:05:32 -07:00
Vishwas Babu A J a90bfada78 Merge pull request #1042 from rishy/Batch-API
extended API-docs and exceptions in Batch API
2014-08-06 03:03:13 -07:00
rishy 34324ab1d6 extended API-docs and exceptions in Batch API 2014-08-06 15:11:21 +05:30
Vishwas Babu A J 21ce356d88 Merging Binny's code around MIFOSX-1468 2014-08-06 02:37:53 -07:00
Vishwas Babu A J 0af62967a7 Merge branch 'binnygopinath-staffjoiningdate' into develop 2014-08-06 02:14:45 -07:00
Vishwas Babu A J 4fd78b9f0e Merge branch 'staffjoiningdate' of git://github.com/binnygopinath/mifosx into binnygopinath-staffjoiningdate 2014-08-06 02:14:11 -07:00
Vishwas Babu A J 98cc90b696 Merge pull request #1040 from pramodn02/develop
MIFOSX-1421 : corrected loan charges
2014-08-05 22:59:18 -07:00
Pramod Nuthakki 482b7aa714 MIFOSX-1421 : corrected loan charges 2014-08-06 11:19:08 +05:30
Vishwas Babu A J 80146f9565 Merge pull request #1039 from pramodn02/develop
MIFOSX-1421 : loan recalculation changes
2014-08-05 17:12:31 -07:00
Pramod Nuthakki fd3a401821 MIFOSX-1421 : loan recalculation changes 2014-08-06 02:10:08 +05:30
Vishwas Babu A J 817794b26b Merge pull request #1038 from vishwasbabu/develop
updating contributor licence
2014-08-05 00:03:31 -07:00
Vishwas Babu A J 18f70dbc2e updating contributor licence 2014-08-05 00:02:20 -07:00
Vishwas Babu A J e3e5b0a97b Merge pull request #1037 from vishwasbabu/develop
applying licence for all files
2014-08-04 23:41:28 -07:00
Vishwas Babu A J 54765a915f applying licence for all files 2014-08-04 23:33:07 -07:00
Binny G Sreevas 1a747ab1c0 MIFOSX-1468 - Added field 'Joining Date' for Staff 2014-08-03 14:01:38 +05:30
Vishwas Babu A J 4d73189a63 Merge pull request #1035 from lingalamadhukar/MIFOSX-1419
MIFOSX-1325 Attach a group to center
2014-07-31 17:34:27 -07:00
Madhukar b2769ff21b MIFOSX-1325 Attach a group to center 2014-08-01 04:37:57 +05:30
Vishwas Babu A J 4dc7581972 Update Contributing.md
with verbiage changes
2014-07-30 23:58:33 -07:00
Vishwas Babu A J 4d4f96567e Update Contributing.md
with bullets for better readability
2014-07-30 23:52:28 -07:00
Vishwas Babu A J ce4ec8d035 Merge pull request #1034 from vishwasbabu/develop
adding Contributor checklist
2014-07-30 23:49:13 -07:00
Vishwas Babu A J 0ab49e72e0 adding Contributor checklist 2014-07-30 23:48:47 -07:00
Vishwas Babu A J c05022f692 Merge pull request #1029 from cgninan/MIFOSX-1456
MIFOSX-1456 - Wrong Field Name in saveCollectionSheet Command Response
2014-07-30 17:37:03 -07:00
Vishwas Babu A J fca0404019 Merge pull request #1031 from rishy/Batch-API
added client activation, loan approval and loan disbursal commands
2014-07-30 17:36:25 -07:00
Vishwas Babu A J 4664220769 Merge pull request #1033 from lingalamadhukar/MIFOSX-1420
MIFOSX-1419,MIFOSX-1420 Interest recalculation crud operations
2014-07-30 17:35:42 -07:00
CieyouRaoul 54ad317227 added support for summittedon_date in saving & loan transaction 2014-07-30 12:49:46 +02:00
Madhukar 5ead31ae9b MIFOSX-1419,MIFOSX-1420 Interest recalculation crud operations
MIFOSX-1419 Update recalculation terms with product update

MIFOSX-1419 Adding calendar for interest recalculation

MIFOSX-1419 API docs and test case updates
2014-07-29 16:08:32 +05:30
rishy ffbff972be added client activation, loan approval and loan disbursal commands 2014-07-29 12:56:27 +05:30
Vishwas Babu A J c26381d594 Merge pull request #1028 from pramodn02/develop
MIFOSX-1422 : added number of days  configuration for loan schedule
2014-07-22 12:52:11 -07:00
Christy Ninan 41b62af4db MIFOSX-1456 - Wrong Field Name in saveCollectionSheet Command Response 2014-07-22 10:59:47 -05:00
Pramod Nuthakki 0cd593d145 MIFOSX-1422 : added number of days configuration for loan schedule 2014-07-22 12:50:29 +05:30
Vishwas Babu A J b758e88a4e Merge pull request #1020 from okelekemike/develop
MIFOSX-1315 Global search should also search for saving account number a...
2014-07-21 21:36:53 -07:00
Vishwas Babu A J 227dd05ff2 Merge pull request #1023 from Musoni/MIFOSX-1453
MIFOSX-1453 done
2014-07-21 18:27:55 -07:00
Vishwas Babu A J e237a3a70e Merge pull request #1021 from lingalamadhukar/MIFOSX-1408
MIFOSX-1408 Inactivate savings charges
2014-07-21 18:24:04 -07:00
Vishwas Babu A J 72e8b11d57 Merge pull request #1012 from lingalamadhukar/MIFOSX-1368
MIFOSX-1368 RBI strategy excess repayments not repid properly
2014-07-21 18:22:54 -07:00
Vishwas Babu A J a2aea2da22 Merge pull request #1022 from lingalamadhukar/MIFOSX-1426
MIFOSX-1446,MIFOSX-1445,MIFOSX-1426
2014-07-21 18:20:11 -07:00
Michael Vorburger cd3e26f817 Fixed 'Not an managed type:' for JPA @Entity on CLI Gradle tests (PLEASE REVIEW - ok?) 2014-07-22 01:22:06 +02:00
Michael Vorburger f4483ab240 Merge branch 'ImprovedTravisGradleConsoleLog' into SpringConfigurationTest 2014-07-22 00:49:10 +02:00
Michael Vorburger 5db84b4470 Improved the logging of test failures on TravisCI 2014-07-22 00:36:55 +02:00
Michael Vorburger c30398d84a New SpringConfigurationTest; the first @RunWith(SpringJUnit4ClassRunner)
@ContextConfiguration in Mifos X. More of it to come - stay tuned.

Signed-off-by: Michael Vorburger <mike@vorburger.ch>
2014-07-21 23:28:08 +02:00
andrew-dzak 1d3e1fd60b MIFOSX-1453 done 2014-07-21 17:52:29 +03:00
Madhukar b8b5d91bc2 MIFOSX-1446,MIFOSX-1445,MIFOSX-1426 2014-07-21 10:34:15 +05:30
Madhukar 41bed0aace MIFOSX-1408 Inactivate savings charges 2014-07-19 14:08:05 +05:30
Vishwas Babu A J d45270c413 Merge pull request #1019 from cgninan/MIFOSX-1395
MIFOSX-1395 - Add Loan/Savings Product Short Name in ClientAccounts Resp...
2014-07-18 19:12:06 -07:00
Christy Ninan 5b909305c2 MIFOSX-1395 - Add Loan/Savings Product Short Name in ClientAccounts Response 2014-07-18 11:59:27 -05:00
okelekemike f4547c26d8 MIFOSX-1315 Global search should also search for saving account number and external_id fields 2014-07-18 09:28:01 +01:00
Vishwas Babu A J 3f35a3e4cf Merge pull request #906 from vorburger/SpringMajorJUnitMinorVersionsBump
bumped Spring major version 3.2.5 -> 4.0.4 (+ JUnit 4.10->4.11)
2014-07-17 16:41:19 -07:00
Vishwas Babu A J 241a02bf0f Merge pull request #1017 from rishy/Batch-API
bug fixes, added api docs for Batch API and Client activation command
2014-07-17 09:12:30 -07:00
Vishwas Babu A J e3d4f08a7f Merge pull request #1018 from pramodn02/develop
MIFOSX-1417 - corrected accruedTill date internally for calculations
2014-07-17 09:11:27 -07:00
Pramod Nuthakki 456e30bf41 MIFOSX-1417 - corrected accruedTill date internally for calculations 2014-07-17 19:04:24 +05:30
rishy 747305cfc9 api docs for Batch API, added Client activation command 2014-07-17 12:21:51 +05:30
Vishwas Babu A J c77b4573b6 Merge pull request #1015 from pramodn02/develop
MIFOSX-1416,MIFOSX-1417 : Periodic accrual changes
2014-07-16 17:23:00 -07:00
Vishwas Babu A J 95afc0238d Merge pull request #1013 from lingalamadhukar/MIFOSX-1411
MIFOSX-1411 Fix for RD Withdrawal template
2014-07-16 15:54:34 -07:00
Vishwas Babu A J 65fa4d33df Merge pull request #1016 from chandrikamohith/MIFOSX-1289epic
MIFOSX-1289 MIFOSX-1290 MIFOSX-1291 Spelling mistake and capitalization ...
2014-07-16 15:40:40 -07:00
Vishwas Babu A J 348c850087 Merge pull request #1001 from rishy/Batch-API
added create and collect charges command
2014-07-16 15:39:17 -07:00
Vishwas Babu A J 6cdd3322de Merge pull request #1007 from lingalamadhukar/MIFOSX-1403
MIFOSX-1424 and api-docs update for close savings account
2014-07-16 15:35:43 -07:00
Chandrika 40665f0b66 MIFOSX-1289 MIFOSX-1290 MIFOSX-1291 Spelling mistake and capitalization done for options under Charge time type dropdown 2014-07-16 15:04:42 +05:30
Pramod Nuthakki 4051afd583 MIFOSX-1417 : added api to run periodic accrules till specific date 2014-07-15 21:45:55 +05:30
Pramod Nuthakki 40b005cbfa MIFOSX-1416 : added batch job for periodic accrual 2014-07-15 21:45:50 +05:30
Madhukar bd6fd35a20 MIFOSX-1411 Fix for RD Withdrawal template 2014-07-15 14:58:16 +05:30
Vishwas Babu A J ec7b7c0fd6 merging Michael's pull requests around MIFOSX-1184 2014-07-15 00:49:29 -07:00
Madhukar 1ff83bd7e8 MIFOSX-1368 RBI strategy excess repayments not repid properly 2014-07-14 23:49:13 +05:30
Vishwas Babu A J c25805a804 Merge pull request #1005 from pramodn02/develop
MIFOSX-1415 : Modified loan to capture last accrued date
2014-07-12 23:28:45 -07:00
Vishwas Babu A J b5f7cc5f22 Merge pull request #1008 from lingalamadhukar/develop
Updating AMI for 1.24 release
2014-07-12 23:27:26 -07:00
Sander van der Heyden af86c1727f #MIFOSX-1429 - Loans incorrectly classified as NPA 2014-07-11 12:05:09 +02:00
Madhukar d9e1ba8139 Updating AMI for 1.24 release 2014-07-11 11:05:58 +05:30
Vishwas Babu A J 6df0c28df6 Update CHANGELOG.md 2014-07-10 19:14:16 -07:00
Vishwas Babu A J 64b142f478 update sample data for 1.24 release 2014-07-10 18:39:09 -07:00
Vishwas Babu A J f0f2583959 Update CHANGELOG.md
with a few more issues foxed for 1.24 release
2014-07-10 14:50:54 -07:00
Madhukar a6c463d525 MIFOSX-1424 and api-docs update for close savings account 2014-07-10 21:50:18 +05:30
rishy eac581c48b added create and collect charges Command and support for nested dependencies 2014-07-10 14:21:34 +05:30
Vishwas Babu A J e3658a5a8f Merge pull request #1006 from lingalamadhukar/MIFOSX-1403
MIFOSX-1398 update api-docs and fix jenkins issues
2014-07-10 00:50:40 -07:00
Madhukar 14989c0ccf MIFOSX-1398 update api-docs and fix jenkins issues 2014-07-10 12:32:13 +05:30
Vishwas Babu A J 8edcaf934e Merge pull request #1003 from lingalamadhukar/MIFOSX-1403
MIFOSX-1398,MIFOSX-1403
2014-07-09 20:17:06 -07:00
Pramod Nuthakki 7ebabc10f6 MIFOSX-1415 : Modified loan to capture last accrued date 2014-07-09 23:10:12 +05:30
CieyouRaoul cb4a249958 abillity to modify client submission date 2014-07-09 15:32:33 +02:00
Madhukar 9599c1197a MIFOSX-1398,MIFOSX-1403 2014-07-09 16:33:46 +05:30
Vishwas Babu A J 3c8a9c232d Merge pull request #1002 from vishwasbabu/develop
updating properties for 1.24 release
2014-07-09 02:33:04 -07:00
Vishwas Babu A J ae1cbf371e updating properties for 1.24 release 2014-07-09 02:31:52 -07:00
Vishwas Babu A J 24fb2d489d Update CHANGELOG.md
for 1.24.o Release
2014-07-09 01:51:54 -07:00
Vishwas Babu A J 21db526584 Merge pull request #1000 from lingalamadhukar/MIFOSX-1358
MIFOSX-1394 overdraft account interest calculation fix
2014-07-06 21:20:55 -07:00
Madhukar 0389bde94e MIFOSX-1394 overdraft account interest calculation fix 2014-07-04 11:38:20 +05:30
Vishwas Babu A J 958c27c443 Merge pull request #998 from lingalamadhukar/MIFOSX-1396
MIFOSX-1396 Delete code displaying dataintegration issue
2014-07-03 15:04:59 -07:00
Vishwas Babu A J 6745cf6280 Merge pull request #999 from vishwasbabu/develop
Cleaning up inconsistencies in ClientDataValidator.java
2014-07-03 11:35:08 -07:00
Vishwas Babu A J 38481b03cf Cleaning up inconsistencies in ClientDataValidator.java 2014-07-03 11:33:24 -07:00
Vishwas Babu A J 530301cc59 Merge pull request #990 from Musoni/MIFOSX-1379
allow null value for loanProduct principal
2014-07-03 11:16:59 -07:00
Madhukar 5cfc7e85c5 MIFOSX-1396 Delete code displaying dataintegration issue 2014-07-03 12:11:03 +05:30
Vishwas Babu A J ef7c7c15a3 Merge pull request #994 from Musoni/MFISOX-1401
fixed inArrearsTolerance validation , make it allows value 0
2014-07-02 14:49:22 -07:00
Vishwas Babu A J a30f46f5d8 Merge pull request #996 from vishwasbabu/develop
cleaning up MIFOSX-1399
2014-07-02 14:47:14 -07:00
Vishwas Babu A J 6a14031ac3 cleaning up MIFOSX-1399 2014-07-02 14:46:25 -07:00
Vishwas Babu A J 78284b8115 Merge pull request #992 from Musoni/MIFOSX-1399
fix adding new guaraton to loan account having existing guarantor
2014-07-02 14:38:38 -07:00
CieyouRaoul b385a95a30 fixed inArrearsTolerance validation , make it allows value 0 2014-07-02 14:15:07 +02:00
CieyouRaoul 7c76541a2d fix adding new guaraton to loan account having existing guarantor 2014-07-02 12:16:52 +02:00
CieyouRaoul 3c97fccee8 allow null value for loanProduct principal 2014-07-02 10:39:49 +02:00
Vishwas Babu A J b4c3e8be64 update api-docs for MIFOSX-1161 2014-07-01 19:20:28 -07:00
Vishwas Babu A J 83ae893088 Merge pull request #987 from vishwasbabu/develop
MIFOSX-1161 clean ups
2014-07-01 19:07:48 -07:00
Vishwas Babu A J b0df80e2a2 MIFOSX-1161 clean ups 2014-07-01 19:06:30 -07:00
Vishwas Babu A J 1b60601664 Merge pull request #986 from lingalamadhukar/MIFOSX-1358
MIFOSX-1275 refactoring endpoint of standinginstruction history
2014-07-01 13:12:49 -07:00
Madhukar 4975a59b7e MIFOSX-1275 refactoring endpoint of standinginstruction history 2014-07-01 15:11:21 +05:30
Vishwas Babu A J 342a0edc24 merging Mardukars work arounf standing instructions 2014-06-30 18:28:26 -07:00
Vishwas Babu A J 85207ae273 Merge pull request #983 from pramodn02/develop
MIFOSX-1392 : changes for minBalanceForInterestCalculation
2014-06-30 15:33:14 -07:00
Madhukar 07c39d49af MIFOSX-1389, MIFOSX-1275 Adding apidocs 2014-07-01 02:44:36 +05:30
Pramod Nuthakki 55ef6628c1 MIFOSX-1392 : changes for minBalanceForInterestCalculation 2014-06-30 23:54:48 +05:30
Vishwas Babu A J b2bf8cbe95 fix test failures 2014-06-27 01:08:16 -07:00
Vishwas Babu A J ffb5dc3715 Merging @rainerhessmer changes around MIFOSX-1161 2014-06-26 23:42:34 -07:00
Vishwas Babu A J 3ac3a0ff5f Merge pull request #982 from vishwasbabu/develop
updating documentation for MIFOSX-1324
2014-06-26 23:21:08 -07:00
Vishwas Babu A J 5a06119811 Merge pull request #981 from pramodn02/develop
MIFOSX-1275 : added table to maintain execution history of standing inst...
2014-06-26 23:02:36 -07:00
Pramod Nuthakki f51cf6f4fe MIFOSX-1275 : added table to maintain execution history of standing instructions 2014-06-27 11:16:28 +05:30
Vishwas Babu A J 44a235d329 updating documentation for MIFOSX-1324 2014-06-26 19:50:55 -07:00
Vishwas Babu A J b852af14d3 Merge pull request #979 from lingalamadhukar/MIFOSX-1358
Update Install.md
2014-06-26 13:25:35 -07:00
Vishwas Babu A J 1e89de1807 Merge pull request #980 from rishy/Batch-API
added ApplySavings command in Batch-API
2014-06-26 13:24:30 -07:00
rishy ef43647a10 added ApplySavings command 2014-06-26 17:51:36 +05:30
Madhukar 16fc259540 Update Install.md 2014-06-26 15:34:37 +05:30
Vishwas Babu A J 45a372944c Merge pull request #978 from lingalamadhukar/MIFOSX-1358
MIFOSX-1358,MIFOSX-1357
2014-06-25 20:42:42 -07:00
Madhukar fc2d90db7b MIFOSX-1358,MIFOSX-1357 2014-06-26 08:12:10 +05:30
Vishwas Babu A J 1eff0f138e Update INSTALL.md
with details of right version of JDK
2014-06-25 16:45:37 -07:00
Vishwas Babu A J b1cf0b5e59 removing warnings after upgrade to java 7 2014-06-25 16:42:23 -07:00
Vishwas Babu A J 722aceccc7 Merge pull request #977 from pramodn02/develop
MIFOSX-1157 : updated API doc for RD accounts
2014-06-25 11:53:06 -07:00
Pramod Nuthakki 0e62a7de81 MIFOSX-1157 : updated API doc for RD accounts 2014-06-26 00:17:26 +05:30
Vishwas Babu A J 06448ccb54 Merge pull request #976 from lingalamadhukar/MIFOSX-1235
MIFOSX-1369 and update groupnamesbystaff report to core report
2014-06-25 08:51:17 -07:00
Madhukar 5481d2033a MIFOSX-1369 and update groupnamesbystaff report to core report 2014-06-25 12:50:50 +05:30
Vishwas Babu A J cdd724f601 Merge pull request #975 from pramodn02/MIFOSX-1359
MIFOSX-1359 : refactored savings write services
2014-06-25 00:02:28 -07:00
Pramod Nuthakki c0b92c97af MIFOSX-1359 : refactored savings write services 2014-06-25 12:25:01 +05:30
Vishwas Babu A J 2e9604c126 Merge pull request #973 from pramodn02/MIFOSX-1340
MIFOSX-1340 : corrected schedule generator to use calendar instance
2014-06-24 21:26:56 -07:00
Vishwas Babu A J 81e847aada Merge pull request #974 from lingalamadhukar/MIFOSX-1235
MIFOSX-1235,MIFOSX-1365,MIFSOX-1204
2014-06-24 21:26:02 -07:00
Vishwas Babu A J 5664ac3f98 Update INSTALL.md 2014-06-24 18:07:27 -07:00
Vishwas Babu A J b5ed7fecf7 Update INSTALL.md
with amazon image details
2014-06-24 18:05:54 -07:00
Pramod Nuthakki 5474e87227 MIFOSX-1340 : corrected schedule generator to use calendar instance 2014-06-24 23:51:10 +05:30
Madhukar 2d7b1d9cf4 MIFOSX-1235,MIFOSX-1365,MIFSOX-1204 2014-06-24 23:42:09 +05:30
Vishwas Babu A J 5ae0e0f62c Merge pull request #972 from rishy/Batch-API
fixed integration tests in BatchApiTest
2014-06-24 11:01:33 -07:00
rishy fc0bb3897d fixed integration tests in BatchApiTest 2014-06-24 23:28:16 +05:30
Vishwas Babu A J cb52335e23 Merge pull request #971 from pramodn02/MIFOSX-1339
MIFOSX-1339 : removed reinvest option for premature close
2014-06-24 10:11:40 -07:00
Vishwas Babu A J d67bf61d1c Merge pull request #970 from pramodn02/MIFOSX-1341
MIFOSX-1341 : added deposit type in savings data
2014-06-24 10:05:25 -07:00
Pramod Nuthakki da20683715 MIFOSX-1339 : removed reinvest option for premature close 2014-06-24 22:11:20 +05:30
Pramod Nuthakki 0d2abd3b60 MIFOSX-1341 : added deposit type in savings data 2014-06-24 21:24:47 +05:30
Vishwas Babu A J d1575d9cbb Merge pull request #968 from rishy/Batch-API
added "UpdateClient" and "ApplyLoan" commands with dependency resolution
2014-06-23 15:16:39 -07:00
Vishwas Babu A J 3aa3699eaa Merge pull request #969 from pramodn02/MIFOSX-1353
MIFOSX-1353 : corrected monthly charge calculation
2014-06-23 15:12:22 -07:00
Pramod Nuthakki a152cb6698 MIFOSX-1353 : corrected monthly charge calculation 2014-06-23 23:59:51 +05:30
rishy 0fd87bf951 added updateClient and ApplyLoan commands with dependency resolution 2014-06-23 23:40:23 +05:30
Vishwas Babu A J a2ba251b83 Merge pull request #967 from vishwasbabu/Nayan-MIFOSX-12352
Nayan mifosx 12352
2014-06-22 15:08:33 -07:00
Vishwas Babu A J 199dbfd417 merge Nayan's work around weekly charges 2014-06-22 15:04:47 -07:00
Vishwas Babu A J 01c05abad6 Merge pull request #932 from rishy/Batch-API
Batch-API added with 'Create Client Command' and transaction scope
2014-06-21 22:45:35 -07:00
blingdahlandVishwas Babu A J f9dfd409db Also adds an output parameter to allow viewing images directly in the browser (values octet to download as an attachment, and inline_octet to view inline) 2014-06-21 22:32:58 -07:00
Vishwas Babu A J c2c2f65c13 Merge pull request #966 from vishwasbabu/develop
MIFOSX-1364
2014-06-20 02:11:51 -07:00
Vishwas Babu A J 43a3359ac2 MIFOSX-1364 2014-06-20 02:11:05 -07:00
Vishwas Babu A J e0e4b1db43 Merge pull request #965 from vishwasbabu/develop
renaming a couple of methods for better readability in SavingsAccountCha...
2014-06-19 20:48:25 -07:00
Vishwas Babu A J f23a0cb18b renaming a couple of methods for better readability in SavingsAccountCharge.java 2014-06-19 20:46:51 -07:00
Vishwas Babu A J 60e2af384b Update INSTALL.md
with details of amazon image
2014-06-19 20:03:11 -07:00
Vishwas Babu A J 722e657ea9 Merge pull request #964 from pramodn02/MIFOSX-1200
added Override method for getEffectiveInterestRateAsFraction
2014-06-18 20:44:06 -07:00
Vishwas Babu A J 4e84934110 Merge pull request #963 from lingalamadhukar/MIFOSX-1349
MIFOSX-1351,MIFOSX-1349
2014-06-18 20:43:33 -07:00
Vishwas Babu A J f7204f3905 Merge pull request #962 from pramodn02/MIFOSX-1272
MIFOSX-1272 : added recalculation of charges for diff disburse amount
2014-06-18 14:07:42 -07:00
Pramod Nuthakki c26bac92d8 added Override method for getEffectiveInterestRateAsFraction 2014-06-18 17:16:25 +05:30
Madhukar 8a4fa86f03 MIFOSX-1351,MIFOSX-1349 2014-06-18 15:41:58 +05:30
Pramod Nuthakki 9c9c91b44a MIFOSX-1272 : added recalculation of charges for diff disburse amount 2014-06-18 13:19:15 +05:30
Vishwas Babu A J 9aa9473c8c Update CHANGELOG.md
for 1.23.1. Release
2014-06-18 00:17:24 -07:00
Vishwas Babu A J 9126e40ddc updates for 1.23.1 release 2014-06-17 23:17:51 -07:00
Vishwas Babu A J 48baa127d4 Merge pull request #961 from pramodn02/MIFOSX-1336
Mifosx 1336
2014-06-17 17:52:21 -07:00
Pramod Nuthakki 1f07da18d4 added junit test cases 2014-06-17 23:27:37 +05:30
Pramod Nuthakki b66e289df8 MIFOSX-1336 - updated scale values for money with multiples of roundoff 2014-06-17 16:03:34 +05:30
Vishwas Babu A J fcaad335f0 Merge pull request #960 from openMF/develop
Update CHANGELOG.md
2014-06-17 01:22:07 -07:00
Vishwas Babu A J 58d4458515 Update CHANGELOG.md
and fix typos
2014-06-17 01:21:06 -07:00
Vishwas Babu A J 7ad0a6c71b Merge pull request #959 from lingalamadhukar/MIFOSX-1247
MIFOSX-1317 test case fix
2014-06-17 00:46:15 -07:00
Madhukar 17d96ae8a6 MIFOSX-1317 test case fix 2014-06-17 13:09:54 +05:30
Vishwas Babu A J a01d243078 Update CHANGELOG.md
with details of fixes for 1.23 release
2014-06-16 22:12:28 -07:00
Vishwas Babu A J 46b653e387 merging pramods changes around rd and fd 2014-06-16 21:52:23 -07:00
Vishwas Babu A J e0fd3d0fe7 Merge pull request #958 from vishwasbabu/develop
more fixes to account transfers test cases
2014-06-16 21:37:59 -07:00
Vishwas Babu A J ccb98baf5f more fixes to account transfers test cases 2014-06-16 21:36:40 -07:00
Vishwas Babu A J f7254fc660 Merge pull request #957 from vishwasbabu/develop
fix validations for financial activity accounts test
2014-06-16 18:40:20 -07:00
Vishwas Babu A J e8de3cbecc fix validations for financial activity accounts test 2014-06-16 18:39:34 -07:00
Vishwas Babu A J 632855d896 Merge pull request #956 from vishwasbabu/develop
more fixes to account transfer test cases
2014-06-16 18:20:05 -07:00
Vishwas Babu A J fb5398e83b more fixes to account transfer test cases 2014-06-16 18:18:15 -07:00
Vishwas Babu A J 97a88e1d1e Merge pull request #955 from vishwasbabu/develop
modifying test cases for account transfers
2014-06-16 18:04:11 -07:00
Vishwas Babu A J 2a60b05bf6 modifying test cases for account transfers 2014-06-16 18:02:26 -07:00
Vishwas Babu A J c8fccc51ad Update CHANGELOG.md 2014-06-16 17:34:14 -07:00
Vishwas Babu A J 67a7570412 Merge pull request #954 from vishwasbabu/develop
Develop
2014-06-16 17:16:09 -07:00
Vishwas Babu A J f4e47cc013 fixing failing test cases and updating documentation for account transfers 2014-06-16 17:14:31 -07:00
Vishwas Babu A J 3eb0b46a89 Merge pull request #953 from vishwasbabu/develop
updating test cases for financial activity accounts and accounts transfe...
2014-06-16 16:34:36 -07:00
Vishwas Babu A J c6d39fa737 updating test cases for financial activity accounts and accounts transfers 2014-06-16 16:33:07 -07:00
Vishwas Babu A J a031463930 Merge pull request #952 from vishwasbabu/develop
update default account for tracking inter branch transfers
2014-06-16 13:09:48 -07:00
Vishwas Babu A J 5ef940627c update default account for tracking inter branch transfers 2014-06-16 13:08:37 -07:00
Vishwas Babu A J 469f871756 Merge pull request #951 from lingalamadhukar/MIFOSX-1247
MIFOSX-1343, format api-docs of standing instructions, account transfers
2014-06-16 12:14:02 -07:00
Madhukar d04f2757e2 MIFOSX-1343, format api-docs of standing instructions, account transfers 2014-06-17 00:34:53 +05:30
goutham-M 602f0bdb07 Weekly saving charges 2014-06-16 19:02:07 +05:30
Vishwas Babu A J d7399cc6e5 Merge pull request #949 from vishwasbabu/develop
Rewriting Financial Activity Account Mapping
2014-06-16 01:31:01 -07:00
Vishwas Babu A J 80439d6e6d Rewriting Financial Activity Account Mapping 2014-06-16 01:28:04 -07:00
rainerh 7f5ff5780f MIFOSX-1161: Enforce minRequiredBalance 2014-06-14 12:06:24 -07:00
rainerh 2aa8b89d65 MIFOSX-1161: Adding new properties
Adding fields minRequiredBalance and allowOverdraftMinBalance to
SavingsProduct and SavingsAccount. No enforcement yet.
2014-06-13 17:15:16 -07:00
rishy 317363de11 Batch-API added with CreateClientCommand and transaction scope 2014-06-14 00:16:01 +05:30
Vishwas Babu A J e820d4ae00 Merge pull request #946 from lingalamadhukar/MIFOSX-1267
MIFOSX-1317 Premature Interest Calculation Fix
2014-06-13 10:50:38 -07:00
Pramod Nuthakki 63173c0de0 MIFOSX-1335,MIFOSX-1300 - corrected FD and RD related issues 2014-06-13 23:10:09 +05:30
Madhukar 9035063dc2 Interest calculation bug fix 2014-06-12 20:22:11 +05:30
Vishwas Babu A J baeab1f7c8 Merge pull request #945 from pramodn02/latest
MIFOSX-1313 : client incentive code cleanup
2014-06-12 04:58:18 -07:00
Pramod Nuthakki 71505edbc5 MIFOSX-1313 : client incentive code cleanup 2014-06-12 14:22:51 +05:30
Vishwas Babu A J 06efcb73c9 updates to finanacial activity to account mapping api's 2014-06-11 13:36:03 -07:00
Vishwas Babu A J c2d94f2976 update sample data for 1.23 release 2014-06-11 10:21:41 -07:00
Vishwas Babu A J dbde081057 Update CHANGELOG.md
for 1.23 release
2014-06-11 09:38:00 -07:00
Vishwas Babu A J caad86ac65 updating details of 1.23 release 2014-06-11 09:01:09 -07:00
Vishwas Babu A J e1a8c8a371 Update CHANGELOG.md
for 1.23 release
2014-06-11 08:44:45 -07:00
Vishwas Babu A J 2885cc0864 Merge pull request #944 from lingalamadhukar/MIFOSX-1267
MIFOSX-1318,MIFOSX-1314,MIFOSX-1300,MIFOSX-1242,MIFOSX-1199
2014-06-11 07:08:51 -07:00
Madhukar e09162f5e2 MIFOSX-1318,MIFOSX-1314,MIFOSX-1300,MIFOSX-1242,MIFOSX-1199 2014-06-11 19:24:33 +05:30
Vishwas Babu A J c89699c9df minor cleanups 2014-06-10 23:16:10 -07:00
Vishwas Babu A J 6cc6d03785 Merge pull request #940 from juniormonkey/develop
MIFOSX-1302: A new exception when a currency that is still in use is set to be deleted.
2014-06-10 16:57:01 -07:00
Martin Strauss 54b60fdcd0 Fix MIFOSX-1302: Throw a CurrencyInUseException whenever a currency is requested for deletion that is still in use by a charge, a loan or a savings product. 2014-06-10 15:37:42 -07:00
Martin Strauss a450829b94 Throw a CurrencyInUseException when a currency is being deleted that is still in use. 2014-06-10 15:36:50 -07:00
Michael Vorburger ece576e275 Fixed startup error following upgrade (spring-security-3.2.xsd) 2014-05-12 03:17:36 +02:00
Michael Vorburger 1db61882a8 bumped Spring major version 3.2.5 -> 4.0.4 (+ JUnit 4.10->4.11) 2014-05-12 00:17:51 +02:00
Michael Vorburger 37710750eb ClassMethodNamesPair for CronMethodParser instead of CLASS_INDEX /
METHOD_INDEX
2014-05-11 02:27:24 +02:00
Michael Vorburger f194867c15 SchedulerTriggerListener really should just be normally injected, like
everything else; it's an anti pattern to directly use
applicationContext, unless there is a specific good reason for it.
2014-05-11 02:27:23 +02:00
Michael Vorburger 226439bef1 MIFOSX-1184 FIXED JobRegisterServiceImpl <-> SchedulerStopListener
circular bean dependency
2014-05-11 01:48:49 +02:00
Michael Vorburger d33c16e594 Just some clean-up to see more clearly - this should not change
anything. PLEASE CAREFULLY CODE REVIEW NEVERTHELESS.
2014-05-11 01:16:45 +02:00
Michael Vorburger e6ac1213f7 Correct space-instead-tab and one-line formatting for new log. 2014-05-11 00:37:58 +02:00
1332 changed files with 49233 additions and 9879 deletions
Executable
BIN
View File
Binary file not shown.
+5
View File
@@ -4,3 +4,8 @@ jdk:
script: ./travis_build.sh
notifications:
email: true
# This is so that the Gradle output is readable on the Travis web console
# @see http://stackoverflow.com/questions/17942819/how-can-i-get-clean-gradle-output-on-travis-ci
# @see http://gradle.1045684.n5.nabble.com/Plain-console-output-td5710237.html
env:
- TERM=dumb
+269
View File
@@ -6,6 +6,11 @@ See VERSIONING (https://github.com/openMF/mifosx/blob/master/VERSIONING.md) for
Releases
===============
1. 1 Nov 2014 - 1.25.1.RELEASE
1. 12 Oct 2014 - 1.25.0.RELEASE
1. 10 Jul 2014 - 1.24.0.RELEASE
1. 16 Jun 2014 - 1.23.1.RELEASE
1. 15 Jun 2014 - 1.23.0.RELEASE
1. 30 Apr 2014 - 1.22.0.RELEASE
1. 30 Mar 2014 - 1.21.0.RELEASE
1. 18 Mar 2014 - 1.20.1.RELEASE
@@ -63,6 +68,270 @@ Releases
1. 05 April 2013 - 0.11.1.beta
1. 05 April 2013 - 0.11.0.beta
1.25.1.RELEASE
=============
Bug Release
Platform & API
New Features & Improvements
- [MIFOSX-1466] - Savings interest posting - Should be flexible
- [MIFOSX-1632] - Fine tuning of Accrual transactions with interest recalculation
Bugs
- [MIFOSX-1586] - Applying overdue charge for a loan with interest recalculation causes the application to create multiple schedules for the same loan account
- [MIFOSX-1589] - Support for Charge and interest waivers with Accrual accounting
- [MIFOSX-1595] - Periodic accrual is posting wrong interest when run multiple times in a repayment period
- [MIFOSX-1606] - Closing savings account throws null pointer exception
- [MIFOSX-1608] - Rounding issue in periodic accrual for loan accounts with Decimal Place as Zero.
- [MIFOSX-1612] - If a loan disbursal is undone, then the journal entries created for the accrued interest on that loan is not being reversed.
- [MIFOSX-1631] - Not able to disburse loan with installment fees attached
Community App
- [MIFOSX-1626] - Pagination Issue in Audit Trails Search
- [MIFOSX-1604] - Community app always uploads signature to the "default" tenant, similar issues exists with loan documents
1.25.0.RELEASE
=============
This feature release ships various enhancements like interest recalculation for loans with configurable rest definitions and compounding options, point in time accruals, improved pre-payment functionality, batching API calls and support for Hooks along with a number of updates to the Community app and bug fixes.
New Features & Improvements
- [MIFOSX-580] - Add support for 'pure' declining balance
- [MIFOSX-1442] - Support for Webhooks
- [MIFOSX-1188] - GSOC Project: Batch API
- [MIFOSX-1420] - Add pre-payment functionality
- [MIFOSX-1537] - Add display of original Schedule for interest recalculation
- [MIFOSX-1526] - Add future installments display for interest first repayment strategies
- [MIFOSX-1416] - Add batch jobs to run accruals with specific periodicity
- [MIFOSX-1417] - Add API to add accrual transactions till specified date
- [MIFOSX-1418] - Recalculate and adjust accruals for back dated entries
- [MIFOSX-1252] - Add API's for assigning and unassigning Staff for savings account (along with tracking assignment history similar to loans)
- [MIFOSX-1265] - Ability to capture "External ID" for Savings account
- [MIFOSX-1315] - Global search should search for saving account number and external id fields
- [MIFOSX-1395] - Add Loan/Savings Product Short Name in ClientAccounts Response
- [MIFOSX-1397] - Added Submitted date on loan transaction and saving transaction
- [MIFOSX-1400] - User should be able to modify client submission date
- [MIFOSX-1415] - Modify loan and Add Accrual Transactions batch job to capture last accrued date
- [MIFOSX-1468] - Add a "joining date" field for staff
- [MIFOSX-1522] - Add loan running balance to transactions
- [MIFOSX-1470] - Increase column length to 200 for COA name field
- [MIFOSX-1434] - Populate Submitted On date for Create Client with default date as current date
Bugs
- [MIFOSX-1145] - Update data table throws "Data truncation: Invalid use of NULL value" SQL error
- [MIFOSX-1424] - Opening and closing of Overdraft account
- [MIFOSX-1184] - BeanCurrentlyInCreationException: Error creating bean with name 'schedulerStopListener': Requested bean is currently in creation: Is there an unresolvable circular reference?
- [MIFOSX-1291] - Overdue Fees
- [MIFOSX-1368] - In Loans excess repayment is not getting repaid properly if Repayment Strategy is RBI
- [MIFOSX-1410] - Should not allow to close Client with -ve account balance (Overdraft account)
- [MIFOSX-1411] - Withdraw of amount in RD account results in null point exception
- [MIFOSX-1426] - Issues related to Loan Collaterals
- [MIFOSX-1429] - Loans incorrectly classified as NPA
- [MIFOSX-1452] - Active Client Loan not correct when there is a group loan
- [MIFOSX-1453] - When transferring a client with a loan status as overpaid to another branch the loan status is changed to active instead of overpaid
- [MIFOSX-1467] - Periodic accrual accounting is not working properly if the gap between loan approved and disbursement date is more
- [MIFOSX-1483] - Not able to submit Recurring deposit account application if "Deposit Frequency" is defined as days
- [MIFOSX-1500] - Some fields for loan in the client page loan section not populate/displayed.
- [MIFOSX-1501] - Fixing Issues related to clean shutdown of Mifos Server: AbandonedCleanupThread and Quartz scheduler worker Threads.
- [MIFOSX-1513] - If more than one repayment is done on today's date (i.e sysdate) loan got closed with overpaid status
- [MIFOSX-1517] - For Tranche Loans interest is getting calculated with respect to the Approved amount than Disbursed amount
- [MIFOSX-1528] - Missing Documentation: For Assign and Unassign Loan Officer
- [MIFOSX-1531] - Not Appearing Loan Approval and Loan Disbursal in Checker Inbox & Tasks
- [MIFOSX-1539] - In Loan account "First repayment on" is not working as expected
- [MIFOSX-1547] - Interest is getting calculated for the non Disbursed amount in Tranche loan if one of the repayment date and 2nd Tranche disbursement date is today
- [MIFOSX-1549] - For JLG Loans repayments are not syncing with the meeting dates if disbursement date is other than meeting date
- [MIFOSX-1554] - Not able to withdraw amount from savings account having sufficient balance
- [MIFOSX-1557] - No Journal entries are created if accounts are being mapped in 'Advance Accounting Rule" (Issue found only in Accrual Accounting)
- [MIFOSX-1561] - In Tranche Loan should not allowed to repay second Tranche amount if only first Tranche is disbursed
- [MIFOSX-1563] - For Loans, generated schedule is incorrect after the first repayment
Community App
- [MIFOSX-1020] - Improvements in User profile page
- [MIFOSX-1037] - Need thousands separator for amounts
- [MIFOSX-1425] - Bulk JLG Loan Applications
- [MIFOSX-1534] - Limited Date Formats
- [MIFOSX-1497] - Loan Category under Loan purpose
- [MIFOSX-1516] - High CPU Usage from "grunt serve"
- [MIFOSX-1437] - Center Screen Layout Changes
- [MIFOSX-1438] - Groups Screen Layout Changes
- [MIFOSX-1374] - Improvements to Chart of Account UI
- [MIFOSX-1308] - The labels for collateral attributes are inconsistent on different pages.
- [MIFOSX-1031] - UI related Issues
- [MIFOSX-1290] - Correctly spell Installment Fee under Charge time type
- [MIFOSX-1432] - Minor layout fixes to Organization Admin screens
- [MIFOSX-1446] - In "Client savings transaction" page ( transaction page -> Export) different client name is displaying
- [MIFOSX-1465] - UI and Label related issues
- [MIFOSX-1430] - Activities search bar on home page doesn't populate with available activities or actually search
- [MIFOSX-1433] - Products Views layout changes.
- [MIFOSX-1455] - In Centers -> View Centers -> Create Group page members added is not displaying properly in Group General page
- [MIFOSX-1325] - Add ability to attach a group to a center
- [MIFOSX-1482] - Improve work-flow for adding Clients to a Group during its Creation
- [MIFOSX-1574] - Unable to search for GL Accounts by GL Codes in "Add Journal Entries"
1.24.0.RELEASE
=============
This feature release ships improvements to savings accounts including support for weekly fees and minimum balance for interest calculation along with a number of bug fixes and minor enhancements
Also note that issue https://mifosforge.jira.com/browse/MIFOSX-1364 introduces an API breaking change.
Platform & API
New Features & Improvements
- [MIFOSX-1392] - Add minimum balance support for interest calculation
- [MIFOSX-1161] - Add minimum balance to savings product and accounts
- [MIFOSX-1235] - Saving charges with weekly frequency
- [MIFOSX-1275] - Improve logging for Standing Instructions
- [MIFOSX-1398] - Add an option for balance withdrawal on closing of savings account
- [MIFOSX-1324] - Support for server side Image resizing
Bugs
- [MIFOSX-1364] - Checker permissions should have _CHECKER appended to the Action name
- [MIFOSX-1157] - API Document updates related to recurring deposit extensions
- [MIFOSX-1200] - In Fixed deposit on premature closure withdrawal amount is calculating incorrectly
- [MIFOSX-1204] - Missing documentation related to optional parameter "multiRow" while Creating Data tables
- [MIFOSX-1272] - Percentage of Fee amount on Loan disbursement should calculated with respect to actual disbursed amount than approved amount
- [MIFOSX-1302] - Organization currencies can be deleted even when they are associated with active loan/savings products or charges
- [MIFOSX-1339] - Reinvest of Term deposits should not be allowed on premature closure
- [MIFOSX-1340] - In Recurring deposits for Mandatory savings, activation of account and deposits not getting scheduled with meeting dates
- [MIFOSX-1341] - Withdrawal is not possible in active recurring deposit if "Allow withdrawal" checkbox is selected while submitting the application
- [MIFOSX-1351] - Charge on activation attached to a saving product is not creating journal entry while creating a client with active savings account
- [MIFOSX-1353] - Monthly charges attached to an active savings account is not getting collected on due date
- [MIFOSX-1357] - Repayment reschedule to next meeting date is falling on Non working day in Loan repayment schedule
- [MIFOSX-1358] - If repayment reschedule date is defined as holiday, then also repayment falls on that date
- [MIFOSX-1359] - Code Duplication in multiple classes: Re-factor and cleanup as necessary
- [MIFOSX-1365] - Not able to disburse Loan with backdated (borrower loan counter included) for the client who already having active Loans ( borrower loan counter not included)
- [MIFOSX-1366] - Incentive value defined for Gender in Fixed and Recurring deposit product is displaying improper value on submitting account for a client
- [MIFOSX-1369] - Undo disbursal of Loan is not getting updated in "Amount Disbursed for Today" home page
- [MIFOSX-1394] - For overdraft account interest is not posting properly for the +ve balance after repayment of dues
- [MIFOSX-1399] - Creating new Guarantor for loan account crash if the loan already has existing guarantor
- [MIFOSX-1401] - Allow value 0 for inArrearsTolerance when editing loanAccount
- [MIFOSX-1349] - In Client savings account -> Chages page - Monthly charges is not updating properly
- [MIFOSX-1403] - Closing of Fixed deposit creates double journal entries
Community App
- [MIFOSX-1142] - Ability to zoom-in client's photo in the community-app
- [MIFOSX-1158] - Allow upload of a client's signature & preview of the same
- [MIFOSX-1348] - Implementation of sorting options for transaction preview tables for Fixed deposits and Recurring deposit accounts
- [MIFOSX-1333] - Usability related issue in Frequent posting and Add journal entry pages
- [MIFOSX-1396] - Improper error message is displayed on trying to delete the used code values.
- [MIFOSX-1404] - Not able to add Group to the Center
- [MIFOSX-1367] - Merge Landing Page and Dashboard for the Community App
- [MIFOSX-1371] - Improvements to Add Journal Entries screens
- [MIFOSX-1373] - Improvements to Search Journal Entries screens
- [MIFOSX-1375] - Improvements to Accounting Closure screens
- [MIFOSX-1376] - Improvements to Accounting Rules screens
- [MIFOSX-1414] - Add change password button in user profile screen
- [MIFOSX-1413] - Populate date for collection sheet with default date as current date
- [MIFOSX-1362] - After Loan disbursement for a client in Transaction page displaying "Accrual" in transaction type for interest
- [MIFOSX-1388] - UI related issues due to bootstrap upgradation
- [MIFOSX-1390] - Term deposits - UI related issues
- [MIFOSX-1391] - Duplicate Client Creation Forms
- [MIFOSX-1218] - Make view of action to be verified more readable for checker
1.23.1.RELEASE
=============
Bug Release
Bugs
- [MIFOSX-1336] - Mifos X Generates Incorrect Repayment Schedules for Loans
1.23.0.RELEASE
=============
This feature release contains works around adding support for opening fixed deposits from existing savings accounts, transferring interest from fixed deposits to savings Account, accounting improvements for account Transfers, ability to collect "recovery payments" for written off Loans, flexible interest rate charts with the ability to provide incentives based on customer attributes along with a number of bug fixes
Platform & API
New Features & Improvements
- [MIFOSX-1163] - Add support for opening fixed deposits from existing savings account
- [MIFOSX-1182] - Add support to transfer interest from fixed deposit to linked savings account
- [MIFOSX-695] - Clean up Account Transfers functionality implementation
- [MIFOSX-281] - Add ability to enter a 'recovery repayment' on written off loan
- [MIFOSX-1227] - Option to set staff as active/inactive
- [MIFOSX-1024] - Add support to decline maker checker
- [MIFOSX-709] - Ability of Not allow to Close Client with the Loan status "Overpaid"
- [MIFOSX-982] - Add ability to associate a staff to user
- [MIFOSX-1203] - Add batch job to update status from Active to Matured in Fixed deposits
- [MIFOSX-1313] - Add support to use incentives for interest rate chart
Bugs
- [MIFOSX-1019] - transferring a client with a savings account not approved yet crashes
- [MIFOSX-1099] - Added validation that compound period falls within posting period
- [MIFOSX-1107] - Transaction balance end day calculated wrongly after interest posting in recurring deposit account
- [MIFOSX-1115] - Withdrawal posted twice when closing matured recurring deposit account
- [MIFOSX-1150] - Issue where null pointer exception was thrown after enabling cash based accounting for recurring deposit account
- [MIFOSX-1151] - Issue where expected first deposit date was not updated when recurring deposit account was edited
- [MIFOSX-1162] - Undo disbursal failing for loans which have overdue charges
- [MIFOSX-1187] - Not able to submit Fixed deposit application if the Maximum deposit term is not defined in Product level
- [MIFOSX-1183] - replaced fields in loans api transactions part (loanTransactionType.invalid)
- [MIFOSX-960] - Lefthand navigation menu shouldn't collapse automatically
- [MIFOSX-1300] - Should not allowed to transfer fund from Savings account to an active Fixed deposit account
- [MIFOSX-1200] - In Fixed deposit on premature closure withdrawal amount is calculating incorrectly
- [MIFOSX-1288] - For FD and RD transfer to savings account on premature closure is not working as expected
- [MIFOSX-1242] - For update fixed deposit product - "View Audit entry" page displays other improper details along with the output
- [MIFOSX-1243] - Not able to create Fixed deposit account for a client if Maker checker task is enabled.
- [MIFOSX-1244] - Details displayed in "Waiting For Checker Approval" page after creating Recurring Deposit is not proper
- [MIFOSX-1245] - Not able to create Recurring deposit account for a client if Maker checker task is enabled.
- [MIFOSX-1260] - Not able to create a client with the savings account attached
- [MIFOSX-1268] - In demo version Transactions created by activation of savings account while creating client is not proper
- [MIFOSX-1270] - In Savings account Journal entries are not mapping properly because of the charges attached on activation.
- [MIFOSX-1274] - Standing Instructions fail if the savings account had gone to negative balance during account creation
- [MIFOSX-1318] - Not able to Generate collection sheet for the defined meeting date
- [MIFOSX-1238] - Error while running Pentaho reports in MySQL 5.6+ with strict mode enabled
- [MIFOSX-1208] - Issue on Retrieving Datatable entries for Office.
- [MIFOSX-1215] - Not able to approve/delete maker checker tasks with checker user role
- [MIFOSX-1237] - Able to login with Deleted user
- [MIFOSX-1335] - Not able to close FD and RD accounts, displays "account is not active" error message
Community App
- [MIFOSX-1233] - When assigning staff to Centers, Groups, Client, Loan, Savings a/c: Only loan officers who belong to the branch should be displayed in dropdown
- [MIFOSX-1154] - Usability issues while editing data tables
- [MIFOSX-1164] - Clean up login page transition
- [MIFOSX-1320] - Force logout on the community app on tab/window close
- [MIFOSX-1263] - Client/Loan Account info table takes up too much space
- [MIFOSX-1039] - Provide option for External ID to Loans
- [MIFOSX-1069] - Implementation of sorting options for transaction preview tables for savings or loans.
- [MIFOSX-1207] - Journal Entries - should have debits before credits
- [MIFOSX-1209] - In Loan repayment schedule page "Waive" column should be introduced
- [MIFOSX-1226] - UI improvements in Fixed deposits
- [MIFOSX-1254] - The UI for defining/managing charges, refers to loan products only. Charges may be set up for other products.
- [MIFOSX-1255] - Overdue charges do not appear in UI in loan product edit mode
- [MIFOSX-1256] - Filter charge and overdue charges drop-down lists to display only valid charges (matching currency)
- [MIFOSX-1257] - When creating charges, charges may be associated with either Loan or Saving, but Saving apply to Fixed and Recurring Deposits as well.
- [MIFOSX-1259] - Need space between icons and text
- [MIFOSX-1267] - Loan writeoff screen should display Writeoff amount
- [MIFOSX-1294] - Ability to hide " Add Fee Frequency " field for Loan charges except for Overdue fees
- [MIFOSX-1297] - In Saving product creation page settings is not working as expected
- [MIFOSX-1299] - Not able to add cash based accounting in Edit Fixed deposit product
- [MIFOSX-1196] - In fixed deposit product not able to "Edit Interest Rate Chart" displays improper error message
- [MIFOSX-1198] - Mobile Number field in Community App should be Text instead of Numeric field
- [MIFOSX-1282] - UI related issues in FD, RD, Loan and Savings products
- [MIFOSX-1276] - Not able to save Edit loan product page with Accounting "None"
- [MIFOSX-1279] - Deposit frequency is missed in Create and edit Recurring deposit product
- [MIFOSX-1280] - "Locking period frequency" is displaying improper values after submitting the Fixed deposit application and Recurring deposit application for a client
- [MIFOSX-1281] - In cash based accounting for loan products "Over payment liability" GL accounts are not displaying in dropdown
- [MIFOSX-1314] - Transfer of overpaid Loan amount to Savings account navigates to a page displays without entries
- [MIFOSX-1327] - Date format modified in settings is displaying "invalid date format" error while adding charge to savings account
- [MIFOSX-1328] - UI related issues
- [MIFOSX-1217] - Overdue charges added while creating the loan product is not displaying in Edit loan product page.
- [MIFOSX-1219] - Unable to make datatable entries for manually registered datatables
- [MIFOSX-1221] - External ID added while creating the center is not displaying in center general page
- [MIFOSX-1240] - Gender drop down menu does not display when editing client information
- [MIFOSX-1331] - For saving charges in Edit charge page Dropdown of "Charge calculation" is displaying Loan charge related inputs
1.22.0.RELEASE
=============
+23
View File
@@ -0,0 +1,23 @@
# Getting started with Mifos X
Instructions for getting started are located at https://mifosforge.jira.com/wiki/display/MIFOSX/Getting+started+-+Contributing+to+MifosX
# Pull Request Checklist
Before sending out a pull request, please ensure that the following pre-requisites are taken care of
1. API documentation has been updated to reflect any changes made to the API (new API's, adding new Fields or Options to existing API etc)
1. An integration test is added/updated to test the new feature developed/bug-fix being made
1. The pull request has a Jira issue associated with it. Details for creating issues on Jira are located at https://mifosforge.jira.com/wiki/display/MIFOSX/Getting+started+-+Contributing+to+MifosX#Gettingstarted-ContributingtoMifosX-CreateIssues
1. The Relevant Jira number (Ex: MIFOSX-1454) is present as a part of the commit message. Refer http://comments.gmane.org/gmane.comp.finance.mifos.devel/14664 for details
1. Newly added code has been formatted and cleaned up as per our preferences at https://github.com/openMF/mifosx/wiki/Eclipse#apply-project-preferences-to-eclipse
1. Comments are added where relevant to ease peer review
1. Your work is present in a single commit rather than several broken up commits. This helps us maintain a cleaner commit history. https://github.com/openMF/mifosx/wiki/Github-&-Git#contributing-back-changes-to-original-repositoryauthors has instructions for squashing multiple commits or resetting head and recommiting your work as a single commit
1. Your work is rebased on top of the latest code from develop branch to make life easier for our Committers
1. "gradlew licenseFormatMain licenseFormatTest licenseFormatIntegrationTest" has been run to apply the Mozilla License on all newly added files (your pull requests are verified to ensure compliance with this since https://github.com/openMF/mifosx/pull/1053)
+60 -24
View File
@@ -32,7 +32,7 @@ The two ways to get up and running with mifos platform is:
## 1. Amazon Public AMI
Use AWS Wizard to launch instance by using this link: <a target="_blank" href="https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchAmi=ami-948b6be3" title="Mifos Platform Public AMI 1.13.0.RELEASE">Mifos Platform AMI (ami-948b6be3)</a>
Use AWS Wizard to launch instance by using this link: <a target="_blank" href="https://console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchAmi=ami-a6035af4" title="Latest Mifos Platform Public AMI">Mifos Platform AMI (ami-a6035af4)</a>
*Note:* Read through the following as you step through the AWS Wizard
@@ -44,23 +44,21 @@ The two ways to get up and running with mifos platform is:
- You will be asked to use a 'keypair' which you will need to SSH onto the new instance, if this is your first time create a new keypair, be srue to download it and store in place as you will need it later, otherwise use an existing keypair.
- When the instance starts, the following should be available at:
- Platform application should be available @ https://[public DNS]:8443/mifosng-provider/api/v1/offices?tenantIdentifier=default&pretty=true
- Reference application should be available @ https://[public DNS]:8443/IndividualLendingGeneralJavaScript/IndivLendHome.html?baseApiUrl=https://[server ip address]:8443/mifosng-provider/api/v1/
- Community app should be available @ https://[public DNS]:8443/community-app
- API docs should be available @ https://[public DNS]:8443/api-docs/apiLive.htm
*Name:* Mifos Platform 1.13.0.RELEASE Public AMI
*Name:* Mifos Platform 1.24.0.RELEASE Public AMI
- AMI ID: ami-948b6be3
- Kernel ID: aki-71665e05
- Name: Mifos Platform 1.13.0.RELEASE Public AMI
- Owner: 476083131096
- Source: 476083131096/Mifos Platform 1.13.0.RELEASE Public AMI
- AMI ID: ami-a6035af4
- Kernel ID: aki-503e7402
- Name: Mifos Platform 1.24.0.RELEASE Public AMI
- Owner: 540782944231
- Source: 540782944231/Mifos X-1.24.0 release
- Architecture: Ubuntu12.04 LTS x86_64
- Built starting from Ubuntu AMI ami-35acbb41
- Java 1.6_45 32 bit JVM
- Java 1.7.0_51 64 bit JVM
- Tomcat 7.0.39 (with SSL configured for self-signed certificate)
- MySql 5.5.31
- Mifos Platform 1.13.0.RELEASE
- Mifos Reference App 1.13.0.RELEASE
## 2. Manual Installation
@@ -96,29 +94,67 @@ The two ways to get up and running with mifos platform is:
exit
```
Step two: populate mifosplatform-tenants database using ```database/mifospltaform-tenants-first-time-install.sql```
```
mysql -uroot -pmysql mifosplatform-tenants < database/mifospltaform-tenants-first-time-install.sql
```
Step three: create mifostenant-default database
Step two: create mifostenant-default database
```
mysql -uroot -pmysql
create database `mifostenant-default`;
exit
```
The tables and lookup data for both databases are created on application startup.
Step three (optional): to be followed only if your mysql credentials are other than root/mysql
Manually restore the contents of *mifosplatform-tenants* database
```
mysql -uroot -pmysql mifosplatform-tenants < database/mifospltaform-tenants-first-time-install.sql
```
Next, update the default credentials for connecting to *mifoplatform-default* database stored in the *tenants* table of *mifosplatform-tenants* with your credentials
```
UPDATE tenants SET schema_username = "your_username", schema_password = "your_password" WHERE identifier = "default";
```
#### 2.2.2 Upgrade existing database(s)
Those updating an existing MifosX installation to version 1.21.* or higher would need to upgrade the *mifosplatform-tenants* database with patch ```database/migrations/list_db/V2__externalize-connection-properties.sql```
```
mysql -uroot -pmysql mifosplatform-tenants < database/migrations/list_db/V2__externalize-connection-properties.sql
```
Any *tenant* databases will be upgraded automatically when the application starts if the *auto_update* field of the *tenants* database table is enabled(=1). This is the default setting.
The list database *mifosplatform-tenants* is upgraded when the application starts. Any *tenant* databases will also be upgraded automatically when the application starts if the *auto_update* field of the *tenants* database table is enabled(=1). This is the default setting.
Upgrading your database in this way is the recommended way as it will upgrade any *tenants* setup in the *mifosplatform-tenants* database but can be disabled by setting the *auto_update* field of the tenant to zero.
##### 2.2.2.1 Special Instructions for those upgrading from version 1.24.* or lower
Starting from version 1.25.* , updates to *mifosplatform-tenants* database are managed by Flyway (http://flywaydb.org/). To ensure that flyway works correctly, verify that table *schema_version* is present along with two entries in *mifosplatform-tenants* database.
You can do so as follows
````
mysql -uroot -pmysql
use `mifosplatform-tenants`;
select * from schema_version;
```
If the table does not exist, create the same using the script at https://gist.github.com/vishwasbabu/dc105b6a9450cff8ff1f
Next, check if the patch for "externalizing mysql connection properties" has been run (i.e if you are updating from 1.21 or a higher version of Mifos X)
````
mysql -uroot -pmysql
use `mifosplatform-tenants`;
select pool_initial_size from tenants;
```
If the above query does **not** throw an error (Unknown column 'pool_initial_size'), *schema_version* needs to be updated with the details of this patch by executing the scripts below
```
mysql -uroot -pmysql
use `mifosplatform-tenants`;
INSERT INTO `schema_version` (`version_rank`, `installed_rank`, `version`, `description`, `type`, `script`, `checksum`, `installed_by`, `installed_on`, `execution_time`, `success`) VALUES
(2, 2, '2', 'externalize-connection-properties', 'SQL', 'V2__externalize-connection-properties.sql', 210473669, 'root', '2014-10-12 22:13:51', 661, 1);
```
#### 2.2.3 Load *mifostenant-default* schema with sample data (optional)
Every release ships with sample data (offices, users, customers, loan products, savings products and a chart of accounts). The same can be restored by running the following command
@@ -134,7 +170,7 @@ The two ways to get up and running with mifos platform is:
#### 2.3.1 Environment Variables Check
Check that the following environment variables exist:
- JAVA_HOME ... should point to directory where a 1.6 JDK or JRE is on machine
- JAVA_HOME ... should point to directory where a 1.7 JDK or JRE is on machine
- CATALINA_HOME ... should point to a directory where a Tomcat 7 instance is installed
Check that the following is on your path:
+3658 -474
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -47,8 +47,9 @@ CREATE TABLE `schema_version` (
LOCK TABLES `schema_version` WRITE;
/*!40000 ALTER TABLE `schema_version` DISABLE KEYS */;
INSERT INTO `schema_version` VALUES (1,1,'1','mifos-platform-shared-tenants','SQL','/V1__mifos-platform-shared-tenants.sql',-486745552,'root','2013-04-05 09:33:11',50,1);
/*!40000 ALTER TABLE `schema_version` ENABLE KEYS */;
INSERT INTO `schema_version` (`version_rank`, `installed_rank`, `version`, `description`, `type`, `script`, `checksum`, `installed_by`, `installed_on`, `execution_time`, `success`) VALUES
(1, 1, '1', 'mifos-platform-shared-tenants', 'SQL', 'V1__mifos-platform-shared-tenants.sql', -486745552, 'root', '2014-10-12 22:13:50', 896, 1),
(2, 2, '2', 'externalize-connection-properties', 'SQL', 'V2__externalize-connection-properties.sql', 210473669, 'root', '2014-10-12 22:13:51', 661, 1);/*!40000 ALTER TABLE `schema_version` ENABLE KEYS */;
UNLOCK TABLES;
--
@@ -346,6 +346,7 @@ CREATE TABLE `m_staff` (
`firstname` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`display_name` varchar(100) NOT NULL,
`joining_date` date,
PRIMARY KEY (`id`),
UNIQUE KEY `display_name` (`display_name`),
KEY `FK_m_staff_m_office` (`office_id`),
+66 -56
View File
@@ -10,29 +10,30 @@ buildscript {
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.0',
'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.0',
'org.zeroturnaround:gradle-jrebel-plugin:1.1.2'
'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0',
'org.zeroturnaround:gradle-jrebel-plugin:1.1.2',
'org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE' // also change springDataJpaVersion below
}
}
apply plugin: 'rebel'
apply plugin: 'license'
apply plugin: 'war'
apply plugin: 'spring-boot'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'tomcat'
apply plugin: 'project-report'
/* define the valid syntax level for source files */
sourceCompatibility = JavaVersion.VERSION_1_6
/* define binary compatiblity version */
targetCompatibility = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_7
/* define binary compatibility version */
targetCompatibility = JavaVersion.VERSION_1_7
project.ext.springVersion = '3.2.5.RELEASE'
project.ext.springSecurityVersion = '3.1.4.RELEASE'
project.ext.hibernateCoreVersion = '4.1.9.Final'
project.ext.springBootVersion = '1.1.6.RELEASE'
project.ext.springVersion = '4.0.7.RELEASE'
project.ext.jerseyVersion = '1.17'
project.ext.springDataJpaVersion = '1.4.1.RELEASE'
project.ext.springDataJpaVersion = '1.7.0.RELEASE' // also change spring-boot-gradle-plugin version above
project.ext.mysqlUser='root'
project.ext.mysqlPassword='mysql'
@@ -43,11 +44,13 @@ group = 'org.mifosplatform'
repositories {
jcenter()
maven {
url "http://repository.pentaho.org/artifactory/pentaho/"
url "http://repository.pentaho.org/artifactory/pentaho/"
}
// mavenLocal() // useful for local dev using MariaDB4j SNAPSHOTs (not needed for real-world non-SNAPHOT builds)
}
configurations {
providedRuntime // needed for Spring Boot executable WAR
providedCompile
compile
runtime
@@ -55,31 +58,28 @@ configurations {
}
dependencies {
def tomcatVersion = '7.0.47'
def tomcatVersion = '7.0.54'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
"org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatVersion}" // NOT tomcat-embed-logging-juli (http://stackoverflow.com/questions/23963049/classcircularityerror-java-util-logging-logrecord-running-gradle-webapp-with-ja)
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
tomcat "org.apache.tomcat:tomcat-dbcp:${tomcatVersion}"
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
providedCompile(
[group: 'javax.servlet', name: 'servlet-api', version: '2.5'],
// [group: 'javax.servlet', name: 'servlet-api', version: '2.5'],
)
compile(
[group: 'org.springframework', name: 'spring-core', version: springVersion],
[group: 'org.springframework', name: 'spring-aspects', version: springVersion],
[group: 'org.springframework', name: 'spring-web', version: springVersion],
[group: 'org.springframework', name: 'spring-test', version: springVersion],
[group: 'org.springframework.security', name: 'spring-security-core', version: springSecurityVersion],
[group: 'org.springframework.security', name: 'spring-security-web', version: springSecurityVersion],
[group: 'org.springframework.security', name: 'spring-security-config', version: springSecurityVersion],
[group: 'org.aspectj', name: 'aspectjrt', version: '1.7.0.RELEASE'],
[group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.1'],
[group: 'org.hibernate', name: 'hibernate-core', version: hibernateCoreVersion],
[group: 'org.hibernate', name: 'hibernate-entitymanager', version: hibernateCoreVersion],
[group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.0-api', version: '1.0.1.Final'],
[group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion],
[group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: springBootVersion],
[group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: springBootVersion],
[group: 'org.springframework', name: 'spring-context-support', version: springVersion],
[group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'],
[group: 'com.sun.jersey', name: 'jersey-core', version: jerseyVersion],
@@ -89,24 +89,23 @@ dependencies {
[group: 'com.sun.jersey.contribs', name: 'jersey-spring', version: jerseyVersion],
[group: 'com.sun.jersey.contribs', name: 'jersey-multipart', version: jerseyVersion],
[group: 'com.squareup.retrofit', name: 'retrofit', version: '1.6.1'],
[group: 'com.squareup.okhttp', name: 'okhttp', version: '2.0.0'],
[group: 'com.squareup.okhttp', name: 'okhttp-urlconnection', version: '2.0.0'],
[group: 'com.google.code.gson', name: 'gson', version: '2.2.4'],
[group: 'com.google.guava', name: 'guava', version: '15.0'],
[group: 'org.springframework.data', name: 'spring-data-jpa', version: springDataJpaVersion],
[group: 'joda-time', name: 'joda-time', version: '2.3'],
[group: 'joda-time', name: 'joda-time', version: '2.4'],
[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.1'],
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'],
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
[group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'],
[group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.5'],
[group: 'ch.qos.logback', name: 'logback-core', version: '1.0.13'],
[group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.13'],
// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.47'],
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-core', version: '3.9.1.1'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions', version: '3.9.1-GA'],
@@ -132,17 +131,22 @@ dependencies {
[group: 'com.lowagie', name: 'itext', version: '2.1.7'],
[group: 'com.lowagie', name: 'itext-rtf', version: '2.1.7'],
[group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.4'],
[group: 'com.googlecode.flyway', name: 'flyway-maven-plugin', version: '2.1.1'],
[group: 'com.googlecode.flyway', name: 'flyway-core', version: '2.1.1'],
[group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.7'],
[group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.2.1'],
[group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2'],
[group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12']
)
[group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12'],
[group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
testCompile 'junit:junit:4.10',
'junit:junit-dep:4.10',
'org.mockito:mockito-all:1.9.5',
'com.jayway.restassured:rest-assured:1.7.2'
// Although Mifos (at the time of writing) doesn't have any compile time dep. on this,
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5']
)
testCompile 'junit:junit:4.11',
'junit:junit-dep:4.11',
'org.mockito:mockito-core:1.9.5',
'com.jayway.restassured:rest-assured:2.3.3',
[group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion]
}
@@ -173,7 +177,7 @@ task dist(type:Zip){
include '*.sql'
into('database')
}
from('../mifosng-db/migrations') {
from('src/main/resources/sql/migrations') {
fileMode = 0755
include '**/*'
into('database/migrations')
@@ -197,13 +201,12 @@ task deployPentahoReports() {
war {
it.dependsOn deployPentahoReports
from ('../mifosng-db/migrations/core_db') {
into "WEB-INF/classes/sql"
}
war.finalizedBy(bootRepackage)
}
license {
header rootProject.file('../LICENSE.md')
excludes(["**/*.mustache", "**/*.sql", "**/package-info.java", "**/keystore.jks"])
strictCheck true
}
@@ -222,11 +225,14 @@ tomcatRunWar {
stopPort = 8081
stopKey= 'stopKey'
enableSSL = true
keystoreFile = file('../keystore.jks')
keystoreFile = file('src/main/resources/keystore.jks')
keystorePass = 'openmf'
configFile = file('src/test/resources/META-INF/context.xml')
}
/* http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle */
sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir
sourceSets.test.output.resourcesDir = sourceSets.test.output.classesDir
sourceSets {
integrationTest {
@@ -296,7 +302,7 @@ buildscript {
}
dependencies {
classpath 'com.github.ben-manes:gradle-flyway-plugin:0.2'
classpath "org.flywaydb:flyway-gradle-plugin:3.0" // version upgraded during Spring Boot & MariaDB4j work, as prev. used v0.2 didn't work well after *.sql moved from mifosng-db to mifosng-provider/src/main/resources (new version also has clearer errors, e.g. in case of missing DB)
classpath 'mysql:mysql-connector-java:5.1.22'
}
}
@@ -306,15 +312,12 @@ flyway {
url = "jdbc:mysql://localhost:3306/mifostenant-default"
user = mysqlUser
password = mysqlPassword
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations'
locations = [filePath]
}
task migrateTenantDB<<{
description="Migrates a Tenant DB. Optionally can pass dbName. Defaults to 'mifostenant-default' (Example: -PdbName=someTenantDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/core_db'
def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/core_db'
def tenantDbName = 'mifostenant-default';
if (rootProject.hasProperty("dbName")) {
tenantDbName = rootProject.getProperty("dbName")
@@ -329,7 +332,7 @@ task migrateTenantDB<<{
task showTenantDBInfo<<{
description="Shows the migration info for a Tenant DB. Optionally can pass dbName. Defaults to 'mifostenant-default' (Example: -PdbName=someTenantDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/core_db'
def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/core_db'
def tenantDbName = 'mifostenant-default';
if (rootProject.hasProperty("dbName")) {
tenantDbName = rootProject.getProperty("dbName")
@@ -344,7 +347,7 @@ task showTenantDBInfo<<{
task migrateTenantListDB<<{
description="Migrates a Tenant List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db'
def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/list_db'
def tenantsDbName = 'mifosplatform-tenants';
if (rootProject.hasProperty("dbName")) {
tenantsDbName = rootProject.getProperty("dbName")
@@ -359,7 +362,7 @@ task migrateTenantListDB<<{
task showTenantListDBInfo<<{
description="Shows the migration info for a List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db'
def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/list_db'
def tenantsDbName = 'mifosplatform-tenants';
if (rootProject.hasProperty("dbName")) {
tenantsDbName = rootProject.getProperty("dbName")
@@ -373,7 +376,7 @@ task showTenantListDBInfo<<{
task repairTenantDB<<{
description="repair migrate"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db'
def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/list_db'
def tenantsDbName = 'mifosplatform-tenants';
if (rootProject.hasProperty("dbName")) {
tenantsDbName = rootProject.getProperty("dbName")
@@ -401,3 +404,10 @@ def qualifyVersionIfNecessary(version) {
}
return version
}
springBoot {
mainClass = 'org.mifosplatform.ServerWithMariaDB4jApplication'
}
bootRepackage {
mainClass = 'org.mifosplatform.ServerWithMariaDB4jApplication'
}
+1 -1
View File
@@ -1,4 +1,4 @@
releaseVersion=1.22.0.RELEASE
releaseVersion=1.25.1.RELEASE
@@ -1,13 +1,16 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -17,10 +20,10 @@ import org.mifosplatform.integrationtests.common.OfficeHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.accounting.Account;
import org.mifosplatform.integrationtests.common.accounting.AccountHelper;
import org.mifosplatform.integrationtests.common.accounting.FinancialActivityAccountHelper;
import org.mifosplatform.integrationtests.common.accounting.JournalEntry;
import org.mifosplatform.integrationtests.common.accounting.JournalEntryHelper;
import org.mifosplatform.integrationtests.common.accounting.OfficeAccountMappingHelper;
import org.mifosplatform.integrationtests.common.charges.ChargesHelper;
import org.mifosplatform.integrationtests.common.accounting.Account.AccountType;
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanStatusChecker;
@@ -66,6 +69,10 @@ public class AccountTransferTest {
Float TRANSFER_AMOUNT = new Float(ACCOUNT_TRANSFER_AMOUNT);
Float TRANSFER_AMOUNT_ADJUST = new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
private FinancialActivityAccountHelper financialActivityAccountHelper;
private Integer financialActivityAccountId;
private Account liabilityTransferAccount;
@Before
public void setup() {
Utils.initializeRESTAssured();
@@ -74,6 +81,42 @@ public class AccountTransferTest {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
if (financialActivities.isEmpty()) {
/** Setup liability transfer account **/
/** Create a Liability and an Asset Transfer Account **/
liabilityTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(liabilityTransferAccount);
/*** Create A Financial Activity to Account Mapping **/
financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
FinancialActivityAccountsTest.liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(financialActivityAccountId);
} else {
for (HashMap financialActivity : financialActivities) {
HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData");
if (financialActivityData.get("id").equals(FinancialActivityAccountsTest.liabilityTransferFinancialActivityId)) {
HashMap glAccountData = (HashMap) financialActivity.get("glAccountData");
liabilityTransferAccount = new Account((Integer) glAccountData.get("id"), AccountType.LIABILITY);
financialActivityAccountId = (Integer) financialActivity.get("id");
break;
}
}
}
}
/**
* Delete the Liability transfer account
*/
@After
public void tearDown() {
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(deletedFinancialActivityAccountId);
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
}
@Test
@@ -95,15 +138,6 @@ public class AccountTransferTest {
String.valueOf(toOfficeId));
Assert.assertNotNull(toClientID);
Account toTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(toTransferAccount);
OfficeAccountMappingHelper accountMappingHelper = new OfficeAccountMappingHelper(this.requestSpec,
new ResponseSpecBuilder().build());
Integer toTransferAccountMappingId = (Integer) accountMappingHelper.createOfficeAccountMapping(toOfficeId,
toTransferAccount.getAccountID(), CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(toTransferAccountMappingId);
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
incomeAccount, expenseAccount, liabilityAccount);
Assert.assertNotNull(toSavingsProductID);
@@ -131,13 +165,6 @@ public class AccountTransferTest {
String.valueOf(fromOfficeId));
Assert.assertNotNull(fromClientID);
Account fromTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(fromTransferAccount);
Integer fromTransferAccountMappingId = (Integer) accountMappingHelper.createOfficeAccountMapping(fromOfficeId,
fromTransferAccount.getAccountID(), CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(fromTransferAccountMappingId);
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
Assert.assertNotNull(fromSavingsProductID);
@@ -178,10 +205,10 @@ public class AccountTransferTest {
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT),
JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(fromTransferAccount, AccountTransferHelper.ACCOUNT_TRANSFER_DATE,
office1LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForAssetAccount(toTransferAccount, AccountTransferHelper.ACCOUNT_TRANSFER_DATE,
office2LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(toOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office2LiabilityEntries);
}
@@ -213,12 +240,6 @@ public class AccountTransferTest {
Account toTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(toTransferAccount);
OfficeAccountMappingHelper accountMappingHelper = new OfficeAccountMappingHelper(this.requestSpec,
new ResponseSpecBuilder().build());
Integer toTransferAccountMappingId = (Integer) accountMappingHelper.createOfficeAccountMapping(toOfficeId,
toTransferAccount.getAccountID(), CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(toTransferAccountMappingId);
final Integer toLoanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
Assert.assertNotNull(toLoanProductID);
@@ -242,13 +263,6 @@ public class AccountTransferTest {
String.valueOf(fromOfficeId));
Assert.assertNotNull(fromClientID);
Account fromTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(fromTransferAccount);
Integer fromTransferAccountMappingId = (Integer) accountMappingHelper.createOfficeAccountMapping(fromOfficeId,
fromTransferAccount.getAccountID(), CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(fromTransferAccountMappingId);
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
Assert.assertNotNull(fromSavingsProductID);
@@ -288,10 +302,10 @@ public class AccountTransferTest {
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(fromTransferAccount, AccountTransferHelper.ACCOUNT_TRANSFER_DATE,
office1LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForAssetAccount(toTransferAccount, AccountTransferHelper.ACCOUNT_TRANSFER_DATE,
office2LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(toOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office2LiabilityEntries);
}
@Test
@@ -319,15 +333,6 @@ public class AccountTransferTest {
String.valueOf(toOfficeId));
Assert.assertNotNull(toClientID);
Account toTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(toTransferAccount);
OfficeAccountMappingHelper accountMappingHelper = new OfficeAccountMappingHelper(this.requestSpec,
new ResponseSpecBuilder().build());
Integer toTransferAccountMappingId = (Integer) accountMappingHelper.createOfficeAccountMapping(toOfficeId,
toTransferAccount.getAccountID(), CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(toTransferAccountMappingId);
final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount,
incomeAccount, expenseAccount, liabilityAccount);
Assert.assertNotNull(toSavingsProductID);
@@ -353,13 +358,6 @@ public class AccountTransferTest {
String.valueOf(fromOfficeId));
Assert.assertNotNull(fromClientID);
Account fromTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(fromTransferAccount);
Integer fromTransferAccountMappingId = (Integer) accountMappingHelper.createOfficeAccountMapping(fromOfficeId,
fromTransferAccount.getAccountID(), CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(fromTransferAccountMappingId);
final Integer loanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount);
Assert.assertNotNull(loanProductID);
@@ -375,7 +373,6 @@ public class AccountTransferTest {
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
assetAccount, incomeAccount, expenseAccount, liabilityAccount);
Assert.assertNotNull(fromSavingsProductID);
@@ -426,10 +423,10 @@ public class AccountTransferTest {
final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST),
JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(fromTransferAccount, AccountTransferHelper.ACCOUNT_TRANSFER_DATE,
office1LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForAssetAccount(toTransferAccount, AccountTransferHelper.ACCOUNT_TRANSFER_DATE,
office2LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office1LiabilityEntries);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(toOfficeId, liabilityTransferAccount,
AccountTransferHelper.ACCOUNT_TRANSFER_DATE, office2LiabilityEntries);
}
@@ -1,14 +1,24 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.joda.time.Days;
import org.joda.time.LocalDate;
import org.junit.Assert;
import org.junit.Before;
@@ -21,6 +31,7 @@ import org.mifosplatform.integrationtests.common.accounting.Account;
import org.mifosplatform.integrationtests.common.accounting.AccountHelper;
import org.mifosplatform.integrationtests.common.accounting.JournalEntry;
import org.mifosplatform.integrationtests.common.accounting.JournalEntryHelper;
import org.mifosplatform.integrationtests.common.accounting.PeriodicAccrualAccountingHelper;
import org.mifosplatform.integrationtests.common.charges.ChargesHelper;
import org.mifosplatform.integrationtests.common.fixeddeposit.FixedDepositAccountHelper;
import org.mifosplatform.integrationtests.common.fixeddeposit.FixedDepositAccountStatusChecker;
@@ -83,6 +94,7 @@ public class AccountingScenarioIntegrationTest {
private RecurringDepositProductHelper recurringDepositProductHelper;
private RecurringDepositAccountHelper recurringDepositAccountHelper;
private SchedulerJobHelper schedulerJobHelper;
private PeriodicAccrualAccountingHelper periodicAccrualAccountingHelper;
@Before
public void setup() {
@@ -95,6 +107,7 @@ public class AccountingScenarioIntegrationTest {
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.periodicAccrualAccountingHelper = new PeriodicAccrualAccountingHelper(this.requestSpec, this.responseSpec);
}
@Test
@@ -325,7 +338,7 @@ public class AccountingScenarioIntegrationTest {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
DateFormat currentDateFormat = new SimpleDateFormat("dd");
Calendar todaysDate = Calendar.getInstance();
@@ -407,7 +420,7 @@ public class AccountingScenarioIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account liabilityAccount = this.accountHelper.createLiabilityAccount();
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
DateFormat currentDateFormat = new SimpleDateFormat("dd");
Calendar todaysDate = Calendar.getInstance();
@@ -422,7 +435,7 @@ public class AccountingScenarioIntegrationTest {
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
Integer currentDate = new Integer(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1;
@@ -432,7 +445,8 @@ public class AccountingScenarioIntegrationTest {
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId);
Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, assetAccount, liabilityAccount, incomeAccount, expenseAccount);
Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, assetAccount, liabilityAccount,
incomeAccount, expenseAccount);
Assert.assertNotNull(recurringDepositProductId);
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
@@ -450,23 +464,26 @@ public class AccountingScenarioIntegrationTest {
recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.activateRecurringDeposit(recurringDepositAccountId,
ACTIVATION_DATE);
RecurringDepositAccountStatusChecker.verifyRecurringDepositIsActive(recurringDepositAccountStatusHashMap);
HashMap recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec, recurringDepositAccountId);
HashMap recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(depositTransactionId);
// Checking initial Journal entries after Activation.
// Checking initial Journal entries after Activation.
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, liablilityAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE,
liablilityAccountInitialEntry);
Integer interestPostingTransactionId = this.recurringDepositAccountHelper
.postInterestForRecurringDeposit(recurringDepositAccountId);
Assert.assertNotNull(interestPostingTransactionId);
HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
@@ -508,8 +525,7 @@ public class AccountingScenarioIntegrationTest {
System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
final String recurringDepositProductJSON = recurringDepositProductHelper //
.withAccountingRuleAsCashBased(accounts)
.build(validFrom, validTo);
.withAccountingRuleAsCashBased(accounts).build(validFrom, validTo);
return RecurringDepositProductHelper.createRecurringDepositProduct(recurringDepositProductJSON, requestSpec, responseSpec);
}
@@ -557,7 +573,7 @@ public class AccountingScenarioIntegrationTest {
final String jobName = "Add Accrual Transactions";
try {
this.schedulerJobHelper.excuteJob(jobName);
this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -568,7 +584,8 @@ public class AccountingScenarioIntegrationTest {
final float FIRST_PRINCIPAL = 2000.0f;
final float FEE_PORTION = 0.0f;
final float PENALTY_PORTION = 0.0f;
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[1]), FIRST_INTEREST, FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[1]), FIRST_INTEREST,
FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
float expected_value = this.LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, expected_value, loanID);
@@ -584,19 +601,23 @@ public class AccountingScenarioIntegrationTest {
final float SECOND_AND_THIRD_INTEREST = 400.0f;
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[2]), FIRST_INTEREST, FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[3]), FIRST_INTEREST, FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[2]), FIRST_INTEREST,
FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[3]), FIRST_INTEREST,
FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(2, expected_value, loanID);
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
new JournalEntry(SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT),
new JournalEntry(SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT), };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
System.out.println("Repayment 2 Done ......");
// WAIVE INTEREST
System.out.println("Waive Interest ......");
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[4]), FIRST_INTEREST, FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[5]), FIRST_INTEREST, FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[4]), FIRST_INTEREST,
FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[5]), FIRST_INTEREST,
FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.waiveInterest(this.REPAYMENT_DATE[4], this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
final JournalEntry waivedEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
@@ -605,7 +626,7 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
System.out.println("Waive Interest Done......");
// REPAYMENT 3
System.out.println("Repayment 3 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
@@ -637,16 +658,232 @@ public class AccountingScenarioIntegrationTest {
System.out.println("Repayment 5 Done ......");
}
@Test
public void checkPeriodicAccrualAccountingTillCurrentDateFlow() {
final Account assetAccount = this.accountHelper.createAssetAccount();
final Account incomeAccount = this.accountHelper.createIncomeAccount();
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
overpaymentAccount);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
final float FEE_PORTION = 50.0f;
final float PENALTY_PORTION = 100.0f;
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todayDate = Calendar.getInstance();
final String currentDate = dateFormat.format(todayDate.getTime());
todayDate.add(Calendar.DATE, -4);
final String LOAN_DISBURSEMENT_DATE = dateFormat.format(todayDate.getTime());
todayDate.add(Calendar.MONTH, 2);
final String FIRST_REPAYMENT_DATE = dateFormat.format(todayDate.getTime());
todayDate = Calendar.getInstance();
todayDate.add(Calendar.DATE, -2);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
todayDate.add(Calendar.DATE, 1);
this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(flat), dateFormat.format(todayDate.getTime()), String.valueOf(FEE_PORTION)));
// CHECK ACCOUNT ENTRIES
System.out.println("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry);
final String jobName = "Add Periodic Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
loanID);
// MAKE 1
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
LocalDate fromDateLocal = LocalDate.now();
fromDateLocal = fromDateLocal.withYear((int) fromDateList.get(0));
fromDateLocal = fromDateLocal.withMonthOfYear((int) fromDateList.get(1));
fromDateLocal = fromDateLocal.withDayOfMonth((int) fromDateList.get(2));
List dueDateList = (List) loanSchedule.get(1).get("dueDate");
LocalDate dueDateLocal = LocalDate.now();
dueDateLocal = dueDateLocal.withYear((int) dueDateList.get(0));
dueDateLocal = dueDateLocal.withMonthOfYear((int) dueDateList.get(1));
dueDateLocal = dueDateLocal.withDayOfMonth((int) dueDateList.get(2));
int totalDaysInPeriod = Days.daysBetween(fromDateLocal, dueDateLocal).getDays();
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
float INTEREST_4_DAYS = totalInterest / totalDaysInPeriod * 4;
INTEREST_4_DAYS = new Float(numberFormat.format(INTEREST_4_DAYS));
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(currentDate), INTEREST_4_DAYS, FEE_PORTION,
PENALTY_PORTION, loanID);
}
@Test
public void checkPeriodicAccrualAccountingAPIFlow() {
final Account assetAccount = this.accountHelper.createAssetAccount();
final Account incomeAccount = this.accountHelper.createIncomeAccount();
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
overpaymentAccount);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
final float FEE_PORTION = 50.0f;
final float PENALTY_PORTION = 100.0f;
final float NEXT_FEE_PORTION = 55.0f;
final float NEXT_PENALTY_PORTION = 105.0f;
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
Integer flatSpecifiedDueDateNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_PENALTY_PORTION), true));
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todayDate = Calendar.getInstance();
final String currentDate = dateFormat.format(todayDate.getTime());
todayDate.add(Calendar.DATE, -4);
final String LOAN_DISBURSEMENT_DATE = dateFormat.format(todayDate.getTime());
todayDate.add(Calendar.MONTH, 2);
final String FIRST_REPAYMENT_DATE = dateFormat.format(todayDate.getTime());
todayDate = Calendar.getInstance();
todayDate.add(Calendar.DATE, -2);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
todayDate.add(Calendar.DATE, 1);
String runOndate = dateFormat.format(todayDate.getTime());
this.loanTransactionHelper
.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate,
String.valueOf(FEE_PORTION)));
todayDate.add(Calendar.DATE, 1);
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDateNext),
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
this.loanTransactionHelper.addChargesForLoan(
loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatNext),
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
// CHECK ACCOUNT ENTRIES
System.out.println("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry);
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
loanID);
// MAKE 1
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
LocalDate fromDateLocal = LocalDate.now();
fromDateLocal = fromDateLocal.withYear((int) fromDateList.get(0));
fromDateLocal = fromDateLocal.withMonthOfYear((int) fromDateList.get(1));
fromDateLocal = fromDateLocal.withDayOfMonth((int) fromDateList.get(2));
List dueDateList = (List) loanSchedule.get(1).get("dueDate");
LocalDate dueDateLocal = LocalDate.now();
dueDateLocal = dueDateLocal.withYear((int) dueDateList.get(0));
dueDateLocal = dueDateLocal.withMonthOfYear((int) dueDateList.get(1));
dueDateLocal = dueDateLocal.withDayOfMonth((int) dueDateList.get(2));
int totalDaysInPeriod = Days.daysBetween(fromDateLocal, dueDateLocal).getDays();
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
float INTEREST_3_DAYS = totalInterest / totalDaysInPeriod * 3;
INTEREST_3_DAYS = new Float(numberFormat.format(INTEREST_3_DAYS));
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), INTEREST_3_DAYS, FEE_PORTION,
PENALTY_PORTION, loanID);
runOndate = dateFormat.format(todayDate.getTime());
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
float interestPerDay = (totalInterest / totalDaysInPeriod * 4) - INTEREST_3_DAYS;
interestPerDay = new Float(numberFormat.format(interestPerDay));
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), interestPerDay, NEXT_FEE_PORTION,
NEXT_PENALTY_PORTION, loanID);
}
private Integer createLoanProductWithPeriodicAccrualAccountingEnabled(final Account... accounts) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRulePeriodicAccrual(accounts)
.build(null);
.withDaysInMonth("30").withDaysInYear("365").build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
@Test
public void checkCashBasedAccountingFlow() {
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -677,7 +914,7 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
// MAKE 1
System.out.println("Repayment 1 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
@@ -707,15 +944,15 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2], new JournalEntry(
SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
System.out.println("Repayment 2 Done ......");
// WAIVE INTEREST
System.out.println("Waive Interest ......");
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(this.REPAYMENT_DATE[4], this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
// waive of fees and interest are not considered in cash based accounting,
this.journalEntryHelper.ensureNoAccountingTransactionsWithTransactionId("L"+transactionId);
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(this.REPAYMENT_DATE[4],
this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
// waive of fees and interest are not considered in cash based
// accounting,
this.journalEntryHelper.ensureNoAccountingTransactionsWithTransactionId("L" + transactionId);
// REPAYMENT 3
System.out.println("Repayment 3 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
@@ -725,7 +962,7 @@ public class AccountingScenarioIntegrationTest {
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
System.out.println("Repayment 3 Done ......");
// REPAYMENT 4
System.out.println("Repayment 4 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
@@ -746,25 +983,25 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
System.out.println("Repayment 5 Done ......");
}
private Integer createLoanProductWithCashBasedAccountingEnabled(final Account... accounts) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleAsCashBased(accounts)
.build(null);
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleAsCashBased(accounts).build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
private LocalDate getDateAsLocalDate(String dateAsString) {
LocalDate date = null;
try {
DateFormat df = new SimpleDateFormat("dd MMMM yyyy");
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
date = new LocalDate(df.parse(dateAsString));
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
}
@@ -0,0 +1,412 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.batch.domain.BatchRequest;
import org.mifosplatform.batch.domain.BatchResponse;
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
import org.mifosplatform.integrationtests.common.BatchHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsProductHelper;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
* Test class for
* {@link org.mifosplatform.batch.command.CommandStrategyProvider}. This tests
* the response provided by commandStrategy by injecting it with a
* {@code BatchRequest}.
*
* @author RishabhShukla
*
* @see org.mifosplatform.integrationtests.common.BatchHelper
* @see org.mifosplatform.batch.domain.BatchRequest
*/
public class BatchApiTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
public BatchApiTest() {
super();
}
/**
* Sets up the essential settings for the TEST like contentType,
* expectedStatusCode. It uses the '@Before' annotation provided by jUnit.
*/
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
/**
* Tests for the unimplemented command Strategies by returning 501 status
* code. For a unknownRequest a statusCode 501 is returned back with
* response.
*
* @see org.mifosplatform.batch.command.internal.UnknownCommandStrategy
*/
@Test
public void shouldReturnStatusNotImplementedUnknownCommand() {
final BatchRequest br = new BatchRequest();
br.setRequestId(4711L);
br.setRelativeUrl("/nirvana");
br.setMethod("POST");
final List<BatchResponse> response = BatchHelper.postWithSingleRequest(this.requestSpec, this.responseSpec, br);
// Verify that only 501 is returned as the status code
for (BatchResponse resp : response) {
Assert.assertEquals("Verify Status code 501", (long) 501, (long) resp.getStatusCode());
}
}
/**
* Tests for the successful response for a createClient request from
* createClientCommand. A successful response with statusCode '200' is
* returned back.
*
* @see org.mifosplatform.batch.command.internal.CreateClientCommandStrategy
*/
@Test
public void shouldReturnOkStatusForCreateClientCommand() {
final BatchRequest br = BatchHelper.createClientRequest(4712L, "");
final List<BatchResponse> response = BatchHelper.postWithSingleRequest(this.requestSpec, this.responseSpec, br);
// Verify that a 200 response is returned as the status code
for (BatchResponse resp : response) {
Assert.assertEquals("Verify Status code 200", (long) 200, (long) resp.getStatusCode());
}
}
/**
* Tests for an erroneous response with statusCode '501' if transaction
* fails. If Query Parameter 'enclosingTransaction' is set to 'true' and if
* one of the request in BatchRequest fails then all transactions are rolled
* back.
*
* @see org.mifosplatform.batch.command.internal.CreateClientCommandStrategy
* @see org.mifosplatform.batch.api.BatchApiResource
* @see org.mifosplatform.batch.service.BatchApiService
*/
@Test
public void shouldRollBackAllTransactionsOnFailure() {
// Create first client request
final BatchRequest br1 = BatchHelper.createClientRequest(4713L, "TestExtId11");
// Create second client request
final BatchRequest br2 = BatchHelper.createClientRequest(4714L, "TestExtId12");
// Create third client request, having same externalID as second client,
// hence cause of error
final BatchRequest br3 = BatchHelper.createClientRequest(4715L, "TestExtId11");
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br1);
batchRequests.add(br2);
batchRequests.add(br3);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
// Verifies that none of the client in BatchRequest is created on the
// server
BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId11");
BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId12");
// Asserts that all the transactions have been successfully rolled back
Assert.assertEquals(response.size(), 1);
Assert.assertEquals("Verify Status code 400", (long) 400, (long) response.get(0).getStatusCode());
}
/**
* Tests that a client information was successfully updated through
* updateClientCommand. A 'changes' parameter is returned in the response
* after successful update of client information.
*
* @see org.mifosplatform.batch.command.internal.UpdateClientCommandStrategy
*/
@Test
public void shouldReflectChangesOnClientUpdate() {
// Create a createClient Request
final BatchRequest br1 = BatchHelper.createClientRequest(4716L, "");
// Create a clientUpdate Request
final BatchRequest br2 = BatchHelper.updateClientRequest(4717L, 4716L);
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br1);
batchRequests.add(br2);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
// Get the changes parameter from updateClient Response
final JsonObject changes = new FromJsonHelper().parse(response.get(1).getBody()).getAsJsonObject().get("changes").getAsJsonObject();
// Asserts the client information is successfully updated
Assert.assertEquals("Verify Firstname", "TestFirstName", changes.get("firstname").getAsString());
Assert.assertEquals("Verify Lastname", "TestLastName", changes.get("lastname").getAsString());
}
/**
* Tests that a ApplyLoanCommand was successfully executed and returned a
* 200(OK) status. It creates a new client and apply a loan to that client.
* This also verifies the successful resolution of dependencies among two
* requests.
*
* @see org.mifosplatform.batch.command.internal.ApplyLoanCommandStrategy
*/
@Test
public void shouldReturnOkStatusForApplyLoanCommand() {
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("10000000.00") //
.withNumberOfRepayments("24") //
.withRepaymentAfterEvery("1") //
.withRepaymentTypeAsMonth() //
.withinterestRatePerPeriod("2") //
.withInterestRateFrequencyTypeAsMonths() //
.withAmortizationTypeAsEqualPrincipalPayment() //
.withInterestTypeAsDecliningBalance() //
.currencyDetails("0", "100").build(null);
final Integer productId = new LoanTransactionHelper(this.requestSpec, this.responseSpec).getLoanProductId(loanProductJSON);
// Create a createClient Request
final BatchRequest br1 = BatchHelper.createClientRequest(4718L, "");
// Create a activateClient Request
final BatchRequest br2 = BatchHelper.activateClientRequest(4719L, 4718L);
// Create a ApplyLoan Request
final BatchRequest br3 = BatchHelper.applyLoanRequest(4720L, 4719L, productId);
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br1);
batchRequests.add(br2);
batchRequests.add(br3);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
// Get the clientId parameter from createClient Response
final JsonElement clientId = new FromJsonHelper().parse(response.get(0).getBody()).getAsJsonObject().get("clientId");
Assert.assertEquals("Verify Status Code 200" + clientId.getAsString(), 200L, (long) response.get(1).getStatusCode());
}
/**
* Tests that a new savings accounts was applied to an existing client and a
* 200(OK) status was returned. It first creates a new client and a savings
* product, then uses the cliendId and ProductId to apply a savings account.
*
* @see org.mifosplatform.batch.command.internal.ApplySavingsCommandStrategy
*/
@Test
public void shouldReturnOkStatusForApplySavingsCommand() {
final SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
final String savingsProductJSON = savingsProductHelper //
.withInterestCompoundingPeriodTypeAsDaily() //
.withInterestPostingPeriodTypeAsMonthly() //
.withInterestCalculationPeriodTypeAsDailyBalance() //
.withMinimumOpenningBalance("5000").build();
final Integer productId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, this.requestSpec, this.responseSpec);
// Create a createClient Request
final BatchRequest br1 = BatchHelper.createClientRequest(4720L, "");
// Create a activateClient Request
final BatchRequest br2 = BatchHelper.activateClientRequest(4721L, 4720L);
// Create a applySavings Request
final BatchRequest br3 = BatchHelper.applySavingsRequest(4722L, 4721L, productId);
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br1);
batchRequests.add(br2);
batchRequests.add(br3);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
Assert.assertEquals("Verify Status Code 200", 200L, (long) response.get(1).getStatusCode());
}
/**
* Tests that a new charge was added to a newly created loan and charges are
* Collected properly 200(OK) status was returned for successful responses.
* It first creates a new client and apply a loan, then creates a new charge
* for the create loan and then fetches all the applied charges
*
* @see org.mifosplatform.batch.command.internal.CollectChargesCommandStrategy
* @see org.mifosplatform.batch.command.internal.CreateChargeCommandStrategy
*/
@Test
public void shouldReturnOkStatusForCollectChargesCommand() {
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("10000000.00") //
.withNumberOfRepayments("24") //
.withRepaymentAfterEvery("1") //
.withRepaymentTypeAsMonth() //
.withinterestRatePerPeriod("2") //
.withInterestRateFrequencyTypeAsMonths() //
.withAmortizationTypeAsEqualPrincipalPayment() //
.withInterestTypeAsDecliningBalance() //
.currencyDetails("0", "100").build(null);
final Integer productId = new LoanTransactionHelper(this.requestSpec, this.responseSpec).getLoanProductId(loanProductJSON);
// Create a createClient Request
final BatchRequest br1 = BatchHelper.createClientRequest(4722L, "");
// Create a activateClient Request
final BatchRequest br2 = BatchHelper.activateClientRequest(4723L, 4722L);
// Create a ApplyLoan Request
final BatchRequest br3 = BatchHelper.applyLoanRequest(4724L, 4723L, productId);
// Create a Collect Charges Request
final BatchRequest br4 = BatchHelper.collectChargesRequest(4725L, 4724L);
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br1);
batchRequests.add(br2);
batchRequests.add(br3);
batchRequests.add(br4);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
Assert.assertEquals("Verify Status Code 200 for Create Loan Charge", 200L, (long) response.get(3).getStatusCode());
}
/**
* Test for the successful activation of a pending client using
* 'ActivateClientCommandStrategy'. A '200' status code is expected on
* successful activation.
*
* @see org.mifosplatform.batch.command.internal.ActivateClientCommandStrategy
*/
@Test
public void shouldReturnOkStatusOnSuccessfulClientActivation() {
// Create a createClient Request
final BatchRequest br1 = BatchHelper.createClientRequest(4726L, "");
// Create a activateClient Request
final BatchRequest br2 = BatchHelper.activateClientRequest(4727L, 4726L);
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br1);
batchRequests.add(br2);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
Assert.assertEquals("Verify Status Code 200 for Create Client", 200L, (long) response.get(0).getStatusCode());
Assert.assertEquals("Verify Status Code 200 for Activate Client", 200L, (long) response.get(1).getStatusCode());
}
/**
* Test for the successful approval and disbursal of a loan using
* 'ApproveLoanCommandStrategy' and 'DisburseLoanCommandStrategy'. A '200'
* status code is expected on successful activation.
*
* @see org.mifosplatform.batch.command.internal.ApproveLoanCommandStrategy
* @see org.mifosplatform.batch.command.internal.DisburseLoanCommandStrategy
*/
@Test
public void shouldReturnOkStatusOnSuccessfulLoanApprovalAndDisburse() {
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("10000000.00") //
.withNumberOfRepayments("24") //
.withRepaymentAfterEvery("1") //
.withRepaymentTypeAsMonth() //
.withinterestRatePerPeriod("2") //
.withInterestRateFrequencyTypeAsMonths() //
.withAmortizationTypeAsEqualPrincipalPayment() //
.withInterestTypeAsDecliningBalance() //
.currencyDetails("0", "100").build(null);
final Integer productId = new LoanTransactionHelper(this.requestSpec, this.responseSpec).getLoanProductId(loanProductJSON);
// Create a createClient Request
final BatchRequest br1 = BatchHelper.createClientRequest(4730L, "");
// Create a activateClient Request
final BatchRequest br2 = BatchHelper.activateClientRequest(4731L, 4730L);
// Create a ApplyLoan Request
final BatchRequest br3 = BatchHelper.applyLoanRequest(4732L, 4731L, productId);
// Create a approveLoan Request
final BatchRequest br4 = BatchHelper.approveLoanRequest(4733L, 4732L);
// Create a disburseLoan Request
final BatchRequest br5 = BatchHelper.disburseLoanRequest(4734L, 4733L);
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br1);
batchRequests.add(br2);
batchRequests.add(br3);
batchRequests.add(br4);
batchRequests.add(br5);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
Assert.assertEquals("Verify Status Code 200 for Approve Loan", 200L, (long) response.get(3).getStatusCode());
Assert.assertEquals("Verify Status Code 200 for Disburse Loan", 200L, (long) response.get(4).getStatusCode());
}
}
@@ -0,0 +1,127 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.batch.domain.BatchRequest;
import org.mifosplatform.batch.domain.BatchResponse;
import org.mifosplatform.integrationtests.common.BatchHelper;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.GroupHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
* Test class for testing the integration of Batch API with custom batch
* requests and various user defined workflow. Like in the case of mifos
* community-app
*
* @author Rishabh Shukla
*/
public class BatchRequestsIntegrationTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
public BatchRequestsIntegrationTest() {
super();
}
/**
* Sets up the essential settings for the TEST like contentType,
* expectedStatusCode. It uses the '@Before' annotation provided by jUnit.
*/
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@Test
/**
* Tests that a loan is successfully applied to client members of a group.
* Firstly, it'll create a few new clients and then will add those clients
* to the group. Then a few loans will be created and one of those loans
* will be chosen at random and similarily a few of the created clients will
* be chosen on random. Now, the selected loan will be applied to these
* clients through Batch - API ApplyLoanCommandStrategy.
*/
public void shouldReturnOkStatusForLoansAppliedToSelectedClients() {
// Generate a random count of number of clients to be created
final Integer clientsCount = (int) Math.ceil(Math.random() * 7) + 3;
final Integer[] clientIDs = new Integer[clientsCount];
// Create a new group and get its groupId
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true);
// Create new clients and add those to this group
for (Integer i = 0; i < clientsCount; i++) {
clientIDs[i] = ClientHelper.createClient(this.requestSpec, this.responseSpec);
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientIDs[i].toString());
System.out.println("client " + clientIDs[i] + " has been added to the group " + groupID);
}
// Generate a random count of number of new loan products to be created
final Integer loansCount = (int) Math.ceil(Math.random() * 4) + 1;
final Integer[] loanProducts = new Integer[loansCount];
// Create new loan Products
for (Integer i = 0; i < loansCount; i++) {
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal(String.valueOf(10000.00 + Math.ceil(Math.random() * 1000000.00))) //
.withNumberOfRepayments(String.valueOf(2 + (int) Math.ceil(Math.random() * 36))) //
.withRepaymentAfterEvery(String.valueOf(1 + (int) Math.ceil(Math.random() * 3))) //
.withRepaymentTypeAsMonth() //
.withinterestRatePerPeriod(String.valueOf(1 + (int) Math.ceil(Math.random() * 4))) //
.withInterestRateFrequencyTypeAsMonths() //
.withAmortizationTypeAsEqualPrincipalPayment() //
.withInterestTypeAsDecliningBalance() //
.currencyDetails("0", "100").build(null);
loanProducts[i] = new LoanTransactionHelper(this.requestSpec, this.responseSpec).getLoanProductId(loanProductJSON);
}
// Select anyone of the loan products at random
final Integer loanProductID = loanProducts[(int) Math.floor(Math.random() * (loansCount - 1))];
final List<BatchRequest> batchRequests = new ArrayList<>();
// Select a few clients from created group at random
Integer selClientsCount = (int) Math.ceil(Math.random() * clientsCount) + 2;
for (int i = 0; i < selClientsCount; i++) {
BatchRequest br = BatchHelper.applyLoanRequest((long) selClientsCount, null, loanProductID);
br.setBody(br.getBody().replace("$.clientId", String.valueOf(clientIDs[(int) Math.floor(Math.random() * (clientsCount - 1))])));
batchRequests.add(br);
}
// Send the request to Batch - API
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
jsonifiedRequest);
// Verify that each loan has been applied successfully
for (BatchResponse res : response) {
Assert.assertEquals("Verify Status Code 200", 200L, (long) res.getStatusCode());
}
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.ArrayList;
@@ -1,13 +1,24 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.joda.time.LocalDate;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -55,8 +66,12 @@ public class ClientSavingsIntegrationTest {
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -90,13 +105,64 @@ public class ClientSavingsIntegrationTest {
}
@Test
public void testSavingsAccount_CLOSE_APPLICATION() {
public void testSavingsAccountWithMinBalanceForInterestCalculation() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final String minBalanceForInterestCalculation = "5000";
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, null);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertNotNull(savingsProductID);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId,
ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertTrue(modifications.containsKey("submittedOnDate"));
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
this.savingsAccountHelper.calculateInterestForSavings(savingsId);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
assertEquals(summaryBefore, summary);
this.savingsAccountHelper.postInterestForSavings(savingsId);
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
assertEquals(summaryBefore, summary);
final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId);
Assert.assertNull(savingsInterest);
}
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccount_CLOSE_APPLICATION() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = "1000.0";
final String enforceMinRequiredBalance = "true";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -111,10 +177,86 @@ public class ClientSavingsIntegrationTest {
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.closeSavingsAccount(savingsId);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
String withdrawBalance = "false";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
withdrawBalance = "true";
savingsStatusHashMap = this.savingsAccountHelper.closeSavingsAccount(savingsId, withdrawBalance);
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
}
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccount_WITH_ENFORCE_MIN_BALANCE() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = "1500.0";
final String openningBalance = "1600";
final String enforceMinRequiredBalance = "true";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, openningBalance ,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertNotNull(savingsProductID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
final Integer savingsActivationChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
ChargesHelper.getSavingsActivationFeeJSON());
Assert.assertNotNull(savingsActivationChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, savingsActivationChargeId);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
Float balance = new Float(openningBalance);
Float chargeAmt = 100f;
balance -= chargeAmt;
assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
Calendar todaysDate = Calendar.getInstance();
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
final String withdrawAmt = "800";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.withdrawalFromSavingsAccount(savingsId,
withdrawAmt, TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.savingsaccount.transaction.insufficient.account.balance",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, withdrawAmt,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(withdrawAmt);
assertEquals("Verifying Withdrawal Amount", new Float(withdrawAmt), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
}
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccount_DELETE_APPLICATION() {
@@ -125,8 +267,12 @@ public class ClientSavingsIntegrationTest {
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, null);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -164,8 +310,12 @@ public class ClientSavingsIntegrationTest {
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -205,8 +355,12 @@ public class ClientSavingsIntegrationTest {
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -229,8 +383,12 @@ public class ClientSavingsIntegrationTest {
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -319,16 +477,23 @@ public class ClientSavingsIntegrationTest {
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountCharges() {
final ResponseSpecification erroResponseSpec = new ResponseSpecBuilder().build();
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, erroResponseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertNotNull(savingsProductID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
@@ -368,7 +533,14 @@ public class ClientSavingsIntegrationTest {
Assert.assertEquals(1, charges.size());
HashMap savingsChargeForPay = charges.get(0);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat);
Integer annualSavingsChargeId = (Integer) savingsChargeForPay.get("id");
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.inactivateCharge(annualSavingsChargeId,
savingsId, CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due", savingsAccountErrorData
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat, Locale.US);
Calendar cal = Calendar.getInstance();
List dates = (List) savingsChargeForPay.get("dueDate");
cal.set(Calendar.YEAR, (Integer) dates.get(0));
@@ -380,6 +552,10 @@ public class ClientSavingsIntegrationTest {
HashMap paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForPay.get("id"));
assertEquals(savingsChargeForPay.get("amount"), paidCharge.get("amountPaid"));
Integer inactivatedChargeId = (Integer) this.savingsAccountHelper.inactivateCharge(annualSavingsChargeId, savingsId,
CommonConstants.RESPONSE_RESOURCE_ID);
assertEquals("Inactivated Savings Charges Id", annualSavingsChargeId, inactivatedChargeId);
final Integer monthlyFeechargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
ChargesHelper.getSavingsMonthlyFeeJSON());
Assert.assertNotNull(monthlyFeechargeId);
@@ -389,19 +565,231 @@ public class ClientSavingsIntegrationTest {
Assert.assertEquals(2, charges.size());
HashMap savingsChargeForWaive = charges.get(1);
final Integer monthlySavingsCharge = (Integer) savingsChargeForWaive.get("id");
savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.inactivateCharge(monthlySavingsCharge, savingsId,
CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due", savingsAccountErrorData
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
HashMap waiveCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForWaive.get("id"));
assertEquals(savingsChargeForWaive.get("amount"), waiveCharge.get("amountWaived"));
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
waiveCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForWaive.get("id"));
BigDecimal totalWaiveAmount = BigDecimal.valueOf(Double.valueOf((Float) savingsChargeForWaive.get("amount")));
totalWaiveAmount = totalWaiveAmount.add(totalWaiveAmount);
assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived"));
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
ChargesHelper.getSavingsWeeklyFeeJSON());
Assert.assertNotNull(weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(3, charges.size());
savingsChargeForPay = charges.get(2);
final Integer weeklySavingsFeeId = (Integer) savingsChargeForPay.get("id");
savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.inactivateCharge(weeklySavingsFeeId, savingsId,
CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.savingsaccountcharge.inactivation.of.charge.not.allowed.when.charge.is.due", savingsAccountErrorData
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
cal = Calendar.getInstance();
dates = (List) savingsChargeForPay.get("dueDate");
cal.set(Calendar.YEAR, (Integer) dates.get(0));
cal.set(Calendar.MONTH, (Integer) dates.get(1) - 1);
cal.set(Calendar.DAY_OF_MONTH, (Integer) dates.get(2));
// Depositing huge amount as scheduler job deducts the fee amount
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "100000",
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(depositTransactionId);
this.savingsAccountHelper.payCharge((Integer) savingsChargeForPay.get("id"), savingsId,
((Float) savingsChargeForPay.get("amount")).toString(), sdf.format(cal.getTime()));
paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForPay.get("id"));
assertEquals(savingsChargeForPay.get("amount"), paidCharge.get("amountPaid"));
List nextDueDates = (List) paidCharge.get("dueDate");
LocalDate nextDueDate = new LocalDate((Integer) nextDueDates.get(0), (Integer) nextDueDates.get(1), (Integer) nextDueDates.get(2));
LocalDate expectedNextDueDate = new LocalDate((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
.plusWeeks((Integer) paidCharge.get("feeInterval"));
assertEquals(expectedNextDueDate, nextDueDate);
}
/***
* Test case for overdraft account functionality. Open account with zero
* balance, perform transactions then post interest and verify posted
* interest
*/
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountWithOverdraft() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
/***
* Create a client to apply for savings account (overdraft account).
*/
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
final String minBalanceForInterestCalculation = null;
/***
* Create savings product with zero opening balance and overdraft
* enabled
*/
final String zeroOpeningBalance = "0.0";
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final boolean allowOverdraft = true;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, zeroOpeningBalance,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
/***
* Apply for Savings account
*/
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertNotNull(savingsProductID);
HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId,
ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertTrue(modifications.containsKey("submittedOnDate"));
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
/***
* Approve the savings account
*/
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -1);
todaysDate.set(Calendar.DAY_OF_MONTH, 1);
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
final Integer lastDayOfMonth = todaysDate.getActualMaximum(Calendar.DAY_OF_MONTH);
todaysDate.set(Calendar.DAY_OF_MONTH, lastDayOfMonth);
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
/***
* Activate the application and verify account status
*
* @param activationDate
* this value is every time first day of previous month
*/
savingsStatusHashMap = activateSavingsAccount(savingsId, ACTIVATION_DATE);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
/***
* Verify the account summary
*/
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
this.savingsAccountHelper.calculateInterestForSavings(savingsId);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
assertEquals(summaryBefore, summary);
Float balance = Float.valueOf(zeroOpeningBalance);
/***
* Perform withdraw transaction, verify account balance(account balance
* will go to negative as no deposits are there prior to this
* transaction)
*/
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
/***
* Perform Deposit transaction on last day of month and verify account
* balance.
*
* @param transactionDate
* this value is every time last day of previous month
*/
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
/***
* Perform Post interest transaction and verify the posted amount
*/
this.savingsAccountHelper.postInterestForSavings(savingsId);
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
/***
* Calculate expected interest to be posted, interest should be posted
* for one day only because deposit transaction happened on last day of
* month before this account balance is negative.
*/
final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
final Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
double interestRateInFraction = (nominalAnnualInterest / 100);
double perDay = (double) 1 / (daysInYear);
double interestPerDay = interestRateInFraction * perDay;
Float interestPosted = (float) (interestPerDay * balance * 1);
/***
* Apply rounding on interestPosted, actualInterestPosted and verify
* both are same
*/
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted));
actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted));
assertEquals("Verifying interest posted", interestPosted, actualInterestPosted);
todaysDate = Calendar.getInstance();
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
String withdrawBalance = "false";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
private HashMap activateSavingsAccount(final Integer savingsId, final String activationDate) {
final HashMap status = this.savingsAccountHelper.activateSavingsAccount(savingsId, activationDate);
return status;
}
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance) {
final String minOpenningBalance, String minBalanceForInterestCalculation, String minRequiredBalance,
String enforceMinRequiredBalance, final boolean allowOverdraft) {
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
final String savingsProductJSON = savingsProductHelper //
.withInterestCompoundingPeriodTypeAsDaily() //
.withInterestPostingPeriodTypeAsMonthly() //
.withInterestCalculationPeriodTypeAsDailyBalance() //
if (allowOverdraft) {
final String overDraftLimit = "2000.0";
savingsProductHelper = savingsProductHelper.withOverDraft(overDraftLimit);
}
final String savingsProductJSON = savingsProductHelper
//
.withInterestCompoundingPeriodTypeAsDaily()
//
.withInterestPostingPeriodTypeAsMonthly()
//
.withInterestCalculationPeriodTypeAsDailyBalance()
//
.withMinBalanceForInterestCalculation(minBalanceForInterestCalculation)
//
.withMinRequiredBalance(minRequiredBalance).withEnforceMinRequiredBalance(enforceMinRequiredBalance)
.withMinimumOpenningBalance(minOpenningBalance).build();
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
@@ -0,0 +1,48 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
public class ClientStatusChecker {
public static void verifyClientIsActive(final HashMap clientStatusHashMap) {
assertEquals((int) clientStatusHashMap.get("id"), 300);
}
public static void verifyClientClosed(final HashMap clientStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS CLOSED ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 600);
System.out.println("Client Status:" + clientStatusHashMap + "\n");
}
public static void verifyClientPending(final HashMap clientStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS PENDING ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 100);
System.out.println("Client Status:" + clientStatusHashMap + "\n");
}
public static void verifyClientRejected(final HashMap clientStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS REJECTED ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 700);
System.out.println("Client Status:" + clientStatusHashMap + "\n");
}
public static void verifyClientActiavted(final HashMap clientStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS ACTIVATED ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 300);
System.out.println("Client Status:" + clientStatusHashMap + "\n");
}
public static void verifyClientWithdrawn(final HashMap clientStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 800);
System.out.println("Client Status:" + clientStatusHashMap + "\n");
}
}
@@ -0,0 +1,78 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.HashMap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.SchedulerJobHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.accounting.AccountHelper;
import org.mifosplatform.integrationtests.common.accounting.JournalEntryHelper;
import org.mifosplatform.integrationtests.common.accounting.PeriodicAccrualAccountingHelper;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsStatusChecker;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class ClientTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private ClientHelper clientHelper;
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@Test
public void testClientStatus() {
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId);
HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientIsActive(status);
HashMap clientStatusHashMap = this.clientHelper.closeClient(clientId);
ClientStatusChecker.verifyClientClosed(clientStatusHashMap);
clientStatusHashMap = this.clientHelper.reactivateClient(clientId);
ClientStatusChecker.verifyClientPending(clientStatusHashMap);
clientStatusHashMap = this.clientHelper.rejectClient(clientId);
ClientStatusChecker.verifyClientRejected(clientStatusHashMap);
clientStatusHashMap = this.clientHelper.activateClient(clientId);
ClientStatusChecker.verifyClientActiavted(clientStatusHashMap);
clientStatusHashMap = this.clientHelper.closeClient(clientId);
ClientStatusChecker.verifyClientClosed(clientStatusHashMap);
clientStatusHashMap = this.clientHelper.reactivateClient(clientId);
ClientStatusChecker.verifyClientPending(clientStatusHashMap);
clientStatusHashMap = this.clientHelper.withdrawClient(clientId);
ClientStatusChecker.verifyClientWithdrawn(clientStatusHashMap);
}
}
@@ -0,0 +1,151 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.List;
import org.junit.Assert;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
import org.mifosplatform.accounting.financialactivityaccount.exception.DuplicateFinancialActivityAccountFoundException;
import org.mifosplatform.accounting.financialactivityaccount.exception.FinancialActivityAccountInvalidException;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.accounting.Account;
import org.mifosplatform.integrationtests.common.accounting.AccountHelper;
import org.mifosplatform.integrationtests.common.accounting.FinancialActivityAccountHelper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings("rawtypes")
public class FinancialActivityAccountsTest {
private ResponseSpecification responseSpec;
private ResponseSpecification responseSpecForValidationError;
private ResponseSpecification responseSpecForDomainRuleViolation;
private ResponseSpecification responseSpecForResourceNotFoundError;
private RequestSpecification requestSpec;
private AccountHelper accountHelper;
private FinancialActivityAccountHelper financialActivityAccountHelper;
private final Integer assetTransferFinancialActivityId = FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue();
public static final Integer liabilityTransferFinancialActivityId = FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue();
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.responseSpecForValidationError = new ResponseSpecBuilder().expectStatusCode(400).build();
this.responseSpecForDomainRuleViolation = new ResponseSpecBuilder().expectStatusCode(403).build();
this.responseSpecForResourceNotFoundError = new ResponseSpecBuilder().expectStatusCode(404).build();
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.financialActivityAccountHelper = new FinancialActivityAccountHelper(this.requestSpec);
}
@SuppressWarnings("unchecked")
@Test
public void testFinancialActivityAccounts() {
/** Create a Liability and an Asset Transfer Account **/
Account liabilityTransferAccount = accountHelper.createLiabilityAccount();
Account assetTransferAccount = accountHelper.createAssetAccount();
Assert.assertNotNull(assetTransferAccount);
Assert.assertNotNull(liabilityTransferAccount);
/*** Create A Financial Activity to Account Mapping **/
Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount(
liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(), responseSpec,
CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(financialActivityAccountId);
/***
* Fetch Created Financial Activity to Account Mapping and validate
* created values
**/
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId, liabilityTransferAccount);
/**
* Update Existing Financial Activity to Account Mapping and assert
* changes
**/
Account newLiabilityTransferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(newLiabilityTransferAccount);
HashMap changes = (HashMap) financialActivityAccountHelper.updateFinancialActivityAccount(financialActivityAccountId,
liabilityTransferFinancialActivityId, newLiabilityTransferAccount.getAccountID(), responseSpec,
CommonConstants.RESPONSE_CHANGES);
Assert.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId"));
/** Validate update works correctly **/
assertFinancialActivityAccountCreation(financialActivityAccountId, liabilityTransferFinancialActivityId,
newLiabilityTransferAccount);
/** Update with Invalid Financial Activity should fail **/
List<HashMap> invalidFinancialActivityUpdateError = (List<HashMap>) financialActivityAccountHelper.updateFinancialActivityAccount(
financialActivityAccountId, 232, newLiabilityTransferAccount.getAccountID(), responseSpecForValidationError,
CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.financialactivityaccount.financialActivityId.is.not.one.of.expected.enumerations",
invalidFinancialActivityUpdateError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/** Creating Duplicate Financial Activity should fail **/
List<HashMap> duplicateFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper
.createFinancialActivityAccount(liabilityTransferFinancialActivityId, liabilityTransferAccount.getAccountID(),
responseSpecForDomainRuleViolation, CommonConstants.RESPONSE_ERROR);
assertEquals(DuplicateFinancialActivityAccountFoundException.getErrorcode(),
duplicateFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/**
* Associating incorrect GL account types with a financial activity
* should fail
**/
List<HashMap> invalidFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper.updateFinancialActivityAccount(
financialActivityAccountId, assetTransferFinancialActivityId, newLiabilityTransferAccount.getAccountID(),
responseSpecForDomainRuleViolation, CommonConstants.RESPONSE_ERROR);
assertEquals(FinancialActivityAccountInvalidException.getErrorcode(),
invalidFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/** Should be able to delete a Financial Activity to Account Mapping **/
Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(deletedFinancialActivityAccountId);
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
/*** Trying to fetch a Deleted Account Mapping should give me a 404 **/
financialActivityAccountHelper.getFinancialActivityAccount(deletedFinancialActivityAccountId, responseSpecForResourceNotFoundError);
}
private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) {
HashMap mappingDetails = financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId, responseSpec);
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
}
/**
* Delete the Financial activities
*/
@After
public void tearDown() {
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
for (HashMap financialActivity : financialActivities) {
Integer financialActivityAccountId = (Integer) financialActivity.get("id");
Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount(
financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(deletedFinancialActivityAccountId);
Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId);
}
}
}
@@ -0,0 +1,148 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.GlobalConfigurationHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsProductHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsStatusChecker;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "rawtypes", "unused", "unchecked" })
public class FlexibleSavingsInterestPostingIntegrationTest {
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private SavingsProductHelper savingsProductHelper;
private SavingsAccountHelper savingsAccountHelper;
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.savingsProductHelper = new SavingsProductHelper();
}
@Test
public void testSavingsInterestPostingAtPeriodEnd() {
//client activation, savings activation and 1st transaction date
final String startDate = "01 December 2013";
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate);
Assert.assertNotNull(clientID);
// Configuring global config flags
configureInterestPosting(true, 4);
final Integer savingsId = createSavingsAccount(clientID, startDate);
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000",
startDate, CommonConstants.RESPONSE_RESOURCE_ID);
/***
* Perform Post interest transaction and verify the posted transaction date
*/
this.savingsAccountHelper.postInterestForSavings(savingsId);
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>)
accountDetails.get("transactions");
HashMap<String, Object> interestPostingTransaction = transactions.get(0);
for(Entry<String, Object> entry : interestPostingTransaction.entrySet())
System.out.println(entry.getKey() + "-" + entry.getValue().toString());
//1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily balance
//33.7016 obtained from formula in excel provided by Subramanya
assertEquals("Equality check for interest posted amount",
"33.7016", interestPostingTransaction.get("amount").toString());
assertEquals("Date check for Interest Posting transaction",
"[2014, 3, 31]", interestPostingTransaction.get("date").toString());
}
private Integer createSavingsAccount(final Integer clientID, final String startDate) {
final Integer savingsProductID = createSavingsProduct();
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplicationOnDate(clientID,
savingsProductID, ACCOUNT_TYPE_INDIVIDUAL, startDate);
Assert.assertNotNull(savingsId);
HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavingsOnDate(savingsId, startDate);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.activateSavingsAccount(savingsId, startDate);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
return savingsId;
}
private void configureInterestPosting(final Boolean periodEndEnable,
final Integer financialYearBeginningMonth) {
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
this.responseSpec);
Assert.assertNotNull(globalConfig);
// Updating flag for interest posting at period end
Integer periodEndConfigId = (Integer) globalConfig.get(10).get("id");
Assert.assertNotNull(periodEndConfigId);
HashMap periodEndConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
periodEndConfigId.toString());
Assert.assertNotNull(periodEndConfigData);
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
if (enabled != periodEndEnable)
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
periodEndConfigId.toString(), periodEndEnable);
//Updating value for financial year beginning month
Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id");
Assert.assertNotNull(financialYearBeginningConfigId);
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec,
financialYearBeginningConfigId.toString());
Assert.assertNotNull(financialYearBeginningConfigData);
financialYearBeginningConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
financialYearBeginningConfigId.toString(), financialYearBeginningMonth.toString());
Assert.assertNotNull(financialYearBeginningConfigId);
}
private Integer createSavingsProduct() {
final String savingsProductJSON = this.savingsProductHelper
.withInterestCompoundingPeriodTypeAsDaily()
.withInterestPostingPeriodTypeAsAnnual()
.withInterestCalculationPeriodTypeAsDailyBalance()
.build();
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
//Reset configuration fields
@After
public void tearDown() {
configureInterestPosting(false, 1);
}
}
@@ -0,0 +1,333 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertEquals;
import com.google.gson.Gson;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.funds.FundsHelper;
import org.mifosplatform.integrationtests.common.funds.FundsResourceHandler;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import java.util.*;
/**
* Funds Integration Test for checking Funds Application.
*/
public class FundsIntegrationTest {
private ResponseSpecification statusOkResponseSpec;
private RequestSpecification requestSpec;
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.statusOkResponseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@Test
public void testCreateFund() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
}
@Test
public void testCreateFundWithEmptyName() {
FundsHelper fh = FundsHelper
.create(null)
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
Assert.assertNull(fundID);
}
@Test
public void testCreateFundWithEmptyExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(null)
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
}
@Test
public void testCreateFundWithDuplicateName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
FundsHelper fh2 = FundsHelper
.create(fh.getName())
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
jsonData = fh2.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
Assert.assertNull(fundID2);
}
@Test
public void testCreateFundWithDuplicateExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
FundsHelper fh2 = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(fh.getExternalId())
.build();
jsonData = fh2.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
Assert.assertNull(fundID2);
}
@Test
public void testCreateFundWithInvalidName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 120))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
Assert.assertNull(fundID);
}
@Test
public void testCreateFundWithInvalidExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 120))
.build();
String jsonData = fh.toJSON();
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
final Long fundID = createFund(jsonData, this.requestSpec, responseSpec);
Assert.assertNull(fundID);
}
@Test
public void testRetrieveFund() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
FundsHelper fh2 = FundsHelper.fromJSON(jsonData);
assertEquals(fh.getName(), fh2.getName());
}
@Test
public void testRetrieveAllFunds() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
List<FundsHelper> fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fhList);
Assert.assertThat(fhList.size(), greaterThanOrEqualTo(1));
Assert.assertThat(fhList, hasItem(fh));
}
@Test
public void testRetrieveUnknownFund() {
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec);
HashMap<String, String> map = new Gson().fromJson(jsonData, HashMap.class);
assertEquals(map.get("userMessageGlobalisationCode"), "error.msg.resource.not.found");
}
@Test
public void testUpdateFund() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
String newName = Utils.randomNameGenerator("", 10);
String newExternalId = Utils.randomNameGenerator("fund-", 5);
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, this.statusOkResponseSpec);
Assert.assertEquals(newName, fh2.getName());
Assert.assertEquals(newExternalId, fh2.getExternalId());
}
@Test
public void testUpdateUnknownFund() {
String newName = Utils.randomNameGenerator("", 10);
String newExternalId = Utils.randomNameGenerator("fund-", 5);
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec,
responseSpec);
Assert.assertNull(fh);
}
@Test
public void testUpdateFundWithInvalidNewName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
String newName = Utils.randomNameGenerator("", 120);
String newExternalId = Utils.randomNameGenerator("fund-", 5);
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
responseSpec);
Assert.assertNull(fh2);
}
@Test
public void testUpdateFundWithNewExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
String newExternalId = Utils.randomNameGenerator("fund-", 5);
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, newExternalId, this.requestSpec, this.statusOkResponseSpec);
Assert.assertEquals(newExternalId, fh2.getExternalId());
}
@Test
public void testUpdateFundWithInvalidNewExternalId() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
String newName = Utils.randomNameGenerator("", 10);
String newExternalId = Utils.randomNameGenerator("fund-", 120);
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec,
responseSpec);
Assert.assertNull(fh2);
}
@Test
public void testUpdateFundWithNewName() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
String newName = Utils.randomNameGenerator("", 10);
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, null, this.requestSpec, this.statusOkResponseSpec);
Assert.assertEquals(newName, fh2.getName());
}
@Test
public void testUpdateFundWithEmptyParams() {
FundsHelper fh = FundsHelper
.create(Utils.randomNameGenerator("", 10))
.externalId(Utils.randomNameGenerator("fund-", 5))
.build();
String jsonData = fh.toJSON();
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fundID);
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, null, this.requestSpec, this.statusOkResponseSpec);
Assert.assertNull(fh2.getName());
Assert.assertNull(fh2.getExternalId());
// assert that there was no change in
// the name and external ID of the fund
jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
FundsHelper fh3 = new Gson().fromJson(jsonData, FundsHelper.class);
Assert.assertEquals(fh.getName(), fh3.getName());
Assert.assertEquals(fh.getExternalId(), fh3.getExternalId());
}
private Long createFund(final String fundJSON,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
String fundId = String.valueOf(FundsResourceHandler.createFund(fundJSON, requestSpec, responseSpec));
if (fundId.equals("null")) {
// Invalid JSON data parameters
return null;
}
return new Long(fundId);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.ArrayList;
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
@@ -93,22 +98,22 @@ public class GroupLoanIntegrationTest {
private void verifyLoanRepaymentSchedule(final ArrayList<HashMap> loanSchedule) {
System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
assertEquals("Checking for Due Date for 1st Month", new ArrayList<Integer>(Arrays.asList(2011, 10, 20)),
assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)),
loanSchedule.get(1).get("dueDate"));
assertEquals("Checking for Principal Due for 1st Month", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue"));
assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue"));
assertEquals("Checking for Due Date for 2nd Month", new ArrayList<Integer>(Arrays.asList(2011, 11, 20)),
assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)),
loanSchedule.get(2).get("dueDate"));
assertEquals("Checking for Principal Due for 2nd Month", new Float("2969.71"), loanSchedule.get(2).get("principalDue"));
assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue"));
assertEquals("Checking for Due Date for 3rd Month", new ArrayList<Integer>(Arrays.asList(2011, 12, 20)),
assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)),
loanSchedule.get(3).get("dueDate"));
assertEquals("Checking for Principal Due for 3rd Month", new Float("3029.1"), loanSchedule.get(3).get("principalDue"));
assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue"));
assertEquals("Checking for Due Date for 4th Month", new ArrayList<Integer>(Arrays.asList(2012, 1, 20)),
assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)),
loanSchedule.get(4).get("dueDate"));
assertEquals("Checking for Principal Due for 4th Month", new Float("3089.7"), loanSchedule.get(4).get("principalDue"));
assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
@@ -1,13 +1,22 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.joda.time.LocalDate;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -63,7 +72,11 @@ public class GroupSavingsIntegrationTest {
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
Assert.assertNotNull(groupID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
@@ -93,9 +106,12 @@ public class GroupSavingsIntegrationTest {
final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId);
}
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccount_CLOSE_APPLICATION() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
@@ -106,7 +122,11 @@ public class GroupSavingsIntegrationTest {
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
Assert.assertNotNull(groupID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, null);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = "1000.0";
final String enforceMinRequiredBalance = "true";
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
@@ -121,7 +141,17 @@ public class GroupSavingsIntegrationTest {
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
savingsStatusHashMap = this.savingsAccountHelper.closeSavingsAccount(savingsId);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime());
String withdrawBalance = "false";
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.closeSavingsAccountAndGetBackRequiredField(
savingsId, withdrawBalance, CommonConstants.RESPONSE_ERROR, CLOSEDON_DATE);
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
withdrawBalance = "true";
savingsStatusHashMap = this.savingsAccountHelper.closeSavingsAccount(savingsId, withdrawBalance);
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
}
@@ -142,7 +172,11 @@ public class GroupSavingsIntegrationTest {
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
Assert.assertNotNull(groupID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, null);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
@@ -187,7 +221,11 @@ public class GroupSavingsIntegrationTest {
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
Assert.assertNotNull(groupID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
@@ -233,7 +271,11 @@ public class GroupSavingsIntegrationTest {
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
Assert.assertNotNull(groupID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
@@ -263,7 +305,11 @@ public class GroupSavingsIntegrationTest {
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
Assert.assertNotNull(groupID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
@@ -363,7 +409,11 @@ public class GroupSavingsIntegrationTest {
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
Assert.assertNotNull(groupID);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE);
final String minBalanceForInterestCalculation = null;
final String minRequiredBalance = null;
final String enforceMinRequiredBalance = "false";
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP);
@@ -407,7 +457,7 @@ public class GroupSavingsIntegrationTest {
Assert.assertEquals(1, charges.size());
HashMap savingsChargeForPay = charges.get(0);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat, Locale.US);
Calendar cal = Calendar.getInstance();
List dates = (List) savingsChargeForPay.get("dueDate");
cal.set(Calendar.YEAR, (Integer) dates.get(0));
@@ -431,16 +481,55 @@ public class GroupSavingsIntegrationTest {
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
HashMap waiveCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForWaive.get("id"));
assertEquals(savingsChargeForWaive.get("amount"), waiveCharge.get("amountWaived"));
this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId);
waiveCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForWaive.get("id"));
BigDecimal totalWaiveAmount = BigDecimal.valueOf(Double.valueOf((Float) savingsChargeForWaive.get("amount")));
totalWaiveAmount = totalWaiveAmount.add(totalWaiveAmount);
assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived"));
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON());
Assert.assertNotNull(weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(3, charges.size());
savingsChargeForPay = charges.get(2);
cal = Calendar.getInstance();
dates = (List) savingsChargeForPay.get("dueDate");
cal.set(Calendar.YEAR, (Integer) dates.get(0));
cal.set(Calendar.MONTH, (Integer) dates.get(1) - 1);
cal.set(Calendar.DAY_OF_MONTH, (Integer) dates.get(2));
// Depositing huge amount as scheduler job deducts the fee amount
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "100000",
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(depositTransactionId);
this.savingsAccountHelper.payCharge((Integer) savingsChargeForPay.get("id"), savingsId,
((Float) savingsChargeForPay.get("amount")).toString(), sdf.format(cal.getTime()));
paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForPay.get("id"));
assertEquals(savingsChargeForPay.get("amount"), paidCharge.get("amountPaid"));
List nextDueDates = (List) paidCharge.get("dueDate");
LocalDate nextDueDate = new LocalDate((Integer) nextDueDates.get(0), (Integer) nextDueDates.get(1), (Integer) nextDueDates.get(2));
LocalDate expectedNextDueDate = new LocalDate((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
.plusWeeks((Integer) paidCharge.get("feeInterval"));
assertEquals(expectedNextDueDate, nextDueDate);
}
public static Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance) {
final String minOpenningBalance, final String minBalanceForInterestCalculation, final String minRequiredBalance,
final String enforceMinRequiredBalance) {
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
final String savingsProductJSON = savingsProductHelper //
.withInterestCompoundingPeriodTypeAsDaily() //
.withInterestPostingPeriodTypeAsMonthly() //
.withInterestCalculationPeriodTypeAsDailyBalance() //
.withMinBalanceForInterestCalculation(minBalanceForInterestCalculation) //
.withMinRequiredBalance(minRequiredBalance) //
.withEnforceMinRequiredBalance(enforceMinRequiredBalance) //
.withMinimumOpenningBalance(minOpenningBalance).build();
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
@@ -1,9 +1,16 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.GroupHelper;
import org.mifosplatform.integrationtests.common.StaffHelper;
import org.mifosplatform.integrationtests.common.Utils;
import com.jayway.restassured.builder.RequestSpecBuilder;
@@ -11,6 +18,16 @@ import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import org.mifosplatform.integrationtests.common.accounting.Account;
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import java.util.HashMap;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
/**
* Group Test for checking Group: Creation, Activation, Client Association,
@@ -20,6 +37,12 @@ public class GroupTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
private String principal = "10000.00";
private String accountingRule = "1";
private String numberOfRepayments = "5";
private String interestRatePerPeriod = "18";
@Before
public void setup() {
@@ -27,6 +50,8 @@ public class GroupTest {
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
}
@Test
@@ -53,4 +78,90 @@ public class GroupTest {
// GroupHelper.deleteGroup(this.requestSpec, this.responseSpec, groupID.toString());
// GroupHelper.verifyGroupDeleted(this.requestSpec, this.responseSpec, groupID);
}
@Test
public void assignStaffToGroup(){
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec);
GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
final String updateGroupName = Utils.randomNameGenerator("Savings Group Help_",5);
groupID = GroupHelper.activateGroup(this.requestSpec, this.responseSpec, groupID.toString());
Integer updateGroupId = GroupHelper.updateGroup(this.requestSpec,this.responseSpec,updateGroupName,groupID.toString());
//create client and add client to group
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString());
GroupHelper.verifyGroupMembers(this.requestSpec, this.responseSpec, groupID, clientID);
//create staff
Integer createStaffId1 = StaffHelper.createStaff(this.requestSpec, this.responseSpec) ;
System.out.println("--------------creating first staff with id-------------" + createStaffId1);
Assert.assertNotNull(createStaffId1);
Integer createStaffId2 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
System.out.println("--------------creating second staff with id-------------" + createStaffId2);
Assert.assertNotNull(createStaffId2);
//assign staff "createStaffId1" to group
HashMap assignStaffGroupId = (HashMap)GroupHelper.assignStaff(this.requestSpec,this.responseSpec,groupID.toString(),createStaffId1.longValue());
assertEquals("Verify assigned staff id is the same as id sent",assignStaffGroupId.get("staffId"),createStaffId1);
//assign staff "createStaffId2" to client
final HashMap assignStaffToClientChanges = (HashMap)ClientHelper.assignStaffToClient(this.requestSpec,this.responseSpec,clientID.toString(),createStaffId2.toString());
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToClientChanges.get("staffId"),createStaffId2);
final Integer loanProductId = this.createLoanProduct();
final Integer loanId = this.applyForLoanApplication(clientID,loanProductId,this.principal);
this.loanTransactionHelper.approveLoan("20 September 2014",loanId);
this.loanTransactionHelper.disburseLoan("20 September 2014",loanId);
final HashMap assignStaffAndInheritStaffForClientAccounts = (HashMap)GroupHelper.assignStaffInheritStaffForClientAccounts(this.requestSpec,this.responseSpec,groupID.toString(),createStaffId1.toString());
final Integer getClientStaffId = ClientHelper.getClient(this.requestSpec,this.responseSpec,clientID.toString());
//assert if client staff officer has change Note client was assigned staff with createStaffId2
assertNotEquals("Verify if client stuff has changed", assignStaffAndInheritStaffForClientAccounts.get("staffId"), createStaffId2);
assertEquals("Verify if client inherited staff assigned above", assignStaffAndInheritStaffForClientAccounts.get("staffId"), getClientStaffId);
//assert if clients loan officer has changed
final Integer loanOfficerId = this.loanTransactionHelper.getLoanOfficerId(loanId.toString());
assertEquals("Verify if client loan inherited staff", assignStaffAndInheritStaffForClientAccounts.get("staffId"), loanOfficerId);
}
private Integer createLoanProduct() {
final String loanProductJSON = new LoanProductTestBuilder()
.withPrincipal(this.principal)
.withNumberOfRepayments(this.numberOfRepayments)
.withinterestRatePerPeriod(this.interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear()
.build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, String principal) {
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal(principal) //
.withLoanTermFrequency("4") //
.withLoanTermFrequencyAsMonths() //
.withNumberOfRepayments("4") //
.withRepaymentEveryAfter("1") //
.withRepaymentFrequencyTypeAsMonths() //
.withInterestRatePerPeriod("2") //
.withAmortizationTypeAsEqualInstallments() //
.withInterestTypeAsDecliningBalance() //
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
.withExpectedDisbursementDate("20 September 2014") //
.withSubmittedOnDate("20 September 2014") //
.build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
}
@@ -0,0 +1,83 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.concurrent.TimeUnit;
import org.apache.http.conn.HttpHostConnectException;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.HookHelper;
import org.mifosplatform.integrationtests.common.OfficeHelper;
import org.mifosplatform.integrationtests.common.Utils;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class HookIntegrationTest {
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
private HookHelper hookHelper;
private OfficeHelper officeHelper;
@Before
public void setUp() throws Exception {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.hookHelper = new HookHelper(this.requestSpec, this.responseSpec);
this.officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
}
@Test
public void shouldSendOfficeCreationNotification() {
// Subject to https://echo-webhook.herokuapp.com being up
// See
// http://www.jamesward.com/2014/06/11/testing-webhooks-was-a-pain-so-i-fixed-the-glitch
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
this.hookHelper.createHook(payloadURL);
final Integer createdOfficeID = this.officeHelper.createOffice("01 January 2012");
try {
/**
* sleep for a three seconds after each failure to increase the
* likelihood of the previous request for creating office completing
**/
for (int i = 0; i < 6; i++) {
try {
final String json = RestAssured.get(payloadURL.replace("?", "")).asString();
final Integer notificationOfficeId = JsonPath.with(json).get("officeId");
assertEquals("Equality check for created officeId and hook received payload officeId", createdOfficeID,
notificationOfficeId);
System.out.println("Notification Office Id - " + notificationOfficeId);
i = 6;
} catch (Exception e) {
TimeUnit.SECONDS.sleep(3);
i++;
}
}
} catch (final Exception e) {
if (e instanceof HttpHostConnectException) {
fail("Failed to connect to https://echo-webhook.herokuapp.com platform");
}
throw new RuntimeException(e);
}
}
}
@@ -0,0 +1,107 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.HashMap;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanStatusChecker;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
@SuppressWarnings("rawtypes")
public class LoanApplicationApprovalTest {
private ResponseSpecification responseSpec;
private ResponseSpecification responseSpecForStatusCode403;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.responseSpecForStatusCode403 = new ResponseSpecBuilder().expectStatusCode(403).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
}
/*
* Positive test case: Approved amount non zero is less than proposed amount
*
*/
@Test
public void loanApplicationApprovedAmountLessThanProposedAmount() {
final String proposedAmount = "8000";
final String approvalAmount = "5000";
final String approveDate = "20 September 2012";
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder().build(null));
final Integer loanID = applyForLoanApplication(clientID, loanProductID, proposedAmount);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, approvalAmount, loanID);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
}
/*
* Negative test case: Approved amount non zero is greater than proposed amount
*
*/
@Test
public void loanApplicationApprovedAmountGreaterThanProposedAmount() {
final String proposedAmount = "5000";
final String approvalAmount = "9000";
final String approveDate = "20 September 2011";
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder().build(null));
final Integer loanID = applyForLoanApplication(clientID, loanProductID, proposedAmount);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
@SuppressWarnings("unchecked")
List<HashMap> error = (List<HashMap>) this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, approvalAmount, loanID,
CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.loan.approval.amount.can't.be.greater.than.loan.amount.demanded", error
.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String proposedAmount) {
final String loanApplication = new LoanApplicationTestBuilder().withPrincipal(proposedAmount).withLoanTermFrequency("5")
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5").withRepaymentEveryAfter("1")
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withExpectedDisbursementDate("04 April 2012")
.withSubmittedOnDate("02 April 2012").build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplication);
}
}
@@ -0,0 +1,206 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.LoanRescheduleRequestHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanRescheduleRequestTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
* Test the creation, approval and rejection of a loan reschedule request
**/
@SuppressWarnings({ "rawtypes" })
public class LoanRescheduleRequestTest {
private ResponseSpecification responseSpec;
private ResponseSpecification generalResponseSpec;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
private LoanRescheduleRequestHelper loanRescheduleRequestHelper;
private Integer clientId;
private Integer loanProductId;
private Integer loanId;
private Integer loanRescheduleRequestId;
private String loanPrincipalAmount = "100000.00";
private String numberOfRepayments = "12";
private String interestRatePerPeriod = "18";
private String dateString = "4 September 2014";
@Before
public void initialize() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
this.generalResponseSpec = new ResponseSpecBuilder().build();
// create all required entities
this.createRequiredEntities();
}
/**
* Creates the client, loan product, and loan entities
**/
private void createRequiredEntities() {
this.createClientEntity();
this.createLoanProductEntity();
this.createLoanEntity();
}
/**
* create a new client
**/
private void createClientEntity() {
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, this.clientId);
}
/**
* create a new loan product
**/
private void createLoanProductEntity() {
System.out.println("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder()
.withPrincipal(loanPrincipalAmount)
.withNumberOfRepayments(numberOfRepayments)
.withinterestRatePerPeriod(interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear()
.build(null);
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
System.out.println("Successfully created loan product (ID: " + this.loanProductId + ")");
}
/**
* submit a new loan application, approve and disburse the loan
**/
private void createLoanEntity() {
System.out.println("---------------------------------NEW LOAN APPLICATION------------------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder()
.withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency(numberOfRepayments)
.withLoanTermFrequencyAsMonths()
.withNumberOfRepayments(numberOfRepayments)
.withRepaymentEveryAfter("1")
.withRepaymentFrequencyTypeAsMonths()
.withAmortizationTypeAsEqualInstallments()
.withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod)
.withLoanTermFrequencyAsMonths()
.withSubmittedOnDate(dateString)
.withExpectedDisbursementDate(dateString)
.withPrincipalGrace("2")
.withInterestGrace("2")
.build(this.clientId.toString(), this.loanProductId.toString(), null);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
System.out.println("Sucessfully created loan (ID: " + this.loanId + ")");
this.approveLoanApplication();
this.disburseLoan();
}
/**
* approve the loan application
**/
private void approveLoanApplication() {
if(this.loanId != null) {
this.loanTransactionHelper.approveLoan(this.dateString, this.loanId);
System.out.println("Successfully approved loan (ID: " + this.loanId + ")");
}
}
/**
* disburse the newly created loan
**/
private void disburseLoan() {
if(this.loanId != null) {
this.loanTransactionHelper.disburseLoan(this.dateString, this.loanId);
System.out.println("Successfully disbursed loan (ID: " + this.loanId + ")");
}
}
/**
* create new loan reschedule request
**/
private void createLoanRescheduleRequest() {
System.out.println("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
final String requestJSON = new LoanRescheduleRequestTestBuilder().build(this.loanId.toString());
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
System.out.println("Successfully created loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
}
@Test
public void testCreateLoanRescheduleRequest() {
this.createLoanRescheduleRequest();
}
@Test
public void testRejectLoanRescheduleRequest() {
this.createLoanRescheduleRequest();
System.out.println("-----------------------------REJECTING LOAN RESCHEDULE REQUEST--------------------------");
final String requestJSON = new LoanRescheduleRequestTestBuilder().getRejectLoanRescheduleRequestJSON();
this.loanRescheduleRequestHelper.rejectLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
assertTrue((Boolean)response.get("rejected"));
System.out.println("Successfully rejected loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
}
@Test
public void testApproveLoanRescheduleRequest() {
this.createLoanRescheduleRequest();
System.out.println("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
final String requestJSON = new LoanRescheduleRequestTestBuilder().getApproveLoanRescheduleRequestJSON();
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
assertTrue((Boolean)response.get("approved"));
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId, "numberOfRepayments");
final HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(requestSpec, generalResponseSpec, loanId);
final Float totalExpectedRepayment = (Float) loanSummary.get("totalExpectedRepayment");
assertEquals("NUMBER OF REPAYMENTS SHOULD BE 16, NOT 12", "16", numberOfRepayments.toString());
assertEquals("TOTAL EXPECTED REPAYMENT MUST BE EQUAL TO 118000.0", "118000.0", totalExpectedRepayment.toString());
System.out.println("Successfully approved loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.HashMap;
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.HashMap;
@@ -0,0 +1,207 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.CalendarHelper;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.GroupHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
import org.mifosplatform.integrationtests.common.loans.LoanStatusChecker;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
* Test the creation, approval and rejection of a loan reschedule request
**/
@SuppressWarnings({ "rawtypes" })
public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
private ResponseSpecification responseSpec;
private ResponseSpecification responseSpecForStatusCode403;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
private Integer clientId;
private Integer groupId;
private Integer groupCalendarId;
private Integer loanProductId;
private Integer loanId;
private final String loanPrincipalAmount = "100000.00";
private final String numberOfRepayments = "12";
private final String interestRatePerPeriod = "18";
private final String groupActivationDate = "1 August 2014";
@Before
public void setup() {
Utils.initializeRESTAssured();
}
/*
* MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days
* between disbursal date and first repayment is set as 7. system should
* allow to create this loan and allow to disburse
*/
@Test
public void createLoanEntity_WITH_DAY_BETWEEN_DISB_DATE_AND_REPAY_START_DATE_GREATER_THAN_MIN_DAY_CRITERIA() {
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
// create all required entities
this.createRequiredEntities();
final String disbursalDate = "4 September 2014";
final String firstRepaymentDate = "11 September 2014";
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsWeeks().withNumberOfRepayments(numberOfRepayments)
.withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments()
.withInterestCalculationPeriodTypeAsDays().withInterestRatePerPeriod(interestRatePerPeriod)
.withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate).withExpectedDisbursementDate(disbursalDate)
.withPrincipalGrace("2").withInterestGrace("2").withFirstRepaymentDate(firstRepaymentDate)
.build(this.clientId.toString(), this.loanProductId.toString(), null);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
// Test for loan account is created
Assert.assertNotNull(this.loanId);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
// Test for loan account is created, can be approved
this.loanTransactionHelper.approveLoan(disbursalDate, this.loanId);
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
// Test for loan account approved can be disbursed
this.loanTransactionHelper.disburseLoan(disbursalDate, this.loanId);
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
}
/*
* MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days
* between disbursal date and first repayment is set as 7. system should
* allow to create this loan and allow to disburse
*/
@SuppressWarnings("unchecked")
@Test
public void createLoanEntity_WITH_DAY_BETWEEN_DISB_DATE_AND_REPAY_START_DATE_LESS_THAN_MIN_DAY_CRITERIA() {
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.responseSpecForStatusCode403 = new ResponseSpecBuilder().expectStatusCode(403).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
// create all required entities
this.createRequiredEntities();
// loanTransactionHelper is reassigned to accept 403 status code from
// server
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
final String disbursalDate = "4 September 2014";
final String firstRepaymentDate = "5 September 2014";
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsWeeks().withNumberOfRepayments(numberOfRepayments)
.withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments()
.withInterestCalculationPeriodTypeAsDays().withInterestRatePerPeriod(interestRatePerPeriod)
.withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate).withExpectedDisbursementDate(disbursalDate)
.withPrincipalGrace("2").withInterestGrace("2").withFirstRepaymentDate(firstRepaymentDate)
.build(this.clientId.toString(), this.loanProductId.toString(), null);
List<HashMap> error = (List<HashMap>) this.loanTransactionHelper.createLoanAccount(loanApplicationJSON,
CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.loan.days.between.first.repayment.and.disbursal.are.less.than.minimum.allowed",
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
/**
* Creates the client, loan product, and loan entities
**/
private void createRequiredEntities() {
final String minimumDaysBetweenDisbursalAndFirstRepayment = "7"; // &
// days
this.createGroupEntityWithCalendar();
this.createClientEntity();
this.associateClientToGroup(this.groupId, this.clientId);
this.createLoanProductEntity(minimumDaysBetweenDisbursalAndFirstRepayment);
}
/*
* Associate client to the group
*/
private void associateClientToGroup(final Integer groupId, final Integer clientId) {
GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupId.toString(), clientId.toString());
GroupHelper.verifyGroupMembers(this.requestSpec, this.responseSpec, groupId, clientId);
}
/*
* Create a new group
*/
private void createGroupEntityWithCalendar() {
this.groupId = GroupHelper.createGroup(this.requestSpec, this.responseSpec, this.groupActivationDate);
GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, this.responseSpec, this.groupId);
final String startDate = this.groupActivationDate;
final String frequency = "2"; // 2:Weekly
final String interval = "1"; // Every one week
final String repeatsOnDay = "1"; // 1:Monday
this.setGroupCalendarId(CalendarHelper.createMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, startDate,
frequency, interval, repeatsOnDay));
}
/**
* create a new client
**/
private void createClientEntity() {
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, this.clientId);
}
/**
* create a new loan product
**/
private void createLoanProductEntity(final String minimumDaysBetweenDisbursalAndFirstRepayment) {
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear()
.withMinimumDaysBetweenDisbursalAndFirstRepayment(minimumDaysBetweenDisbursalAndFirstRepayment).build(null);
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
public Integer getGroupCalendarId() {
return groupCalendarId;
}
public void setGroupCalendarId(Integer groupCalendarId) {
this.groupCalendarId = groupCalendarId;
}
}
@@ -1,93 +0,0 @@
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.List;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.OfficeHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.accounting.Account;
import org.mifosplatform.integrationtests.common.accounting.AccountHelper;
import org.mifosplatform.integrationtests.common.accounting.OfficeAccountMappingHelper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings("rawtypes")
public class OfficeAccountingMappingsTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@SuppressWarnings("unchecked")
@Test
public void testOfficeAccountingMappings() {
OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec);
Integer officeId = officeHelper.createOffice("01 January 2014");
Assert.assertNotNull(officeId);
Integer officeId2 = officeHelper.createOffice("01 January 2014");
Assert.assertNotNull(officeId2);
AccountHelper accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
Account transferAccount = accountHelper.createLiabilityAccount();
Assert.assertNotNull(transferAccount);
OfficeAccountMappingHelper accountMappingHelper = new OfficeAccountMappingHelper(this.requestSpec,
new ResponseSpecBuilder().build());
Integer transferAccountMappingId = (Integer) accountMappingHelper.createOfficeAccountMapping(officeId,
transferAccount.getAccountID(), CommonConstants.RESPONSE_RESOURCE_ID);
Assert.assertNotNull(transferAccountMappingId);
HashMap mappingDetails = accountMappingHelper.getOfficeAccountMapping(transferAccountMappingId);
Assert.assertEquals(officeId, ((HashMap) mappingDetails.get("officeData")).get("id"));
Assert.assertEquals(transferAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
Account transferAccount2 = accountHelper.createLiabilityAccount();
Assert.assertNotNull(transferAccount2);
HashMap changes = (HashMap) accountMappingHelper.updateOfficeAccountMapping(transferAccountMappingId, officeId,
transferAccount2.getAccountID(), CommonConstants.RESPONSE_CHANGES);
Assert.assertEquals(transferAccount2.getAccountID(), changes.get("liabilityTransferInSuspenseAccountId"));
mappingDetails = accountMappingHelper.getOfficeAccountMapping(transferAccountMappingId);
Assert.assertEquals(officeId, ((HashMap) mappingDetails.get("officeData")).get("id"));
Assert.assertEquals(transferAccount2.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
List<HashMap> error1 = (List<HashMap>) accountMappingHelper.updateOfficeAccountMapping(transferAccountMappingId, officeId2,
transferAccount2.getAccountID(), CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.officeToAccountMapping.update.of.officeId.is.not.supported",
error1.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
List<HashMap> error2 = (List<HashMap>) accountMappingHelper.createOfficeAccountMapping(officeId, transferAccount.getAccountID(),
CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.officeToAccountMapping.exists.for.office", error2.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
Account fundAccount = accountHelper.createAssetAccount();
Assert.assertNotNull(fundAccount);
List<HashMap> error3 = (List<HashMap>) accountMappingHelper.createOfficeAccountMapping(officeId2, fundAccount.getAccountID(),
CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.liabilityTransferInSuspenseAccountId.invalid.account.type", error3.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.ArrayList;
@@ -1,13 +1,21 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.junit.Assert;
import org.junit.Before;
@@ -33,6 +41,8 @@ import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsProductHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsStatusChecker;
import org.mifosplatform.portfolio.account.PortfolioAccountType;
import org.mifosplatform.portfolio.account.domain.AccountTransferType;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.builder.ResponseSpecBuilder;
@@ -115,7 +125,7 @@ public class SchedulerJobsTestResults {
HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
String JobName = "Apply Annual Fee For Savings";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId);
Float chargeAmount = (Float) chargeData.get("amount");
@@ -155,7 +165,7 @@ public class SchedulerJobsTestResults {
String JobName = "Post Interest For Savings";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
Assert.assertNotSame("Verifying the Balance after running Post Interest for Savings Job", summaryBefore.get("accountBalance"),
@@ -206,7 +216,7 @@ public class SchedulerJobsTestResults {
Assert.assertNotNull(specifiedDueDateChargeId);
this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(specifiedDueDateChargeId.toString()));
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(specifiedDueDateChargeId.toString(), "12 March 2013", "100"));
ArrayList<HashMap> chargesPendingState = this.loanTransactionHelper.getLoanCharges(loanID);
Assert.assertEquals(1, chargesPendingState.size());
@@ -215,7 +225,7 @@ public class SchedulerJobsTestResults {
final HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId);
String JobName = "Transfer Fee For Loans From Savings";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
@@ -286,7 +296,7 @@ public class SchedulerJobsTestResults {
String JobName = "Apply Holidays To Loans";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
final ArrayList<HashMap> repaymentScheduleDataAfterJob = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
this.responseSpec, loanID);
@@ -337,7 +347,7 @@ public class SchedulerJobsTestResults {
String JobName = "Pay Due Savings Charges";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId);
@@ -387,7 +397,7 @@ public class SchedulerJobsTestResults {
String JobName = "Update Accounting Running Balances";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
final HashMap runningBalanceAfter = this.accountHelper.getAccountingWithRunningBalanceById(accountID.toString());
final Integer INT_BALANCE = new Integer(MINIMUM_OPENING_BALANCE);
@@ -422,7 +432,7 @@ public class SchedulerJobsTestResults {
String JobName = "Update Loan Arrears Ageing";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
HashMap loanSummaryData = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
Float totalLoanArrearsAging = (Float) loanSummaryData.get("principalOverdue") + (Float) loanSummaryData.get("interestOverdue");
@@ -437,7 +447,7 @@ public class SchedulerJobsTestResults {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todayDate = Calendar.getInstance();
final String currentDate = dateFormat.format(todayDate.getTime());
@@ -477,7 +487,7 @@ public class SchedulerJobsTestResults {
HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
String JobName = "Update Loan Paid In Advance";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
// Retrieving Loan Repayment Schedule after the successful
// completion of
// Update Loan Paid in Advance Scheduler Job
@@ -498,7 +508,7 @@ public class SchedulerJobsTestResults {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
final String currentDate = dateFormat.format(todaysDate.getTime());
@@ -540,7 +550,7 @@ public class SchedulerJobsTestResults {
HashMap loanSummaryBefore = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
String JobName = "Update loan Summary";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
Float expectedSummaryAfterJob = (Float) loanSummaryBefore.get("totalExpectedRepayment")
- (Float) loanSummaryBefore.get("feeChargesPaid");
HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID);
@@ -555,11 +565,11 @@ public class SchedulerJobsTestResults {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.standingInstructionsHelper = new StandingInstructionsHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat monthDayFormat = new SimpleDateFormat("dd MMMM");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
DateFormat monthDayFormat = new SimpleDateFormat("dd MMMM", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -1);
todaysDate.add(Calendar.WEEK_OF_YEAR, -1);
final String VALID_FROM = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
@@ -612,7 +622,7 @@ public class SchedulerJobsTestResults {
Assert.assertNotNull(standingInstructionId);
String JobName = "Execute Standing Instruction";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsId);
Float fromSavingsBalanceAfter = (Float) fromSavingsSummaryAfter.get("accountBalance");
@@ -628,6 +638,16 @@ public class SchedulerJobsTestResults {
fromSavingsBalanceAfter);
Assert.assertEquals("Verifying To Savings Balance after Successful completion of Scheduler Job", expectedToSavingsBalance,
toSavingsBalanceAfter);
Integer fromAccountType = PortfolioAccountType.SAVINGS.getValue();
Integer transferType = AccountTransferType.ACCOUNT_TRANSFER.getValue();
List<HashMap> standinInstructionHistoryData = this.standingInstructionsHelper.getStandingInstructionHistory(fromSavingsId,
fromAccountType, clientID, transferType);
Assert.assertEquals("Verifying the no of stainding instruction transactions logged for the client", 1,
standinInstructionHistoryData.size());
HashMap loggedTransaction = standinInstructionHistoryData.get(0);
Assert.assertEquals("Verifying transferred amount and logged transaction amounts", (Float) standingInstructionData.get("amount"),
(Float) loggedTransaction.get("amount"));
}
@@ -663,7 +683,7 @@ public class SchedulerJobsTestResults {
this.responseSpec, loanID);
String JobName = "Apply penalty to overdue loans";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId);
@@ -708,7 +728,7 @@ public class SchedulerJobsTestResults {
Assert.assertFalse(isNPABefore);
// Integer jobId = (Integer) allSchedulerJobsData.get(1).get("jobId");
String JobName = "Update Non Performing Assets";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
final Boolean isNPAAfter = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA");
Assert.assertTrue(isNPAAfter);
}
@@ -721,8 +741,8 @@ public class SchedulerJobsTestResults {
AccountHelper accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
FixedDepositAccountHelper fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat monthDayFormat = new SimpleDateFormat("dd MMM");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
DateFormat monthDayFormat = new SimpleDateFormat("dd MMM", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -3);
@@ -785,7 +805,7 @@ public class SchedulerJobsTestResults {
Float interestPosted = (Float) fixedDepositSummary.get("accountBalance") - new Float(FixedDepositAccountHelper.depositAmount);
String JobName = "Transfer Interest To Savings";
this.schedulerJobHelper.excuteJob(JobName);
this.schedulerJobHelper.executeJob(JobName);
fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId);
assertEquals("Verifying opening Balance", new Float(FixedDepositAccountHelper.depositAmount),
fixedDepositSummary.get("accountBalance"));
@@ -872,7 +892,7 @@ public class SchedulerJobsTestResults {
}
public void validateNumberForEqualExcludePrecission(String val, String val2) {
DecimalFormat twoDForm = new DecimalFormat("#");
DecimalFormat twoDForm = new DecimalFormat("#", new DecimalFormatSymbols(Locale.US));
Assert.assertTrue(new Float(twoDForm.format(new Float(val))).compareTo(new Float(twoDForm.format(new Float(val2)))) == 0);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import org.junit.Before;
@@ -1,8 +1,14 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -24,336 +30,241 @@ import com.jayway.restassured.specification.ResponseSpecification;
* Test for creating, updating, deleting codes and code values
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class SystemCodeTest {
private ResponseSpecification responseSpec;
private ResponseSpecification generalResponseSpec;
private RequestSpecification requestSpec;
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(
ContentType.JSON).build();
this.requestSpec
.header("Authorization",
"Basic "
+ Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200)
.build();
this.generalResponseSpec = new ResponseSpecBuilder().build();
}
// @Ignore()
@Test
// scenario 57, 58, 59, 60
public void testCreateCode() {
final String codeName = "Client Marital Status";
final Integer createResponseId = (Integer) CodeHelper.createCode(
this.requestSpec, this.responseSpec, codeName,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
// verify code created
final HashMap newCodeAttributes = (HashMap) CodeHelper.getCodeById(
this.requestSpec, this.responseSpec, createResponseId, "");
Assert.assertNotNull(newCodeAttributes);
assertEquals("Verify value of codeId", createResponseId,
newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertEquals("Verify code name", codeName,
newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify system defined is false", false,
newCodeAttributes
.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
// update code
final HashMap updateChangeResponse = (HashMap) CodeHelper.updateCode(
this.requestSpec, this.responseSpec, createResponseId, codeName
+ "(CHANGE)", "changes");
assertEquals("Verify code name updated", codeName + "(CHANGE)",
updateChangeResponse.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
// delete code
final Integer deleteResponseId = (Integer) CodeHelper.deleteCodeById(
this.requestSpec, this.responseSpec, createResponseId,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
assertEquals("Verify code deleted", createResponseId, deleteResponseId);
// verify code deleted
final HashMap deletedCodeValues = (HashMap) CodeHelper.getCodeById(
this.requestSpec, this.generalResponseSpec, deleteResponseId,
"");
Assert.assertNotNull(deletedCodeValues);
assertNull("Verify value of codeId",
deletedCodeValues.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertNull("Verify code name",
deletedCodeValues.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertNull("Verify system defined is false",
deletedCodeValues
.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
}
// @Ignore()
@Test
// scenario 57, 60
public void testPreventCreateDuplicateCode() {
final String codeName = "Client Marital Status";
// create code
final Integer createResponseId = (Integer) CodeHelper.createCode(
this.requestSpec, this.responseSpec, codeName,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
// verify code created
final HashMap newCodeAttributes = (HashMap) CodeHelper.getCodeById(
this.requestSpec, this.responseSpec, createResponseId, "");
Assert.assertNotNull(newCodeAttributes);
assertEquals("Verify value of codeId", createResponseId,
newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertEquals("Verify code name", codeName,
newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify system defined is false", false,
newCodeAttributes
.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
// try to create duplicate-- should fail
final List<HashMap> error = (List) CodeHelper.createCode(
this.requestSpec, this.generalResponseSpec, codeName,
CommonConstants.RESPONSE_ERROR);
assertEquals("Verify duplication error",
"error.msg.code.duplicate.name",
error.get(0).get("userMessageGlobalisationCode"));
// delete code that was just created
final Integer deleteResponseId = (Integer) CodeHelper.deleteCodeById(
this.requestSpec, this.responseSpec, createResponseId,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
assertEquals("Verify code deleted", createResponseId, deleteResponseId);
// verify code deleted
final HashMap deletedCodeAttributes = (HashMap) CodeHelper.getCodeById(
this.requestSpec, this.generalResponseSpec, deleteResponseId,
"");
Assert.assertNotNull(deletedCodeAttributes);
assertNull("Verify value of codeId",
deletedCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertNull("Verify code name",
deletedCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertNull("Verify system defined is false",
deletedCodeAttributes
.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
}
// @Ignore
@Test
public void testUpdateDeleteSystemDefinedCode() {
// get any systemDefined code
final HashMap systemDefinedCode = (HashMap) CodeHelper
.getSystemDefinedCodes(this.requestSpec, this.responseSpec);
// delete system-defined code should fail
final List<HashMap> error = (List) CodeHelper.deleteCodeById(
this.requestSpec, this.generalResponseSpec,
(Integer) systemDefinedCode
.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME),
CommonConstants.RESPONSE_ERROR);
assertEquals("Cannot delete system-defined code",
"error.msg.code.systemdefined",
error.get(0).get("userMessageGlobalisationCode"));
// update system-defined code should fail
final List<HashMap> updateError = (List) CodeHelper.updateCode(
this.requestSpec, this.generalResponseSpec,
(Integer) systemDefinedCode
.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME),
systemDefinedCode.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME)
+ "CHANGE", CommonConstants.RESPONSE_ERROR);
assertEquals("Cannot update system-defined code",
"error.msg.code.systemdefined",
error.get(0).get("userMessageGlobalisationCode"));
}
// @Ignore
@Test
public void testCodeValuesNotAssignedToTable() {
final String codeName = "Client Marital Status";
final String codeValue1 = "Married";
final String codeValue2 = "Unmarried";
final int codeValue1Position = 1;
final int codeValue2Position = 2;
// create code
final Integer createCodeResponseId = (Integer) CodeHelper.createCode(
this.requestSpec, this.responseSpec, codeName,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
// create first code value
final Integer createCodeValueResponseId1 = (Integer) CodeHelper
.createCodeValue(this.requestSpec, this.responseSpec,
createCodeResponseId, codeValue1, codeValue1Position,
CodeHelper.SUBRESPONSE_ID_ATTRIBUTE_NAME);
// create second code value
final Integer createCodeValueResponseId2 = (Integer) CodeHelper
.createCodeValue(this.requestSpec, this.responseSpec,
createCodeResponseId, codeValue2, codeValue2Position,
CodeHelper.SUBRESPONSE_ID_ATTRIBUTE_NAME);
// verify two code values created
final List<HashMap> codeValuesList = (List) CodeHelper
.getCodeValuesForCode(this.requestSpec, this.responseSpec,
createCodeResponseId, "");
assertEquals("Number of code values returned matches number created",
2, codeValuesList.size());
// verify values of first code value
final HashMap codeValuesAttributes1 = (HashMap) CodeHelper
.getCodeValueById(this.requestSpec, this.responseSpec,
createCodeResponseId, createCodeValueResponseId1, "");
Assert.assertNotNull(codeValuesAttributes1);
assertEquals("Verify value of codeValueId", createCodeValueResponseId1,
codeValuesAttributes1
.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME));
assertEquals("Verify value of code name", codeValue1,
codeValuesAttributes1
.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify position of code value", codeValue1Position,
codeValuesAttributes1
.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME));
// verify values of second code value
final HashMap codeValuesAttributes2 = (HashMap) CodeHelper
.getCodeValueById(this.requestSpec, this.responseSpec,
createCodeResponseId, createCodeValueResponseId2, "");
Assert.assertNotNull(codeValuesAttributes2);
assertEquals("Verify value of codeValueId", createCodeValueResponseId2,
codeValuesAttributes2
.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME));
assertEquals("Verify value of code name", codeValue2,
codeValuesAttributes2
.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify position of code value", codeValue2Position,
codeValuesAttributes2
.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME));
// update code value 1
final HashMap codeValueChanges = (HashMap) CodeHelper
.updateCodeValue(this.requestSpec, this.responseSpec,
createCodeResponseId, createCodeValueResponseId1,
codeValue1 + "CHANGE", 4, "changes");
assertEquals("Verify changed code value name",
codeValueChanges.get("name"), codeValue1 + "CHANGE");
// delete code value
final Integer deletedCodeValueResponseId1 = (Integer) CodeHelper
.deleteCodeValueById(this.requestSpec,
this.generalResponseSpec, createCodeResponseId,
createCodeValueResponseId1,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
private ResponseSpecification responseSpec;
private ResponseSpecification generalResponseSpec;
private RequestSpecification requestSpec;
// Verify code value deleted
@Before
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
final HashMap deletedCodeValueAttributes1 = (HashMap) CodeHelper
.getCodeValueById(this.requestSpec, this.generalResponseSpec,
createCodeResponseId, deletedCodeValueResponseId1, "");
this.generalResponseSpec = new ResponseSpecBuilder().build();
// Assert.assertNotNull(deletedCodeValueAttributes1);
assertNull("Verify value of codeValueId",
deletedCodeValueAttributes1
.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME));
}
assertNull("Verify value of code name",
deletedCodeValueAttributes1
.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME));
// @Ignore()
@Test
// scenario 57, 58, 59, 60
public void testCreateCode() {
final String codeName = "Client Marital Status";
assertNull("Verify position of code value",
deletedCodeValueAttributes1
.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME));
final List<HashMap> deletedCodeValuesList = (List) CodeHelper
.getCodeValuesForCode(this.requestSpec, this.responseSpec,
createCodeResponseId, "");
assertEquals("Number of code values is 1", 1,
deletedCodeValuesList.size());
// delete code, remaining code values automatically deleted
final Integer deleteCodeResponseId = (Integer) CodeHelper
.deleteCodeById(this.requestSpec, this.generalResponseSpec,
createCodeResponseId,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
assertEquals("Verify code deleted", createCodeResponseId,
deleteCodeResponseId);
final Integer createResponseId = (Integer) CodeHelper.createCode(this.requestSpec, this.responseSpec, codeName,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
// verify code deleted
final HashMap deletedCodeAttributes = (HashMap) CodeHelper.getCodeById(
this.requestSpec, this.generalResponseSpec,
createCodeResponseId, "");
// verify code created
Assert.assertNotNull(deletedCodeAttributes);
assertNull("Verify value of codeId is null",
deletedCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
final HashMap newCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.responseSpec, createResponseId, "");
assertNull("Verify code name is null",
deletedCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertNull("Verify system defined is null",
deletedCodeAttributes
.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
// Verify remaining code value deleted
final HashMap deletedCodeValues2 = (HashMap) CodeHelper
.getCodeValueById(this.requestSpec, this.generalResponseSpec,
createCodeResponseId, createCodeValueResponseId2, "");
Assert.assertNotNull(newCodeAttributes);
assertEquals("Verify value of codeId", createResponseId, newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertNull("Verify value of codeValueId is null",
deletedCodeValues2.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME));
assertNull("Verify value of code name is null",
deletedCodeValues2
.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME));
assertNull("Verify position of code value null",
deletedCodeValues2
.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME));
}
assertEquals("Verify code name", codeName, newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify system defined is false", false, newCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
@Ignore
@Test
public void testCodeValuesAssignedToTable() {
// update code
final HashMap updateChangeResponse = (HashMap) CodeHelper.updateCode(this.requestSpec, this.responseSpec, createResponseId,
codeName + "(CHANGE)", "changes");
}
assertEquals("Verify code name updated", codeName + "(CHANGE)", updateChangeResponse.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
// delete code
final Integer deleteResponseId = (Integer) CodeHelper.deleteCodeById(this.requestSpec, this.responseSpec, createResponseId,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
assertEquals("Verify code deleted", createResponseId, deleteResponseId);
// verify code deleted
final HashMap deletedCodeValues = (HashMap) CodeHelper
.getCodeById(this.requestSpec, this.generalResponseSpec, deleteResponseId, "");
Assert.assertNotNull(deletedCodeValues);
assertNull("Verify value of codeId", deletedCodeValues.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertNull("Verify code name", deletedCodeValues.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertNull("Verify system defined is false", deletedCodeValues.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
}
// @Ignore()
@Test
// scenario 57, 60
public void testPreventCreateDuplicateCode() {
final String codeName = "Client Marital Status";
// create code
final Integer createResponseId = (Integer) CodeHelper.createCode(this.requestSpec, this.responseSpec, codeName,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
// verify code created
final HashMap newCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.responseSpec, createResponseId, "");
Assert.assertNotNull(newCodeAttributes);
assertEquals("Verify value of codeId", createResponseId, newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertEquals("Verify code name", codeName, newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify system defined is false", false, newCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
// try to create duplicate-- should fail
final List<HashMap> error = (List) CodeHelper.createCode(this.requestSpec, this.generalResponseSpec, codeName,
CommonConstants.RESPONSE_ERROR);
assertEquals("Verify duplication error", "error.msg.code.duplicate.name", error.get(0).get("userMessageGlobalisationCode"));
// delete code that was just created
final Integer deleteResponseId = (Integer) CodeHelper.deleteCodeById(this.requestSpec, this.responseSpec, createResponseId,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
assertEquals("Verify code deleted", createResponseId, deleteResponseId);
// verify code deleted
final HashMap deletedCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.generalResponseSpec,
deleteResponseId, "");
Assert.assertNotNull(deletedCodeAttributes);
assertNull("Verify value of codeId", deletedCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME));
assertNull("Verify code name", deletedCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME));
assertNull("Verify system defined is false", deletedCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME));
}
// @Ignore
@Test
public void testUpdateDeleteSystemDefinedCode() {
// get any systemDefined code
final HashMap systemDefinedCode = (HashMap) CodeHelper.getSystemDefinedCodes(this.requestSpec, this.responseSpec);
// delete system-defined code should fail
final List<HashMap> error = (List) CodeHelper.deleteCodeById(this.requestSpec, this.generalResponseSpec,
(Integer) systemDefinedCode.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), CommonConstants.RESPONSE_ERROR);
assertEquals("Cannot delete system-defined code", "error.msg.code.systemdefined", error.get(0).get("userMessageGlobalisationCode"));
// update system-defined code should fail
final List<HashMap> updateError = (List) CodeHelper.updateCode(this.requestSpec, this.generalResponseSpec,
(Integer) systemDefinedCode.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME),
systemDefinedCode.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME) + "CHANGE", CommonConstants.RESPONSE_ERROR);
assertEquals("Cannot update system-defined code", "error.msg.code.systemdefined",
updateError.get(0).get("userMessageGlobalisationCode"));
}
// @Ignore
@Test
public void testCodeValuesNotAssignedToTable() {
final String codeName = "Marital Status1";
final String codeValue1 = "Married1";
final String codeValue2 = "Unmarried1";
final int codeValue1Position = 1;
final int codeValue2Position = 1;
final String codeDescription1 = "Description11";
final String codeDescription2 = "Description22";
// create code
final Integer createCodeResponseId = (Integer) CodeHelper.createCode(this.requestSpec, this.responseSpec, codeName,
CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME);
// create first code value
final Integer createCodeValueResponseId1 = (Integer) CodeHelper.createCodeValue(this.requestSpec, this.responseSpec,
createCodeResponseId, codeValue1, codeDescription1, codeValue1Position, CodeHelper.SUBRESPONSE_ID_ATTRIBUTE_NAME);
// create second code value
final Integer createCodeValueResponseId2 = (Integer) CodeHelper.createCodeValue(this.requestSpec, this.responseSpec,
createCodeResponseId, codeValue2, codeDescription2, codeValue1Position, CodeHelper.SUBRESPONSE_ID_ATTRIBUTE_NAME);
// verify two code values created
final List<HashMap> codeValuesList = (List) CodeHelper.getCodeValuesForCode(this.requestSpec, this.responseSpec,
createCodeResponseId, "");
assertEquals("Number of code values returned matches number created", 2, codeValuesList.size());
// verify values of first code value
final HashMap codeValuesAttributes1 = (HashMap) CodeHelper.getCodeValueById(this.requestSpec, this.responseSpec,
createCodeResponseId, createCodeValueResponseId1, "");
Assert.assertNotNull(codeValuesAttributes1);
assertEquals("Verify value of codeValueId", createCodeValueResponseId1,
codeValuesAttributes1.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME));
assertEquals("Verify value of code name", codeValue1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify value of code description", codeDescription1,
codeValuesAttributes1.get(CodeHelper.CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME));
assertEquals("Verify position of code value", codeValue1Position,
codeValuesAttributes1.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME));
// verify values of second code value
final HashMap codeValuesAttributes2 = (HashMap) CodeHelper.getCodeValueById(this.requestSpec, this.responseSpec,
createCodeResponseId, createCodeValueResponseId2, "");
Assert.assertNotNull(codeValuesAttributes2);
assertEquals("Verify value of codeValueId", createCodeValueResponseId2,
codeValuesAttributes2.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME));
assertEquals("Verify value of code name", codeValue2, codeValuesAttributes2.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME));
assertEquals("Verify value of code description", codeDescription2,
codeValuesAttributes2.get(CodeHelper.CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME));
assertEquals("Verify position of code value", codeValue2Position,
codeValuesAttributes2.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME));
// update code value 1
final HashMap codeValueChanges = (HashMap) CodeHelper.updateCodeValue(this.requestSpec, this.responseSpec, createCodeResponseId,
createCodeValueResponseId1, codeValue1 + "CHANGE", codeDescription1 + "CHANGE", 4, "changes");
assertEquals("Verify changed code value name", codeValueChanges.get("name"), codeValue1 + "CHANGE");
assertEquals("Verify changed code value description", codeValueChanges.get("description"), codeDescription1 + "CHANGE");
// delete code value
Integer deletedCodeValueResponseId1 = (Integer) CodeHelper.deleteCodeValueById(this.requestSpec, this.generalResponseSpec,
createCodeResponseId, createCodeValueResponseId1, CodeHelper.SUBRESPONSE_ID_ATTRIBUTE_NAME);
// Verify code value deleted
final ArrayList<HashMap> deletedCodeValueAttributes1 = (ArrayList<HashMap>) CodeHelper.getCodeValueById(this.requestSpec,
this.generalResponseSpec, createCodeResponseId, deletedCodeValueResponseId1, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.codevalue.id.invalid", deletedCodeValueAttributes1.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
final List<HashMap> deletedCodeValuesList = (List) CodeHelper.getCodeValuesForCode(this.requestSpec, this.responseSpec,
createCodeResponseId, "");
assertEquals("Number of code values is 1", 1, deletedCodeValuesList.size());
final Integer deletedCodeValueResponseId2 = (Integer) CodeHelper.deleteCodeValueById(this.requestSpec, this.generalResponseSpec,
createCodeResponseId, createCodeValueResponseId2, CodeHelper.SUBRESPONSE_ID_ATTRIBUTE_NAME);
final ArrayList<HashMap> deletedCodeValueAttributes2 = (ArrayList<HashMap>) CodeHelper.getCodeValueById(this.requestSpec,
this.generalResponseSpec, createCodeResponseId, deletedCodeValueResponseId2, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.codevalue.id.invalid", deletedCodeValueAttributes2.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
final List<HashMap> deletedCodeValuesList1 = (List) CodeHelper.getCodeValuesForCode(this.requestSpec, this.responseSpec,
createCodeResponseId, "");
assertEquals("Number of code values is 0", 0, deletedCodeValuesList1.size());
}
@Ignore
@Test
public void testCodeValuesAssignedToTable() {
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import java.util.ArrayList;
@@ -38,9 +43,9 @@ public class TemplateIntegrationTest {
@Test
public void test() {
final HashMap<String, String> metadata = new HashMap<String, String>();
final HashMap<String, String> metadata = new HashMap<>();
metadata.put("user", "resource_url");
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("name", "foo");
map.put("text", "Hello {{template}}");
map.put("mappers", metadata);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
@@ -0,0 +1,353 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.mifosplatform.batch.domain.BatchRequest;
import org.mifosplatform.batch.domain.BatchResponse;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
* Helper class for {@link org.mifosplatform.integrationtests.BatchApiTest}. It
* takes care of creation of {@code BatchRequest} list and posting this list to
* the server.
*
* @author Rishabh Shukla
*
* @see org.mifosplatform.integrationtests.BatchApiTest
*/
public class BatchHelper {
private static final String BATCH_API_URL = "/mifosng-provider/api/v1/batches?" + Utils.TENANT_IDENTIFIER;
private static final String BATCH_API_URL_EXT = BATCH_API_URL + "&enclosingTransaction=true";
private BatchHelper() {
super();
}
/**
* Returns a JSON String for a list of {@code BatchRequest}s
*
* @param batchRequests
* @return JSON String of BatchRequest
*/
public static String toJsonString(final List<BatchRequest> batchRequests) {
return new Gson().toJson(batchRequests);
}
/**
* Returns the converted string response into JSON.
*
* @param json
* @return List<BatchResponse>
*/
private static List<BatchResponse> fromJsonString(final String json) {
return new Gson().fromJson(json, new TypeToken<List<BatchResponse>>() {}.getType());
}
/**
* Returns a list of BatchResponse with query parameter enclosing
* transaction set to false by posting the jsonified BatchRequest to the
* server.
*
* @param requestSpec
* @param responseSpec
* @param jsonifiedBatchRequests
* @return a list of BatchResponse
*/
public static List<BatchResponse> postBatchRequestsWithoutEnclosingTransaction(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String jsonifiedBatchRequests) {
final String response = Utils.performServerPost(requestSpec, responseSpec, BATCH_API_URL, jsonifiedBatchRequests, null);
return BatchHelper.fromJsonString(response);
}
/**
* Returns a list of BatchResponse with query parameter enclosing
* transaction set to true by posting the jsonified BatchRequest to the
* server.
*
* @param requestSpec
* @param responseSpec
* @param jsonifiedBatchRequests
* @return a list of BatchResponse
*/
public static List<BatchResponse> postBatchRequestsWithEnclosingTransaction(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String jsonifiedBatchRequests) {
final String response = Utils.performServerPost(requestSpec, responseSpec, BATCH_API_URL_EXT, jsonifiedBatchRequests, null);
return BatchHelper.fromJsonString(response);
}
/**
* Returns a BatchResponse based on the given BatchRequest, by posting the
* request to the server.
*
* @param BatchRequest
* @return List<BatchResponse>
*/
public static List<BatchResponse> postWithSingleRequest(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final BatchRequest br) {
final List<BatchRequest> batchRequests = new ArrayList<>();
batchRequests.add(br);
final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(requestSpec, responseSpec,
jsonifiedRequest);
// Verifies that the response result is there
Assert.assertNotNull(response);
Assert.assertTrue(response.size() > 0);
return response;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.CreateClientCommandStrategy}
* Request as one of the request in Batch.
*
* @param reqId
* @param externalId
* @return BatchRequest
*/
public static BatchRequest createClientRequest(final Long requestId, final String externalId) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("clients");
br.setMethod("POST");
final String extId;
if (externalId.equals("")) {
extId = "ext" + String.valueOf((10000 * Math.random())) + String.valueOf((10000 * Math.random()));
} else {
extId = externalId;
}
final String body = "{ \"officeId\": 1, \"firstname\": \"Petra\", \"lastname\": \"Yton\"," + "\"externalId\": " + extId
+ ", \"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en\"," + "\"active\": false, \"submittedOnDate\": \"04 March 2009\"}";
br.setBody(body);
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.UpdateClientCommandStrategy}
* Request with given requestId and reference.
*
* @param reqId
* @param clientId
* @return BatchRequest
*/
public static BatchRequest updateClientRequest(final Long requestId, final Long reference) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("clients/$.clientId");
br.setMethod("PUT");
br.setReference(reference);
br.setBody("{\"firstname\": \"TestFirstName\", \"lastname\": \"TestLastName\"}");
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.ApplyLoanCommandStrategy}
* Request with given requestId and reference.
*
* @param requestId
* @param reference
* @param productId
* @return BatchRequest
*/
public static BatchRequest applyLoanRequest(final Long requestId, final Long reference, final Integer productId) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("loans");
br.setMethod("POST");
br.setReference(reference);
final String body = "{\"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en_GB\", \"clientId\": \"$.clientId\"," + "\"productId\": "
+ productId + ", \"principal\": \"10,000.00\", \"loanTermFrequency\": 12,"
+ "\"loanTermFrequencyType\": 2, \"loanType\": \"individual\", \"numberOfRepayments\": 10,"
+ "\"repaymentEvery\": 1, \"repaymentFrequencyType\": 2, \"interestRatePerPeriod\": 10,"
+ "\"amortizationType\": 1, \"interestType\": 0, \"interestCalculationPeriodType\": 1,"
+ "\"transactionProcessingStrategyId\": 1, \"expectedDisbursementDate\": \"10 Jun 2013\","
+ "\"submittedOnDate\": \"10 Jun 2013\"}";
br.setBody(body);
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.ApplySavingsCommandStrategy}
* Request with given requestId and reference.
*
* @param requestId
* @param reference
* @param productId
* @return BatchRequest
*/
public static BatchRequest applySavingsRequest(final Long requestId, final Long reference, final Integer productId) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("savingsaccounts");
br.setMethod("POST");
br.setReference(reference);
final String body = "{\"clientId\": \"$.clientId\", \"productId\": " + productId + ","
+ "\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"submittedOnDate\": \"01 March 2011\"}";
br.setBody(body);
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.CreateChargeCommandStrategy}
* Request with given requestId and reference
*
* @param requestId
* @param reference
* @return BatchRequest
*/
public static BatchRequest createChargeRequest(final Long requestId, final Long reference) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("loans/$.loanId/charges");
br.setMethod("POST");
br.setReference(reference);
final String body = "{\"chargeId\": \"2\", \"locale\": \"en\", \"amount\": \"100\", "
+ "\"dateFormat\": \"dd MMMM yyyy\", \"dueDate\": \"29 April 2013\"}";
br.setBody(body);
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.CollectChargesCommandStrategy}
* Request with given requestId and reference.
*
* @param requestId
* @param reference
* @return BatchRequest
*/
public static BatchRequest collectChargesRequest(final Long requestId, final Long reference) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("loans/$.loanId/charges");
br.setReference(reference);
br.setMethod("GET");
br.setBody("{ }");
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.ActivateClientCommandStrategy}
* Request with given requestId and reference.
*
*
* @param requestId
* @param reference
* @return BatchRequest
*/
public static BatchRequest activateClientRequest(final Long requestId, final Long reference) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("clients/$.clientId?command=activate");
br.setReference(reference);
br.setMethod("POST");
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"activationDate\": \"01 March 2011\"}");
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.ApproveLoanCommandStrategy}
* Request with given requestId and reference.
*
*
* @param requestId
* @param reference
* @return BatchRequest
*/
public static BatchRequest approveLoanRequest(final Long requestId, final Long reference) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("loans/$.loanId?command=approve");
br.setReference(reference);
br.setMethod("POST");
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"approvedOnDate\": \"12 September 2013\","
+ "\"note\": \"Loan approval note\"}");
return br;
}
/**
* Creates and returns a
* {@link org.mifosplatform.batch.command.internal.DisburseLoanCommandStrategy}
* Request with given requestId and reference.
*
*
* @param requestId
* @param reference
* @return BatchRequest
*/
public static BatchRequest disburseLoanRequest(final Long requestId, final Long reference) {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl("loans/$.loanId?command=disburse");
br.setReference(reference);
br.setMethod("POST");
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"actualDisbursementDate\": \"15 September 2013\"}");
return br;
}
/**
* Checks that the client with given externalId is not created on the
* server.
*
* @param requestSpec
* @param responseSpec
* @param externalId
*/
public static void verifyClientCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String externalId) {
System.out.println("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
final String CLIENT_URL = "/mifosng-provider/api/v1/clients?externalId=" + externalId + "&" + Utils.TENANT_IDENTIFIER;
final Integer responseRecords = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "totalFilteredRecords");
Assert.assertEquals("No records found with given externalId", (long) responseRecords, (long) 0);
}
}
@@ -0,0 +1,61 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import static com.jayway.restassured.path.json.JsonPath.from;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class CalendarHelper {
private static final String BASE_URL = "/mifosng-provider/api/v1/";
private static final String PARENT_ENTITY_NAME = "groups/";
private static final String ENITY_NAME = "/calendars";
public static Integer createMeetingCalendarForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer groupId, final String startDate, final String frequency, final String interval, final String repeatsOnDay) {
System.out.println("---------------------------------CREATING A MEETING CALENDAR FOR THE GROUP------------------------------");
final String CALENDAR_RESOURCE_URL = BASE_URL + PARENT_ENTITY_NAME + groupId + ENITY_NAME + "?" + Utils.TENANT_IDENTIFIER;
System.out.println(CALENDAR_RESOURCE_URL);
return Utils.performServerPost(requestSpec, responseSpec, CALENDAR_RESOURCE_URL, getTestCalendarAsJSON(frequency, interval, repeatsOnDay, startDate),
"resourceId");
}
public static String getTestCalendarAsJSON(final String frequency, final String interval,final String repeatsOnDay,
final String startDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
map.put("frequency", frequency);
map.put("interval", interval);
map.put("repeating", "true");
map.put("repeatsOnDay", repeatsOnDay );
map.put("title", Utils.randomNameGenerator("groups_CollectionMeeting", 4));
map.put("typeId", "1");
map.put("startDate", startDate);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static void verifyCalendarCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupId, final Integer generatedCalendarId) {
System.out.println("------------------------------CHECK CALENDAR DETAILS------------------------------------\n");
final String CLIENT_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupId + "?associations=all&" + Utils.TENANT_IDENTIFIER;
final String responseCalendarDetailsinJSON = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "collectionMeetingCalendar");
final Integer responseCalendarId = from(responseCalendarDetailsinJSON).get("id");
assertEquals("ERROR IN CREATING THE CALENDAR", generatedCalendarId, responseCalendarId);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import static org.junit.Assert.assertEquals;
@@ -10,7 +15,27 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class ClientHelper {
private static final String CREATE_CLIENT_URL = "/mifosng-provider/api/v1/clients?tenantIdentifier=default";
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String CREATE_CLIENT_URL = "/mifosng-provider/api/v1/clients?" + Utils.TENANT_IDENTIFIER;
private static final String CLIENT_URL = "/mifosng-provider/api/v1/clients";
private static final String CLOSE_CLIENT_COMMAND = "close";
private static final String REACTIVATE_CLIENT_COMMAND = "reactivate";
private static final String REJECT_CLIENT_COMMAND = "reject";
private static final String ACTIVATE_CLIENT_COMMAND ="activate";
private static final String WITHDRAW_CLIENT_COMMAND = "withdraw";
public static final String CREATED_DATE = "27 November 2014";
public static final String CREATED_DATE_PLUS_ONE = "28 November 2014";
public static final String CREATED_DATE_MINUS_ONE = "27 November 2014";
public static final String TRANSACTION_DATE = "01 March 2013";
public static final String LAST_TRANSACTION_DATE = "01 March 2013";
public ClientHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public static Integer createClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createClient(requestSpec, responseSpec, "04 March 2011");
@@ -28,8 +53,21 @@ public class ClientHelper {
"clientId");
}
public static Object assignStaffToClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId, final String staffId) {
final String CLIENT_ASSIGN_STAFF_URL = "/mifosng-provider/api/v1/clients/" + clientId + "?" + Utils.TENANT_IDENTIFIER
+ "&command=assignStaff";
System.out.println("---------------------------------CREATING A CLIENT---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CLIENT_ASSIGN_STAFF_URL, assignStaffToClientAsJson(staffId), "changes");
}
public static Integer getClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String clientId) {
return (Integer) getClient(requestSpec, responseSpec, clientId, "staffId");
}
public static String getTestClientAsJSON(final String dateOfJoining, final String officeId) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("officeId", officeId);
map.put("firstname", Utils.randomNameGenerator("Client_FirstName_", 5));
map.put("lastname", Utils.randomNameGenerator("Client_LastName_", 4));
@@ -42,15 +80,125 @@ public class ClientHelper {
return new Gson().toJson(map);
}
public static String assignStaffToClientAsJson(final String staffId) {
final HashMap<String, String> map = new HashMap<>();
map.put("staffId", staffId);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static void verifyClientCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedClientID) {
System.out.println("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
final String CLIENT_URL = "/mifosng-provider/api/v1/clients/" + generatedClientID + "?tenantIdentifier=default";
final String CLIENT_URL = "/mifosng-provider/api/v1/clients/" + generatedClientID + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseClientID = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "id");
assertEquals("ERROR IN CREATING THE CLIENT", generatedClientID, responseClientID);
}
public static Object getClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String clientId,
final String jsonReturn) {
final String GET_CLIENT_URL = "/mifosng-provider/api/v1/clients/" + clientId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------GET A CLIENT---------------------------------------------");
return Utils.performServerGet(requestSpec, responseSpec, GET_CLIENT_URL, jsonReturn);
}
public static HashMap getClientStatus(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId) {
return (HashMap) getClient(requestSpec, responseSpec, clientId, "status");
}
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
private String getCloseClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("closureDate", CREATED_DATE_PLUS_ONE);
map.put("closureReasonId", "12");
String clientJson = new Gson().toJson(map);
System.out.println(clientJson);
return clientJson;
}
private String getReactivateClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("reactivationDate", CREATED_DATE_PLUS_ONE);
String clientJson = new Gson().toJson(map);
System.out.println(clientJson);
return clientJson;
}
private String getRejectClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("rejectDate", CREATED_DATE_PLUS_ONE);
map.put("rejectReasonId", "15");
String clientJson = new Gson().toJson(map);
System.out.println(clientJson);
return clientJson;
}
private String getActivateClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("activationDate", CREATED_DATE_PLUS_ONE);
String clientJson = new Gson().toJson(map);
System.out.println(clientJson);
return clientJson;
}
private String getWithdrawClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("withdrawDate", CREATED_DATE_PLUS_ONE);
map.put("withdrawReasonId", "17");
String clientJson = new Gson().toJson(map);
System.out.println(clientJson);
return clientJson;
}
public HashMap closeClient(final Integer clientId) {
System.out.println("--------------------------------- CLOSE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(CLOSE_CLIENT_COMMAND, clientId), getCloseClientAsJSON(), clientId);
}
public HashMap reactivateClient(final Integer clientId) {
System.out.println("--------------------------------- REACTIVATE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(REACTIVATE_CLIENT_COMMAND, clientId), getReactivateClientAsJSON(), clientId);
}
public HashMap rejectClient(final Integer clientId) {
System.out.println("--------------------------------- REJECT CLIENT -------------------------------");
return performClientActions(createClientOperationURL(REJECT_CLIENT_COMMAND, clientId), getRejectClientAsJSON(), clientId);
}
public HashMap activateClient(final Integer clientId) {
System.out.println("--------------------------------- ACTIVATE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId), getActivateClientAsJSON(), clientId);
}
public HashMap withdrawClient(final Integer clientId) {
System.out.println("--------------------------------- WITHDRAWN CLIENT -------------------------------");
return performClientActions(createClientOperationURL(WITHDRAW_CLIENT_COMMAND, clientId), getWithdrawClientAsJSON(), clientId);
}
private String createClientOperationURL(final String command, final Integer clientId) {
return CLIENT_URL + "/" + clientId + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
private HashMap performClientActions(final String postURLForClient, final String jsonToBeSent, final Integer clientId) {
HashMap status = null;
Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent, CommonConstants.RESPONSE_STATUS);
HashMap response = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
return response;
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
@@ -7,6 +12,7 @@ public interface CommonConstants {
public static final String dateFormat = "dd MMMM yyyy";
public static final String RESPONSE_RESOURCE_ID = "resourceId";
public static final String RESPONSE_CHANGES = "changes";
public static final String RESPONSE_STATUS = "status";
public static final String RESPONSE_ERROR = "errors";
public static final String RESPONSE_ERROR_MESSAGE_CODE = "userMessageGlobalisationCode";
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import java.util.ArrayList;
@@ -20,7 +25,7 @@ public class GlobalConfigurationHelper {
}
public static ArrayList getAllGlobalConfigurations(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String GET_ALL_GLOBAL_CONFIG_URL = "/mifosng-provider/api/v1/configurations?tenantIdentifier=default";
final String GET_ALL_GLOBAL_CONFIG_URL = "/mifosng-provider/api/v1/configurations?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING ALL GLOBAL CONFIGURATIONS -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_GLOBAL_CONFIG_URL, "");
return (ArrayList) response.get("globalConfiguration");
@@ -28,14 +33,14 @@ public class GlobalConfigurationHelper {
public static HashMap getGlobalConfigurationById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String configId) {
final String GET_GLOBAL_CONFIG_BY_ID_URL = "/mifosng-provider/api/v1/configurations/" + configId + "?tenantIdentifier=default";
final String GET_GLOBAL_CONFIG_BY_ID_URL = "/mifosng-provider/api/v1/configurations/" + configId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING GLOBAL CONFIGURATION BY ID -------------------------");
return Utils.performServerGet(requestSpec, responseSpec, GET_GLOBAL_CONFIG_BY_ID_URL, "");
}
public static Integer updateValueForGlobalConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String configId, final String value) {
final String GLOBAL_CONFIG_UPDATE_URL = "/mifosng-provider/api/v1/configurations/" + configId + "?tenantIdentifier=default";
final String GLOBAL_CONFIG_UPDATE_URL = "/mifosng-provider/api/v1/configurations/" + configId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE VALUE FOR GLOBAL CONFIG---------------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, GLOBAL_CONFIG_UPDATE_URL, updateGlobalConfigUpdateValueAsJSON(value),
"resourceId");
@@ -43,7 +48,7 @@ public class GlobalConfigurationHelper {
public static Integer updateEnabledFlagForGlobalConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String configId, final Boolean enabled) {
final String GLOBAL_CONFIG_UPDATE_URL = "/mifosng-provider/api/v1/configurations/" + configId + "?tenantIdentifier=default";
final String GLOBAL_CONFIG_UPDATE_URL = "/mifosng-provider/api/v1/configurations/" + configId + "?" + Utils.TENANT_IDENTIFIER;
System.out
.println("---------------------------------UPDATE GLOBAL CONFIG FOR ENABLED FLAG---------------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, GLOBAL_CONFIG_UPDATE_URL,
@@ -52,7 +57,7 @@ public class GlobalConfigurationHelper {
public static ArrayList getGlobalConfigurationIsCacheEnabled(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String GET_IS_CACHE_GLOBAL_CONFIG_URL = "/mifosng-provider/api/v1/caches?tenantIdentifier=default";
final String GET_IS_CACHE_GLOBAL_CONFIG_URL = "/mifosng-provider/api/v1/caches?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING IS CACHE ENABLED GLOBAL CONFIGURATION -------------------------");
final ArrayList<HashMap> response = Utils.performServerGet(requestSpec, responseSpec, GET_IS_CACHE_GLOBAL_CONFIG_URL, "");
return response;
@@ -60,14 +65,14 @@ public class GlobalConfigurationHelper {
public static HashMap updateIsCacheEnabledForGlobalConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String cacheType) {
final String IS_CACHE_GLOBAL_CONFIG_UPDATE_URL = "/mifosng-provider/api/v1/caches?tenantIdentifier=default";
final String IS_CACHE_GLOBAL_CONFIG_UPDATE_URL = "/mifosng-provider/api/v1/caches?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------UPDATE GLOBAL CONFIG FOR IS CACHE ENABLED----------------------");
return Utils.performServerPut(requestSpec, responseSpec, IS_CACHE_GLOBAL_CONFIG_UPDATE_URL,
updateIsCacheEnabledGlobalConfigUpdateAsJSON(cacheType), "changes");
}
public static String updateGlobalConfigUpdateValueAsJSON(final String value) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("value", value);
System.out.println("map : " + map);
return new Gson().toJson(map);
@@ -81,7 +86,7 @@ public class GlobalConfigurationHelper {
}
public static String updateIsCacheEnabledGlobalConfigUpdateAsJSON(final String cacheType) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("cacheType", cacheType);
System.out.println("map : " + map);
return new Gson().toJson(map);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import static org.junit.Assert.assertEquals;
@@ -16,7 +21,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class GroupHelper {
private static final String CREATE_GROUP_URL = "/mifosng-provider/api/v1/groups?tenantIdentifier=default";
private static final String CREATE_GROUP_URL = "/mifosng-provider/api/v1/groups?" + Utils.TENANT_IDENTIFIER;
public static Integer createGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
@SuppressWarnings("unused") final boolean active) {
@@ -38,7 +43,7 @@ public class GroupHelper {
public static Integer associateClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId, final String clientMember) {
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId
+ "?command=associateClients&tenantIdentifier=default";
+ "?command=associateClients&" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------Associate Client To A GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, associateClientAsJSON(clientMember), "groupId");
}
@@ -46,33 +51,46 @@ public class GroupHelper {
public static Integer disAssociateClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId, final String clientMember) {
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId
+ "?command=disassociateClients&tenantIdentifier=default";
+ "?command=disassociateClients&" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------Disassociate Client To A GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, associateClientAsJSON(clientMember), "groupId");
}
public static Integer activateGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId) {
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?command=activate&tenantIdentifier=default";
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?command=activate&" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------Activate A GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, activateGroupAsJSON(""), "groupId");
}
public static Integer updateGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String name,
final String groupId) {
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?tenantIdentifier=default";
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE GROUP---------------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, updateGroupAsJSON(name), "groupId");
}
public static Integer deleteGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId) {
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?tenantIdentifier=default";
final String GROUP_ASSOCIATE_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------DELETE GROUP---------------------------------------------");
return Utils.performServerDelete(requestSpec, responseSpec, GROUP_ASSOCIATE_URL, "groupId");
}
public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId,final Long staffId){
final String GROUP_ASSIGN_STAFF_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER + "&command=assignStaff";
System.out.println("---------------------------------DELETE GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSIGN_STAFF_URL,assignStaffAsJSON(staffId),"changes");
}
public static Object assignStaffInheritStaffForClientAccounts(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId,final String staffId){
final String GROUP_ASSIGN_STAFF_URL = "/mifosng-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER + "&command=assignStaff";
System.out.println("---------------------------------DELETE GROUP---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSIGN_STAFF_URL,assignStaffAndInheritStaffForClientAccountsAsJSON(staffId),"changes");
}
public static String getTestGroupAsJSON(final boolean active, final String activationDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("officeId", "1");
map.put("name", randomNameGenerator("Group_Name_", 5));
map.put("externalId", randomIDGenerator("ID_", 7));
@@ -93,7 +111,7 @@ public class GroupHelper {
public static String associateClientAsJSON(final String clientMember) {
final HashMap<String, List<String>> map = new HashMap<String, List<String>>();
final List<String> list = new ArrayList<String>();
final List<String> list = new ArrayList<>();
list.add(clientMember);
map.put("clientMembers", list);
System.out.println("map : " + map);
@@ -101,7 +119,7 @@ public class GroupHelper {
}
public static String activateGroupAsJSON(final String activationDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
if (StringUtils.isNotEmpty(activationDate)) {
@@ -115,16 +133,30 @@ public class GroupHelper {
}
public static String updateGroupAsJSON(final String name) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("name", name);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String assignStaffAsJSON(final Long staffId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("staffId", staffId);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String assignStaffAndInheritStaffForClientAccountsAsJSON(final String staffId) {
final HashMap<String, String> map = new HashMap<>();
map.put("staffId", staffId);
map.put("inheritStaffForClientAccounts","true");
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static void verifyGroupCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupID) {
System.out.println("------------------------------CHECK GROUP DETAILS------------------------------------\n");
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?tenantIdentifier=default";
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseGroupID = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "id");
assertEquals("ERROR IN CREATING THE GROUP", generatedGroupID, responseGroupID);
}
@@ -132,7 +164,7 @@ public class GroupHelper {
public static void verifyGroupDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupID, final String field, final String expectedValue) {
System.out.println("------------------------------CHECK GROUP DETAILS------------------------------------\n");
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?tenantIdentifier=default";
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?" + Utils.TENANT_IDENTIFIER;
final String responseValue = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, field);
assertEquals("ERROR IN CREATING THE GROUP", expectedValue, responseValue);
}
@@ -140,36 +172,36 @@ public class GroupHelper {
public static void verifyGroupActivatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupID, final boolean generatedGroupStatus) {
System.out.println("------------------------------CHECK GROUP STATUS------------------------------------\n");
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?tenantIdentifier=default";
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?" + Utils.TENANT_IDENTIFIER;
final Boolean responseGroupStatus = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "active");
assertEquals("ERROR IN ACTIVATING THE GROUP", generatedGroupStatus, responseGroupStatus);
}
public static void verifyGroupMembers(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupID, final Integer groupMember) {
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
System.out.println("------------------------------CHECK GROUP MEMBERS------------------------------------\n");
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID
+ "?associations=clientMembers&tenantIdentifier=default";
+ "?associations=clientMembers&" + Utils.TENANT_IDENTIFIER;
list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "clientMembers");
assertTrue("ERROR IN GROUP MEMBER", list.toString().contains("id=" + groupMember.toString()));
}
public static void verifyEmptyGroupMembers(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupID) {
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
System.out.println("------------------------------CHECK EMPTY GROUP MEMBER LIST------------------------------------\n");
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID
+ "?associations=clientMembers&tenantIdentifier=default";
+ "?associations=clientMembers&" + Utils.TENANT_IDENTIFIER;
list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "clientMembers");
assertEquals("GROUP MEMBER LIST NOT EMPTY", list, null);
}
public static void verifyGroupDeleted(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedGroupID) {
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
System.out.println("------------------------------CHECK GROUP DELETED------------------------------------\n");
final String GROUP_URL = "/mifosng-provider/api/v1/groups/?tenantIdentifier=default";
final String GROUP_URL = "/mifosng-provider/api/v1/groups/?" + Utils.TENANT_IDENTIFIER;
list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "pageItems");
assertFalse("GROUP NOT DELETED", list.toString().contains("id=" + generatedGroupID.toString()));
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import java.util.ArrayList;
@@ -28,9 +33,9 @@ public class HolidayHelper {
}
public static String getCreateHolidayDataAsJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
List<HashMap<String, String>> offices = new ArrayList<HashMap<String, String>>();
HashMap<String, String> officeMap = new HashMap<String, String>();
HashMap<String, String> officeMap = new HashMap<>();
officeMap.put("officeId", OFFICE_ID);
offices.add(officeMap);
@@ -48,7 +53,7 @@ public class HolidayHelper {
}
public static String getActivateHolidayDataAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
String activateHoliday = new Gson().toJson(map);
System.out.println(activateHoliday);
return activateHoliday;
@@ -59,13 +64,13 @@ public class HolidayHelper {
}
public static Integer activateHolidays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String holidayID) {
final String ACTIVATE_HOLIDAY_URL = HOLIDAYS_URL + "/" + holidayID + "?command=activate";
final String ACTIVATE_HOLIDAY_URL = HOLIDAYS_URL + "/" + holidayID + "?command=activate&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, ACTIVATE_HOLIDAY_URL, getActivateHolidayDataAsJSON(), "resourceId");
}
public static HashMap getHolidayById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String holidayID) {
final String GET_HOLIDAY_BY_ID_URL = HOLIDAYS_URL + "/" + holidayID + "?tenantIdentifier=default";
final String GET_HOLIDAY_BY_ID_URL = HOLIDAYS_URL + "/" + holidayID + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING HOLIDAY BY ID -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_HOLIDAY_BY_ID_URL, "");
return response;
@@ -0,0 +1,52 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import java.util.ArrayList;
import java.util.HashMap;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class HookHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String CREATE_HOOK_URL = "/mifosng-provider/api/v1/hooks?" + Utils.TENANT_IDENTIFIER;
public HookHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Integer createHook(final String payloadURL) {
System.out.println("---------------------------------CREATING A HOOK---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_HOOK_URL, getTestHookAsJson(payloadURL),
"resourceId");
}
public String getTestHookAsJson(final String payloadURL) {
final HashMap<String, Object> map = new HashMap<>();
map.put("name", "Web");
map.put("displayName", Utils.randomNameGenerator("Hook_DisplayName_", 5));
map.put("isActive", "true");
final HashMap<String, String> config = new HashMap<>();
config.put("Content Type", "json");
config.put("Payload URL", payloadURL);
map.put("config", config);
final ArrayList<HashMap<String, String>> events = new ArrayList<>();
final HashMap<String, String> createOfficeEvent = new HashMap<>();
createOfficeEvent.put("actionName", "CREATE");
createOfficeEvent.put("entityName", "OFFICE");
events.add(createOfficeEvent);
map.put("events", events);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
}
@@ -0,0 +1,54 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import static org.junit.Assert.assertEquals;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class LoanRescheduleRequestHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String LOAN_RESCHEDULE_REQUEST_URL = "/mifosng-provider/api/v1/rescheduleloans";
public LoanRescheduleRequestHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Integer createLoanRescheduleRequest(final String requestJSON) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, requestJSON, "resourceId");
}
public Integer rejectLoanRescheduleRequest(final Integer requestId, final String requestJSON) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER + "&command=reject";
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, requestJSON, "resourceId");
}
public Integer approveLoanRescheduleRequest(final Integer requestId, final String requestJSON) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER + "&command=approve";
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, requestJSON, "resourceId");
}
public Object getLoanRescheduleRequest(final Integer requestId, final String param) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, param);
}
public void verifyCreationOfLoanRescheduleRequest(final Integer requestId) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER;
final Integer id = Utils.performServerGet(requestSpec, responseSpec, URL, "id");
assertEquals("ERROR IN CREATING LOAN RESCHEDULE REQUEST", requestId, id);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import java.util.HashMap;
@@ -26,7 +31,7 @@ public class OfficeHelper {
public static String getAsJSON(final String openingDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("parentId", "1");
map.put("name", Utils.randomNameGenerator("Office_", 4));
map.put("dateFormat", "dd MMMM yyyy");
@@ -1,8 +1,12 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import org.junit.Assert;
@@ -11,7 +15,7 @@ import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes", "unchecked" })
public class SchedulerJobHelper {
private final RequestSpecification requestSpec;
@@ -23,7 +27,7 @@ public class SchedulerJobHelper {
}
public static ArrayList getAllSchedulerJobs(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String GET_ALL_SCHEDULER_JOBS_URL = "/mifosng-provider/api/v1/jobs?tenantIdentifier=default";
final String GET_ALL_SCHEDULER_JOBS_URL = "/mifosng-provider/api/v1/jobs?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING ALL SCHEDULER JOBS -------------------------");
final ArrayList response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_SCHEDULER_JOBS_URL, "");
return response;
@@ -31,28 +35,29 @@ public class SchedulerJobHelper {
public static HashMap getSchedulerJobById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String jobId) {
final String GET_SCHEDULER_JOB_BY_ID_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "?tenantIdentifier=default";
final String GET_SCHEDULER_JOB_BY_ID_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING SCHEDULER JOB BY ID -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_SCHEDULER_JOB_BY_ID_URL, "");
return response;
}
public static HashMap getSchedulerStatus(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String GET_SCHEDULER_STATUS_URL = "/mifosng-provider/api/v1/scheduler?tenantIdentifier=default";
final String GET_SCHEDULER_STATUS_URL = "/mifosng-provider/api/v1/scheduler?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING SCHEDULER STATUS -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_SCHEDULER_STATUS_URL, "");
return response;
}
public static void updateSchedulerStatus(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String command) {
final String UPDATE_SCHEDULER_STATUS_URL = "/mifosng-provider/api/v1/scheduler?command=" + command +"&tenantIdentifier=default";
public static void updateSchedulerStatus(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String command) {
final String UPDATE_SCHEDULER_STATUS_URL = "/mifosng-provider/api/v1/scheduler?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ UPDATING SCHEDULER STATUS -------------------------");
Utils.performServerPost(requestSpec, responseSpec, UPDATE_SCHEDULER_STATUS_URL, runSchedulerJobAsJSON(), null);
}
public static HashMap updateSchedulerJob(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String jobId, final String active) {
final String UPDATE_SCHEDULER_JOB_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "?tenantIdentifier=default";
final String UPDATE_SCHEDULER_JOB_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ UPDATING SCHEDULER JOB -------------------------");
final HashMap response = Utils.performServerPut(requestSpec, responseSpec, UPDATE_SCHEDULER_JOB_URL,
updateSchedulerJobAsJSON(active), "changes");
@@ -60,7 +65,7 @@ public class SchedulerJobHelper {
}
public static String updateSchedulerJobAsJSON(final String active) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("active", active);
System.out.println("map : " + map);
return new Gson().toJson(map);
@@ -68,27 +73,27 @@ public class SchedulerJobHelper {
public static ArrayList getSchedulerJobHistory(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String jobId) {
final String GET_SCHEDULER_STATUS_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "/runhistory?tenantIdentifier=default";
final String GET_SCHEDULER_STATUS_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "/runhistory?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING SCHEDULER JOB HISTORY -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_SCHEDULER_STATUS_URL, "");
return (ArrayList) response.get("pageItems");
}
public static void runSchedulerJob(final RequestSpecification requestSpec, final String jobId) {
final ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(202).build();
final String RUN_SCHEDULER_JOB_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "?command=executeJob&tenantIdentifier=default";
final ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(202).build();
final String RUN_SCHEDULER_JOB_URL = "/mifosng-provider/api/v1/jobs/" + jobId + "?command=executeJob&" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RUN SCHEDULER JOB -------------------------");
Utils.performServerPost(requestSpec, responseSpec, RUN_SCHEDULER_JOB_URL, runSchedulerJobAsJSON(), null);
}
public static String runSchedulerJobAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
String runSchedulerJob = new Gson().toJson(map);
System.out.println(runSchedulerJob);
return runSchedulerJob;
}
public void excuteJob(String JobName) throws InterruptedException {
public void executeJob(String JobName) throws InterruptedException {
ArrayList<HashMap> allSchedulerJobsData = getAllSchedulerJobs(this.requestSpec, this.responseSpec);
Assert.assertNotNull(allSchedulerJobsData);
@@ -0,0 +1,60 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import java.util.HashMap;
public class StaffHelper {
private static final String TRANSFER_STAFF_URL = "/mifosng-provider/api/v1/groups";
private static final String CREATE_STAFF_URL = "/mifosng-provider/api/v1/staff";
private static final String RESOURCE_ID = "resourceId";
public static final String GROUP_ID = "groupId";
public static Integer transferStaffToGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer groupId,final Integer staffToTransfer ,final String note){
final String url = TRANSFER_STAFF_URL + "/" + groupId + "?command=transferStaff&"+Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, url, transferStaffToGroupAsJSON(staffToTransfer, note), GROUP_ID);
}
public static String transferStaffToGroupAsJSON(final Integer staffToTransferId,final String note) {
final HashMap<String, Object> map = new HashMap<>();
map.put("staffId", staffToTransferId);
map.put("note", note);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static Integer createStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String url = CREATE_STAFF_URL +"?"+ Utils.TENANT_IDENTIFIER ;
return Utils.performServerPost(requestSpec, responseSpec, url, createStaffAsJSON(), RESOURCE_ID);
}
public static String createStaffAsJSON(){
final HashMap<String, Object> map = new HashMap<>();
map.put("officeId",1);
map.put("firstname", Utils.randomNameGenerator("michael_",5));
map.put("lastname", Utils.randomNameGenerator("Doe_",4));
map.put("isLoanOfficer", true);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
}
@@ -1,6 +1,12 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import java.util.HashMap;
import java.util.List;
import org.mifosplatform.integrationtests.common.Utils;
@@ -10,10 +16,11 @@ import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "unused", "rawtypes" })
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
public class StandingInstructionsHelper {
private static final String STANDING_INSTRUCTIONS_URL = "/mifosng-provider/api/v1/standinginstructions";
private static final String STANDING_INSTRUCTIONS_RUNHISTORY_URL = "/mifosng-provider/api/v1/standinginstructionrunhistory";
private static final String LOCALE = "en_GB";
private static final String OFFICE_ID = "1";
private static final String INSTRUCTION_TYPE_FIXED = "1";
@@ -48,7 +55,7 @@ public class StandingInstructionsHelper {
public String build(final String clientId, final String fromAccountId, final String toAccountId, final String fromAccountType,
final String toAccountType, final String validFrom, final String validTo, final String monthDay) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("name", Utils.randomNameGenerator("STANDING_INSTRUCTION_", 5));
map.put("dateFormat", "dd MMMM yyyy");
map.put("monthDayFormat", "dd MMMM");
@@ -70,7 +77,7 @@ public class StandingInstructionsHelper {
map.put("validTill", validTo);
map.put("recurrenceType", RECURRENCE_TYPE_PERIODIC);
map.put("recurrenceInterval", "1");
map.put("recurrenceFrequency", RECURRENCE_FREQUENCY_MONTHS);
map.put("recurrenceFrequency", RECURRENCE_FREQUENCY_WEEKS);
map.put("recurrenceOnMonthDay", monthDay);
String savingsApplicationJSON = new Gson().toJson(map);
System.out.println(savingsApplicationJSON);
@@ -95,4 +102,14 @@ public class StandingInstructionsHelper {
final HashMap response = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_STANDING_INSTRUCTION_BY_ID_URL, "");
return response;
}
public List<HashMap> getStandingInstructionHistory(Integer fromSavingsId, Integer fromAccountType, Integer fromClientId, Integer transferType) {
final String STANDING_INSTRUCTIONS_HISTORY_URL = STANDING_INSTRUCTIONS_RUNHISTORY_URL + "?" + Utils.TENANT_IDENTIFIER
+ "&fromSavingsId=" + fromSavingsId + "&fromAccountType=" + fromAccountType + "&clientId=" + fromClientId
+ "&transferType=" + transferType;
System.out.println("STANDING_INSTRUCTIONS_HISTORY_URL="+STANDING_INSTRUCTIONS_HISTORY_URL);
final List<HashMap> response = (List<HashMap>) Utils.performServerGet(this.requestSpec, this.responseSpec,
STANDING_INSTRUCTIONS_HISTORY_URL, "pageItems");
return response;
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import com.google.gson.Gson;
@@ -8,9 +13,9 @@ import java.util.HashMap;
import static org.junit.Assert.assertEquals;
public class surveyHelper {
public class SurveyHelper {
private static final String FULFIL_SURVEY_URL = "/mifosng-provider/api/v1/survey/ppi_kenya_2009/clientId?tenantIdentifier=default";
private static final String FULFIL_SURVEY_URL = "/mifosng-provider/api/v1/survey/ppi_kenya_2009/clientId?" + Utils.TENANT_IDENTIFIER;
public static Integer fulfilSurvey(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return fulfilSurvey(requestSpec, responseSpec, "04 March 2011");
@@ -23,7 +28,7 @@ public class surveyHelper {
}
public static String getTestPPIAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("date", "2014-05-19 00:00:00");
map.put("ppi_household_members_cd_q1_householdmembers","107");
@@ -47,7 +52,7 @@ public class surveyHelper {
public static void verifySurveyCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedClientID) {
System.out.println("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
final String SURVEY_URL = "/mifosng-provider/api/v1/Survey/ppi_kenya_2009/clientid/entryId" + generatedClientID + "?tenantIdentifier=default";
final String SURVEY_URL = "/mifosng-provider/api/v1/Survey/ppi_kenya_2009/clientid/entryId" + generatedClientID + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseClientID = Utils.performServerGet(requestSpec, responseSpec, SURVEY_URL, "id");
assertEquals("ERROR IN CREATING THE CLIENT", generatedClientID, responseClientID);
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common;
import static com.jayway.restassured.RestAssured.given;
@@ -8,6 +13,7 @@ import static org.junit.Assert.fail;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
@@ -18,6 +24,11 @@ import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
* Util for RestAssured tests.
* This class here in src/integrationTest is copy/pasted to src/test; please keep them in sync.
*/
@SuppressWarnings("unchecked")
public class Utils {
@@ -28,7 +39,7 @@ public class Utils {
public static void initializeRESTAssured() {
RestAssured.baseURI = "https://localhost";
RestAssured.port = 8443;
RestAssured.keystore("../keystore.jks", "openmf");
RestAssured.keystore("src/main/resources/keystore.jks", "openmf");
}
public static String loginIntoServerAndGetBase64EncodedAuthenticationKey() {
@@ -76,7 +87,7 @@ public class Utils {
}
public static String convertDateToURLFormat(final String dateToBeConvert) {
final SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy");
final SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy", Locale.US);
final SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd");
String reformattedStr = "";
try {
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
public class Account {
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
import java.util.ArrayList;
@@ -11,7 +16,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings("rawtypes")
public class AccountHelper {
private final String CREATE_GL_ACCOUNT_URL = "/mifosng-provider/api/v1/glaccounts?tenantIdentifier=default";
private final String CREATE_GL_ACCOUNT_URL = "/mifosng-provider/api/v1/glaccounts?" + Utils.TENANT_IDENTIFIER;
private final String GL_ACCOUNT_ID_RESPONSE = "resourceId";
private final RequestSpecification requestSpec;
@@ -44,9 +49,9 @@ public class AccountHelper {
}
public Account createLiabilityAccount() {
final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsLiability().build();
final String liabilityAccountJSON = new GLAccountBuilder().withAccountTypeAsLiability().build();
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL,
assetAccountJSON, this.GL_ACCOUNT_ID_RESPONSE);
liabilityAccountJSON, this.GL_ACCOUNT_ID_RESPONSE);
return new Account(accountID, Account.AccountType.LIABILITY);
}
@@ -0,0 +1,56 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
import java.util.HashMap;
import java.util.List;
import org.mifosplatform.integrationtests.common.Utils;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings("rawtypes")
public class FinancialActivityAccountHelper {
private static final String FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL = "/mifosng-provider/api/v1/financialactivityaccounts";
private final RequestSpecification requestSpec;
public FinancialActivityAccountHelper(final RequestSpecification requestSpec) {
this.requestSpec = requestSpec;
}
public Object createFinancialActivityAccount(Integer financialActivityId, Integer glAccountId,
final ResponseSpecification responseSpecification, String jsonBack) {
String json = FinancialActivityAccountsMappingBuilder.build(financialActivityId, glAccountId);
return Utils.performServerPost(this.requestSpec, responseSpecification, FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "?"
+ Utils.TENANT_IDENTIFIER, json, jsonBack);
}
public Object updateFinancialActivityAccount(Integer financialActivityAccountId, Integer financialActivityId, Integer glAccountId,
final ResponseSpecification responseSpecification, String jsonBack) {
String json = FinancialActivityAccountsMappingBuilder.build(financialActivityId, glAccountId);
return Utils.performServerPut(this.requestSpec, responseSpecification, FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "/"
+ financialActivityAccountId + "?" + Utils.TENANT_IDENTIFIER, json, jsonBack);
}
public HashMap getFinancialActivityAccount(final Integer financialActivityAccountId, final ResponseSpecification responseSpecification) {
final String url = FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "/" + financialActivityAccountId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpecification, url, "");
}
public List<HashMap> getAllFinancialActivityAccounts(final ResponseSpecification responseSpecification) {
final String url = FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(this.requestSpec, responseSpecification, url, "");
}
public Integer deleteFinancialActivityAccount(final Integer financialActivityAccountId,
final ResponseSpecification responseSpecification, String jsonBack) {
final String url = FINANCIAL_ACTIVITY_ACCOUNT_MAPPING_URL + "/" + financialActivityAccountId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(this.requestSpec, responseSpecification, url, jsonBack);
}
}
@@ -0,0 +1,20 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
import java.util.HashMap;
import com.google.gson.Gson;
public class FinancialActivityAccountsMappingBuilder {
public static String build(Integer financialActivityId, Integer glAccountId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("financialActivityId", financialActivityId);
map.put("glAccountId", glAccountId);
return new Gson().toJson(map);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
import java.util.Calendar;
@@ -29,7 +34,7 @@ public class GLAccountBuilder {
private static String description = "DEFAULT_DESCRIPTION";
public String build() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("name", GLAccountBuilder.name);
map.put("glCode", GLAccountBuilder.GLCode);
map.put("manualEntriesAllowed", GLAccountBuilder.manualEntriesAllowed);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
public class JournalEntry {
@@ -19,10 +24,12 @@ public class JournalEntry {
private final Float transactionAmount;
private final TransactionType transactionType;
private final Integer officeId;
public JournalEntry(final float transactionAmount, final TransactionType type) {
this.transactionAmount = transactionAmount;
this.transactionType = type;
this.officeId = null;
}
public Float getTransactionAmount() {
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
import static org.hamcrest.Matchers.equalTo;
@@ -24,25 +29,31 @@ public class JournalEntryHelper {
}
public void checkJournalEntryForExpenseAccount(final Account expenseAccount, final String date, final JournalEntry... accountEntries) {
checkJournalEntry(expenseAccount, date, accountEntries);
checkJournalEntry(null, expenseAccount, date, accountEntries);
}
public void checkJournalEntryForAssetAccount(final Account assetAccount, final String date, final JournalEntry... accountEntries) {
checkJournalEntry(assetAccount, date, accountEntries);
checkJournalEntry(null, assetAccount, date, accountEntries);
}
public void checkJournalEntryForIncomeAccount(final Account incomeAccount, final String date, final JournalEntry... accountEntries) {
checkJournalEntry(incomeAccount, date, accountEntries);
checkJournalEntry(null, incomeAccount, date, accountEntries);
}
public void checkJournalEntryForLiabilityAccount(final Account liabilityAccount, final String date, final JournalEntry... accountEntries) {
checkJournalEntry(liabilityAccount, date, accountEntries);
public void checkJournalEntryForLiabilityAccount(final Account liabilityAccount, final String date,
final JournalEntry... accountEntries) {
checkJournalEntry(null, liabilityAccount, date, accountEntries);
}
public void checkJournalEntryForLiabilityAccount(final Integer officeId, final Account liabilityAccount, final String date,
final JournalEntry... accountEntries) {
checkJournalEntry(officeId, liabilityAccount, date, accountEntries);
}
public void ensureNoAccountingTransactionsWithTransactionId(final String transactionId) {
ArrayList<HashMap> transactions = getJournalEntriesByTransactionId(transactionId);
assertTrue("Tranasactions are is not empty", transactions.isEmpty());
}
private String getEntryValueFromJournalEntry(final ArrayList<HashMap> entryResponse, final int entryNumber) {
@@ -54,8 +65,8 @@ public class JournalEntryHelper {
return (Float) entryResponse.get(entryNumber).get("amount");
}
private void checkJournalEntry(final Account account, final String date, final JournalEntry... accountEntries) {
final String url = createURLForGettingAccountEntries(account, date);
private void checkJournalEntry(final Integer officeId, final Account account, final String date, final JournalEntry... accountEntries) {
final String url = createURLForGettingAccountEntries(account, date, officeId);
final ArrayList<HashMap> response = Utils.performServerGet(this.requestSpec, this.responseSpec, url, "pageItems");
for (int i = 0; i < accountEntries.length; i++) {
assertThat(getEntryValueFromJournalEntry(response, i), equalTo(accountEntries[i].getTransactionType()));
@@ -63,10 +74,14 @@ public class JournalEntryHelper {
}
}
private String createURLForGettingAccountEntries(final Account account, final String date) {
return new String("/mifosng-provider/api/v1/journalentries?glAccountId=" + account.getAccountID() + "&type="
private String createURLForGettingAccountEntries(final Account account, final String date, final Integer officeId) {
String url = new String("/mifosng-provider/api/v1/journalentries?glAccountId=" + account.getAccountID() + "&type="
+ account.getAccountType() + "&fromDate=" + date + "&toDate=" + date + "&tenantIdentifier=default"
+ "&orderBy=id&sortOrder=desc&locale=en&dateFormat=dd MMMM yyyy");
if (officeId != null) {
url = url + "&officeId=" + officeId;
}
return url;
}
private ArrayList<HashMap> getJournalEntriesByTransactionId(final String transactionId) {
@@ -1,15 +0,0 @@
package org.mifosplatform.integrationtests.common.accounting;
import java.util.HashMap;
import com.google.gson.Gson;
public class OfficeAccountMappingBuilder {
public static String build(Integer officeId, Integer glAccountId) {
final HashMap<String, Object> map = new HashMap<String, Object>();
map.put("officeId", officeId);
map.put("liabilityTransferInSuspenseAccountId", glAccountId);
return new Gson().toJson(map);
}
}
@@ -1,44 +0,0 @@
package org.mifosplatform.integrationtests.common.accounting;
import java.util.HashMap;
import org.mifosplatform.integrationtests.common.Utils;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings("rawtypes")
public class OfficeAccountMappingHelper {
private static final String ACCOUNT_MAPPING_URL = "/mifosng-provider/api/v1/officeglaccounts";
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public OfficeAccountMappingHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Object createOfficeAccountMapping(Integer officeId, Integer glAccountId, String jsonBack) {
String json = OfficeAccountMappingBuilder.build(officeId, glAccountId);
return Utils.performServerPost(this.requestSpec, this.responseSpec, ACCOUNT_MAPPING_URL + "?" + Utils.TENANT_IDENTIFIER, json,
jsonBack);
}
public Object updateOfficeAccountMapping(Integer mappingId, Integer officeId, Integer glAccountId, String jsonBack) {
String json = OfficeAccountMappingBuilder.build(officeId, glAccountId);
return Utils.performServerPut(this.requestSpec, this.responseSpec, ACCOUNT_MAPPING_URL + "/" + mappingId + "?"
+ Utils.TENANT_IDENTIFIER, json, jsonBack);
}
public HashMap getOfficeAccountMapping(final Integer mappingId) {
final String URL = ACCOUNT_MAPPING_URL + "/" + mappingId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, "");
}
public HashMap getOfficeAccountMappings() {
final String URL = ACCOUNT_MAPPING_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, "");
}
}
@@ -0,0 +1,40 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.accounting;
import java.util.HashMap;
import org.mifosplatform.integrationtests.common.Utils;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class PeriodicAccrualAccountingHelper {
private static final String PERIODIC_ACCRUAL_URL = "/mifosng-provider/api/v1/runaccruals";
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public PeriodicAccrualAccountingHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Object runPeriodicAccrualAccounting(String date) {
String json = getRunPeriodicAccrual(date);
return Utils.performServerPost(this.requestSpec, this.responseSpec, PERIODIC_ACCRUAL_URL + "?" + Utils.TENANT_IDENTIFIER, json, "");
}
private String getRunPeriodicAccrual(String date) {
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en_GB");
map.put("tillDate", date);
return new Gson().toJson(map);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.charges;
import java.util.ArrayList;
@@ -28,6 +33,7 @@ public class ChargesHelper {
private static final Integer CHARGE_INSTALLMENT_FEE = 8;
private static final Integer CHARGE_OVERDUE_INSTALLMENT_FEE = 9;
private static final Integer CHARGE_OVERDRAFT_FEE = 10;
private static final Integer WEEKLY_FEE = 11;
public static final Integer CHARGE_CALCULATION_TYPE_FLAT = 1;
public static final Integer CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT = 2;
@@ -92,6 +98,15 @@ public class ChargesHelper {
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getSavingsWeeklyFeeJSON() {
final HashMap<String, Object> map = populateDefaultsForSavings();
map.put("chargeTimeType", WEEKLY_FEE);
map.put("feeInterval", 1);
String chargesCreateJson = new Gson().toJson(map);
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getSavingsOverdraftFeeJSON() {
final HashMap<String, Object> map = populateDefaultsForSavings();
@@ -102,7 +117,7 @@ public class ChargesHelper {
}
public static HashMap<String, Object> populateDefaultsForSavings() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("active", ChargesHelper.active);
map.put("amount", ChargesHelper.amount);
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_SAVINGS);
@@ -207,9 +222,21 @@ public class ChargesHelper {
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getLoanOverdueFeeJSONWithCalculattionTypePercentage() {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("penalty", ChargesHelper.penalty);
map.put("amount", "10");
map.put("chargePaymentMode", ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
map.put("chargeTimeType", CHARGE_OVERDUE_INSTALLMENT_FEE);
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST);
String chargesCreateJson = new Gson().toJson(map);
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static HashMap<String, Object> populateDefaultsForLoan() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("active", ChargesHelper.active);
map.put("amount", ChargesHelper.amount);
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_LOAN);
@@ -254,7 +281,7 @@ public class ChargesHelper {
}
public static String getModifyChargeJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("amount", "200.0");
String json = new Gson().toJson(map);
@@ -263,7 +290,7 @@ public class ChargesHelper {
}
public static String getModifyWithdrawalFeeSavingsChargeJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT);
String json = new Gson().toJson(map);
@@ -272,7 +299,7 @@ public class ChargesHelper {
}
public static String getModifyChargeAsPecentageAmountJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT);
map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
@@ -282,7 +309,7 @@ public class ChargesHelper {
}
public static String getModifyChargeAsPecentageLoanAmountWithInterestJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST);
map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
@@ -292,7 +319,7 @@ public class ChargesHelper {
}
public static String getModifyChargeAsPercentageInterestJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST);
map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
@@ -302,7 +329,7 @@ public class ChargesHelper {
}
public static String getModifyChargeFeeFrequencyAsDaysJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_DAYS);
map.put("feeInterval", 2);
@@ -312,7 +339,7 @@ public class ChargesHelper {
}
public static String getModifyChargeFeeFrequencyAsWeeksJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_WEEKS);
map.put("feeInterval", 2);
@@ -322,7 +349,7 @@ public class ChargesHelper {
}
public static String getModifyChargeFeeFrequencyAsMonthsJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_MONTHS);
map.put("feeInterval", 2);
@@ -332,7 +359,7 @@ public class ChargesHelper {
}
public static String getModifyChargeFeeFrequencyAsYearsJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_YEARS);
map.put("feeInterval", 2);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.fixeddeposit;
import java.util.ArrayList;
@@ -80,10 +85,10 @@ public class FixedDepositAccountHelper {
public String build(final String clientId, final String productId, final String validFrom, final String validTo,
final String penalInterestType) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
List<HashMap<String, String>> chartSlabs = new ArrayList<HashMap<String, String>>();
HashMap<String, String> chartSlabsMap1 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap1 = new HashMap<>();
chartSlabsMap1.put("description", "First");
chartSlabsMap1.put("periodType", MONTHS);
chartSlabsMap1.put("fromPeriod", "1");
@@ -92,7 +97,7 @@ public class FixedDepositAccountHelper {
chartSlabsMap1.put("locale", LOCALE);
chartSlabs.add(0, chartSlabsMap1);
HashMap<String, String> chartSlabsMap2 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap2 = new HashMap<>();
chartSlabsMap2.put("description", "Second");
chartSlabsMap2.put("periodType", MONTHS);
chartSlabsMap2.put("fromPeriod", "7");
@@ -101,7 +106,7 @@ public class FixedDepositAccountHelper {
chartSlabsMap2.put("locale", LOCALE);
chartSlabs.add(1, chartSlabsMap2);
HashMap<String, String> chartSlabsMap3 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap3 = new HashMap<>();
chartSlabsMap3.put("description", "Third");
chartSlabsMap3.put("periodType", MONTHS);
chartSlabsMap3.put("fromPeriod", "13");
@@ -110,7 +115,7 @@ public class FixedDepositAccountHelper {
chartSlabsMap3.put("locale", LOCALE);
chartSlabs.add(2, chartSlabsMap3);
HashMap<String, String> chartSlabsMap4 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap4 = new HashMap<>();
chartSlabsMap4.put("description", "Fourth");
chartSlabsMap4.put("periodType", MONTHS);
chartSlabsMap4.put("fromPeriod", "19");
@@ -120,7 +125,7 @@ public class FixedDepositAccountHelper {
chartSlabs.add(3, chartSlabsMap4);
List<HashMap<String, Object>> charts = new ArrayList<HashMap<String, Object>>();
HashMap<String, Object> chartsMap = new HashMap<String, Object>();
HashMap<String, Object> chartsMap = new HashMap<>();
chartsMap.put("fromDate", validFrom);
chartsMap.put("endDate", validTo);
chartsMap.put("dateFormat", "dd MMMM yyyy");
@@ -324,7 +329,7 @@ public class FixedDepositAccountHelper {
}
private String getApproveFixedDepositAccountAsJSON(final String approvedOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("approvedOnDate", approvedOnDate);
@@ -335,7 +340,7 @@ public class FixedDepositAccountHelper {
}
private String getRejectedFixedDepositAsJSON(final String rejectedOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("rejectedOnDate", rejectedOnDate);
@@ -346,7 +351,7 @@ public class FixedDepositAccountHelper {
}
private String getWithdrawnFixedDepositAccountAsJSON(final String withdrawnApplicationOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("withdrawnOnDate", withdrawnApplicationOnDate);
@@ -357,7 +362,7 @@ public class FixedDepositAccountHelper {
}
private String getActivatedFixedDepositAccountAsJSON(final String activationDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("activatedOnDate", activationDate);
@@ -367,14 +372,14 @@ public class FixedDepositAccountHelper {
}
private String getCalculatedInterestForFixedDepositApplicationAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
String fixedDepositAccountCalculatedInterestJson = new Gson().toJson(map);
System.out.println(fixedDepositAccountCalculatedInterestJson);
return fixedDepositAccountCalculatedInterestJson;
}
private String getCalculatedPrematureAmountForFixedDepositAccountAsJSON(final String closedOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("closedOnDate", closedOnDate);
@@ -385,7 +390,7 @@ public class FixedDepositAccountHelper {
private String getPrematureCloseForFixedDepositAccountAsJSON(final String closedOnDate, final String closureType,
final Integer toSavingsId) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("closedOnDate", closedOnDate);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.fixeddeposit;
import static org.junit.Assert.assertTrue;
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.fixeddeposit;
import static org.junit.Assert.assertEquals;
@@ -81,10 +86,10 @@ public class FixedDepositProductHelper {
private Account[] accountList = null;
public String build(final String validFrom, final String validTo) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
List<HashMap<String, String>> chartSlabs = new ArrayList<HashMap<String, String>>();
HashMap<String, String> chartSlabsMap1 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap1 = new HashMap<>();
chartSlabsMap1.put("description", "First");
chartSlabsMap1.put("periodType", MONTHS);
chartSlabsMap1.put("fromPeriod", "1");
@@ -93,7 +98,7 @@ public class FixedDepositProductHelper {
chartSlabsMap1.put("locale", LOCALE);
chartSlabs.add(0, chartSlabsMap1);
HashMap<String, String> chartSlabsMap2 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap2 = new HashMap<>();
chartSlabsMap2.put("description", "Second");
chartSlabsMap2.put("periodType", MONTHS);
chartSlabsMap2.put("fromPeriod", "7");
@@ -102,7 +107,7 @@ public class FixedDepositProductHelper {
chartSlabsMap2.put("locale", LOCALE);
chartSlabs.add(1, chartSlabsMap2);
HashMap<String, String> chartSlabsMap3 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap3 = new HashMap<>();
chartSlabsMap3.put("description", "Third");
chartSlabsMap3.put("periodType", MONTHS);
chartSlabsMap3.put("fromPeriod", "13");
@@ -111,7 +116,7 @@ public class FixedDepositProductHelper {
chartSlabsMap3.put("locale", LOCALE);
chartSlabs.add(2, chartSlabsMap3);
HashMap<String, String> chartSlabsMap4 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap4 = new HashMap<>();
chartSlabsMap4.put("description", "Fourth");
chartSlabsMap4.put("periodType", MONTHS);
chartSlabsMap4.put("fromPeriod", "19");
@@ -121,7 +126,7 @@ public class FixedDepositProductHelper {
chartSlabs.add(3, chartSlabsMap4);
List<HashMap<String, Object>> charts = new ArrayList<HashMap<String, Object>>();
HashMap<String, Object> chartsMap = new HashMap<String, Object>();
HashMap<String, Object> chartsMap = new HashMap<>();
chartsMap.put("fromDate", validFrom);
chartsMap.put("endDate", validTo);
chartsMap.put("dateFormat", "dd MMMM yyyy");
@@ -177,7 +182,7 @@ public class FixedDepositProductHelper {
}
private Map<String, String> getAccountMappingForCashBased() {
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
if (accountList != null) {
for (int i = 0; i < this.accountList.length; i++) {
if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) {
@@ -0,0 +1,98 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.funds;
import com.google.gson.Gson;
public class FundsHelper {
public static class Builder {
private String name;
private String externalId;
private Builder(final String name) {
this.name = name;
}
public Builder externalId(final String externalId) {
this.externalId = externalId;
return this;
}
public FundsHelper build() {
return new FundsHelper(this.name, this.externalId);
}
}
private String name;
private String externalId;
private Long resourceId;
FundsHelper() {
super();
}
private FundsHelper(final String name,
final String externalId) {
super();
this.name = name;
this.externalId = externalId;
}
public String getName() {
return this.name;
}
public String getExternalId() {
return this.externalId;
}
public Long getResourceId() {
return this.resourceId;
}
public String toJSON() {
return new Gson().toJson(this);
}
public static FundsHelper fromJSON(final String jsonData) {
return new Gson().fromJson(jsonData, FundsHelper.class);
}
public static Builder create(final String name) {
return new Builder(name);
}
@Override
public int hashCode() {
if (this.name != null) {
return this.name.hashCode();
}
return super.hashCode();
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof FundsHelper)) {
return false;
}
FundsHelper fh = (FundsHelper)o;
if (this.name.equals(fh.name)) {
return true;
}
return false;
}
}
@@ -0,0 +1,58 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.funds;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import org.mifosplatform.integrationtests.common.Utils;
import java.util.HashMap;
import java.util.List;
public class FundsResourceHandler {
private static final String FUNDS_URL = "/mifosng-provider/api/v1/funds";
private static final String CREATE_FUNDS_URL = FUNDS_URL + "?" + Utils.TENANT_IDENTIFIER;
public static Integer createFund(final String fundJSON,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_FUNDS_URL, fundJSON, "resourceId");
}
public static List<FundsHelper> retrieveAllFunds(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String URL = FUNDS_URL + "?" + Utils.TENANT_IDENTIFIER;
List<HashMap<String, Object>> list = Utils.performServerGet(requestSpec, responseSpec, URL, "");
final String jsonData = new Gson().toJson(list);
return new Gson().fromJson(jsonData, new TypeToken<List<FundsHelper>>(){}.getType());
}
public static String retrieveFund(final Long fundID,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String URL = FUNDS_URL + "/" + fundID + "?" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "");
return new Gson().toJson(response);
}
public static FundsHelper updateFund(final Long fundID,
final String newName,
final String newExternalId,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
FundsHelper fh = FundsHelper.create(newName).externalId(newExternalId).build();
String updateJSON = new Gson().toJson(fh);
final String URL = FUNDS_URL + "/" + fundID + "?" + Utils.TENANT_IDENTIFIER;
final HashMap<String, String> response = Utils.performServerPut(requestSpec, responseSpec, URL, updateJSON, "changes");
final String jsonData = new Gson().toJson(response);
return new Gson().fromJson(jsonData, FundsHelper.class);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.loans;
import java.util.ArrayList;
@@ -17,7 +22,8 @@ public class LoanApplicationTestBuilder {
private static final String EQUAL_PRINCIPAL_PAYMENTS = "0";
private static final String EQUAL_INSTALLMENTS = "1";
private static final String CALCULATION_PERIOD_SAME_AS_REPAYMENT_PERIOD = "1";
private static final String MIFOS_STANDARD_STRATEGY = "1";
public static final String MIFOS_STANDARD_STRATEGY = "1";
public static final String RBI_INDIA_STRATEGY = "4";
private String principal = "10,000";
private String loanTermFrequency = "";
@@ -30,18 +36,22 @@ public class LoanApplicationTestBuilder {
private String interestType = FLAT_BALANCE;
private String amortizationType = EQUAL_PRINCIPAL_PAYMENTS;
private String interestCalculationPeriodType = CALCULATION_PERIOD_SAME_AS_REPAYMENT_PERIOD;
private final String transactionProcessingID = MIFOS_STANDARD_STRATEGY;
private String transactionProcessingID = MIFOS_STANDARD_STRATEGY;
private String expectedDisbursmentDate = "";
private String submittedOnDate = "";
private String loanType = "individual";
private String fixedEmiAmount = "10000";
private String maxOutstandingLoanBalance = "36000";
private String graceOnPrincipalPayment = null;
private String graceOnInterestPayment = null;
private List<HashMap> disbursementData = null;
private List<HashMap> charges = new ArrayList<HashMap>();
private String recalculationRestFrequencyDate = null;
private String repaymentsStartingFromDate = null;
public String build(final String ID, final String loanProductId, final String savingsID) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en_GB");
if (this.loanType == "group") {
@@ -64,6 +74,8 @@ public class LoanApplicationTestBuilder {
map.put("expectedDisbursementDate", this.expectedDisbursmentDate);
map.put("submittedOnDate", this.submittedOnDate);
map.put("loanType", this.loanType);
map.put("repaymentsStartingFromDate", this.repaymentsStartingFromDate);
if (charges != null) {
map.put("charges", charges);
}
@@ -71,12 +83,23 @@ public class LoanApplicationTestBuilder {
map.put("linkAccountId", savingsID);
}
if (graceOnPrincipalPayment != null) {
map.put("graceOnPrincipalPayment", graceOnPrincipalPayment);
}
if (graceOnInterestPayment != null) {
map.put("graceOnInterestPayment", graceOnInterestPayment);
}
if (disbursementData != null) {
map.put("disbursementData", disbursementData);
map.put("fixedEmiAmount", fixedEmiAmount);
map.put("maxOutstandingLoanBalance", maxOutstandingLoanBalance);
}
if (recalculationRestFrequencyDate != null) {
map.put("recalculationRestFrequencyDate", recalculationRestFrequencyDate);
}
return new Gson().toJson(map);
}
@@ -136,6 +159,11 @@ public class LoanApplicationTestBuilder {
return this;
}
public LoanApplicationTestBuilder withRepaymentFrequencyTypeAsYear() {
this.repaymentFrequencyType = YEARS;
return this;
}
public LoanApplicationTestBuilder withInterestRatePerPeriod(final String interestRate) {
this.interestRate = interestRate;
return this;
@@ -191,8 +219,33 @@ public class LoanApplicationTestBuilder {
return this;
}
public LoanApplicationTestBuilder withPrincipalGrace(final String graceOnPrincipalPayment) {
this.graceOnPrincipalPayment = graceOnPrincipalPayment;
return this;
}
public LoanApplicationTestBuilder withInterestGrace(final String graceOnInterestPayment) {
this.graceOnInterestPayment = graceOnInterestPayment;
return this;
}
public LoanApplicationTestBuilder withTranches(final List<HashMap> disbursementData) {
this.disbursementData = disbursementData;
return this;
}
public LoanApplicationTestBuilder withwithRepaymentStrategy(final String transactionProcessingStrategy) {
this.transactionProcessingID = transactionProcessingStrategy;
return this;
}
public LoanApplicationTestBuilder withRestFrequencyDate(final String recalculationRestFrequencyDate) {
this.recalculationRestFrequencyDate = recalculationRestFrequencyDate;
return this;
}
public LoanApplicationTestBuilder withFirstRepaymentDate(final String firstRepaymentDate) {
this.repaymentsStartingFromDate = firstRepaymentDate;
return this;
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.loans;
import java.util.ArrayList;
@@ -13,7 +18,6 @@ import com.google.gson.Gson;
public class LoanProductTestBuilder {
private static final String LOCALE = "en_GB";
private static final String DIGITS_AFTER_DECIMAL = "2";
private static final String USD = "USD";
private static final String DAYS = "0";
private static final String WEEK = "1";
@@ -24,17 +28,35 @@ public class LoanProductTestBuilder {
private static final String EQUAL_INSTALLMENTS = "1";
private static final String DECLINING_BALANCE = "0";
private static final String FLAT_BALANCE = "1";
private static final String MIFOS_STANDARD_STRATEGY = "1";
public static final String MIFOS_STANDARD_STRATEGY = "1";
// private static final String HEAVENS_FAMILY_STRATEGY ="2";
// private static final String CREO_CORE_STRATEGY ="3";
// private static final String RBI_INDIA_STRATEGY ="4";
public static final String RBI_INDIA_STRATEGY = "4";
public static final String RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD = "1";
public static final String RECALCULATION_FREQUENCY_TYPE_DAILY = "2";
public static final String RECALCULATION_FREQUENCY_TYPE_WEEKLY = "3";
public static final String RECALCULATION_FREQUENCY_TYPE_MONTHLY = "4";
public static final String RECALCULATION_STRATEGY_RESCHEDULE_NEXT_REPAYMENTS = "1";
public static final String RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS = "2";
public static final String RECALCULATION_STRATEGY_REDUCE_EMI_AMOUN = "3";
public static final String RECALCULATION_COMPOUNDING_METHOD_NONE = "0";
public static final String RECALCULATION_COMPOUNDING_METHOD_INTEREST = "1";
public static final String RECALCULATION_COMPOUNDING_METHOD_FEE = "2";
public static final String RECALCULATION_COMPOUNDING_METHOD_INTEREST_AND_FEE = "3";
private static final String NONE = "1";
private static final String CASH_BASED = "2";
private static final String ACCRUAL_PERIODIC = "3";
private static final String ACCRUAL_UPFRONT = "4";
private String digitsAfterDecimal = "2";
private String inMultiplesOf = "0";
private String nameOfLoanProduct = Utils.randomNameGenerator("LOAN_PRODUCT_", 6);
private String shortName = Utils.randomNameGenerator("", 4);
private final String shortName = Utils.randomNameGenerator("", 4);
private String principal = "10000.00";
private String numberOfRepayments = "5";
private String repaymentFrequency = MONTHS;
@@ -45,24 +67,34 @@ public class LoanProductTestBuilder {
private String overdueDaysForNPA = "5";
private String interestCalculationPeriodType = CALCULATION_PERIOD_SAME_AS_REPAYMENT_PERIOD;
private String inArrearsTolerance = "0";
private final String transactionProcessingStrategy = MIFOS_STANDARD_STRATEGY;
private String transactionProcessingStrategy = MIFOS_STANDARD_STRATEGY;
private String accountingRule = NONE;
private final String currencyCode = USD;
private String amortizationType = EQUAL_INSTALLMENTS;
private String minPrincipal = "1000.00";
private String maxPrincipal = "100000.00";
private String maxPrincipal = "10000000.00";
private Account[] accountList = null;
private Boolean multiDisburseLoan = false;
private String outstandingLoanBalance = "35000";
private String maxTrancheCount = "35000";
private final String outstandingLoanBalance = "35000";
private final String maxTrancheCount = "35000";
private Boolean isInterestRecalculationEnabled = false;
private String daysInYearType = "1";
private String daysInMonthType = "1";
private String interestRecalculationCompoundingMethod = "0";
private String rescheduleStrategyMethod = "1";
private String recalculationRestFrequencyType = "1";
private String recalculationRestFrequencyInterval = "0";
private String recalculationRestFrequencyDate = null;
private String minimumDaysBetweenDisbursalAndFirstRepayment = null;
public String build(final String chargeId) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
if (chargeId != null) {
List<HashMap<String, String>> charges = new ArrayList<HashMap<String, String>>();
HashMap<String, String> chargeMap = new HashMap<String, String>();
List<HashMap<String, String>> charges = new ArrayList<>();
HashMap<String, String> chargeMap = new HashMap<>();
chargeMap.put("id", chargeId);
charges.add(chargeMap);
map.put("charges", charges);
@@ -71,7 +103,9 @@ public class LoanProductTestBuilder {
map.put("shortName", this.shortName);
map.put("currencyCode", this.currencyCode);
map.put("locale", LOCALE);
map.put("digitsAfterDecimal", DIGITS_AFTER_DECIMAL);
map.put("dateFormat", "dd MMMM yyyy");
map.put("digitsAfterDecimal", digitsAfterDecimal);
map.put("inMultiplesOf", inMultiplesOf);
map.put("principal", this.principal);
map.put("numberOfRepayments", this.numberOfRepayments);
map.put("repaymentEvery", this.repaymentPeriod);
@@ -87,6 +121,9 @@ public class LoanProductTestBuilder {
map.put("minPrincipal", this.minPrincipal);
map.put("maxPrincipal", this.maxPrincipal);
map.put("overdueDaysForNPA", this.overdueDaysForNPA);
if (this.minimumDaysBetweenDisbursalAndFirstRepayment != null) {
map.put("minimumDaysBetweenDisbursalAndFirstRepayment", this.minimumDaysBetweenDisbursalAndFirstRepayment);
}
if (multiDisburseLoan) {
map.put("multiDisburseLoan", this.multiDisburseLoan);
map.put("maxTrancheCount", this.maxTrancheCount);
@@ -98,6 +135,16 @@ public class LoanProductTestBuilder {
} else if (this.accountingRule.equals(CASH_BASED)) {
map.putAll(getAccountMappingForCashBased());
}
map.put("daysInMonthType", this.daysInMonthType);
map.put("daysInYearType", this.daysInYearType);
map.put("isInterestRecalculationEnabled", this.isInterestRecalculationEnabled);
if (this.isInterestRecalculationEnabled) {
map.put("interestRecalculationCompoundingMethod", this.interestRecalculationCompoundingMethod);
map.put("rescheduleStrategyMethod", this.rescheduleStrategyMethod);
map.put("recalculationRestFrequencyType", recalculationRestFrequencyType);
map.put("recalculationRestFrequencyInterval", recalculationRestFrequencyInterval);
map.put("recalculationRestFrequencyDate", recalculationRestFrequencyDate);
}
return new Gson().toJson(map);
}
@@ -230,7 +277,7 @@ public class LoanProductTestBuilder {
}
private Map<String, String> getAccountMappingForCashBased() {
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
for (int i = 0; i < this.accountList.length; i++) {
if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) {
final String ID = this.accountList[i].getAccountID().toString();
@@ -258,7 +305,7 @@ public class LoanProductTestBuilder {
}
private Map<String, String> getAccountMappingForAccrualBased() {
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
for (int i = 0; i < this.accountList.length; i++) {
if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) {
final String ID = this.accountList[i].getAccountID().toString();
@@ -296,4 +343,46 @@ public class LoanProductTestBuilder {
return this;
}
public LoanProductTestBuilder currencyDetails(final String digitsAfterDecimal, final String inMultiplesOf) {
this.digitsAfterDecimal = digitsAfterDecimal;
this.inMultiplesOf = inMultiplesOf;
return this;
}
public LoanProductTestBuilder withRepaymentStrategy(final String transactionProcessingStrategy) {
this.transactionProcessingStrategy = transactionProcessingStrategy;
return this;
}
public LoanProductTestBuilder withDaysInMonth(final String daysInMonthType) {
this.daysInMonthType = daysInMonthType;
return this;
}
public LoanProductTestBuilder withDaysInYear(final String daysInYearType) {
this.daysInYearType = daysInYearType;
return this;
}
public LoanProductTestBuilder withInterestRecalculationDetails(final String interestRecalculationCompoundingMethod,
final String rescheduleStrategyMethod) {
this.isInterestRecalculationEnabled = true;
this.interestRecalculationCompoundingMethod = interestRecalculationCompoundingMethod;
this.rescheduleStrategyMethod = rescheduleStrategyMethod;
return this;
}
public LoanProductTestBuilder withInterestRecalculationRestFrequencyDetails(final String recalculationRestFrequencyType,
final String recalculationRestFrequencyInterval, final String recalculationRestFrequencyDate) {
this.isInterestRecalculationEnabled = true;
this.recalculationRestFrequencyType = recalculationRestFrequencyType;
this.recalculationRestFrequencyInterval = recalculationRestFrequencyInterval;
this.recalculationRestFrequencyDate = recalculationRestFrequencyDate;
return this;
}
public LoanProductTestBuilder withMinimumDaysBetweenDisbursalAndFirstRepayment(final String minimumDaysBetweenDisbursalAndFirstRepayment) {
this.minimumDaysBetweenDisbursalAndFirstRepayment = minimumDaysBetweenDisbursalAndFirstRepayment;
return this;
}
}
@@ -0,0 +1,136 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.loans;
import java.util.HashMap;
import com.google.gson.Gson;
public class LoanRescheduleRequestTestBuilder {
private String rescheduleFromDate = "04 December 2014";
private String graceOnPrincipal = "2";
private String graceOnInterest = "2";
private String extraTerms = "2";
private Boolean recalculateInterest = false;
private String newInterestRate = null;
private String adjustedDueDate = null;
private String rescheduleReasonId = "1";
private String rescheduleReasonComment = null;
private String submittedOnDate = "04 September 2014";
public String build(final String loanId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en_GB");
map.put("loanId", loanId);
map.put("submittedOnDate", submittedOnDate);
map.put("rescheduleFromDate", rescheduleFromDate);
if(graceOnPrincipal != null) {
map.put("graceOnPrincipal", graceOnPrincipal);
}
if(graceOnInterest != null) {
map.put("graceOnInterest", graceOnInterest);
}
if(extraTerms != null) {
map.put("extraTerms", extraTerms);
}
map.put("recalculateInterest", recalculateInterest);
if(newInterestRate != null) {
map.put("newInterestRate", newInterestRate);
}
if(adjustedDueDate != null) {
map.put("adjustedDueDate", adjustedDueDate);
}
map.put("rescheduleReasonId", rescheduleReasonId);
if(rescheduleReasonComment != null) {
map.put("rescheduleReasonComment", rescheduleReasonComment);
}
return new Gson().toJson(map);
}
public LoanRescheduleRequestTestBuilder updateRescheduleFromDate(final String rescheduleFromDate) {
if(rescheduleFromDate != null) {
this.rescheduleFromDate = rescheduleFromDate;
}
return this;
}
public LoanRescheduleRequestTestBuilder updateGraceOnPrincipal(final String graceOnPrincipal) {
this.graceOnPrincipal = graceOnPrincipal;
return this;
}
public LoanRescheduleRequestTestBuilder updateGraceOnInterest(final String graceOnInterest) {
this.graceOnInterest = graceOnInterest;
return this;
}
public LoanRescheduleRequestTestBuilder updateExtraTerms(final String extraTerms) {
this.extraTerms = extraTerms;
return this;
}
public LoanRescheduleRequestTestBuilder updateRecalculateInterest(final Boolean recalculateInterest) {
this.recalculateInterest = recalculateInterest;
return this;
}
public LoanRescheduleRequestTestBuilder updateNewInterestRate(final String newInterestRate) {
this.newInterestRate = newInterestRate;
return this;
}
public LoanRescheduleRequestTestBuilder updateAdjustedDueDate(final String adjustedDueDate) {
this.adjustedDueDate = adjustedDueDate;
return this;
}
public LoanRescheduleRequestTestBuilder updateRescheduleReasonId(final String rescheduleReasonId) {
this.rescheduleReasonId = rescheduleReasonId;
return this;
}
public LoanRescheduleRequestTestBuilder updateRescheduleReasonComment(final String rescheduleReasonComment) {
this.rescheduleReasonComment = rescheduleReasonComment;
return this;
}
public String getRejectLoanRescheduleRequestJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("rejectedOnDate", submittedOnDate);
return new Gson().toJson(map);
}
public String getApproveLoanRescheduleRequestJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("approvedOnDate", submittedOnDate);
return new Gson().toJson(map);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.loans;
import static org.junit.Assert.assertFalse;
@@ -43,7 +48,7 @@ public class LoanStatusChecker {
public static HashMap getStatusOfLoan(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String url = "/mifosng-provider/api/v1/loans/" + loanID + "?tenantIdentifier=default";
final String url = "/mifosng-provider/api/v1/loans/" + loanID + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "status");
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.loans;
import static org.junit.Assert.assertEquals;
@@ -19,8 +24,8 @@ public class LoanTransactionHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String CREATE_LOAN_PRODUCT_URL = "/mifosng-provider/api/v1/loanproducts?tenantIdentifier=default";
private static final String APPLY_LOAN_URL = "/mifosng-provider/api/v1/loans?tenantIdentifier=default";
private static final String CREATE_LOAN_PRODUCT_URL = "/mifosng-provider/api/v1/loanproducts?" + Utils.TENANT_IDENTIFIER;
private static final String APPLY_LOAN_URL = "/mifosng-provider/api/v1/loans?" + Utils.TENANT_IDENTIFIER;
private static final String APPROVE_LOAN_COMMAND = "approve";
private static final String UNDO_APPROVAL_LOAN_COMMAND = "undoApproval";
private static final String DISBURSE_LOAN_COMMAND = "disburse";
@@ -43,28 +48,44 @@ public class LoanTransactionHelper {
public Integer getLoanId(final String loanApplicationJSON) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, "loanId");
}
public Integer getLoanOfficerId(final String loanId) {
final String GET_LOAN_URL = "/mifosng-provider/api/v1/loans/" + loanId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(this.requestSpec, this.responseSpec, GET_LOAN_URL, "loanOfficerId");
}
public Object createLoanAccount(final String loanApplicationJSON, final String responseAttribute) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, responseAttribute);
}
public Integer updateLoan(final Integer id, final String loanApplicationJSON) {
return Utils.performServerPut(this.requestSpec, this.responseSpec, "/mifosng-provider/api/v1/loans/" + id
+ "?tenantIdentifier=default", loanApplicationJSON, "loanId");
+ "?" + Utils.TENANT_IDENTIFIER, loanApplicationJSON, "loanId");
}
public ArrayList getLoanRepaymentSchedule(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule&tenantIdentifier=default";
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "repaymentSchedule");
return (ArrayList) response.get("periods");
}
public ArrayList getLoanFutureRepaymentSchedule(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule,futureSchedule&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "repaymentSchedule");
return (ArrayList) response.get("futurePeriods");
}
public HashMap getLoanSummary(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=all&tenantIdentifier=default";
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "summary");
return response;
}
public Object getLoanDetail(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID,
final String param) {
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=all&tenantIdentifier=default";
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, param);
}
@@ -76,6 +97,19 @@ public class LoanTransactionHelper {
public HashMap approveLoan(final String approvalDate, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID), getApproveLoanAsJSON(approvalDate));
}
public HashMap approveLoanWithApproveAmount(final String approvalDate, final String approvalAmount, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID), getApproveLoanAsJSON(approvalDate, approvalAmount));
}
public Object approveLoanWithApproveAmount(final String approvalDate, final String approvalAmount, final Integer loanID,
final String responseAttribute) {
final String approvalURL = createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID);
final String approvalJSONData = getApproveLoanAsJSON(approvalDate, approvalAmount);
return performLoanTransaction(approvalURL, approvalJSONData, responseAttribute);
}
public HashMap undoApproval(final Integer loanID) {
final String undoBodyJson = "{'note':'UNDO APPROVAL'}";
@@ -83,11 +117,15 @@ public class LoanTransactionHelper {
}
public HashMap disburseLoan(final String date, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date));
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date, null));
}
public HashMap disburseLoan(final String date, final Integer loanID, final String disburseAmt) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date, disburseAmt));
}
public HashMap disburseLoanToSavings(final String date, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_TO_SAVINGS_COMMAND, loanID), getDisburseLoanAsJSON(date));
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_TO_SAVINGS_COMMAND, loanID), getDisburseLoanAsJSON(date, null));
}
public HashMap undoDisbursal(final Integer loanID) {
@@ -105,11 +143,11 @@ public class LoanTransactionHelper {
public HashMap waiveInterest(final String date, final String amountToBeWaived, final Integer loanID) {
return performLoanTransaction(createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID), getWaiveBodyAsJSON(date, amountToBeWaived));
}
public Integer waiveInterestAndReturnTransactionId(final String date, final String amountToBeWaived, final Integer loanID) {
Integer resourceId = Utils.performServerPost(this.requestSpec, this.responseSpec, createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID),
getWaiveBodyAsJSON(date, amountToBeWaived), "resourceId");
return resourceId;
Integer resourceId = Utils.performServerPost(this.requestSpec, this.responseSpec,
createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID), getWaiveBodyAsJSON(date, amountToBeWaived), "resourceId");
return resourceId;
}
public HashMap makeRepayment(final String date, final Float amountToBePaid, final Integer loanID) {
@@ -124,7 +162,7 @@ public class LoanTransactionHelper {
public Integer addChargesForLoan(final Integer loanId, final String request) {
System.out.println("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
final String ADD_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges?tenantIdentifier=default";
final String ADD_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, ADD_CHARGES_URL, request, "");
return (Integer) response.get("resourceId");
}
@@ -132,7 +170,7 @@ public class LoanTransactionHelper {
public Integer updateChargesForLoan(final Integer loanId, final Integer loanchargeId, final String request) {
System.out.println("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
final String UPDATE_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId
+ "?tenantIdentifier=default";
+ "?" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPut(requestSpec, responseSpec, UPDATE_CHARGES_URL, request, "");
return (Integer) response.get("resourceId");
}
@@ -140,7 +178,7 @@ public class LoanTransactionHelper {
public Integer deleteChargesForLoan(final Integer loanId, final Integer loanchargeId) {
System.out.println("--------------------------------- DELETE CHARGES FOR LOAN --------------------------------");
final String DELETE_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId
+ "?tenantIdentifier=default";
+ "?" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerDelete(requestSpec, responseSpec, DELETE_CHARGES_URL, "");
return (Integer) response.get("resourceId");
}
@@ -148,7 +186,7 @@ public class LoanTransactionHelper {
public Integer waiveChargesForLoan(final Integer loanId, final Integer loanchargeId, final String json) {
System.out.println("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
final String CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId
+ "?command=waive&tenantIdentifier=default";
+ "?command=waive&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return (Integer) response.get("resourceId");
}
@@ -156,31 +194,44 @@ public class LoanTransactionHelper {
public Integer payChargesForLoan(final Integer loanId, final Integer loanchargeId, final String json) {
System.out.println("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
final String CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId
+ "?command=pay&tenantIdentifier=default";
+ "?command=pay&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return (Integer) response.get("resourceId");
}
private String getDisburseLoanAsJSON(final String actualDisbursementDate) {
final HashMap<String, String> map = new HashMap<String, String>();
private String getDisburseLoanAsJSON(final String actualDisbursementDate, final String transactionAmount) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("actualDisbursementDate", actualDisbursementDate);
map.put("note", "DISBURSE NOTE");
if (transactionAmount != null) {
map.put("transactionAmount", transactionAmount);
}
return new Gson().toJson(map);
}
private String getApproveLoanAsJSON(final String approvalDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("approvedOnDate", approvalDate);
map.put("note", "Approval NOTE");
return new Gson().toJson(map);
}
private String getApproveLoanAsJSON(final String approvalDate, final String approvalAmount) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("approvedLoanAmount", approvalAmount);
map.put("approvedOnDate", approvalDate);
map.put("note", "Approval NOTE");
return new Gson().toJson(map);
}
private String getRepaymentBodyAsJSON(final String transactionDate, final Float transactionAmount) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("transactionDate", transactionDate);
@@ -190,7 +241,7 @@ public class LoanTransactionHelper {
}
private String getWriteOffBodyAsJSON(final String transactionDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
map.put("note", " LOAN WRITE OFF!!!");
@@ -199,7 +250,7 @@ public class LoanTransactionHelper {
}
private String getWaiveBodyAsJSON(final String transactionDate, final String amountToBeWaived) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("transactionDate", transactionDate);
@@ -209,7 +260,7 @@ public class LoanTransactionHelper {
}
private String getWithdrawLoanApplicationBodyAsJSON(final String withdrawDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("withdrawnOnDate", withdrawDate);
@@ -223,7 +274,7 @@ public class LoanTransactionHelper {
}
public static String getSpecifiedDueDateChargesForLoanAsJSON(final String chargeId, final String dueDate, final String amount) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("dateFormat", "dd MMMM yyyy");
map.put("amount", amount);
@@ -239,7 +290,7 @@ public class LoanTransactionHelper {
}
public static String getDisbursementChargesForLoanAsJSON(final String chargeId, String amount) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("dateFormat", "dd MMMM yyyy");
map.put("amount", amount);
@@ -250,7 +301,7 @@ public class LoanTransactionHelper {
}
public static String getInstallmentChargesForLoanAsJSON(final String chargeId, final String amount) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("dateFormat", "dd MMMM yyyy");
map.put("amount", amount);
@@ -261,7 +312,7 @@ public class LoanTransactionHelper {
}
public static String getUpdateChargesForLoanAsJSON(String amount) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("dateFormat", "dd MMMM yyyy");
map.put("amount", amount);
@@ -271,7 +322,7 @@ public class LoanTransactionHelper {
}
public static String getPayChargeJSON(final String date, final String installmentNumber) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("dateFormat", "dd MMMM yyyy");
map.put("transactionDate", date);
@@ -284,7 +335,7 @@ public class LoanTransactionHelper {
}
public static String getWaiveChargeJSON(final String installmentNumber) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("installmentNumber", installmentNumber);
String json = new Gson().toJson(map);
@@ -293,7 +344,7 @@ public class LoanTransactionHelper {
}
public String getLoanCalculationBodyAsJSON(final String productID) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en_GB");
map.put("productId", productID);
@@ -314,11 +365,11 @@ public class LoanTransactionHelper {
}
private String createLoanOperationURL(final String command, final Integer loanID) {
return "/mifosng-provider/api/v1/loans/" + loanID + "?command=" + command + "&tenantIdentifier=default";
return "/mifosng-provider/api/v1/loans/" + loanID + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
private String createLoanTransactionURL(final String command, final Integer loanID) {
return "/mifosng-provider/api/v1/loans/" + loanID + "/transactions?command=" + command + "&tenantIdentifier=default";
return "/mifosng-provider/api/v1/loans/" + loanID + "/transactions?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
private HashMap performLoanTransaction(final String postURLForLoanTransaction, final String jsonToBeSent) {
@@ -327,6 +378,17 @@ public class LoanTransactionHelper {
"changes");
return (HashMap) response.get("status");
}
private Object performLoanTransaction(final String postURLForLoanTransaction, final String jsonToBeSent, final String responseAttribute) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent, responseAttribute);
}
public HashMap getPrepayAmount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "/transactions/template?command=prepayLoan&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "");
return response;
}
public void verifyRepaymentScheduleEntryFor(final int repaymentNumber, final float expectedPrincipalOutstanding, final Integer loanID) {
System.out.println("---------------------------GETTING LOAN REPAYMENT SCHEDULE--------------------------------");
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.recurringdeposit;
import java.text.DateFormat;
@@ -6,6 +11,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
@@ -91,10 +97,10 @@ public class RecurringDepositAccountHelper {
public String build(final String clientId, final String productId, final String validFrom, final String validTo,
final String penalInterestType) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
List<HashMap<String, String>> chartSlabs = new ArrayList<HashMap<String, String>>();
HashMap<String, String> chartSlabsMap1 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap1 = new HashMap<>();
chartSlabsMap1.put("description", "First");
chartSlabsMap1.put("periodType", MONTHS);
chartSlabsMap1.put("fromPeriod", "1");
@@ -103,7 +109,7 @@ public class RecurringDepositAccountHelper {
chartSlabsMap1.put("locale", LOCALE);
chartSlabs.add(0, chartSlabsMap1);
HashMap<String, String> chartSlabsMap2 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap2 = new HashMap<>();
chartSlabsMap2.put("description", "Second");
chartSlabsMap2.put("periodType", MONTHS);
chartSlabsMap2.put("fromPeriod", "7");
@@ -112,7 +118,7 @@ public class RecurringDepositAccountHelper {
chartSlabsMap2.put("locale", LOCALE);
chartSlabs.add(1, chartSlabsMap2);
HashMap<String, String> chartSlabsMap3 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap3 = new HashMap<>();
chartSlabsMap3.put("description", "Third");
chartSlabsMap3.put("periodType", MONTHS);
chartSlabsMap3.put("fromPeriod", "13");
@@ -121,7 +127,7 @@ public class RecurringDepositAccountHelper {
chartSlabsMap3.put("locale", LOCALE);
chartSlabs.add(2, chartSlabsMap3);
HashMap<String, String> chartSlabsMap4 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap4 = new HashMap<>();
chartSlabsMap4.put("description", "Fourth");
chartSlabsMap4.put("periodType", MONTHS);
chartSlabsMap4.put("fromPeriod", "19");
@@ -131,7 +137,7 @@ public class RecurringDepositAccountHelper {
chartSlabs.add(3, chartSlabsMap4);
List<HashMap<String, Object>> charts = new ArrayList<HashMap<String, Object>>();
HashMap<String, Object> chartsMap = new HashMap<String, Object>();
HashMap<String, Object> chartsMap = new HashMap<>();
chartsMap.put("fromDate", validFrom);
chartsMap.put("endDate", validTo);
chartsMap.put("dateFormat", "dd MMMM yyyy");
@@ -247,7 +253,7 @@ public class RecurringDepositAccountHelper {
public HashMap updateRecurringDepositAccount(final String clientID, final String productID, final String accountID,
final String validFrom, final String validTo, final String penalInterestType, final String submittedOnDate) {
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -1);
todaysDate.add(Calendar.DATE, -1);
@@ -378,7 +384,7 @@ public class RecurringDepositAccountHelper {
}
private String getApproveRecurringDepositAccountAsJSON(final String approvedOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("approvedOnDate", approvedOnDate);
@@ -389,7 +395,7 @@ public class RecurringDepositAccountHelper {
}
private String getUpdateTransactionAsJSON(final String transactionDate, final Float transactionAmount) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("transactionDate", transactionDate);
@@ -400,7 +406,7 @@ public class RecurringDepositAccountHelper {
}
private String getRejectedRecurringDepositAsJSON(final String rejectedOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("rejectedOnDate", rejectedOnDate);
@@ -411,7 +417,7 @@ public class RecurringDepositAccountHelper {
}
private String getWithdrawnRecurringDepositAccountAsJSON(final String withdrawnApplicationOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("withdrawnOnDate", withdrawnApplicationOnDate);
@@ -422,7 +428,7 @@ public class RecurringDepositAccountHelper {
}
private String getActivatedRecurringDepositAccountAsJSON(final String activationDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("activatedOnDate", activationDate);
@@ -432,14 +438,14 @@ public class RecurringDepositAccountHelper {
}
private String getCalculatedInterestForRecurringDepositApplicationAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
String recurringDepositAccountCalculatedInterestJson = new Gson().toJson(map);
System.out.println(recurringDepositAccountCalculatedInterestJson);
return recurringDepositAccountCalculatedInterestJson;
}
private String getCalculatedPrematureAmountForRecurringDepositAccountAsJSON(final String closedOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("closedOnDate", closedOnDate);
@@ -449,7 +455,7 @@ public class RecurringDepositAccountHelper {
}
private String getDepositToRecurringDepositAccountAsJSON(final Float depositAmount, final String depositedOnDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("transactionAmount", depositAmount);
@@ -461,7 +467,7 @@ public class RecurringDepositAccountHelper {
private String getPrematureCloseForRecurringDepositAccountAsJSON(final String closedOnDate, final String closureType,
final Integer toSavingsId) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("closedOnDate", closedOnDate);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.recurringdeposit;
import static org.junit.Assert.assertTrue;
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.recurringdeposit;
import java.util.ArrayList;
@@ -79,10 +84,10 @@ public class RecurringDepositProductHelper {
private Account[] accountList = null;
public String build(final String validFrom, final String validTo) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
List<HashMap<String, String>> chartSlabs = new ArrayList<HashMap<String, String>>();
HashMap<String, String> chartSlabsMap1 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap1 = new HashMap<>();
chartSlabsMap1.put("description", "First");
chartSlabsMap1.put("periodType", MONTHS);
chartSlabsMap1.put("fromPeriod", "1");
@@ -91,7 +96,7 @@ public class RecurringDepositProductHelper {
chartSlabsMap1.put("locale", LOCALE);
chartSlabs.add(0, chartSlabsMap1);
HashMap<String, String> chartSlabsMap2 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap2 = new HashMap<>();
chartSlabsMap2.put("description", "Second");
chartSlabsMap2.put("periodType", MONTHS);
chartSlabsMap2.put("fromPeriod", "7");
@@ -100,7 +105,7 @@ public class RecurringDepositProductHelper {
chartSlabsMap2.put("locale", LOCALE);
chartSlabs.add(1, chartSlabsMap2);
HashMap<String, String> chartSlabsMap3 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap3 = new HashMap<>();
chartSlabsMap3.put("description", "Third");
chartSlabsMap3.put("periodType", MONTHS);
chartSlabsMap3.put("fromPeriod", "13");
@@ -109,7 +114,7 @@ public class RecurringDepositProductHelper {
chartSlabsMap3.put("locale", LOCALE);
chartSlabs.add(2, chartSlabsMap3);
HashMap<String, String> chartSlabsMap4 = new HashMap<String, String>();
HashMap<String, String> chartSlabsMap4 = new HashMap<>();
chartSlabsMap4.put("description", "Fourth");
chartSlabsMap4.put("periodType", MONTHS);
chartSlabsMap4.put("fromPeriod", "19");
@@ -119,7 +124,7 @@ public class RecurringDepositProductHelper {
chartSlabs.add(3, chartSlabsMap4);
List<HashMap<String, Object>> charts = new ArrayList<HashMap<String, Object>>();
HashMap<String, Object> chartsMap = new HashMap<String, Object>();
HashMap<String, Object> chartsMap = new HashMap<>();
chartsMap.put("fromDate", validFrom);
chartsMap.put("endDate", validTo);
chartsMap.put("dateFormat", "dd MMMM yyyy");
@@ -181,7 +186,7 @@ public class RecurringDepositProductHelper {
}
private Map<String, String> getAccountMappingForCashBased() {
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
if (accountList != null) {
for (int i = 0; i < this.accountList.length; i++) {
if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) {
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.savings;
import java.util.HashMap;
@@ -31,7 +36,7 @@ public class AccountTransferHelper {
public String build(final String fromAccountId, final String fromClientId, final String toAccountId, final String toClientId,
final String fromAccountType, final String toAccountType, final String transferAmount) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", LOCALE);
map.put("fromClientId", fromClientId);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.savings;
import java.text.SimpleDateFormat;
@@ -5,6 +10,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
@@ -46,16 +52,21 @@ public class SavingsAccountHelper {
}
public static String getFutureDate() {
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat);
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.dateFormat, Locale.US);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 1);
return sdf.format(calendar.getTime());
}
public Integer applyForSavingsApplication(final Integer ID, final Integer savingsProductID, final String accountType) {
System.out.println("--------------------------------APPLYING FOR SAVINGS APPLICATION--------------------------------");
return applyForSavingsApplicationOnDate(ID, savingsProductID, accountType, CREATED_DATE);
}
public Integer applyForSavingsApplicationOnDate(final Integer ID, final Integer savingsProductID, final String accountType,
final String submittedOnDate) {
System.out.println("--------------------------------APPLYING FOR SAVINGS APPLICATION--------------------------------");
final String savingsApplicationJSON = new SavingsApplicationTestBuilder() //
.withSubmittedOnDate(CREATED_DATE) //
.withSubmittedOnDate(submittedOnDate) //
.build(ID.toString(), savingsProductID.toString(), accountType);
return Utils.performServerPost(this.requestSpec, this.responseSpec, SAVINGS_ACCOUNT_URL + "?" + Utils.TENANT_IDENTIFIER,
savingsApplicationJSON, "savingsId");
@@ -71,8 +82,15 @@ public class SavingsAccountHelper {
}
public HashMap approveSavings(final Integer savingsID) {
System.out.println("--------------------------------- APPROVING SAVINGS APPLICATION ------------------------------------");
return performSavingApplicationActions(createSavingsOperationURL(APPROVE_SAVINGS_COMMAND, savingsID), getApproveSavingsAsJSON());
return approveSavingsOnDate(savingsID, null);
}
public HashMap approveSavingsOnDate(final Integer savingsID, final String approvalDate) {
System.out.println("--------------------------------- APPROVING SAVINGS APPLICATION ------------------------------------");
final String savingsOperationURL = createSavingsOperationURL(APPROVE_SAVINGS_COMMAND, savingsID);
if(approvalDate == null || approvalDate == "")
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON());
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate));
}
public HashMap undoApproval(final Integer savingsID) {
@@ -104,9 +122,9 @@ public class SavingsAccountHelper {
return performSavingApplicationActions(createSavingsOperationURL(ACTIVATE_SAVINGS_COMMAND, savingsID), getActivatedSavingsAsJSON());
}
public HashMap closeSavingsAccount(final Integer savingsID) {
public HashMap closeSavingsAccount(final Integer savingsID, String withdrawBalance) {
System.out.println("---------------------------------- CLOSE SAVINGS APPLICATION ----------------------------------");
return performSavingApplicationActions(createSavingsOperationURL(CLOSE_SAVINGS_COMMAND, savingsID), getCloseAccountJSON());
return performSavingApplicationActions(createSavingsOperationURL(CLOSE_SAVINGS_COMMAND, savingsID), getCloseAccountJSON(withdrawBalance, LAST_TRANSACTION_DATE));
}
public Object deleteSavingsApplication(final Integer savingsId, final String jsonAttributeToGetBack) {
@@ -179,10 +197,14 @@ public class SavingsAccountHelper {
}
private String getApproveSavingsAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
return getApproveSavingsAsJsonOnDate(CREATED_DATE_PLUS_ONE);
}
private String getApproveSavingsAsJsonOnDate(final String approvalDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("approvedOnDate", CREATED_DATE_PLUS_ONE);
map.put("approvedOnDate", approvalDate);
map.put("note", "Approval NOTE");
String savingsAccountApproveJson = new Gson().toJson(map);
System.out.println(savingsAccountApproveJson);
@@ -190,7 +212,7 @@ public class SavingsAccountHelper {
}
private String getRejectedSavingsAsJSON(final String rejectedOnDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("rejectedOnDate", rejectedOnDate);
@@ -201,7 +223,7 @@ public class SavingsAccountHelper {
}
private String getWithdrawnSavingsAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("withdrawnOnDate", CREATED_DATE_PLUS_ONE);
@@ -212,7 +234,7 @@ public class SavingsAccountHelper {
}
private String getActivatedSavingsAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("activatedOnDate", TRANSACTION_DATE);
@@ -222,7 +244,7 @@ public class SavingsAccountHelper {
}
private String getSavingsTransactionJSON(final String amount, final String transactionDate) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("transactionDate", transactionDate);
@@ -233,14 +255,14 @@ public class SavingsAccountHelper {
}
private String getCalculatedInterestForSavingsApplicationAsJSON() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
String savingsAccountCalculatedInterestJson = new Gson().toJson(map);
System.out.println(savingsAccountCalculatedInterestJson);
return savingsAccountCalculatedInterestJson;
}
private String getSavingsPayChargeJSON(final String amount, final String dueDate) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("amount", amount);
@@ -250,7 +272,7 @@ public class SavingsAccountHelper {
}
private String getSavingsWaiveChargeJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
String josn = new Gson().toJson(map);
@@ -258,7 +280,7 @@ public class SavingsAccountHelper {
}
private String getModifyChargeJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("amount", "50");
@@ -266,11 +288,12 @@ public class SavingsAccountHelper {
return josn;
}
private String getCloseAccountJSON() {
final HashMap<String, Object> map = new HashMap<String, Object>();
private String getCloseAccountJSON(String withdrawBalance, String closedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("closedOnDate", LAST_TRANSACTION_DATE);
map.put("closedOnDate", closedOnDate);
map.put("withdrawBalance", withdrawBalance);
map.put("note", "Close Test");
String josn = new Gson().toJson(map);
return josn;
@@ -329,6 +352,12 @@ public class SavingsAccountHelper {
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "summary");
return response;
}
public HashMap getSavingsDetails(final Integer savingsID) {
final String URL = SAVINGS_ACCOUNT_URL + "/" + savingsID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "");
return response;
}
private HashMap performSavingApplicationActions(final String postURLForSavingsTransaction, final String jsonToBeSent) {
HashMap status = null;
@@ -346,8 +375,15 @@ public class SavingsAccountHelper {
jsonAttributeToGetBack);
}
public Object closeSavingsAccountAndGetBackRequiredField(final Integer savingsID, String withdrawBalance,
final String jsonAttributeToGetBack, final String closedOnDate) {
System.out.println("---------------------------------- CLOSE SAVINGS APPLICATION ----------------------------------");
return performSavingActions(createSavingsOperationURL(CLOSE_SAVINGS_COMMAND, savingsID),
getCloseAccountJSON(withdrawBalance, closedOnDate), jsonAttributeToGetBack);
}
private String getPeriodChargeRequestJSON(Integer chargeId) {
final HashMap<String, Object> map = new HashMap<String, Object>();
final HashMap<String, Object> map = new HashMap<>();
map.put("chargeId", chargeId);
map.put("amount", 100);
map.put("feeOnMonthDay", "15 January");
@@ -358,4 +394,31 @@ public class SavingsAccountHelper {
String json = new Gson().toJson(map);
return json;
}
private String getAccountActivationJSON(final String activationDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("activatedOnDate", activationDate);
String savingsAccountActivateJson = new Gson().toJson(map);
return savingsAccountActivateJson;
}
public HashMap activateSavingsAccount(Integer savingsID, String activationDate) {
return performSavingApplicationActions(createSavingsOperationURL(ACTIVATE_SAVINGS_COMMAND, savingsID),
getAccountActivationJSON(activationDate));
}
public Object inactivateCharge(final Integer chargeId, final Integer savingsId, final String jsonAttributeToGetBack) {
return performSavingActions(createChargesURL("inactivate", savingsId, chargeId), getSavingsInactivateChargeJSON(),
jsonAttributeToGetBack);
}
private String getSavingsInactivateChargeJSON() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
String josn = new Gson().toJson(map);
return josn;
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.savings;
import java.util.HashMap;
@@ -12,7 +17,7 @@ public class SavingsApplicationTestBuilder {
public String build(final String ID, final String savingsProductId, final String accountType) {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
if (accountType == "GROUP") {
map.put("groupId", ID);
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.savings;
import static org.junit.Assert.assertEquals;
@@ -63,9 +68,14 @@ public class SavingsProductHelper {
private final String currencyCode = USD;
private final String interestCalculationDaysInYearType = DAYS_365;
private Account[] accountList = null;
private String minBalanceForInterestCalculation = null;
private String allowOverdraft = "false";
private String overdraftLimit = null;
private String minRequiredBalance = null;
private String enforceMinRequiredBalance = "false";
public String build() {
final HashMap<String, String> map = new HashMap<String, String>();
final HashMap<String, String> map = new HashMap<>();
map.put("name", this.nameOfSavingsProduct);
map.put("shortName", this.shortName);
@@ -93,6 +103,11 @@ public class SavingsProductHelper {
map.put("lockinPeriodFrequency", this.lockinPeriodFrequency);
map.put("lockinPeriodFrequencyType", this.lockingPeriodFrequencyType);
map.put("withdrawalFeeForTransfers", this.withdrawalFeeForTransfers);
map.put("minBalanceForInterestCalculation", minBalanceForInterestCalculation);
map.put("allowOverdraft", this.allowOverdraft);
map.put("overdraftLimit", this.overdraftLimit);
map.put("minRequiredBalance", this.minRequiredBalance);
map.put("enforceMinRequiredBalance", this.enforceMinRequiredBalance);
if (this.accountingRule.equals(CASH_BASED)) {
map.putAll(getAccountMappingForCashBased());
@@ -126,6 +141,11 @@ public class SavingsProductHelper {
this.interestPostingPeriodType = MONTHLY;
return this;
}
public SavingsProductHelper withMinBalanceForInterestCalculation(final String amount) {
this.minBalanceForInterestCalculation = amount;
return this;
}
public SavingsProductHelper withInterestPostingPeriodTypeAsQuarterly() {
this.interestPostingPeriodType = QUARTERLY;
@@ -157,9 +177,25 @@ public class SavingsProductHelper {
this.accountList = account_list;
return this;
}
public SavingsProductHelper withMinRequiredBalance(String minBalance) {
this.minRequiredBalance = minBalance;
return this;
}
public SavingsProductHelper withEnforceMinRequiredBalance(String enforceMinRequiredBalance) {
this.enforceMinRequiredBalance = enforceMinRequiredBalance;
return this;
}
public SavingsProductHelper withOverDraft(final String overDraftLimit) {
this.allowOverdraft = "true";
this.overdraftLimit = overDraftLimit;
return this;
}
private Map<String, String> getAccountMappingForCashBased() {
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
if (accountList != null) {
for (int i = 0; i < this.accountList.length; i++) {
if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) {
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.savings;
import static org.junit.Assert.assertTrue;
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.system;
import static com.jayway.restassured.RestAssured.given;
@@ -13,151 +18,132 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class CodeHelper {
public static final String CODE_ID_ATTRIBUTE_NAME = "id";
public static final String RESPONSE_ID_ATTRIBUTE_NAME = "resourceId";
public static final String SUBRESPONSE_ID_ATTRIBUTE_NAME = "subResourceId";
public static final String CODE_NAME_ATTRIBUTE_NAME = "name";
public static final String CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME = "systemDefined";
public static final String CODE_URL = "/mifosng-provider/api/v1/codes";
public static final String CODE_ID_ATTRIBUTE_NAME = "id";
public static final String RESPONSE_ID_ATTRIBUTE_NAME = "resourceId";
public static final String SUBRESPONSE_ID_ATTRIBUTE_NAME = "subResourceId";
public static final String CODE_NAME_ATTRIBUTE_NAME = "name";
public static final String CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME = "systemDefined";
public static final String CODE_URL = "/mifosng-provider/api/v1/codes";
public static final String CODE_VALUE_ID_ATTRIBUTE_NAME = "id";
public static final String CODE_VALUE_NAME_ATTRIBUTE_NAME = "name";
public static final String CODE_VALUE_POSITION_ATTRIBUTE_NAME = "position";
public static final String CODE_VALUE_URL = "/mifosng-provider/api/v1/codes/[codeId]/codevalues";
public static final String CODE_VALUE_ID_ATTRIBUTE_NAME = "id";
public static final String CODE_VALUE_NAME_ATTRIBUTE_NAME = "name";
public static final String CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME = "description";
public static final String CODE_VALUE_POSITION_ATTRIBUTE_NAME = "position";
public static final String CODE_VALUE_URL = "/mifosng-provider/api/v1/codes/[codeId]/codevalues";
public static Object createCode(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String codeName,
final String jsonAttributeToGetback) {
public static Object createCode(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String codeName, final String jsonAttributeToGetback) {
return Utils.performServerPost(requestSpec, responseSpec, CODE_URL
+ "?" + Utils.TENANT_IDENTIFIER, getTestCodeAsJSON(codeName),
jsonAttributeToGetback);
}
return Utils.performServerPost(requestSpec, responseSpec, CODE_URL + "?" + Utils.TENANT_IDENTIFIER, getTestCodeAsJSON(codeName),
jsonAttributeToGetback);
}
public static Object updateCode(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final String codeName, final String jsonAttributeToGetback) {
public static Object updateCode(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer codeId,
final String codeName, final String jsonAttributeToGetback) {
return Utils.performServerPut(requestSpec, responseSpec, CODE_URL + "/"
+ codeId + "?" + Utils.TENANT_IDENTIFIER,
getTestCodeAsJSON(codeName), jsonAttributeToGetback);
}
return Utils.performServerPut(requestSpec, responseSpec, CODE_URL + "/" + codeId + "?" + Utils.TENANT_IDENTIFIER,
getTestCodeAsJSON(codeName), jsonAttributeToGetback);
}
public static Object getCodeById(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final String jsonAttributeToGetback) {
public static Object getCodeById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final String jsonAttributeToGetback) {
return Utils.performServerGet(requestSpec, responseSpec, CODE_URL + "/"
+ codeId + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
return Utils.performServerGet(requestSpec, responseSpec, CODE_URL + "/" + codeId + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
}
}
public static Object getAllCodes(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static Object getAllCodes(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec, CODE_URL + "?"
+ Utils.TENANT_IDENTIFIER, "");
return Utils.performServerGet(requestSpec, responseSpec, CODE_URL + "?" + Utils.TENANT_IDENTIFIER, "");
}
}
public static Object getSystemDefinedCodes(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
public static Object getSystemDefinedCodes(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String getResponse = given().spec(requestSpec).expect()
.spec(responseSpec).when()
.get(CodeHelper.CODE_URL + "?" + Utils.TENANT_IDENTIFIER)
.asString();
final String getResponse = given().spec(requestSpec).expect().spec(responseSpec).when()
.get(CodeHelper.CODE_URL + "?" + Utils.TENANT_IDENTIFIER).asString();
final JsonPath getResponseJsonPath = new JsonPath(getResponse);
final JsonPath getResponseJsonPath = new JsonPath(getResponse);
// get any systemDefined code
return getResponseJsonPath.get("find { e -> e.systemDefined == true }");
// get any systemDefined code
return getResponseJsonPath.get("find { e -> e.systemDefined == true }");
}
}
public static String getTestCodeAsJSON(final String codeName) {
final HashMap<String, String> map = new HashMap<String, String>();
map.put(CODE_NAME_ATTRIBUTE_NAME, codeName);
return new Gson().toJson(map);
}
public static String getTestCodeAsJSON(final String codeName) {
final HashMap<String, String> map = new HashMap<>();
map.put(CODE_NAME_ATTRIBUTE_NAME, codeName);
return new Gson().toJson(map);
}
public static String getTestCodeValueAsJSON(final String codeValueName,
final Integer position) {
final HashMap<String, Object> map = new HashMap<String, Object>();
map.put(CODE_VALUE_NAME_ATTRIBUTE_NAME, codeValueName);
map.put(CODE_VALUE_POSITION_ATTRIBUTE_NAME, position);
return new Gson().toJson(map);
}
public static String getTestCodeValueAsJSON(final String codeValueName, final String description, final Integer position) {
final HashMap<String, Object> map = new HashMap<>();
map.put(CODE_VALUE_NAME_ATTRIBUTE_NAME, codeValueName);
if (description != null) {
map.put(CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME, description);
}
map.put(CODE_VALUE_POSITION_ATTRIBUTE_NAME, position);
return new Gson().toJson(map);
}
public static Object deleteCodeById(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final String jsonAttributeToGetback) {
public static Object deleteCodeById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final String jsonAttributeToGetback) {
return Utils.performServerDelete(requestSpec, responseSpec, CODE_URL
+ "/" + codeId + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
return Utils.performServerDelete(requestSpec, responseSpec, CODE_URL + "/" + codeId + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
}
}
public static Object createCodeValue(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final String codeValueName, final Integer position,
final String jsonAttributeToGetback) {
public static Object createCodeValue(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final String codeValueName, final Integer position, final String jsonAttributeToGetback) {
String description = null;
return createCodeValue(requestSpec, responseSpec, codeId, codeValueName, description, position, jsonAttributeToGetback);
}
return Utils.performServerPost(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ Utils.TENANT_IDENTIFIER,
getTestCodeValueAsJSON(codeValueName, position),
jsonAttributeToGetback);
}
public static Object createCodeValue(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final String codeValueName, final String description, final Integer position,
final String jsonAttributeToGetback) {
public static Object getCodeValuesForCode(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final String jsonAttributeToGetback) {
return Utils.performServerPost(requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ Utils.TENANT_IDENTIFIER, getTestCodeValueAsJSON(codeValueName, description, position), jsonAttributeToGetback);
}
return Utils.performServerGet(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ Utils.TENANT_IDENTIFIER, jsonAttributeToGetback);
}
public static Object getCodeValuesForCode(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final String jsonAttributeToGetback) {
public static Object getCodeValueById(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final Integer codeValueId, final String jsonAttributeToGetback) {
return Utils.performServerGet(requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ Utils.TENANT_IDENTIFIER, jsonAttributeToGetback);
}
return Utils.performServerGet(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId.toString() + "?"
+ Utils.TENANT_IDENTIFIER, jsonAttributeToGetback);
}
public static Object getCodeValueById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final Integer codeValueId, final String jsonAttributeToGetback) {
public static Object deleteCodeValueById(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final Integer codeValueId, final String jsonAttributeToGetback) {
return Utils.performServerGet(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/" + codeValueId.toString() + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
}
return Utils.performServerDelete(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId.toString() + "?"
+ Utils.TENANT_IDENTIFIER, jsonAttributeToGetback);
}
public static Object deleteCodeValueById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final Integer codeValueId, final String jsonAttributeToGetback) {
public static Object updateCodeValue(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final Integer codeValueId, final String codeValueName,
final Integer position, final String jsonAttributeToGetback) {
return Utils.performServerDelete(requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId.toString() + "?" + Utils.TENANT_IDENTIFIER, jsonAttributeToGetback);
}
return Utils.performServerPut(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId + "?" + Utils.TENANT_IDENTIFIER,
getTestCodeValueAsJSON(codeValueName, position),
jsonAttributeToGetback);
}
public static Object updateCodeValue(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final Integer codeValueId, final String codeValueName, final Integer position,
final String jsonAttributeToGetback) {
String description = null;
return updateCodeValue(requestSpec, responseSpec, codeId, codeValueId, codeValueName, description, position, jsonAttributeToGetback);
}
public static Object updateCodeValue(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final Integer codeValueId, final String codeValueName, final String description, final Integer position,
final String jsonAttributeToGetback) {
return Utils.performServerPut(requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/" + codeValueId
+ "?" + Utils.TENANT_IDENTIFIER, getTestCodeValueAsJSON(codeValueName, description, position), jsonAttributeToGetback);
}
}
@@ -1,3 +1,8 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.integrationtests.common.xbrl;
import java.util.ArrayList;
@@ -14,8 +19,8 @@ public class XBRLIntegrationTestHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String GET_TAXONOMY_LIST_URL = "/mifosng-provider/api/v1/mixtaxonomy?tenantIdentifier=default";
private static final String TAXONOMY_MAPPING_URL = "/mifosng-provider/api/v1/mixmapping?tenantIdentifier=default";
private static final String GET_TAXONOMY_LIST_URL = "/mifosng-provider/api/v1/mixtaxonomy?" + Utils.TENANT_IDENTIFIER;
private static final String TAXONOMY_MAPPING_URL = "/mifosng-provider/api/v1/mixmapping?" + Utils.TENANT_IDENTIFIER;
public XBRLIntegrationTestHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
@@ -0,0 +1,43 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform;
import org.mifosplatform.infrastructure.core.boot.AbstractApplicationConfiguration;
import org.mifosplatform.infrastructure.core.boot.ApplicationExitUtil;
import org.mifosplatform.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration;
import org.mifosplatform.infrastructure.core.boot.db.DataSourceConfiguration;
import org.mifosplatform.infrastructure.core.boot.db.DataSourceProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
/**
* Mifos main() application which launches Mifos X in an embedded Tomcat HTTP
* (using Spring Boot).
*
* The DataSource used is a to a "normal" external database (not use MariaDB4j).
* This DataSource can be configured with parameters, see {@link DataSourceProperties}.
*
* You can easily launch this via Debug as Java Application in your IDE -
* without needing command line Gradle stuff, no need to build and deploy a WAR,
* remote attachment etc.
*
* It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Mifos X! ;-)
*
* @see DataSourceProperties about how to configure the DataSource used
* @see ServerWithMariaDB4jApplication for an alternative with an embedded DB
*/
public class ServerApplication {
@Import({ DataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
private static class Configuration extends AbstractApplicationConfiguration { }
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
}
}
@@ -0,0 +1,39 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform;
import org.mifosplatform.infrastructure.core.boot.AbstractApplicationConfiguration;
import org.mifosplatform.infrastructure.core.boot.ApplicationExitUtil;
import org.mifosplatform.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration;
import org.mifosplatform.infrastructure.core.boot.db.MariaDB4jDataSourceConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
/**
* Mifos main() application which launches Mifos X in an embedded Tomcat HTTP
* server (using Spring Boot), as well as an embedded database (using
* MariaDB4j).
*
* You can easily launch this via Debug as Java Application in your IDE -
* without needing command line Gradle stuff, no need to build and deploy a WAR,
* remote attachment etc.
*
* It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Mifos X! ;-)
*
* @see ServerApplication for the same without the embedded MariaDB4j database
*/
public class ServerWithMariaDB4jApplication {
@Import({ MariaDB4jDataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
public static class Configuration extends AbstractApplicationConfiguration { }
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
}
}
@@ -1,47 +0,0 @@
package org.mifosplatform.accounting.accountmapping.data;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.mifosplatform.accounting.glaccount.data.GLAccountData;
import org.mifosplatform.organisation.office.data.OfficeData;
public class OfficeToGLAccountMappingData {
private final Long id;
private final OfficeData officeData;
private final GLAccountData glAccountData;
private final Map<String, List<GLAccountData>> accountingMappingOptions;
private final Collection<OfficeData> officeOptions;
public static OfficeToGLAccountMappingData instance(final Long id, final OfficeData officeData, final GLAccountData glAccountData) {
final Map<String, List<GLAccountData>> accountingMappingOptions = null;
final Collection<OfficeData> officeOptions = null;
return new OfficeToGLAccountMappingData(id, officeData, glAccountData, accountingMappingOptions, officeOptions);
}
public static OfficeToGLAccountMappingData template(final Map<String, List<GLAccountData>> accountingMappingOptions,
final Collection<OfficeData> officeOptions) {
final Long id = null;
final OfficeData officeData = null;
final GLAccountData glAccountData = null;
return new OfficeToGLAccountMappingData(id, officeData, glAccountData, accountingMappingOptions, officeOptions);
}
public static OfficeToGLAccountMappingData associateTemplateData(final OfficeToGLAccountMappingData templateData,
final OfficeToGLAccountMappingData accountMappingData) {
return new OfficeToGLAccountMappingData(accountMappingData.id, accountMappingData.officeData, accountMappingData.glAccountData,
templateData.accountingMappingOptions, templateData.officeOptions);
}
private OfficeToGLAccountMappingData(final Long id, final OfficeData officeData, final GLAccountData glAccountData,
final Map<String, List<GLAccountData>> accountingMappingOptions, final Collection<OfficeData> officeOptions) {
this.id = id;
this.officeData = officeData;
this.glAccountData = glAccountData;
this.accountingMappingOptions = accountingMappingOptions;
this.officeOptions = officeOptions;
}
}
@@ -1,69 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.mifosplatform.accounting.glaccount.domain.GLAccount;
import org.mifosplatform.organisation.office.domain.Office;
import org.springframework.data.jpa.domain.AbstractPersistable;
@Entity
@Table(name = "acc_gl_office_mapping")
public class OfficeToGLAccountMapping extends AbstractPersistable<Long> {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "gl_account_id")
private GLAccount glAccount;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "office_id")
private Office office;
@Column(name = "financial_account_type", nullable = false)
private int financialAccountType;
public static OfficeToGLAccountMapping createNew(final GLAccount glAccount, final Office office, final int financialAccountType) {
return new OfficeToGLAccountMapping(glAccount, office, financialAccountType);
}
protected OfficeToGLAccountMapping() {
//
}
private OfficeToGLAccountMapping(final GLAccount glAccount, final Office office, final int financialAccountType) {
this.glAccount = glAccount;
this.office = office;
this.financialAccountType = financialAccountType;
}
public GLAccount glAccount() {
return this.glAccount;
}
public void updateGlAccount(final GLAccount glAccount) {
this.glAccount = glAccount;
}
public Office office() {
return this.office;
}
public void updateOffice(Office office) {
this.office = office;
}
public int getFinancialAccountType() {
return this.financialAccountType;
}
}
@@ -1,23 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.domain;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface OfficeToGLAccountMappingRepository extends JpaRepository<OfficeToGLAccountMapping, Long>,
JpaSpecificationExecutor<OfficeToGLAccountMapping> {
@Query("from OfficeToGLAccountMapping otga where otga.office.id = :officeId and otga.financialAccountType = :financialAccountType")
OfficeToGLAccountMapping findByOfficeAndFinancialAccountType(@Param("officeId")Long officeId,@Param("financialAccountType") int financialAccountType);
@Query("from OfficeToGLAccountMapping otga where otga.office.id =:officeId")
List<OfficeToGLAccountMapping> findByOffice(@Param("officeId")Long officeId);
}
@@ -1,55 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.domain;
import java.util.List;
import org.mifosplatform.accounting.accountmapping.exception.OfficeToGLAccountMappingNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* Wrapper for {@link OfficeToGLAccountMappingRepository} that adds NULL
* checking and Error handling capabilities
* </p>
*/
@Service
public class OfficeToGLAccountMappingRepositoryWrapper {
private final OfficeToGLAccountMappingRepository repository;
@Autowired
public OfficeToGLAccountMappingRepositoryWrapper(final OfficeToGLAccountMappingRepository repository) {
this.repository = repository;
}
public OfficeToGLAccountMapping findOneWithNotFoundDetection(final Long id) {
final OfficeToGLAccountMapping officeToGLAccountMapping = this.repository.findOne(id);
if (officeToGLAccountMapping == null) { throw new OfficeToGLAccountMappingNotFoundException(id); }
return officeToGLAccountMapping;
}
public OfficeToGLAccountMapping findByOfficeAndFinancialAccountType(final Long officeId, final int financialAccountType) {
return this.repository.findByOfficeAndFinancialAccountType(officeId, financialAccountType);
}
public List<OfficeToGLAccountMapping> findByOffice(final Long officeId) {
return this.repository.findByOffice(officeId);
}
public void save(final OfficeToGLAccountMapping entity) {
this.repository.save(entity);
}
public void saveAndFlush(final OfficeToGLAccountMapping entity) {
this.repository.saveAndFlush(entity);
}
public void delete(final OfficeToGLAccountMapping entity) {
this.repository.delete(entity);
}
}
@@ -1,21 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.exception;
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not
* found.
*/
public class DuplicateOfficeToGLAccountMappingFoundException extends AbstractPlatformDomainRuleException {
public DuplicateOfficeToGLAccountMappingFoundException(final Long officeId, final Integer accountType) {
super("error.msg.officeToAccountMapping.exists.for.office", "Mapping for office with Id " + officeId
+ " exist for an account of type " + accountType, officeId, accountType);
}
}
@@ -1,19 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.exception;
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when Calendar resources are not found.
*/
public class MappingUpdateNotSupportedException extends AbstractPlatformDomainRuleException {
public MappingUpdateNotSupportedException(final String postFix, final String defaultUserMessage,
final Object... defaultUserMessageArgs) {
super("error.msg.officeToAccountMapping.update.of." + postFix + ".is.not.supported", defaultUserMessage, defaultUserMessageArgs);
}
}
@@ -1,24 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.exception;
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not
* found.
*/
public class OfficeToGLAccountMappingNotFoundException extends AbstractPlatformResourceNotFoundException {
public OfficeToGLAccountMappingNotFoundException(final Long officeId, final String accountType) {
super("error.msg.officeToAccountMapping.not.found", "Mapping for office with Id " + officeId
+ " does not exist for an account of type " + accountType, officeId, accountType);
}
public OfficeToGLAccountMappingNotFoundException(final Long id) {
super("error.msg.officeToAccountMapping.not.found", "Mapping for GL Account with Id " + id + " does not exist", id);
}
}
@@ -1,98 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.serialization;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.mifosplatform.accounting.common.AccountingConstants.ORGANIZATION_ACCOUNTING_PARAMS;
import org.mifosplatform.infrastructure.core.data.ApiParameterError;
import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
@Component
public final class OfficeToGLAccountMappingDataValidator {
/**
* The parameters supported for this command.
*/
private final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("locale",
ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), "officeId"));
private final FromJsonHelper fromApiJsonHelper;
@Autowired
public OfficeToGLAccountMappingDataValidator(final FromJsonHelper fromApiJsonHelper) {
this.fromApiJsonHelper = fromApiJsonHelper;
}
public void validateForCreate(final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct");
final JsonElement element = this.fromApiJsonHelper.parse(json);
final Long liabilityTransferInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), element);
baseDataValidator.reset().parameter(ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue())
.value(liabilityTransferInSuspenseAccountId).notNull().integerGreaterThanZero();
final Long officeID = this.fromApiJsonHelper.extractLongNamed("officeId", element);
baseDataValidator.reset().parameter("officeId").value(officeID).notNull().integerGreaterThanZero();
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
public void validateForUpdate(final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct");
final JsonElement element = this.fromApiJsonHelper.parse(json);
if (this.fromApiJsonHelper.parameterExists(ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), element)) {
final Long liabilityTransferInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue(), element);
baseDataValidator.reset().parameter(ORGANIZATION_ACCOUNTING_PARAMS.LIABILITY_TRANSFER_SUSPENSE.getValue())
.value(liabilityTransferInSuspenseAccountId).notNull().integerGreaterThanZero();
}
if (this.fromApiJsonHelper.parameterExists("officeId", element)) {
final Long officeID = this.fromApiJsonHelper.extractLongNamed("officeId", element);
baseDataValidator.reset().parameter("officeId").value(officeID).notNull().integerGreaterThanZero();
}
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
"Validation errors exist.", dataValidationErrors); }
}
}
@@ -1,21 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.accounting.accountmapping.service;
import org.mifosplatform.accounting.accountmapping.data.OfficeToGLAccountMappingData;
import org.mifosplatform.infrastructure.core.service.Page;
import org.mifosplatform.portfolio.group.service.SearchParameters;
public interface OfficeToGLAccountMappingReadPlatformService {
Page<OfficeToGLAccountMappingData> retrieveAll(final SearchParameters searchParameters);
OfficeToGLAccountMappingData retrieve(Long mappingId);
OfficeToGLAccountMappingData retrieveTemplate();
}
@@ -1,136 +0,0 @@
package org.mifosplatform.accounting.accountmapping.service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.joda.time.LocalDate;
import org.mifosplatform.accounting.accountmapping.data.OfficeToGLAccountMappingData;
import org.mifosplatform.accounting.accountmapping.exception.OfficeToGLAccountMappingNotFoundException;
import org.mifosplatform.accounting.common.AccountingDropdownReadPlatformService;
import org.mifosplatform.accounting.glaccount.data.GLAccountData;
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
import org.mifosplatform.infrastructure.core.service.Page;
import org.mifosplatform.infrastructure.core.service.PaginationHelper;
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
import org.mifosplatform.organisation.office.data.OfficeData;
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
import org.mifosplatform.portfolio.group.service.SearchParameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
@Service
public class OfficeToGLAccountMappingReadPlatformServiceImpl implements OfficeToGLAccountMappingReadPlatformService {
private final JdbcTemplate jdbcTemplate;
private final OfficeToGLAccountMappingMapper accountMappingMapper;
private final PaginationHelper<OfficeToGLAccountMappingData> paginationHelper = new PaginationHelper<OfficeToGLAccountMappingData>();
private final OfficeReadPlatformService officeReadPlatformService;
private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService;
@Autowired
public OfficeToGLAccountMappingReadPlatformServiceImpl(final RoutingDataSource dataSource,
final OfficeReadPlatformService officeReadPlatformService,
final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) {
accountMappingMapper = new OfficeToGLAccountMappingMapper();
this.jdbcTemplate = new JdbcTemplate(dataSource);
this.officeReadPlatformService = officeReadPlatformService;
this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService;
}
@Override
public Page<OfficeToGLAccountMappingData> retrieveAll(final SearchParameters searchParameters) {
StringBuilder sqlBuilder = new StringBuilder(300);
sqlBuilder.append("select SQL_CALC_FOUND_ROWS ");
sqlBuilder.append(this.accountMappingMapper.schema());
Object[] finalObjectArray = {};
if (searchParameters.isOrderByRequested()) {
sqlBuilder.append(" order by ").append(searchParameters.getOrderBy());
if (searchParameters.isSortOrderProvided()) {
sqlBuilder.append(' ').append(searchParameters.getSortOrder());
}
}
if (searchParameters.isLimited()) {
sqlBuilder.append(" limit ").append(searchParameters.getLimit());
if (searchParameters.isOffset()) {
sqlBuilder.append(" offset ").append(searchParameters.getOffset());
}
}
final String sqlCountRows = "SELECT FOUND_ROWS()";
return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), finalObjectArray,
this.accountMappingMapper);
}
@Override
public OfficeToGLAccountMappingData retrieve(Long mappingId) {
try {
StringBuilder sqlBuilder = new StringBuilder(200);
sqlBuilder.append("select ");
sqlBuilder.append(this.accountMappingMapper.schema());
sqlBuilder.append(" where om.id=?");
return this.jdbcTemplate.queryForObject(sqlBuilder.toString(), this.accountMappingMapper, new Object[] { mappingId });
} catch (final EmptyResultDataAccessException e) {
throw new OfficeToGLAccountMappingNotFoundException(mappingId);
}
}
@Override
public OfficeToGLAccountMappingData retrieveTemplate() {
Collection<OfficeData> officeOptions = this.officeReadPlatformService.retrieveAllOfficesForDropdown();
final Map<String, List<GLAccountData>> accountOptions = this.accountingDropdownReadPlatformService.retrieveAccountMappingOptions();
return OfficeToGLAccountMappingData.template(accountOptions, officeOptions);
}
private static final class OfficeToGLAccountMappingMapper implements RowMapper<OfficeToGLAccountMappingData> {
private final String sql;
public OfficeToGLAccountMappingMapper() {
StringBuilder sb = new StringBuilder(300);
sb.append("om.id , office.id as officeId, office.name as officeName, ");
sb.append(" glaccount.id as glAccountId,glaccount.name as glAccountName,glaccount.gl_code as glCode ");
sb.append(" from acc_gl_office_mapping om ");
sb.append("inner join m_office office on office.id = om.office_id ");
sb.append("inner join acc_gl_account glaccount on glaccount.id = om.gl_account_id");
sql = sb.toString();
}
public String schema() {
return sql;
}
@Override
public OfficeToGLAccountMappingData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
final Long id = JdbcSupport.getLong(rs, "id");
final Long officeId = JdbcSupport.getLong(rs, "officeId");
final String officeName = rs.getString("officeName");
final String nameDecorated = null;
final String externalId = null;
final LocalDate openingDate = null;
final String hierarchy = null;
final Long parentId = null;
final String parentName = null;
final Collection<OfficeData> allowedParents = null;
final OfficeData officeData = new OfficeData(officeId, officeName, nameDecorated, externalId, openingDate, hierarchy, parentId,
parentName, allowedParents);
final Long glAccountId = JdbcSupport.getLong(rs, "glAccountId");
final String glAccountName = rs.getString("glAccountName");
final String glCode = rs.getString("glCode");
final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode);
final OfficeToGLAccountMappingData accountMappingData = OfficeToGLAccountMappingData.instance(id, officeData, gLAccountData);
return accountMappingData;
}
}
}

Some files were not shown because too many files have changed in this diff Show More