Compare commits

...
500 Commits
Author SHA1 Message Date
Vishwas Babu A J 9cf159e77c Merge pull request #1466 from rajuan/MIFOSX-2153
MIFOSX-2153:Added support to use seperate DB server instance for reports
2015-08-24 17:40:25 +05:30
Vishwas Babu A J 2587c65b26 Merge pull request #1394 from sachinkulkarni12/futureschedule
MIFOSX-2025:Unable to access loan account page/loan page does not load after a multi-disbursal loan is disbursed
2015-08-24 17:33:25 +05:30
Vishwas Babu A J 2273c8ba65 Merge pull request #1430 from venkatconflux/MIFOSX-2085
MIFOSX-2085:scond repayment computing more interest resolved
2015-08-24 17:30:25 +05:30
Vishwas Babu A J 4842f3d80b Merge pull request #1441 from venkatconflux/MIFOSX-2118
MIFOSX-2118 : Resolved Second Specific Due Date Charges not collecting in RBI Strategy
2015-08-24 17:30:03 +05:30
Vishwas Babu A J f7c0a833cb MIFOSX-583 wip 2015-08-21 04:39:49 +05:30
Adi Raju cef018a990 MIFOSX-2153:Added support to use seperate DB server instance for reports 2015-08-20 15:19:23 +05:30
Vishwas Babu A J da514b8856 Merge pull request #1465 from rajuan/MIFOSX-2158
MIFOSX-2158:Changed how CommandType annotations are retrieved.
2015-08-20 14:14:33 +05:30
Adi Raju 69f9538905 MIFOSX-2158:Changed how CommandType annotations are retrieved. Reverted changes done for issues MIFOSX-2131. Added mozilla license text for missing files. 2015-08-20 11:32:37 +05:30
Vishwas Babu A J 340aa20120 client fees : adding client transaction api's 2015-08-20 01:45:20 +05:30
Vishwas Babu A J b6626b0b83 wip:changes for client fees 2015-08-20 01:45:15 +05:30
Vishwas Babu A J d0fd3e4a6c changes for client fees 2015-08-20 01:45:11 +05:30
Vishwas Babu A J 89aab6b93d Merge pull request #1461 from rajuan/MIFOSX2156
Fix import
2015-08-19 15:41:50 +05:30
Adi Raju 5a9f0f9941 Fix import 2015-08-19 15:34:36 +05:30
Vishwas Babu A J fdf31abd22 Merge pull request #1460 from rajuan/MIFOSX2156
MIFOSX-2156:Fixed integration test failure
2015-08-19 13:49:39 +05:30
Adi Raju 7347012bfa MIFOSX-2156:Fixed integration test failure 2015-08-19 13:13:55 +05:30
Vishwas Babu A J 34e85b2c89 Merge pull request #1459 from shahrahul1985/MIFOSX-2154
MIFOSX-2154: Fix the integration test for ExternalServicesConfigurati…
2015-08-19 13:04:55 +05:30
shahrahul1985 aa214aea92 MIFOSX-2154: Fix the integration test for ExternalServicesConfigurationTest 2015-08-19 11:29:37 +05:30
Vishwas Babu A J 7ccb57eab9 Merge pull request #1458 from pramodn02/performanceissues
MIFOSX-2152 : corrected transaction scope
2015-08-18 14:57:46 +05:30
pramod 8902d2a5cb MIFOSX-2152 : corrected transaction scope 2015-08-18 12:30:35 +05:30
Vishwas Babu A J b4b7555bc1 Merge pull request #1457 from shahrahul1985/MIFOSX-2135
MIFOSX-2135: Fixing the sql file
2015-08-17 21:03:21 +05:30
shahrahul1985 68bb26bd58 MIFOSX-2135: Fixing the sql file 2015-08-17 20:59:18 +05:30
Vishwas Babu A J e2ddedd531 Merge pull request #1452 from shahrahul1985/MIFOSX-2103
MIFOSX-2103:Manage employees display is not working as expected
2015-08-17 17:47:23 +05:30
Vishwas Babu A J 5536342093 Merge pull request #1451 from shahrahul1985/MIFOSX-2135
Mifosx 2135
2015-08-17 17:46:45 +05:30
Vishwas Babu A J f8fa861909 applying licence plugin 2015-08-17 17:44:21 +05:30
Vishwas Babu A J fda49b0794 Merge pull request #1455 from pramodn02/performanceissues
MIFOSX-2151 : corrected transaction scope
2015-08-17 17:40:33 +05:30
pramod 222b943bfd MIFOSX-2151 : corrected transaction scope 2015-08-17 16:57:47 +05:30
pramod e751e1f682 ignoring failing test cases 2015-08-17 13:29:55 +05:30
pramod fce8f73b83 Merge branch 'peter1' into develop 2015-08-17 13:28:15 +05:30
pramod 95c43200d6 cleaning up MIFOSX-1765 2015-08-17 13:27:22 +05:30
Peter Naftaliev dc672153ac Finished fixing group loan date change and rechduling date issues. Bug: MIFOSX-1765 2015-08-14 20:44:04 +03:00
shahrahul1985 72495da5b9 MIFOSX-2103:Manage employees display is not working as expected 2015-08-14 12:44:27 +05:30
shahrahul1985 e4f260bd69 MIFOSX-2135: Create new endpoints and the User interface for managing credentials to external services. 2015-08-14 12:27:22 +05:30
Vishwas Babu A J fb8eb4a977 Merge pull request #1448 from vorburger/UGDTemplateArraySupport_squashed
MIFOSX-2144: TemplateMergeService expandMapArrays + passing @Test arrayUsingLoop
2015-08-12 06:20:07 -07:00
Michael Vorburger da59a50299 MIFOS-2144 TemplateMergeService expandMapArrays + @Test arrayUsingIndex
TemplateMergeService clean up, incl. proper logging
TemplateMergeServiceTest fixed up, incl. fix compileLoanSummary() now()
TemplateMergeServiceTest arrayUsingLoop
TemplateMergeServiceTest simplified
Gradle License check exclude **/*.html for src/test/resources/template-expected.html
2015-08-08 10:52:44 +05:30
Vishwas Babu A J d05f8d8092 Merge branch 'master' into develop 2015-08-06 14:01:53 -07:00
Vishwas Babu A J 9947563078 fix for MIFOSX-2131 2015-08-06 13:32:16 -07:00
Vishwas Babu A J e201f37191 updating documentation for MIFOSX-2122 2015-07-31 19:53:06 -07:00
Vishwas Babu A J 28d359653e cleaning up formatting diffs for MIFOSX-2129 2015-07-31 19:23:06 -07:00
Vishwas Babu A J 9aae2aad3d Merge pull request #1447 from sachinkulkarni12/MIFOSX-2129
MIFOSX-2129:Submitting Collection sheet for zero repayments create an entry in Loan trasaction page
2015-07-31 19:22:07 -07:00
sachinkulkarni12 3757e2b689 MIFOSX-2129:Submitting Collection sheet for zero repayments create an entry in Loan trasaction page 2015-07-29 11:13:58 +05:30
sachinkulkarni12 befd953fcf MIFOSX-1788:Waive interest is not working as expected 2015-08-30 16:27:09 +05:30
Vishwas Babu A J 16d92b83c4 Update INSTALL.md 2015-07-27 17:30:36 -07:00
Vishwas Babu A J 3f9e411670 Update INSTALL.md 2015-07-27 17:28:39 -07:00
Vishwas Babu A J 7e093be216 Update INSTALL.md 2015-07-27 17:27:49 -07:00
Vishwas Babu A J 39c13268f5 clarifying changes made for MIFOSX-1788 2015-07-23 22:30:03 -07:00
Vishwas Babu A J a3dcf36e6b Merge branch 'MIFOSX-1788' of https://github.com/sachinkulkarni12/mifosx into sachinkulkarni12-MIFOSX-1788 2015-07-23 22:02:02 -07:00
Vishwas Babu A J 3698b4fc98 Merge pull request #1438 from emmanuelnnaa/MIFOSX-2102
commit for MIFOSX-2102 (Loan application submittedOnDate property compared with server date instead of tenant date)
2015-07-21 16:14:53 -07:00
Vishwas Babu A J a43a117eef Merge pull request #1443 from sughosh88/MIFOSX-2122
Mifosx 2122
2015-07-16 11:29:37 -07:00
sughosh88 45688cf408 Minor Reporting Fix For issues 2012,2013 & 2015 2015-07-16 10:41:34 -07:00
sughosh88 f5b86e52b6 Export pentaho report to Excel 2007 format (.xlsx) 2015-07-16 10:34:17 -07:00
venkatconflux 6b643eb1a0 MIFOSX-2118 : Resolved Second Specific Due Date Charges not collecting 2015-07-16 09:59:51 +05:30
Emmanuel Nnaa 9aacbb3178 commit for MIFOSX-2102 (Loan application submittedOnDate property compared with server date instead of tenant date) 2015-07-06 10:40:12 +02:00
Vishwas Babu A J 1e00782c91 Merge pull request #1432 from venkatconflux/develop
corrected misspelled payment type API in  API-Docs
2015-06-26 17:16:45 -07:00
venkatconflux 19b624eb86 corrected misspelled payment type API in API-Docs 2015-06-26 16:32:00 +05:30
venkatconflux ae6877d4a0 MIFOSX-2085:scond repayment computing more interest resolved 2015-06-24 11:46:22 +05:30
Vishwas Babu A J 4d0fc18629 Merge pull request #1425 from sughosh88/MIFOSX-2009
MIFOSX-2009 Reports Fix
2015-06-22 05:00:37 -07:00
sughosh88 f8992fe0f3 MIFOSX-2009 Reports Fix 2015-06-18 15:01:37 +05:30
Vishwas Babu A J cc58715575 Merge pull request #1422 from chandrikamohith/MIFOSX-1592
MIFOSX-1592 Fix for Global search api - group loans/savings search ar…
2015-06-17 15:53:16 -07:00
Chandrika bdfb61eaa9 MIFOSX-1592 Fix for Global search api - group loans/savings search are now working as expected. 2015-06-17 17:13:42 -04:00
Vishwas Babu A J 9ed5631033 bumping up sql version 2015-06-16 11:12:46 -07:00
Vishwas Babu A J cef55bdde7 Merge branch 'MIFOSX-2033' of https://github.com/chandrikamohith/mifosx into chandrikamohith-MIFOSX-2033 2015-06-16 11:11:52 -07:00
Vishwas Babu A J ee9ed47163 Merge pull request #1419 from pramodn02/develop
MIFOSX-2006 : fixed emi amount for tranche loan
2015-06-16 10:44:11 -07:00
pramod 5a4dbe3239 MIFOSX-2006 : fixed emi amount for tranche loan 2015-06-16 22:57:56 +05:30
Vishwas Babu A J 55ec6df157 Merge pull request #1417 from chandrikamohith/MIFOSX-2075
MIFOSX-2075 Adding parameter interestRateFrequencyType to supported p…
2015-06-16 07:23:39 -07:00
Vishwas Babu A J f2c1b930a8 Merge pull request #1410 from sharmapankaj2512/MIFOSX-1935
MIFOSX-1935: role with no active user attached will get deleted
2015-06-16 07:22:12 -07:00
Vishwas Babu A J 95f8bb8bca Merge pull request #1415 from sughosh88/MIFOSX-2009
Mifosx 2009
2015-06-15 23:40:20 -07:00
Chandrika 5d73f2bd1d MIFOSX-2075 Adding parameter interestRateFrequencyType to supported parameters. 2015-06-15 23:56:44 -04:00
Vishwas Babu A J e088d50f5d MIFOSX-2074 2015-06-15 15:21:11 -07:00
sughosh88 e93072fca1 MIFOSX-2009(Epic) MIFOSX-2012,MIFOSX-2013,MIFOSX-2015 & MIFOSX-2016 2015-06-10 10:37:50 +05:30
sughosh88 b3735c6270 Balance Outstanding,Collection Report,Disbursal Report & Active Loan Summary Per Branch 2015-06-08 17:36:57 +05:30
Pankaj Sharma dbd1889bf1 MIFOSX-1935: role with no active user attached will get deleted 2015-06-06 09:52:06 +05:30
Vishwas Babu A J be9cb891c9 Merge pull request #1409 from venkatconflux/MIFOSX-2061
MIFOSX-2061 : charges for savings are specific for branch
2015-06-04 16:40:50 -07:00
venkatconflux 1947031aca MIFOSX-2061 : charges for savings are specific for branch 2015-06-04 11:51:31 +05:30
Chandrika 7d3307a0eb MIFOSX-2033 Insert permissions for read payment type and Staff Assignment History report. 2015-06-03 20:08:05 -04:00
Vishwas Babu A J 52b5efdf89 Merge branch 'master' into develop 2015-06-03 03:23:22 -07:00
Vishwas Babu A J 74858671db MIFOSX-2063 2015-06-03 03:18:49 -07:00
Vishwas Babu A J 4060ab33a4 Merge branch 'master' into develop 2015-06-03 02:38:37 -07:00
Vishwas Babu A J 7ab9f6450f Update build.gradle
MIFOSX-2062
2015-06-03 02:36:57 -07:00
Vishwas Babu A J 6a11ec28b1 Merge pull request #1398 from sharmapankaj2512/MIFOSX-1573
MIFOSX-1573 closedOnDate will be set to null on reactivation
2015-06-02 23:28:14 -07:00
Vishwas Babu A J e834b9c920 Merge pull request #1401 from chandrikamohith/MIFOSX-2054
MIFOSX-2054 Condition added to check if meeting frequency is not atta…
2015-06-02 23:26:00 -07:00
Vishwas Babu A J 7926440f37 Merge pull request #1405 from chandrikamohith/reviewChanges
MIFOSX-1992 Addressed review comments for 1992.
2015-06-02 18:46:40 -07:00
Vishwas Babu A J 944dc53b26 Merge pull request #1404 from sughosh88/MIFOSX-1939
MIFOSX-1939 FIX
2015-06-02 18:44:06 -07:00
Chandrika a3ebe54e30 MIFOSX-1992 Addressed review comments for 1992. 2015-06-02 18:57:04 -04:00
sughosh88 09d3eb9c95 MIFOSX-1939 FIX 2015-06-02 16:30:51 +05:30
Vishwas Babu A J e8fa4b3cb6 Merge branch 'chandrikamohith-MIFOSX-1992' into develop 2015-06-01 17:58:53 -07:00
Vishwas Babu A J 2f617529d5 bumping up account number for groups 2015-06-01 17:56:59 -07:00
Vishwas Babu A J 542c81cbba Merge branch 'MIFOSX-1992' of https://github.com/chandrikamohith/mifosx into chandrikamohith-MIFOSX-1992 2015-06-01 17:56:06 -07:00
Vishwas Babu A J 614df03820 Merge pull request #1400 from chandrikamohith/MIFOSX-2053
MIFOSX-2053 Able to add/delete/edit tranches.
2015-06-01 17:36:22 -07:00
Chandrika eb2d539937 MIFOSX-2054 Condition added to check if meeting frequency is not attached to group/center. 2015-06-01 17:16:01 -04:00
Chandrika 1d0892d199 MIFOSX-2053 Able to add/delete/edit tranches. 2015-06-01 14:58:42 -04:00
Vishwas Babu A J 8311a5d1fc undoing changes made for MIFOSX-2006 2015-06-01 00:10:20 -07:00
Vishwas Babu A J 6ccd513236 undoing changes made for MIFOSX-2006 2015-06-01 00:04:34 -07:00
Vishwas Babu A J 1f3f9e0d2c MIFOSX-2006 2015-05-31 18:43:34 -07:00
Pankaj Sharma af6bd39186 MIFOSX-1573 closedOnDate will be set to null on reactivation 2015-05-29 21:14:55 +05:30
Vishwas Babu A J 30b4d662ed Merge pull request #1392 from sangameshn/patch-3
Update INSTALL.md
2015-05-29 00:45:18 -07:00
Vishwas Babu A J 33e72e542d Merge pull request #1396 from sughosh88/MIFOSX-1939-FIX
Modifies reports MIFOSX-1939
2015-05-29 00:44:16 -07:00
sughosh88 66876c0859 Modifies reports MIFOSX-1939 2015-05-29 11:11:31 +05:30
Chandrika 9402ab5529 MIFOSX-1992 Introducing account# to groups and centers.Also expand scope to group and center search API. 2015-05-28 17:45:23 -04:00
sachinkulkarni12 72d82e3267 MIFOSX-2025:Unable to access loan account page 2015-05-28 14:05:59 +05:30
Vishwas Babu A J a59ebad2bf Merge pull request #1393 from sughosh88/MIFOSX-1939
MIFOSX-1939, Modified reports
2015-05-27 19:49:44 -07:00
sughosh88 9c74145e0a MIFOSX-1939, Modified reports 2015-05-26 17:00:42 +05:30
sangameshn 8710b7986e Update INSTALL.md 2015-05-25 17:47:04 +05:30
Vishwas Babu A J ae86a229fc Merge pull request #1389 from keshav10/MIFOSX-2050
MIFOSX-2050
2015-05-21 23:31:49 -07:00
Vishwas Babu A J a6eb16d4a8 Merge pull request #1391 from chandrikamohith/MIFOSX-2047
MIFOSX-2047 Updating Integration test case for hooks.Adding test case…
2015-05-20 23:12:30 -07:00
Chandrika e89772db78 MIFOSX-2047 Updating Integration test case for hooks.Adding test case for update and delete hook. 2015-05-20 15:55:19 -04:00
keshav10 5d713be0d6 MIFOSX-2050 2015-05-20 10:16:57 +05:30
Vishwas Babu A J 67eb567b84 MIFOSX-2047 2015-05-19 10:32:11 -07:00
Vishwas Babu A J 55e3661a6f Update CHANGELOG.md
with details of 15.03.1 Release
2015-05-18 17:18:26 -07:00
Vishwas Babu A J 3c48331480 updating sample data dump 2015-05-18 16:27:06 -07:00
Vishwas Babu A J d7e301c5d4 Merge pull request #1387 from chandrikamohith/MIFOSX-2037
MIFOSX-2037 Payment type is getting displayed in Individual collectio…
2015-05-18 14:55:27 -07:00
Vishwas Babu A J acf3c74f37 Merge pull request #1386 from Musoni/MIFOSX-2046
MIFOSX-2046 fixed overpaid loans not been transferred along when tran…
2015-05-18 14:53:34 -07:00
Chandrika 298f3384cf MIFOSX-2037 Payment type is getting displayed in Individual collection sheet. 2015-05-18 16:26:34 -04:00
andrew-dzak abec451ec2 MIFOSX-2046 fixed overpaid loans not been transferred along when transfering a client 2015-05-18 12:25:36 +02:00
Vishwas Babu A J 75f774e7ee Merge pull request #1375 from awaleram/MIFOSX-1956
MIFOSX-1956: accounting opening balance with multiple currency
2015-05-17 22:31:32 -07:00
Vishwas Babu A J 26fad113d5 Merge pull request #1374 from awaleram/MIFOSX-2032
teller-cashier management with multiple  currency
2015-05-17 22:30:37 -07:00
Vishwas Babu A J e692e1b58b Merge pull request #1385 from chandrikamohith/MIFOSX-2043
MIFOSX-2043 Adding new Database column 'key' to password preferences …
2015-05-15 00:07:25 -07:00
Chandrika 5c8691598e MIFOSX-2043 Adding new Database column 'key' to password preferences to support localization of description values. 2015-05-14 15:18:28 -04:00
Vishwas Babu A J 0061e1dd2e Merge pull request #1382 from chandrikamohith/MIFOSX-2022
MIFOSX-2022 To enable force-password reset, the value of no of days s…
2015-05-13 22:37:15 -07:00
Chandrika 4b3e76afc2 MIFOSX-2022 To enable force-password reset, the value of no of days should be greater than zero. 2015-05-13 20:48:28 -04:00
Vishwas Babu A J e8cfdcf865 Merge pull request #1378 from chandrikamohith/MIFOSX-2036
MIFOSX-2036 Refactoring Groups and Centers API - removing clientOptio…
2015-05-12 13:35:14 -07:00
Chandrika 84b9d5f9f2 MIFOSX-2036 Refactoring Groups and Centers API - removing clientOptions and groupMemberOptions for template true. 2015-05-12 16:31:36 -04:00
Vishwas Babu A J d7ff069e11 Merge pull request #1377 from chandrikamohith/ClientApiChanges
MIFOSX-2035 Added new boolean parameter optionsOnly to retrieve all c…
2015-05-12 10:44:33 -07:00
Chandrika efa73ed009 MIFOSX-2035 Added new boolean parameter optionsOnly to retrieve all clients. 2015-05-12 13:40:15 -04:00
awaleram 05675782f5 MIFOSX-1956: accounting opening balance with multiple currency 2015-05-12 17:36:43 +05:30
awaleram 12300255d2 teller-cashier management with currency 2015-05-12 12:52:55 +05:30
Markus Geiß 257d18798c Merge pull request #1373 from mgeiss/command-provider-test
added logging to detect build failure
2015-05-12 07:19:40 +02:00
Markus Geiss 9c32945c2c added logging to detect build failure 2015-05-12 07:17:17 +02:00
Vishwas Babu A J e47cee6cd9 Merge pull request #1372 from chandrikamohith/apiDoc
MIFOSX-2028 Updating API docs for List client/list groups.
2015-05-11 21:58:21 -07:00
Chandrika 570870bfef MIFOSX-2028 Updating API docs for List client/list groups. 2015-05-11 22:46:12 -04:00
Vishwas Babu A J a4dfa7e8c4 Merge pull request #1371 from chandrikamohith/MIFOSX-2028
MIFOSX-2028 Adding query param OrphansOnly to Groups API.
2015-05-11 17:11:07 -07:00
Chandrika a1e58b7768 MIFOSX-2028 Adding query param OrphansOnly to Groups API. 2015-05-11 15:02:53 -04:00
Vishwas Babu A J 37934dab66 Merge branch 'MIFOSX-2004' of https://github.com/venkatconflux/mifosx into venkatconflux-MIFOSX-2004 2015-05-10 17:29:41 -07:00
Vishwas Babu A J a20bd6fa7e Merge pull request #1369 from chandrikamohith/MIFOSX-2003
MIFOSX-2003 Adding new annotation @commandtype to all command handler…
2015-05-07 19:13:13 -07:00
Chandrika 8b71be5106 MIFOSX-2003 Adding new annotation @commandtype to all command handlers and refactoring code in SynchronousCommandProcessingService and CommandWrapper. 2015-05-07 10:38:13 -04:00
Vishwas Babu A J 658fb7ea82 fixing issues with MIFOSX-2002 2015-05-06 02:29:40 -07:00
Vishwas Babu A J 6b8bae57f9 reverting changes breaking the build 2015-05-05 22:49:29 -07:00
Vishwas Babu A J 0cf447736e Merge pull request #1367 from keshav10/MIFOSX-2002
MIFOSX-2002: allow search client by mobile_no
2015-05-05 22:33:28 -07:00
Vishwas Babu A J 0ee38cfbc8 removing warnings 2015-05-05 07:12:10 -07:00
Vishwas Babu A J e4d231913b MIFOSX-2007 2015-05-02 12:21:52 -07:00
keshav10 f84532d88c MIFOSX-2002 2015-04-29 14:40:24 +05:30
venkatconflux 6beac91da7 MIFOSX-2004:changed to get the loan id with the type of association 2015-04-29 13:44:52 +05:30
Vishwas Babu A J d0f7c8b686 Merge pull request #1364 from pramodn02/develop
MIFOSX-1831 : fix for accrual accounting overpayment
2015-04-27 08:21:44 -07:00
Pramod Nuthakki 514e17494d MIFOSX-1831 : fix for accrual accounting overpayment 2015-04-27 17:14:00 +05:30
Vishwas Babu A J 212e2127c5 Merge pull request #1363 from mgeiss/command-provider
Command provider
2015-04-26 19:57:20 -07:00
Markus Geiss 06c57000c7 Added autodiscovery for command handlers. 2015-04-26 17:08:07 +02:00
Markus Geiss a9ad69f844 Added provider to register and retrieve command handlers. 2015-04-26 16:17:44 +02:00
Vishwas Babu A J 86d12b57a8 Merge branch 'MIFOSX-1891' of https://github.com/chandrikamohith/mifosx into chandrikamohith-MIFOSX-1891 2015-04-24 11:21:49 -07:00
Vishwas Babu A J d33f762350 Merge pull request #1359 from pramodn02/develop
interest recalculation issues fixes and compounding changes
2015-04-24 08:26:15 -07:00
Pramod Nuthakki 356ec7bb59 MIFOSX-1995 : fix for prepay of loan with moratorium 2015-04-24 14:31:49 +05:30
Pramod Nuthakki ff84a13c4c MIFOSX-1951 : compounding changes and recalculation fixes 2015-04-24 14:31:45 +05:30
Vishwas Babu A J 577f59a7a9 Merge pull request #1358 from chandrikamohith/MIFOSX-1988
MIFOSX-1988 Total Disburse amount is updated based on the tranche amount...
2015-04-23 12:47:23 -07:00
Chandrika ebfe13f9c2 MIFOSX-1988 Total Disburse amount is updated based on the tranche amounts disbursed. 2015-04-23 15:37:27 -04:00
Chandrika 82d3d692d7 MIFOSX-1891 Improvements to extend term for loans following daily repayment schedule. 2015-04-21 17:01:39 -04:00
Vishwas Babu A J 3583fabe7a updating release in develop branch 2015-04-17 22:04:13 -07:00
Vishwas Babu A J 5b58bf84bc Merge pull request #1353 from sangameshn/patch-2
Update INSTALL.md
2015-04-16 22:21:11 -07:00
sangameshn db2934d905 Update INSTALL.md 2015-04-17 10:43:00 +05:30
Vishwas Babu A J ed754fc964 Update INSTALL.md 2015-04-16 18:09:46 -07:00
Vishwas Babu A J 38b9ef2b43 Update INSTALL.md
fixing type
2015-04-16 18:08:40 -07:00
Vishwas Babu A J 4ae07dd47c Update INSTALL.md
Automatic setup is broken
2015-04-16 18:08:05 -07:00
Vishwas Babu A J 511303d9e5 update instructions to access mifosx from the browser 2015-04-16 04:34:15 -07:00
Vishwas Babu A J 7934e54b22 updating sample data 2015-04-16 04:16:27 -07:00
Vishwas Babu A J 8dd47769d1 fixing issues with executable war file 2015-04-16 04:09:32 -07:00
Vishwas Babu A J 3b304f8c08 updates for gl report 2015-04-16 03:49:14 -07:00
Vishwas Babu A J 158e048e87 update sample data for 15.03 release 2015-04-16 02:46:05 -07:00
Vishwas Babu A J 1e7fc9d8c3 Update CHANGELOG.md
with release details for 15.03 release
2015-04-16 02:07:00 -07:00
Vishwas Babu A J 05ae42b20b bumping up release number 2015-04-15 22:22:58 -07:00
Vishwas Babu A J 7e2c33d05d Merge pull request #1351 from chandrikamohith/tranche
MIFOSX-1842 Adding validation for add/delete tranche based on loan statu...
2015-04-14 14:05:19 -07:00
Chandrika d45b3a504e MIFOSX-1842 Adding validation for add/delete tranche based on loan status. 2015-04-14 13:44:50 -04:00
Vishwas Babu A J 5f888ca2f2 Merge pull request #1348 from sachinkulkarni12/collection
fix for saving payment details in collection sheet
2015-04-13 15:36:01 -07:00
Vishwas Babu A J 6da6ec799c Merge pull request #1350 from chandrikamohith/exception
MIFOSX-1842 Fix for TransientPropertyValueException during Loan Approval...
2015-04-13 14:32:28 -07:00
Chandrika 445f57f81d MIFOSX-1842 Fix for TransientPropertyValueException during Loan Approval-when the approved amount was lesser than loan demanded. 2015-04-13 16:16:48 -04:00
Vishwas Babu A J b393b24c2d Merge pull request #1349 from chandrikamohith/1842
MIFOSX-1842 validations added for add/delete tranches.
2015-04-13 12:21:25 -07:00
Chandrika 006b14db0a MIFOSX-1842 validations added for add/delete tranches. 2015-04-13 14:15:25 -04:00
sachinkulkarni12 19e568e8f9 fix for saving payment details in collection sheet 2015-04-13 18:38:49 +05:30
Vishwas Babu A J f4ed5f80dd Merge pull request #1347 from rajeshreddy-k/MIFOSX-1958
MIFOSX-1958:Displaying Payment details in Search Journal entry screen
2015-04-13 01:45:33 -07:00
rajeshreddy-k 864b18d1a0 MIFOSX-1958:Displaying Payment details in Search Journal entry screen 2015-04-13 14:03:42 +05:30
Vishwas Babu A J 29de3ed745 fixing failing test cases 2015-04-12 00:54:36 -07:00
Vishwas Babu A J 2537b63183 some timezone related fixes 2015-04-11 09:20:48 -07:00
Vishwas Babu A J 18529f0ea6 fix failing test cases 2015-04-11 01:35:07 -07:00
Vishwas Babu A J f883158001 cleaning up MIFOSX-1947 2015-04-10 23:57:36 -07:00
Vishwas Babu A J 72be7a82a5 adding foreign key relationship and bumping up sql patch 2015-04-10 17:13:05 -07:00
Vishwas Babu A J edcfce422a Merge branch 'MIFOSX-1947' of https://github.com/florinvlad/mifosx into florinvlad-MIFOSX-1947 2015-04-10 17:05:12 -07:00
Vishwas Babu A J 36aea53215 MIFOSX-1938 2015-04-10 17:04:11 -07:00
Vishwas Babu A J bab630a24e Merge branch 'MIFOSX-1938_NEW' of https://github.com/prasadpatill2/mifosx into prasadpatill2-MIFOSX-1938_NEW 2015-04-10 16:59:34 -07:00
Florin Vlad e11236dc2b fix for MIFOSX-1947
change file name

update fix

added sql

added tests for image api

remove comment

api doc

more tests
2015-04-10 19:09:55 +03:00
Vishwas Babu A J f75d2a3b81 adding logs for batch job failures in Integration test cases 2015-04-09 17:06:41 -07:00
Vishwas Babu A J aa915a122b Merge pull request #1340 from chandrikamohith/1256
MIFOSX-1256 Charges dropdown to display only matching currency for savin...
2015-04-09 16:07:21 -07:00
Vishwas Babu A J 8c03f6e41e Merge pull request #1344 from chandrikamohith/MIFOSX-1954
MIFOSX-1954 End date is validated if it is before startDate.Validation f...
2015-04-09 15:23:03 -07:00
Chandrika b0173fa46a MIFOSX-1954 End date is validated if it is before startDate.Validation function merged for Create/Update teller. 2015-04-09 11:30:59 -04:00
Vishwas Babu A J ce576f10be Update VERSIONING.md
with edits around Date versioning scheme
2015-04-08 21:17:22 -07:00
Vishwas Babu A J 1225a72cee Update VERSIONING.md
with details of date versioning scheme
2015-04-08 21:10:12 -07:00
Vishwas Babu A J f790b7e695 fixing validation for loanproduct data validation 2015-04-08 16:01:54 -07:00
Vishwas Babu A J ee71366032 reduce number of server side calls in testLoanProductConfiguration 2015-04-08 15:17:36 -07:00
prasadpatill 3561ff1706 update script for General_Ledger_report 2015-04-08 13:50:09 +05:30
Vishwas Babu A J 69150fc7ad fixes for loan refund test cases 2015-04-07 18:06:10 -07:00
Vishwas Babu A J e6e0af7885 fix for failing test case testSavingsInterestPostingAtPeriodEnd 2015-04-07 17:11:46 -07:00
Vishwas Babu A J 7a8702e165 more fixes for failing integration tests w.r.t Interest recalculation 2015-04-07 16:59:01 -07:00
Vishwas Babu A J 6b67e39b72 Merge pull request #1337 from emmanuelnnaa/MIFOSX-1941
commit for MIFOSX-1941 (Incorrect GL Account running balance figures)
2015-04-07 16:15:21 -07:00
Vishwas Babu A J 7cf3e05fdc Merge pull request #1339 from pramodn02/develop
MIFOSX-1918 : API changes to add option for  fetching pre-close detail b...
2015-04-07 16:12:29 -07:00
Vishwas Babu A J d665ff5a00 Merge pull request #1341 from chandrikamohith/1877
MIFOSX-1877 NumberFormatException issue fixed for working days
2015-04-07 16:10:48 -07:00
Vishwas Babu A J 4b110cfe4b MIFOSX-1948 2015-04-07 16:06:31 -07:00
Chandrika 2b17dba8cd MIFOSX-1877 NumberFormatException issue fixed for working days 2015-04-07 17:53:11 -04:00
Vishwas Babu A J 48bf33c930 Update CHANGELOG.md
with release description for 15.03
2015-04-07 11:27:54 -07:00
Vishwas Babu A J ad8d9e792f Update CHANGELOG.md 2015-04-07 10:59:47 -07:00
Vishwas Babu A J a5a4d1670d fixing failing test cases on payment types 2015-04-07 10:33:30 -07:00
Vishwas Babu A J 15fe1477b7 adding logs to detect failures in test cases 2015-04-07 09:53:07 -07:00
Chandrika 8e7ae0ac03 MIFOSX-1256 Charges dropdown to display only matching currency for savings/FD/RD. 2015-04-07 11:25:55 -04:00
Pramod Nuthakki e992a2b410 MIFOSX-1918 : API changes to add option for fetching pre-close detail based on date 2015-04-07 20:20:30 +05:30
Emmanuel Nnaa 741d683af9 commit for MIFOSX-1941 (Incorrect GL Account running balance figures) 2015-04-07 09:28:44 +02:00
Vishwas Babu A J b1a429e3a2 Update CHANGELOG.md
for 15.03.RELEASE
2015-04-06 22:50:05 -07:00
Vishwas Babu A J 8fc3ace96e MIFOSX-1908 2015-04-06 18:59:09 -07:00
Vishwas Babu A J ade5e76ad9 Merge branch 'loanConfig' of https://github.com/chandrikamohith/mifosx into chandrikamohith-loanConfig
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java
2015-04-06 17:11:19 -07:00
Vishwas Babu A J 0ab2e727ad Merge pull request #1336 from chandrikamohith/MIFOSX-1742
MIFOSX-1742 Not displaying loan records which are not Active.
2015-04-06 16:23:41 -07:00
Chandrika b6f9ec6bcb MIFOSX-1742 Not displaying loan records which are not Active. 2015-04-06 19:17:12 -04:00
Vishwas Babu A J 2ab024e6f7 resolving merge issues with api-docs 2015-04-06 10:00:15 -07:00
Vishwas Babu A J 2a1fed6fa1 Merge pull request #1335 from pramodn02/develop
added extra logs in test cases
2015-04-05 21:15:59 -07:00
Pramod Nuthakki 312446e8ed added extra logs in test cases 2015-04-06 08:02:07 +05:30
Vishwas Babu A J 3abee1cf40 MIFOSX-1918 API docs typos 2015-04-05 14:05:39 -07:00
Vishwas Babu A J 91f21707ab MIFOSX-1918 2015-04-05 13:53:43 -07:00
Vishwas Babu A J 52b82f32d0 Merge pull request #1334 from pramodn02/develop
MIFOSX-1918 : added Pre-closure interest calculation strategy
2015-04-05 13:18:32 -07:00
Pramod Nuthakki 2bfc83722f MIFOSX-1918 : added Pre-closure interest calculation strategy 2015-04-05 23:27:18 +05:30
Vishwas Babu A J 4224fc16cc remove server startup warnings 2015-04-04 20:35:45 -07:00
Vishwas Babu A J dbb1c18dd4 Merge pull request #1333 from chandrikamohith/1939
MIFOSX-1939 Correcting the savings statusEnum value for TRANSFER_ON_HOLD...
2015-04-04 01:37:34 -07:00
Chandrika fa5d388084 MIFOSX-1939 Correcting the savings statusEnum value for TRANSFER_ON_HOLD. 2015-04-03 17:36:23 -04:00
Vishwas Babu A J ae36b0ad47 Merge pull request #1330 from emmanuelnnaa/MIFOSX-1940
commit for MIFOSX-1940 (Accounting running balance job hangs when updating 400,000 or more entries)
2015-04-02 07:38:23 -07:00
Emmanuel Nnaa 3038169bb8 commit for MIFOSX-1940 (Accounting running balance job hangs when updating 400,000 or more entries) 2015-04-02 16:10:24 +02:00
Vishwas Babu A J c3dc53a4b1 remove warnings from portfolio packages 2015-04-01 19:46:44 -07:00
Chandrika d21385792a MIFOSX-1667 Overriding loan product attributes by individual loan accounts. 2015-04-01 15:27:46 -04:00
Vishwas Babu A J b46e9b66c9 Merge pull request #1327 from prasadpatill2/generalreport
GeneralLedgerReport
2015-04-01 08:47:37 -07:00
prasadpatill 8416cd1ec7 GeneralLedgerReport 2015-04-01 16:38:04 +05:30
Vishwas Babu A J 377dee1984 removing warnings on portfolio packages 2015-03-31 13:52:17 -07:00
Vishwas Babu A J 49dc20d2a3 Merge pull request #1326 from chandrikamohith/passwordPref
MIFOSX-1875 Adding test cases and API docs for Password Preferences.
2015-03-31 09:58:50 -07:00
Chandrika cf0f5440a9 MIFOSX-1875 Adding test cases and API docs for Password Preferences. 2015-03-31 12:17:15 -04:00
MithunKashyap ea8080f32c MIFOSX : Api docs for Teller cash mgmt and paymenttypes 2015-03-30 10:56:22 +05:30
Vishwas Babu A J ecaa78f6b5 Merge pull request #1323 from prasadpatill2/LoanandSavingsAccountStatement
LoanandSavingsAccountStatementReports
2015-03-28 16:03:38 +05:30
prasadpatill 60d38fbb8f LoanandSavingsAccountStatement 2015-03-28 13:23:17 +05:30
Vishwas Babu A J a72f1057cd bumping up sql patch number 2015-03-28 11:27:16 +05:30
Vishwas Babu A J 30e9e3b330 Merge branch 'MIFOSX-1892' of git://github.com/MithunKashyap/mifosx into MithunKashyap-MIFOSX-1892 2015-03-28 11:25:26 +05:30
Vishwas Babu A J edef7dbf93 Merge branch 'MIFOSX-1904' of git://github.com/MithunKashyap/mifosx into MithunKashyap-MIFOSX-1904
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
	mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
	mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
2015-03-28 11:23:09 +05:30
Vishwas Babu A J cc2fdbbacc updating licences 2015-03-28 10:44:36 +05:30
Vishwas Babu A J 237b967537 Merge pull request #1321 from chandrikamohith/MIFOSX-1875
MIFOSX-1875 Fix for NullPointerException,update build attributes before ...
2015-03-28 10:42:12 +05:30
Vishwas Babu A J aaaf47c763 Merge pull request #1322 from chandrikamohith/MIFOSX-1868
MIFOSX-1868 Spelling mistake corrected for the field 'passwordNeverExpir...
2015-03-28 10:41:30 +05:30
Chandrika 94af5d0853 MIFOSX-1868 Spelling mistake corrected for the field 'passwordNeverExpires' during Update. 2015-03-27 20:59:14 -04:00
Chandrika f9a33c790e MIFOSX-1875 Fix for NullPointerException,update build attributes before building commandRequest. 2015-03-27 17:43:20 -04:00
Vishwas Babu A J 3043d2ae99 fix failing test cases 2015-03-28 00:09:40 +05:30
Vishwas Babu A J 064fb4845c MIFOSX-1875 2015-03-28 00:07:20 +05:30
Vishwas Babu A J 3416a8dc8e Merge branch 'MIFOSX-1875' of git://github.com/Musoni/mifosx into Musoni-MIFOSX-1875
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
	mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
	mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
2015-03-27 01:14:59 +05:30
Vishwas Babu A J cc010e5b37 cleaning up -MIFOSX-1877 2015-03-26 22:38:17 +05:30
Vishwas Babu A J 3b71c90773 Merge branch 'MIFOSX-1877' of git://github.com/Musoni/mifosx into Musoni-MIFOSX-1877 2015-03-26 21:34:15 +05:30
Vishwas Babu A J a687c49eb1 cleaning up MIFOSX-1897 2015-03-26 18:29:56 +05:30
Vishwas Babu A J 392e94f6bf Merge branch 'MIFOSX-1897' of git://github.com/Musoni/mifosx into Musoni-MIFOSX-1897 2015-03-26 18:06:52 +05:30
Vishwas Babu A J 1098923689 cleaning up MIFOSX-1868 2015-03-26 16:57:32 +05:30
Vishwas Babu A J 9a55b3ffa8 Merge branch 'MIFOSX-1868' of git://github.com/Musoni/mifosx into Musoni-MIFOSX-1868 2015-03-26 15:53:22 +05:30
MithunKashyap 3cb99328eb MIFOSX-1892:Bug fix for Teller cash management 2015-03-25 22:09:24 +05:30
MithunKashyap c73e38fc8c MIFOSX-1904 : Moving payment type to their own table 2015-03-25 21:43:31 +05:30
Vishwas Babu A J 5624da89ea Merge pull request #1316 from sachinkulkarni12/MIFOSX-1839
MIFOSX-1839:fix for show payment details
2015-03-23 17:51:34 +05:30
Vishwas Babu A J 0fabff864c Merge pull request #1313 from MithunKashyap/MIFOSX-1905
MIFOSX-1905: Consistency w.r.t spelling principalThresholdForLastInstalment for loan products
2015-03-23 17:47:21 +05:30
Vishwas Babu A J 5227b48e23 Merge pull request #1315 from sachinkulkarni12/MIFOSX-1885_client_dissasociate
MIFOSX-1885:fix for client dissasociate
2015-03-23 17:28:10 +05:30
sachinkulkarni12 1db9345669 MIFOSX-1839:fix for show payment details 2015-03-23 15:47:50 +05:30
sachinkulkarni12 b8930cb831 MIFOSX-1885:fix for client dissasociate 2015-03-23 15:40:48 +05:30
Vishwas Babu A J 03a5bb57ce Merge pull request #1312 from pramodn02/develop
MIFOSX-1884 : corrected test cases
2015-03-23 14:55:55 +05:30
MithunKashyap 2833318fd3 MIFOSX-1905: Consistency w.r.t spelling principalThresholdForLastInstalment for loan products 2015-03-23 13:25:55 +05:30
Pramod Nuthakki cb1510463d MIFOSX-1884 : corrected test cases 2015-03-23 11:25:56 +05:30
Vishwas Babu A J d91c6a0b64 Merge pull request #1309 from pramodn02/develop
MIFOSX-1884 : corrected principal moratorium
2015-03-20 19:16:08 +05:30
Pramod Nuthakki c923cc2723 MIFOSX-1884 : corrected principal moratorium 2015-03-20 16:39:53 +05:30
Vishwas Babu A J 259a9c43c4 Merge branch 'develop' of github.com:openMF/mifosx into develop 2015-03-20 10:13:56 +05:30
Vishwas Babu A J ef43bbc5b1 fixing compilation issues 2015-03-19 21:58:59 +05:30
Vishwas Babu A J 1a50bd0d47 Merge pull request #1308 from venkatconflux/MIFOSX-1911
MIFOSX-1911:Deposit Account On Hold Transactions
2015-03-19 21:30:30 +05:30
venkatconflux 0710ef964b MIFOSX-1911:CodeFormated 2015-03-19 21:27:45 +05:30
Vishwas Babu A J a6e764279b MIFOSX-1914 2015-03-19 21:24:58 +05:30
Vishwas Babu A J c5e4f22826 Merge pull request #1296 from terencemo/release-script
Release script to set version and releasedate
2015-03-19 17:09:56 +05:30
sachinkulkarni12andVishwas Babu A J 89377a23b4 MIFOSX-1885
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java
2015-03-19 16:57:35 +05:30
Vishwas Babu A J 94dff21a97 Merge pull request #1297 from chandrikamohith/1808
MIFOSX-1808 Group hierarchy updation issue corrected.Center summary is n...
2015-03-19 15:46:12 +05:30
Vishwas Babu A J c8391d119f Merge pull request #1303 from pramodn02/develop
overdue charge lock issue fix
2015-03-19 13:46:31 +05:30
Pramod Nuthakki 9813e097c3 overdue charge lock issue fix 2015-03-19 13:28:06 +05:30
Vishwas Babu A J 44e08dd2e6 Update Contributing.md 2015-03-19 11:52:27 +05:30
Vishwas Babu A J 9f92e5cb7e Update Contributing.md 2015-03-19 11:52:04 +05:30
Vishwas Babu A J 4c5d194766 Merge pull request #1299 from pramodn02/develop
schedule correction for payments after maturity date
2015-03-18 17:25:13 +05:30
Pramod Nuthakki 0d1439afea schedule correction for payments after maturity date 2015-03-18 10:11:00 +05:30
Michael Vorburger 48ee0c9739 Merge pull request #1291 from vorburger/MIFOSX-1758_apps_git_submodule
MIFOSX-1758 Make dist ZIP include community-app in apps/ via Git submodule
2015-03-17 23:31:25 +01:00
Michael Vorburger ac75cc9ba6 MIFOSX-1758 Make the dist ZIP include the community-app in apps/ via Git submodule
Root build.sh, for both back-end and front-end
Added -Penv=dev to incl. MariaDBj4
Include apps/**/* in ZIP, fixed UI URL in launcher, some doc
Set submodule Git rev to one that actually exists on remote
Don't use 'git submodule update --remote' but foreach ..
build-cloudbees.sh makes npm available
Better logging, and trying dev and prod dist UI
2015-03-17 23:22:43 +01:00
Chandrika 7f95e4bf20 MIFOSX-1808 Group hierarchy updation issue corrected.Center summary is now getting updated properly. 2015-03-16 19:16:42 -04:00
Vishwas Babu A J 7fcdb77f36 git push origin develop 2015-03-16 02:26:49 +05:30
Terence Denzil Monteiro 968ddcd8de Release script to set version and releasedate 2015-03-13 20:25:44 +04:00
Michael Vorburger 2a800bf367 Merge pull request #1295 from channagayan/licenceError
ConcurrencyIntegrationTest licenceIssue fixed
2015-03-13 09:04:40 +01:00
Channa Gayan cbe6d672e8 ConcurrencyIntegrationTest licenceIssue fixed 2015-03-13 13:19:07 +05:30
andrew-dzak a38d3d565d MIFOSX-1897 ability to see journals entries for specific loans and savings 2015-03-12 16:04:56 +01:00
andrew-dzak fdd84097ea MIFOSX-1877 ability to edit working days by clients and added license text to ConcurrencyIntegrationTest file 2015-03-12 14:08:41 +01:00
Michael Vorburger f440f294ad Merge pull request #1226 from vorburger/MIFOSX-1756_UseAppsInsteadWebAndDocUpdate
MIFOSX-1756 Follow-up, switched to using (existing) /apps/ instead /web/...
2015-03-10 12:20:23 +01:00
Vishwas Babu A J 19021dd18b Merge pull request #1289 from pramodn02/develop
interest recalculation performance issue fixes
2015-03-09 00:11:25 +05:30
Pramod Nuthakki 4e7f9031be interest recalculation performance issue fixes 2015-03-08 15:56:10 +05:30
Vishwas Babu A J eaa32e9465 sorting out concurrency issues with loans -1 2015-03-05 20:32:38 +05:30
Vishwas Babu A J 221cb1c17d fixing more failing test cases 2015-03-04 23:39:03 +05:30
Vishwas Babu A J d00f793f99 Merge branch 'develop' of github.com:openMF/mifosx into develop 2015-03-04 23:30:14 +05:30
Vishwas Babu A J 942eca1243 fix for MifosX-1859 2015-03-04 23:29:23 +05:30
Vishwas Babu A J d393812cfe Merge pull request #1272 from chandrikamohith/MIFOSX-1864
MIFOSX-1864 Able to delete/add mapping fees and penalties during Edit
2015-03-04 23:14:52 +05:30
Vishwas Babu A J 5262bb6478 Merge pull request #1287 from MithunKashyap/MIFOSX-1737_New
MIFOSX-1737 : Bug fix for center staff assignment history
2015-03-04 23:11:57 +05:30
Vishwas Babu A J 12746ebc0f Merge branch 'develop' of github.com:openMF/mifosx into develop 2015-03-04 22:44:14 +05:30
Vishwas Babu A J a16265eb92 fix failing test cases 2015-03-04 22:41:44 +05:30
MithunKashyap 1b2ea2ebdd MIFOSX-1737 : Bug fix for center staff assignment history 2015-03-04 22:15:34 +05:30
Vishwas Babu A J 3d7ef79d3d Merge pull request #1286 from sachinkulkarni12/accountmapping
Financial Account Mapping Changes Updated.
2015-03-04 21:22:58 +05:30
sachinkulkarni12 71cd946d21 Financial Account Mapping Changes Updated. 2015-03-04 11:51:47 +05:30
Vishwas Babu A J d9ce1745da buping sql patch number 2015-03-03 20:07:17 +05:30
Vishwas Babu A J 95acad7cf4 Merge branch 'latest' of git://github.com/pramodn02/mifosx into develop 2015-03-03 20:06:35 +05:30
Vishwas Babu A J ab4e97821c fixing issue with patch number 244 2015-03-03 19:14:09 +05:30
Vishwas Babu A J 0c75d323eb Merge pull request #1283 from karan173/MIFOSX-1847-datatable-delete-fix
MIFOSX-1847. Deleting non empty Datatables now causes an exception
2015-03-03 18:07:53 +05:30
Vishwas Babu A J d47070a5c2 Merge pull request #1284 from MithunKashyap/MIFOSX-1737_New
MIFOSX-1737: Center Staff Assignment History
2015-03-03 18:04:15 +05:30
Vishwas Babu A J e5ccac0ca2 fixing test case failures due to work on tranche loans improvement 2015-03-03 17:36:08 +05:30
MithunKashyap 72389cf933 MIFOSX-1737: Center Staff Assignment History 2015-03-03 10:40:16 +05:30
Vishwas Babu A J 445a98d225 deleting duplicate sql patches and bumping patch numbers 2015-03-03 08:50:54 +05:30
Vishwas Babu A J 05fdf84981 Merge branch 'chandrikamohith-TrancheDisbursal' into develop 2015-03-03 08:43:26 +05:30
Vishwas Babu A J 495126b754 Merge branch 'TrancheDisbursal' of git://github.com/chandrikamohith/mifosx into chandrikamohith-TrancheDisbursal 2015-03-03 08:43:14 +05:30
karan173 6b8b247565 MIFOSX-1847. Deleting non empty Datatables now causes an exception 2015-03-02 07:28:48 +05:30
Vishwas Babu A J 0adc4fae19 Merge pull request #1280 from MithunKashyap/New_MIFOSX-1828
Mifosx 1828: Entity to entity mapping feature
2015-03-02 07:06:52 +05:30
Vishwas Babu A J 98e9c3d084 fixing failing test case 2015-03-02 07:00:31 +05:30
MithunKashyap f179771b8d MIFOSX-1828:Updated Patch script for EntityMapping Feature 2015-02-28 15:01:52 +05:30
Chandrika f720bd6627 MIFOSX-1842 Changes made for improvements to tranche disbursal loans. 2015-02-24 17:36:11 +05:30
Chandrika f6f04d7ae3 MIFOSX-1824 API changes and test case for loan approval in case of multi-disburse loans. 2015-02-24 17:36:09 +05:30
Pramod Nuthakki 4a2a85d20e MIFOSX-1850 : Recurring deposits without maturity date 2015-02-24 10:45:10 +05:30
Chandrika 07ac26b152 MIFOSX-1864 Able to delete/add mapping fees and penalties during Edit 2015-02-17 14:39:34 +05:30
MithunKashyap f22cac3feb MIFOSX-1828:EntityMapping Feature 2015-02-16 09:51:32 +05:30
Vishwas Babu A J 7ba9a81e53 Merge pull request #1271 from emmanuelnnaa/MIFOSX-1878
commit for MIFOSX-1878 (Savings account timeline does not include the data of the user that activated the account)
2015-02-11 16:06:33 +05:30
Emmanuel Nnaa 2ab84dfd22 commit for MIFOSX-1878 (Savings account timeline does not include the data of the user that activated the account) 2015-02-11 10:58:37 +01:00
CieyouRaoul d89152ce82 MIFOSX-1875 password validation policy 2015-02-10 15:27:09 +01:00
Vishwas Babu A J 1e4b4911e0 Merge pull request #1268 from bharathc27/test1
guaranterdomainserviceissue
2015-02-10 02:37:49 -08:00
bharathc27 ad3a77d70c guaranterdomainserviceissue 2015-02-05 09:49:12 +05:30
Vishwas Babu A J 8b2843cabd Merge pull request #1264 from chandrikamohith/MIFOSX-1860
MIFOSX-1860 Second tranche loan can be disbursed if disbursed on date is...
2015-02-04 09:39:04 -08:00
Vishwas Babu A J 7d887a4e0a Merge pull request #1267 from bharathc27/test1
MIFOSX-1464: fixed testcases of loanintegration which was assigned by vi...
2015-02-04 09:38:24 -08:00
bharathc27 1e3bb039ee MIFOSX-1464: fixed testcases of loanintegration which was assigned by vishwas sir 2015-02-04 13:00:18 +05:30
CieyouRaoul 9e6ec117d3 MIFOSX-1868 2015-02-03 15:22:50 +01:00
Vishwas Babu A J c4a21a8f87 Merge pull request #1265 from chandrikamohith/roundOff
MIFOSX-1464 spelling mistakes corrected
2015-02-03 05:13:58 -08:00
Chandrika 57d4c8f868 MIFOSX-1464 spelling mistakes corrected 2015-02-03 17:14:53 +05:30
Vishwas Babu A J 88edeb8ee3 changing sql patch number for fixed emi changes 2015-02-03 00:42:58 -08:00
Vishwas Babu A J 13e3c0c605 Merge branch 'TestCases' of git://github.com/bharathc27/mifosx into bharathc27-TestCases
Conflicts:
	api-docs/apiLive.htm
	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/loanschedule/domain/LoanApplicationTerms.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/LoanProductConstants.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
2015-02-03 00:05:00 -08:00
Chandrika ca0dcba74f MIFOSX-1860 Second tranche loan can be disbursed if disbursed on date is after first repayment date 2015-02-03 00:39:42 -05:00
bharathc27 0182be4cf9 MIFOSX: client/group loan testcases fixed 2015-01-30 11:11:37 +05:30
Vishwas Babu A J b4c354b224 Merge branch 'MIFOSX-1613' of git://github.com/pramodn02/mifosx into pramodn02-MIFOSX-1613
Conflicts:
	api-docs/apiLive.htm
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
2015-01-29 19:24:43 -08:00
Vishwas Babu A J 3f6d90e7d4 updating sql patch number 2015-01-28 15:33:29 -08:00
Vishwas Babu A J b490a42dcf Merge branch 'MIFOSX-1846' of git://github.com/MithunKashyap/mifosx into MithunKashyap-MIFOSX-1846 2015-01-28 15:32:44 -08:00
Vishwas Babu A J 371d38e1c9 bumping up sql patch number 2015-01-28 15:27:24 -08:00
Vishwas Babu A J f3c306ffbb Merge branch 'displayNameFix' of git://github.com/MegaAlex/mifosx into MegaAlex-displayNameFix 2015-01-28 15:24:42 -08:00
Vishwas Babu A J 1d66c3e897 Merge pull request #1257 from AJLiu/develop
Fixed Failing Test Case
2015-01-20 22:09:58 -08:00
Anthony Liu b641d92e77 Fixed Failing Test Case 2015-01-21 00:30:48 -05:00
Vishwas Babu A J 19e6c28b5f Merge pull request #1255 from pramodn02/MIFOSX-1844
MIFOSX-1844 : added config to manage last transaction
2015-01-20 19:23:11 -08:00
Vishwas Babu A J 2ec7d2eb22 Merge pull request #1256 from sangameshn/patch-1
Update INSTALL.md
2015-01-20 05:10:20 -08:00
sangameshn 852cb45576 Update INSTALL.md 2015-01-20 18:24:51 +05:30
Pramod Nuthakki d9db7d5313 MIFOSX-1844 : added config to manage last transaction 2015-01-20 17:03:06 +05:30
MithunKashyap af43e6c58f MIFOSX-1846: Report and script files for Loan Transaction Receipt 2015-01-17 13:52:31 +05:30
Vishwas Babu A J 69d1edff32 Merge pull request #1251 from pramodn02/MIFOSX-1742
MIFOSX-1742 : added collection sheet for individuals
2015-01-16 01:56:16 -08:00
Vishwas Babu A J ea51f9fceb Merge pull request #1252 from pramodn02/MIFOSX-1481
MIFOSX-1481 : changed the validation to allow writeoff on last repayment...
2015-01-16 01:52:06 -08:00
Pramod Nuthakki f438bc6f17 MIFOSX-1481 : changed the validation to allow writeoff on last repayment date 2015-01-16 15:11:35 +05:30
Markus Geiß d5f0ae53f8 Merge pull request #1250 from AJLiu/develop
closed
2015-01-16 06:25:11 +01:00
Pramod Nuthakki 2bd1332da7 MIFOSX-1742 : added collection sheet for individuals 2015-01-16 10:24:26 +05:30
Anthony Liu a7ddb1a70f Office Integration Office Modification 2015-01-15 01:53:05 -05:00
Vishwas Babu A J bc38cf4ff9 build failing on jenkins 2015-01-14 10:13:07 -08:00
Vishwas Babu A J 20f292d329 MIFOSX-1841 2015-01-14 09:29:42 -08:00
Vishwas Babu A J bd689bc008 MIFOSX-1838 2015-01-13 15:41:26 -08:00
Vishwas Babu A J bdbd1a85ed Merge pull request #1248 from chandrikamohith/MIFOSX-1776
MIFOSX-1776 Sync repayment dates with meeting dates for group loan
2015-01-13 11:14:33 -08:00
Vishwas Babu A J 19c7ef1f32 Merge pull request #1249 from MegaAlex/licenseFix
Add license headers
2015-01-13 11:13:56 -08:00
Vishwas Babu A J f9d4af7d2f bump version number 2015-01-13 11:11:09 -08:00
Vishwas Babu A J 593ba64eac Merge branch 'MIFOSX-1786' of git://github.com/binaryking/mifosx into binaryking-MIFOSX-1786 2015-01-13 11:10:16 -08:00
Alex Ivanov deb506ece3 Add license headers 2015-01-09 22:47:56 +02:00
Chandrika 0c7b8c937c MIFOSX-1776 Sync repayment dates with meeting dates for group loan 2015-01-09 12:17:22 -05:00
Vishwas Babu A J fe9b3437d4 Merge branch 'openingbalances' of git://github.com/binnygopinath/mifosx into binnygopinath-openingbalances
Conflicts:
	mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
2015-01-08 06:32:58 -08:00
Vishwas Babu A J e979bdf6b7 resolving version number conflict with sql patch 2015-01-07 22:57:28 -08:00
Vishwas Babu A J 7d059acd83 Merge branch 'MIFOSX-1809' of git://github.com/chandrikamohith/mifosx into chandrikamohith-MIFOSX-1809 2015-01-07 22:56:28 -08:00
Vishwas Babu A J 0acf7c1498 Merge pull request #1237 from chandrikamohith/MIFOSX-1776
MIFOSX-1776 Sync repayment dates with meeting dates for Group Loan appli...
2015-01-07 22:50:45 -08:00
Vishwas Babu A J 653c534514 Merge pull request #1234 from satish-conflux/MIFOSX-1817
MIFOSX-1870 : Added Currency Type
2015-01-07 21:39:05 -08:00
Vishwas Babu A J cfcc2654d4 Merge pull request #1238 from MithunKashyap/MIFOSX-1823
MIFOSX-1823: Report file and upgrade script for Savings Transaction Receipt
2015-01-07 21:29:25 -08:00
Vishwas Babu A J d0bb7c7ae3 failing test cases fix 2015-01-07 17:51:32 -08:00
MithunKashyap ebab8699fe MIFOSX-1823: Report file and upgrade script for Savings Transaction Receipt 2015-01-06 15:45:25 +05:30
Markus Geiß 8b56795821 Merge pull request #1236 from AJLiu/develop
closed (y)
2015-01-05 20:13:46 +01:00
Chandrika 4cd7c79225 MIFOSX-1776 Sync repayment dates with meeting dates for Group Loan application 2015-01-05 13:54:38 -05:00
Vishwas Babu A J f46875fcb7 fix compilatin issues 2015-01-04 21:30:27 -08:00
Anthony Liu f477a190a7 Center Integration Update and Deletion 2015-01-04 17:47:24 -05:00
Markus Geiß e7db6731d9 Merge pull request #1232 from AJLiu/develop
closed (y)
2015-01-04 08:43:18 +01:00
Anthony Liu f082ac40a6 Center Integration Retrieval 2015-01-04 02:24:21 -05:00
Markus Geiß 144860d48c Merge pull request #1228 from binaryking/MIFOSX-1757
closed (y)
2015-01-02 11:37:27 +01:00
Satish Sajjan 70331f8447 MIFOSX-1870 : Added Currency Type 2014-12-31 19:24:29 +05:30
Pramod Nuthakki 4b6d794a47 MIFOSX-1613 : changes for overdue status and npa 2014-12-31 18:28:43 +05:30
Markus Geiß d310eb308d Merge pull request #1231 from AJLiu/develop
closed
2014-12-30 22:57:43 +01:00
Anthony Liu f5aa3f88e9 Center Integration Setup 2014-12-30 16:38:42 -05:00
Markus Geiß 253fba35c3 Merge pull request #1229 from MegaAlex/qa-staff3
closed
2014-12-30 20:12:11 +01:00
Chandrika e4cf90562c MIFOSX-1809 Closure Reason Code added for Centers-'CenterClosureReason' 2014-12-30 12:50:28 -05:00
Alex Ivanov ed8809f63c Add staff update test cases 2014-12-30 17:13:14 +02:00
Mohammed Nafees 06bb09f189 MIFOSX-1757 Document the new much simpler end-user standalone server set-up end-user experience 2014-12-30 12:10:09 +05:30
Markus Geiß bedbe7023f Merge pull request #1224 from MegaAlex/qa-staff2
closed (y)
2014-12-30 07:33:07 +01:00
Michael Vorburger 4ad30d91d9 MIFOSX-1756 Follow-up, switched to using (existing) /apps/ instead /web/, and slightly updated the doc 2014-12-30 01:57:41 +01:00
Alex Ivanov dcff6fbcd3 Add tests for staff retrieval 2014-12-30 00:27:49 +02:00
Michael Vorburger 74242ed036 Merge pull request #1201 from binaryking/MIFOSX-1756
MIFOSX-1756 Make it easy for Static Web Content such as the community-app to be served by the new standalone end-user server (not development)
2014-12-29 18:30:16 +01:00
Michael Vorburger 37333266aa Merge pull request #1220 from vorburger/UpgradeMariaDB4jFromv211To213ToFixWindows
MIFOSX-1552 Upgraded MariaDB4j dependency from v2.1.1 to v2.1.3, to fix Windows problem
2014-12-29 17:13:47 +01:00
Alex Ivanov 66133d7f22 Change maximum display name length for staff 2014-12-28 17:50:49 +02:00
Vishwas Babu A J 6f16786aa8 updating migration script v_230 as a aworkaround for a flyway bug 2014-12-28 07:42:48 -08:00
Markus Geiß 56a12e3af4 Merge pull request #1221 from MegaAlex/qa-staff1
(y)
2014-12-28 15:48:29 +01:00
Vishwas Babu A J 8e52dd2a1e Merge pull request #1219 from satish-conflux/MIFOSX-1670-1
Role Functionality with test cases
2014-12-28 05:36:19 -08:00
Mohammed Nafees d8bcbba79c MIFOSX-1786 Allow usage of UGD (Templates) for Hooks 2014-12-28 00:18:29 +05:30
Alex Ivanov 3425d762f0 Add Staff creation test cases 2014-12-27 16:44:57 +02:00
Michael Vorburger 8971723d96 Upgraded MariaDB4j dependency from v2.1.1 to v2.1.3, to fix Windows problem 2014-12-27 01:41:06 +01:00
Satish Sajjan 9b3f56f6f6 Role Functionality with test cases 2014-12-26 17:51:36 +05:30
Vishwas Babu A J a19d345d88 release number bumped up for 1.26 release 2014-12-23 09:26:02 -08:00
Vishwas Babu A J dc979da263 schema update was missed out for 1.26 release 2014-12-23 09:18:52 -08:00
Vishwas Babu A J 6f0d24ee98 Update CHANGELOG.md 2014-12-23 08:44:48 -08:00
Vishwas Babu A J fe0438a2ac Update CHANGELOG.md
fixing typos
2014-12-22 01:12:31 -08:00
Vishwas Babu A J 26c8ce6cbe Update CHANGELOG.md
for 1.26 release
2014-12-22 01:09:57 -08:00
Vishwas Babu A J da79d20049 Update CHANGELOG.md
for 1.26 release
2014-12-22 01:07:50 -08:00
Vishwas Babu A J 827e6bdbfb Merge pull request #1211 from openMF/revert-1210-develop
Revert "update V197__updated_loan_running_balance_of_transactions.sql wi...
2014-12-19 04:28:59 -08:00
Vishwas Babu A J 38ffaba65b Revert "update V197__updated_loan_running_balance_of_transactions.sql with a stored procedure" 2014-12-19 04:28:47 -08:00
Vishwas Babu A J b783bc5fad Merge pull request #1210 from sughosh88/develop
update V197__updated_loan_running_balance_of_transactions.sql with a stored procedure
2014-12-19 01:14:04 -08:00
Sughosh 54a45c5e41 update V197__updated_loan_running_balance_of_transactions.sql with a stored procedure 2014-12-19 14:06:10 +05:30
Vishwas Babu A J 436bdfd538 Merge pull request #1209 from MegaAlex/MIFOSX-1739
MIFOSX-1739 Add option to show only active loan products
2014-12-18 19:05:10 -08:00
Vishwas Babu A J 532425626e remove compilation warnings furing gradle build 2014-12-18 19:00:53 -08:00
Vishwas Babu A J a665beb1b7 bump sql patch 2014-12-18 18:51:29 -08:00
Vishwas Babu A J 7acc549a01 Merge branch 'cash_mgmt_revised' of git://github.com/binnygopinath/mifosx into binnygopinath-cash_mgmt_revised 2014-12-18 18:46:22 -08:00
Alex Ivanov 9d07e9ad7a MIFOSX-1739 Add option to show only active loan products 2014-12-19 00:32:59 +02:00
Vishwas Babu A J 19b2ce6def Merge pull request #1208 from chandrikamohith/MIFOSX-1768
MIFOSX-1768 Corrected Spelling error
2014-12-18 14:28:53 -08:00
Chandrika d7b6e22344 MIFOSX-1768 Corrected Spelling error 2014-12-18 17:12:01 -05:00
Vishwas Babu A J f72a5efb52 Merge pull request #1198 from pramodn02/MIFOSX-1744
MIFOSX-1744 : added portion of recovery incase guarantee is more than 100%
2014-12-17 17:34:22 -08:00
Vishwas Babu A J c4068df9f4 Merge pull request #1206 from chandrikamohith/MIFOSX-1766
MIFOSX-1766 Table entry is now being made for savingsOfficer in assignme...
2014-12-17 17:23:15 -08:00
Chandrika 114dcb21c4 MIFOSX-1766 Table entry is now being made for savingsOfficer in assignment history table after Approval 2014-12-17 16:55:21 -05:00
Mohammed Nafees 7ec1f9e808 MIFOSX-1756 Make it easy for Static Web Content such as the community-app to be served by the new standalone end-user server (not development) 2014-12-17 21:41:32 +05:30
Vishwas Babu A J 2cef6cfd9a Merge pull request #1204 from binaryking/develop
Add missing license headers to fix TravisCI build
2014-12-17 07:35:54 -08:00
Mohammed Nafees 7ab8a7bf8e Add missing license headers to fix TravisCI build. 2014-12-17 21:03:30 +05:30
Vishwas Babu A J 73d0017540 Merge pull request #1203 from chandrikamohith/TestCase-fix
MIFOSX-1662 fix for integration test ClientTest and removing warnings
2014-12-17 07:16:23 -08:00
Chandrika fcff48ffdc MIFOSX-1662 fix for integration test ClientTest and removing warnings 2014-12-17 10:13:36 -05:00
Vishwas Babu A J 90ac626fc1 Merge pull request #1200 from pramodn02/MIFOSX-1760
MIFOSX-1760 : corrected start date calculation for approval
2014-12-17 06:42:43 -08:00
Vishwas Babu A J d8ed1b685f Merge pull request #1199 from Nayan/MIFOSX-1680
#MIFOSX-1680 Allow to modifiy frequncy and intervals if calendar is NOT synced with any active entity
2014-12-17 06:34:16 -08:00
Pramod Nuthakki 651da79697 MIFOSX-1760 : corrected start date calculation for approval 2014-12-17 15:22:29 +05:30
Nayan 11ba1f5301 Allow to modifiy frequncy and intervals if calendar is NOT synced with any active entity 2014-12-17 15:01:19 +05:30
Pramod Nuthakki a174469d19 MIFOSX-1744 : added portion of recovery incase guarantee is more than 100% 2014-12-17 12:50:34 +05:30
Vishwas Babu A J 18dba2fe2c bumping up sql patch number 2014-12-16 20:45:08 -08:00
Vishwas Babu A J dac4c63632 Merge pull request #1169 from binnygopinath/branch_specific_products_and_charges
Branch Specific Products and Charges - initial commit
2014-12-16 18:33:14 -08:00
Vishwas Babu A J 299b52ca45 Merge branch 'develop' of git://github.com/michaeldk-miagstan/mifosx into michaeldk-miagstan-develop
Conflicts:
	mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanTransactionHelper.java
	mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/PortfolioAccountReadPlatformService.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
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformService.java
	mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformService.java
2014-12-16 18:29:31 -08:00
Vishwas Babu A J 0b9b2bb6f6 Merge pull request #1194 from MegaAlex/MIFOSX-1747
MIFOSX-1747 Don't register the basic auth filter before Spring's filter ...
2014-12-16 11:46:53 -08:00
Alex Ivanov 9160fb5f57 MIFOSX-1747 Don't register the basic auth filter before Spring's filter chain 2014-12-16 21:06:14 +02:00
Vishwas Babu A J 66cce837b5 Merge pull request #1193 from chandrikamohith/1662
MIFOSX-1662 Corrected Code Names for Reject and Withdraw.
2014-12-16 10:42:51 -08:00
Michael Vorburger 9ec0d7acd5 .travis.yml config to cache Gradle/Maven repos (~/.m2 & .gradle)
This will lead to faster PR builds, and more importantly more reliable ones, as we should have
less bad PRs due to spurious build failures due to unreachable http://repository.pentaho.org.
With Doc + cache APT too (just as an example for later NPM builds)
2014-12-16 19:34:33 +01:00
Chandrika 88a7ffd75a MIFOSX-1662 Corrected Code Names for Reject and Withdraw. 2014-12-16 13:31:17 -05:00
Michael Vorburger 45790c3a60 Merge pull request #1189 from MegaAlex/MIFOSX-1701
MIFOSX-1701 Add option to display only active group members
2014-12-16 19:18:32 +01:00
Michael Vorburger ba52924e2f Added missing license headers which made all the PRs fail on Travis. 2014-12-16 19:02:53 +01:00
Pramod Nuthakki 00d00551ad MIFOSX-1464 : added loan installment round-off 2014-12-16 15:17:42 +05:30
Vishwas Babu A J f98edc8781 Merge pull request #1191 from chandrikamohith/TestCase
MIFOSX-1717,MIFOSX-1662 Test case for account number preferences and Cod...
2014-12-15 18:31:29 -08:00
Chandrika d24839267f MIFOSX-1717,MIFOSX-1662 Test case for account number preferences and Code Refactoring for Client status. 2014-12-15 18:29:30 -05:00
Alex Ivanov 312f016a56 MIFOSX-1701 Add option to display only active group members
Complete documentation for the retrieving group call
2014-12-15 21:59:57 +02:00
Vishwas Babu A J a9850c50da removing merge conflicts introduced in https://github.com/openMF/mifosx/pull/1174 2014-12-14 23:36:10 -08:00
Vishwas Babu A J 9e6f8a8e40 Merge pull request #1174 from MithunKashyap/MIFOSX-1663_New
Mifos-1663:added more flexibilty for center/group meeting reschedule
2014-12-14 23:26:53 -08:00
Michael Vorburger 2c511e8e28 Merge pull request #1187 from binaryking/MIFOSX-969
MIFOSX-969 Missing API Documentation for Collection Sheets
2014-12-13 19:01:11 +01:00
Mohammed Nafees 8192e55942 MIFOSX-969 Missing API Documentation for Collection Sheets 2014-12-13 23:14:26 +05:30
Vishwas Babu A J c94a59c66f formatting test cases 2014-12-13 09:38:43 -08:00
Vishwas Babu A J 5d5d79d46c Merge branch 'chandrikamohith-TestCase' into develop 2014-12-13 09:32:23 -08:00
Chandrika 64e78540d9 MIFOSX-1717 Integration test cases for Account Number Preferences. 2014-12-12 14:56:40 -05:00
Binny G Sreevas c0d76e0d23 Added accounting entries for allocate and settle transactions 2014-12-12 17:23:26 +05:30
Vishwas Babu A J 6e07b83075 Merge pull request #1181 from Nagaraj12/clientReject
MIFOSX-1662:Adding new statuses to Client lifecyle
2014-12-11 11:01:54 -08:00
Vishwas Babu A J a72ad7eef3 ignore failing test case 2014-12-11 08:07:30 -08:00
Vishwas Babu A J 1796310558 Merge pull request #1183 from openMF/revert-1182-develop
Revert "Test Cases for Office API. "
2014-12-11 06:17:09 -08:00
Vishwas Babu A J 243893240c Revert "Test Cases for Office API. " 2014-12-11 06:17:00 -08:00
Markus Geiß c1d7f4a744 Merge pull request #1182 from varunVNnayar/develop
Closed (y)
2014-12-11 10:50:51 +01:00
varunVNnayar f16ae302d2 License Header Added. 2014-12-11 14:55:03 +05:30
varunVNnayar 7a2dec9987 Renaming to .java 2014-12-11 13:55:41 +05:30
varunVNnayar 632fac4d5b Test Cases for Office API. (Reformatted Code) 2014-12-11 13:49:29 +05:30
varunVNnayar fa20a9ccb3 Test cases for Office API. 2014-12-11 13:38:36 +05:30
Vishwas Babu A J 020c11c89a Merge pull request #1176 from AJLiu/develop
Added missing @Test annotation and clarified method names
2014-12-10 08:24:51 -08:00
Vishwas Babu A J 50db06a5f3 Merge pull request #1178 from binnygopinath/MIFOSX-1735
MIFOSX-1735 - sub-status of Client to be fetched during read operations
2014-12-10 08:22:17 -08:00
Vishwas Babu A J 0d21a6d60d MIFOSX-1738 should include unit test cases 2014-12-10 07:47:44 -08:00
Vishwas Babu A J ea53d0ca7c MIFOSX-1738 2014-12-10 06:29:06 -08:00
varunVNnayar f9a57a53ba Test case 1 for Office creation. 2014-12-10 18:43:40 +05:30
Vishwas Babu A J 95d74ac11b commenting out failing client test: 2014-12-10 04:42:30 -08:00
Vishwas Babu A J 81973c0da9 Merge pull request #1179 from openMF/revert-1177-develop
Revert "Integration Test Suite for Office API."
2014-12-10 04:39:39 -08:00
Vishwas Babu A J a3da63b760 Revert "Integration Test Suite for Office API." 2014-12-10 04:39:25 -08:00
Markus Geiß 9e7ce7afeb Merge pull request #1177 from varunVNnayar/develop
closed
2014-12-10 12:57:09 +01:00
varunVNnayar 6b171c5a3f OfficeHelper. 2014-12-10 17:09:20 +05:30
varunVNnayar 2478851790 Upate Office Helper! 2014-12-10 16:46:58 +05:30
Binny G Sreevas 23af79ce1b MIFOSX-1735 - sub-status of Client to be fetched during read operations 2014-12-10 10:31:19 +05:30
Anthony Liu 4caf4efb87 Added missing @Test annotation and clarified method names 2014-12-09 23:42:22 -05:00
Vishwas Babu A J 38bb259f65 updating install.md 2014-12-09 19:10:09 -08:00
Vishwas Babu A J 97ba2321ac Merge pull request #1175 from dragonkoko/patch-1
Updating Mifos Installation Platform
2014-12-09 19:05:59 -08:00
varunVNnayar 77fd8ffe53 Merge branch 'develop_Varun' into develop 2014-12-10 00:00:47 +05:30
varunVNnayar 279660e21b Office Suite
Creation of Office Suite, OfficeIntegrationTests.java ,
OfficeHelper.java, OfficeResourceHandler.java .
2014-12-10 00:00:26 +05:30
Kaloyan c1fa4be549 Updating Mifos Installation Platform
added on line 187 and 188 info about tomcat-jdbc.jar
added from line 195 to 203 upadated
2014-12-09 15:27:32 +02:00
Vishwas Babu A J f63bd6c2cf Merge pull request #1173 from pramodn02/develop
MIFOSX-1709 : added test cases and api documentation
2014-12-09 02:01:47 -08:00
MithunKashyap f48f7ed0f5 Mifos-1663:added more flexibilty for center/group meeting reschedule 2014-12-09 15:22:41 +05:30
Pramod Nuthakki 6d79d59b74 MIFOSX-1709 : added test cases and api documentation 2014-12-09 09:46:25 +05:30
Vishwas Babu A J 3d399eba10 MIFOSX-1728 2014-12-08 17:50:14 -08:00
Vishwas Babu A J 7c64de0a1c renaming ambiguously named test helper methos 2014-12-08 15:23:50 -08:00
Markus Geiß 872cbdf441 Merge pull request #1171 from MegaAlex/currencyTestSuite
Looks good (y)
2014-12-08 15:13:41 +01:00
Alex Ivanov e6402dec73 Create Currency test suite 2014-12-08 15:19:48 +02:00
Vishwas Babu A J 3d020eb6f5 Merge pull request #1147 from chandrikamohith/MIFOSX-1639
MIFOSX-1639 Adding field createStandingInstructionAtDisbursement in  Mod...
2014-12-08 01:05:28 -08:00
Markus Geiß 12dfd63a1f Merge pull request #1170 from AJLiu/develop
Looks good (y)
2014-12-08 06:57:17 +01:00
Anthony Liu e5e96319c2 Integration Test Suite for Currencies API
Includes tests for updates and for retrieves

Formatting
2014-12-08 00:37:10 -05:00
Vishwas Babu A J af6c9e2ed6 MIFOSX-1727 2014-12-07 19:47:19 -08:00
Vishwas Babu A J 452d97cfb0 updates to MIFOSX-1700 2014-12-07 13:59:10 -08:00
Vishwas Babu A J 002ef06d51 MIFOSX-1700 2014-12-06 21:49:20 -08:00
Vishwas Babu A J 990cab63cf remove warnings 2014-12-06 10:37:39 -08:00
Vishwas Babu A J cb48a79e24 formatting savings classes 2014-12-06 10:23:22 -08:00
Binny G Sreevas 9d11434ee7 Branch Specific Products and Charges - initial commit 2014-12-06 14:16:28 +05:30
Vishwas Babu A J c7f3f416ad updates to CalendarInstance Repository 2014-12-05 22:30:24 -08:00
Nagaraj Reddy a389088709 MIFOSX-1662:Adding new statuses to Client lifecyle 2014-12-05 16:11:05 +05:30
Binny G Sreevas 44c9e48479 Opening Balances: initial commit 2014-11-21 20:41:54 +05:30
Chandrika aeb3f051aa MIFOSX-1639 Adding field createStandingInstructionAtDisbursement in Modify Loan 2014-11-20 15:34:02 -05:00
Binny G Sreevas 5afed47767 Cash Management initial commit 2014-11-20 14:35:42 +05:30
Michael Duku-Kaakyire ed03a3078a [MIFOSX-1514] Refund for Active Loans 2014-11-01 02:10:14 +02:00
917 changed files with 48513 additions and 12758 deletions
+4
View File
@@ -0,0 +1,4 @@
[submodule "apps/community-app"]
path = apps/community-app
url = https://github.com/openMF/community-app.git
branch = develop
+9
View File
@@ -1,3 +1,6 @@
# This (sudo: false) is needed to "run on container-based infrastructure" on which cache: is available
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false
language: java
jdk:
- openjdk7
@@ -9,3 +12,9 @@ notifications:
# @see http://gradle.1045684.n5.nabble.com/Plain-console-output-td5710237.html
env:
- TERM=dumb
# http://docs.travis-ci.com/user/caching/#Arbitrary-directories
cache:
apt: true
directories:
- $HOME/.gradle
- $HOME/.m2
+266
View File
@@ -6,6 +6,9 @@ See VERSIONING (https://github.com/openMF/mifosx/blob/master/VERSIONING.md) for
Releases
===============
1. 18 May 2015 - 15.03.1.RELEASE
1. 06 Apr 2015 - 15.03.RELEASE
1. 22 Dec 2014 - 1.26.0.RELEASE
1. 1 Nov 2014 - 1.25.1.RELEASE
1. 12 Oct 2014 - 1.25.0.RELEASE
1. 10 Jul 2014 - 1.24.0.RELEASE
@@ -68,6 +71,269 @@ Releases
1. 05 April 2013 - 0.11.1.beta
1. 05 April 2013 - 0.11.0.beta
15.03.1.RELEASE
=============
This minor release ships new functionality like the ability to create loans products whose interest compounding periods may be different from their rest periods and
allowing extension of repayment schedule for daily loans when repayments fall on holidays along with a number of bug fixes and improvements to the Community app.
Important note on API breaking changes for app developers: As a part of the changes made for MIFOSX-2036, Group and center template API's no longer return details of "clientOptions" and "groupMemberOptions".
You are requested to use /clients and /groups API's with the newly introduced query parameter "orphansOnly" for retrieving details of Clients and Groups which may be associated with particular Groups and Centers respectively.
Sample usage of the same can be found on the "manage members" section on the Group profile screen and "Manage Groups" section of the Center profile screen
Platform & API
New Features & Improvements
- [MIFOSX-1951] - As a operations manager, I want to define loan products that allows interest compounding period to be different from rest period
- [MIFOSX-1983] - Allow extending repayment schedule for Daily loans when repayments fall on holidays
- [MIFOSX-2035] - Add new boolean parameter orphansOnly to retrieve all clients API
- [MIFOSX-2002] - allow search client by mobile_no
Bugs
- [MIFOSX-1831] - Journal entries for "Overpayment Liability" is not getting created for Periodic and Upfront accounting
- [MIFOSX-1955] - Cashier transaction beyond specified date should not be displayed for particular cashier in Teller cash management
- [MIFOSX-2004] - Not Able to modify Loan Application After Undo Disbursal And Undo Approval with Guarantor Attached
- [MIFOSX-1988] - Tranche loan Summary displays entire approved amount as disbursed amount even though the second and higher tranches are not yet disbursed.
- [MIFOSX-1995] - Prepay of loan with Grace on Interest is not working as expected
- [MIFOSX-1891] - Problem with scheduling day loan repayments
- [MIFOSX-1668] - Non-working day's repayment activity
- [MIFOSX-2007] - Unable to list Hooks defined in the system
- [MIFOSX-2032] - Teller Cash Management not handling multiple currencies accurately
- [MIFOSX-2037] - Payment type is not getting displayed in Individual collection sheet
- [MIFOSX-2043] - Password preferences API does not support Localization
- [MIFOSX-2046] - overpaid loans don't get transferred along when transferring of clients
- [MIFOSX-1956] - Accounting multi-currency opening balance
- [MIFOSX-2036] - Refactoring Groups and Centers API - removing clientOptions and groupMemberOptions for template true
Community App
- [MIFOSX-1596] - If a stretchy report's query is modified and submitted, it does not save the modified query. It shows the previously defined query.
- [MIFOSX-1982] - Formatting issues with Stretchy reports
- [MIFOSX-1985] - Unable to create weekly meetings with recurrence of every 4 weeks
- [MIFOSX-1986] - Editing a meeting redirects to home page
- [MIFOSX-1991] - Client Transfer - should allow selecting any group in the particular office
- [MIFOSX-2008] - Enable Vietnamese (tiếng Việt) on the community App
- [MIFOSX-2028] - Dynamic Typeahead for Manage Members and Groups
- [MIFOSX-1979] - Introduce Better pagination for Groups and centers
- [MIFOSX-1980] - Display Account Id and External ID for groups on Group search screen
- [MIFOSX-1993] - Create GL Account - improve order of fields
- [MIFOSX-1286] - Expand the scope of the "Filter by name/account#/staff/office" filter to filter all data rather than just the data visible on a page.
- [MIFOSX-1996] - Issues with search in Client listing page
- [MIFOSX-1999] - Issues related to Working days functionality
- [MIFOSX-2000] - Not able to edit loan product when recalculate interest is enabled and Frequency of compounding != None
- [MIFOSX-2022] - Force password reset days is not working as expected
- [MIFOSX-2023] - Force password reset - issue 2
- [MIFOSX-2026] - Issues with editing system reports
- [MIFOSX-2029] - Small typo on passwordpreferences screen
15.03.RELEASE
=============
This feature release ships new functionality like Collection sheets for Individual loans along with performance improvements around batch jobs and various enhancements to the community app.
Enhamcements to the the loans module include the ability to round off installments, fix EMI's for non-tranche loans, improved flexility for pre-closure, ability to specify which loan product attributes may be overridden at an indivdual account level and greater flexibility around editing tranche definitions during loan approval and disbursal.
Recurring deposits have been enhanced to support open-ended deposits (no maturity amount or period)
Beta API's shipped in this release add the functionality for setting opening balances for GL accounts and Entity mapping (can be used to map products and charges to Offices or Roles)
Note that this release moves "Payments types" from Code values to thier own tables, custom reports and queries might be affected as a result of the same
Platform & API
New Features & Improvements
- [MIFOSX-1742] - Collection Sheet facility for individual loans.
- [MIFOSX-1464] - Loan repayment - Rounding off
- [MIFOSX-1844] - Last installment amount should not exceed the specified EMI amount.
- [MIFOSX-1667] - As a system Administrator, I must be able to decide which attributes of a loan product may be overridden by the loan account
- [MIFOSX-1918] - Allow full installment interest to be collected at time of pre-closure of loan
- [MIFOSX-1868] - Ability to have user passwords never expire
- [MIFOSX-1823] - Add facility to print receipts for all transactions for Savings
- [MIFOSX-1875] - Enforce strict password policies in the system
- [MIFOSX-1824] - Ability to allow user to change Tranche amount during loan approval stage.
- [MIFOSX-1897] - As an accountant I want to be able to see all journals related to a specific loan or savings
- [MIFOSX-1850] - Recurring deposits without maturity date/amount
- [MIFOSX-916] - Ability for Client Loan repayments rounding off to the multiples of 10s or 100s
- [MIFOSX-1159] - Allow Opening Balances to be set for GL (General Ledger) Accounts
- [MIFOSX-1842] - Improvements to disbursal of tranche loans
- [MIFOSX-1480] - Create an API for associating and diassociating groups from centers
- [MIFOSX-1877] - Allow end-user to reconfigure working-days for the institution
- [MIFOSX-1947] - Add API to allow capturing Staff images
- [MIFOSX-1670] - Require modification/deleting of created Role
- [MIFOSX-1817] - Teller Cash Management - capture Currency for Settle and Allocate transactions
- [MIFOSX-1624] - Ability to writeoff loan on the same date of last transaction.
- [MIFOSX-1904] - Move Payment Types to their own table
- [MIFOSX-1846] - Feature to display and print Loan Transaction Receipt
- [MIFOSX-1786] - Allow usage of UGD (Templates) for Hooks
- [MIFOSX-1758] - Make the dist ZIP include the community-app in apps/ so that it works OOB
- [MIFOSX-1908] - Configurable retries on CannotAcquireLockException or ObjectOptimisticLockingFailureException
- [MIFOSX-1613] - The overdue status of a loan should appear only when the principal outstanding from the running schedule is greater than the principal outstanding from the original schedule when compared on current date.
Bugs
- [MIFOSX-1116] - Wrong maturity amount is shown when closing recurring deposit account
- [MIFOSX-1481] - you cannot write off a loan after making a repayment
- [MIFOSX-1729] - Installment amount exceeds the specified emi amount if there are multiple disbursals before the first repayment date.
- [MIFOSX-1776] - Group loan application synk repayment with meeting is not working as expected
- [MIFOSX-1808] - After moving the group from one center to another "Center Summary" is not geting updated
- [MIFOSX-1809] - Closure reason created for Group is displaying in Closure reason for Centers while closing the Center.
- [MIFOSX-1830] - Print report icon is not visible in UI for savings transaction receipt and receipt is coming for reverse transaction
- [MIFOSX-1836] - Can't Transfer Clients between Groups
- [MIFOSX-1839] - Issue related to Show Payment Details in Loans and Savings account Transactions
- [MIFOSX-1847] - Data tables - can be deleted - even if data exists
- [MIFOSX-1859] - no error indication while doing duplicate entry of one client identifier's Unique ID in another client's identifier's ID
- [MIFOSX-1860] - Not able to disburse Second Tranche loan if First repayment date is defined.
- [MIFOSX-1864] - cannot remove all Mappping Fees,Penalties to Income Accounts
- [MIFOSX-1866] - Guarantor Release funds causes 500 error
- [MIFOSX-1878] - Savings account timeline does not include the data of the user that activated the account
- [MIFOSX-1884] - Unable to create a loan account with given loan product definition (tranche loan)
- [MIFOSX-1885] - Not able to disassociate a Client from attached Group even if he is not having any active JLG loans under that Group
- [MIFOSX-1892] - Issues related to Teller/Cashier Management
- [MIFOSX-1905] - Consistency w.r.t spelling "principalThresholdForLastInstalment" for loan products
- [MIFOSX-1914] - Not able to create loan product with "Principal Threshold (%) for Last Instalment" field added
- [MIFOSX-1915] - Repayment schedule is not getting generated as per loan term, rather displaying more term with principal due
- [MIFOSX-1926] - https://github.com/openMF/community-app/issues/1285
- [MIFOSX-1940] - Accounting running balance job hangs when updating 400,000 or more entries
- [MIFOSX-1942] - Edit Tranche option in community app takes you to the wrong page
- [MIFOSX-1943] - UI issue in Loan Tranche Details tab - Edit tranche icon is not displayed
- [MIFOSX-451] - Not able to close the loan earlier than its scheduled date.
- [MIFOSX-1759] - Manage Group under center and Manage member under Group pages are not working as expected
- [MIFOSX-1766] - Issues related to Assign and Unassign staff for Savings account
- [MIFOSX-1941] - Incorrect GL Account running balance figures
- [MIFOSX-1948] - Period accruals jobs does not handle Timezones correctly
Community app
- [MIFOSX-1888] - Allow a UI configuration to specify which fields should be editable/read only/hidden on the loan account creation page
- [MIFOSX-1139] - Cleaner error message when Community app tries to connect to an Invalid Platform URL
- [MIFOSX-1825] - Add feature to bulk create loans (group wise)
- [MIFOSX-1232] - Inconsistent terminology in Loan Product creation regarding loan cycle / borrower cycle
- [MIFOSX-1293] - Add select all option to Pending Tasks in Checker Inbox and Tasks
- [MIFOSX-1312] - When viewing a group loan, the group name does not display
- [MIFOSX-1903] - Enable easier view of Journal entries created by loan transactions on the Community Application
- [MIFOSX-1555] - UI updates to Group screen and applying number formats across the community app
- [MIFOSX-1787] - Audit trails - Advanced search is not working as expected
- [MIFOSX-1685] - Improve browser-back navigation
- [MIFOSX-1690] - Huge dropdown list during account transfers
- [MIFOSX-1693] - Chart of Accounts - display improvements
- [MIFOSX-1605] - In Edit Recurring deposit product page not able "For Pre-mature Closure: on" field is not working
- [MIFOSX-1617] - Better pagination service
- [MIFOSX-1621] - Manage Members on group profile does not behave properly when adding first client to a group
- [MIFOSX-1754] - Typo in Create Loan Product >> Accounting >> Cash (should be losses written off)
- [MIFOSX-1583] - "Help" menu choice on mifos menu should be renamed or linked to the User Manual
- [MIFOSX-1590] - Moving icons on Accounting Menu page distracting
- [MIFOSX-1602] - Including Mifos X release details in Community-App as about info
- [MIFOSX-1793] - Typo's in index.html
- [MIFOSX-1833] - In the Add journal entry - Drop down accounts should be sorted with respect to gl code
- [MIFOSX-1920] - Hiding Of Deleted Guarantors
- [MIFOSX-1777] - Add tooltips for Fixed and Recurring Deposit product labels
- [MIFOSX-1778] - Add tooltips for Loan Product Field labels Pt. 1
- [MIFOSX-1779] - Add tooltips for Loan Product Field labels Pt. 2
- [MIFOSX-1780] - Add tooltips for Loan Product Field labels Pt. 3
- [MIFOSX-1781] - Add tooltips for New Loan Account labels
- [MIFOSX-1783] - Add tooltips for Savings Product labels
- [MIFOSX-1785] - Add tooltips and glossary entires for global configuration and savings accounting labels
- [MIFOSX-1849] - Parse Error in Console while viewing a Group
- [MIFOSX-1696] - UI Improvements to Manage Roles and Permissions
- [MIFOSX-1911] - Deposit Account On Hold Transactions
- [MIFOSX-1858] - Smoother sidebar transition on mouseout
- [MIFOSX-1872] - Drop down for Account Transfers is not working
- [MIFOSX-1640] - Provide select-all checkbox when managing permissions for role
- [MIFOSX-1912] - Chrome browser - Language issue(Date format)
- [MIFOSX-1544] - While creating a Group under center should not allowed to ask for office again
- [MIFOSX-1822] - Create Sub ledger account is not working as expected
- [MIFOSX-1900] - List Keyboard shortcuts
- [MIFOSX-1960] - Add ID and External ID in Center Listing page
- [MIFOSX-1256] - Filter charge and overdue charges drop-down lists to display only valid charges (matching currency)
- [MIFOSX-1899] - Payment Details for "Frequent Postings" are not stored in the database.
- [MIFOSX-1876] - Client attendance details submitted in collection sheet is not getting updated in database
- [MIFOSX-1954] - Start date and end date got interchanged while creating the teller
- [MIFOSX-1958] - Payment details is not getting displayed if any transaction detail is viewed from Search Journal entry screen
1.26.0.RELEASE
=============
This feature release adds support for capturing guarantee requirements for loans and blocking/holding funds in guarantor accounts. It also includes various enhancements like the addition of new statuses for client life cycle, ability to map liability accounts to fees, ability to update deposit amounts for active recurring deposits and the ability to capture client images from a linked webcam along with a number of other improvements and bug fixes
Platform & API
New Features & Improvements
- [MIFOSX-1662] - Adding new statuses to Client lifecyle
- [MIFOSX-1663] - Add more flexibility for center/group meeting reschedule
- [MIFOSX-1584] - Option to set "minimum days between disbursal and first repayment"
- [MIFOSX-1641] - Configure Guarantor requirements for loan product
- [MIFOSX-1675] - Add support to capture guarantee details for loans
- [MIFOSX-1709] - Workflows for holding and releasing funds on savings account linked as guarantee to loan accounts
- [MIFOSX-1728] - Introduce tenure Min/Max constraints for Tranche loans
- [MIFOSX-1639] - Auto create standing instruction at loan disbursement
- [MIFOSX-1700] - Need ability to update deposit amounts for non interest bearing Recurring deposits
- [MIFOSX-1727] - Option to make Calendar Mandatory when disbursing JLG loan
- [MIFOSX-1068] - Option to change approved amount during loan approval
- [MIFOSX-1175] - Ability to transfer loan officer to a group
- [MIFOSX-1523] - Loan rescheduling
- [MIFOSX-1514] - Refund for Active Loans
- [MIFOSX-1463] - Keep track of manually reversed/adjusted loan repayments
- [MIFOSX-1511] - Custom Formats for Client number and account number
- [MIFOSX-1630] - Bit and DateTime data type support in DataTable API
- [MIFOSX-1619] - Add MifosX Eclipse preferences file into source control
- [MIFOSX-1642] - add sub status to client
- [MIFOSX-1628] - Log current user for loan and deposit transactions
- [MIFOSX-1634] - Add option to account fees as liabilities
- [MIFOSX-1638] - Waiving charges attached to zero balance installments - Loan Rescheduling
- [MIFOSX-1738] - Create dev and production profiles for Gradle build
- [MIFOSX-1566] - Constraint for minimum/maximum number of client in a active group
- [MIFOSX-1680] - Option to change center meeting frequency and intervals
- [MIFOSX-1674] - Allow the description field added to m_code_value to be edited/entered
- [MIFOSX-1739] - Loan Products with close date in the past should not appear in loan account creation dropdown
Bugs
- [MIFOSX-1699] - Concurrent Savings transactions are not handled correctly
- [MIFOSX-1550] - No check for NULL principal amount when creating journal entry for loan write-off
- [MIFOSX-1625] - Can't disburse loan with charges configured for periodic accruals
- [MIFOSX-1633] - Newly added pentaho reports are missing read permissions
- [MIFOSX-1655] - Updating a loan (with charges attached) after submitting throws an error
- [MIFOSX-1656] - Bulk JLG Loan application is not working as expected
- [MIFOSX-1661] - Some details provided in the Loan Product page is not displaying in the New loan application page
- [MIFOSX-1671] - User with "ALL_FUNCTIONS_READ" permission does not have access to /users/{userId} resource
- [MIFOSX-1676] - Issues with Interest posting on Fixed deposit Account
- [MIFOSX-1704] - makercheckers endpoint broken for non-superuser roles
- [MIFOSX-1747] - Issues with logging on the MifosX platform after Spring boot update
- [MIFOSX-1760] - For JLG Loans sync repayment with meeting is not working as expected after loan Approval
Community App
- [MIFOSX-1645] - In UI should not allowed to send multiple requests by submitting request for multiple times for same action
- [MIFOSX-1564] - Ability to Capture Client Image from webcams on the Community App
- [MIFOSX-1745] - Community app does not allow deleting client images
- [MIFOSX-1684] - Default current date for activation dates and submission dates
- [MIFOSX-1687] - In search screens, retain the search criteria during browser navigation
- [MIFOSX-1692] - Tree view of Chart of Accounts and Offices to have "Expand All" option
- [MIFOSX-1591] - The +JLG Loan Application on the view group page has a different colored background color than other actions in the system.
- [MIFOSX-1443] - By Clicking on client having Image/Signature, authentication page displays
- [MIFOSX-1556] - AdHoc query Search always give error when 'summary' button is clicked
- [MIFOSX-1043] - Community app does not support datatables with bit, DateTime fields
- [MIFOSX-1559] - Issues related to Manage Groups in Centers and Manage Clients in Groups
- [MIFOSX-1239] - Allow tab out from calendar control (to improve data entry efficiency)
- [MIFOSX-1529] - Showing Today's Date in Datepicker
- [MIFOSX-1546] - Improve UI for Global Configuration
- [MIFOSX-1284] - Sort entries in selection lists alphabetically
- [MIFOSX-1713] - Ability to hide values in "Approved Amount" and "Disburse Amount" for the loans under submitted and pending approval state
- [MIFOSX-1533] - Advanced Search
- [MIFOSX-1551] - System -> Audit trails- search is not working as expected
- [MIFOSX-1644] - Loans transactions history does not hide transactions which have been undone
- [MIFOSX-1730] - Unable to create Tranche loans on the community app when using a Date format other than 'dd MMMM yyyy'
- [MIFOSX-1772] - By clicking on the meeting details in Group page (under Center and meeting assigned at center level) displays calendar does not exist error message
- [MIFOSX-1575] - Reversing a journal entry does not ask for confirmation.
- [MIFOSX-1677] - When moving clients between groups, display customer ids for easier identification
- [MIFOSX-1768] - Clean up Loan product creation screen
1.25.1.RELEASE
=============
Bug Release
+3
View File
@@ -6,6 +6,9 @@ Before sending out a pull request, please ensure that the following pre-requisit
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. Any relevant database changes are encapsulated in an SQL file with the next avilable version number at https://github.com/openMF/mifosx/tree/develop/mifosng-provider/src/main/resources/sql/migrations/core_db. These patches are automatically applied by Flyway on server startup.
For any modifications to the schema which affects data on existing installations (Ex: moving columns to new table etc), ensure that the upgrade scripts are also accompanied by data migration scripts in the same patch file
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
+51 -26
View File
@@ -13,6 +13,8 @@ The release artifact (.zip file) has the following structure:
+ database ... folder contains database setup and upgrade scripts along with sample data required for installation
+ pentahoReports ... folder contains any out-of-the-box reports provided through pentaho
+ apps ... folder contains apps like community app that speak to the platform
+ runmifosx.bat ... launch script for Windows
+ runmifosx.sh ... launch script for Mac OS X and Linux
|
-- CHANGELOG.MD ... file documents changelog of project up to this release
-- CONTRIBUTORS.MD ... file provides details on contributors to project
@@ -25,14 +27,29 @@ The release artifact (.zip file) has the following structure:
## How to Install
The two ways to get up and running with mifos platform is:
The three ways to get up and running with mifos platform is:
1. Use Amazon AWS and mifosplatform public AMI to spin up a new instance in the cloud
2. Manually install the prerequisite software on your own machine, follow setup instructions and use release artifacts to get platform running yourself.
3. ~~The (and the easiest) method is to just fire up the launch script provided in the release artifact and Mifos takes care of all the database, server-side and client-side setup for you.~~ Currently Broken
## 1. Amazon Public AMI
## 1. Launch script automatic out-of-the box setup
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>
Important : Automatic setup is currently broken, please follow the instructions for **Manual Installation** instead. For details of the issue, refer comments at https://mifosforge.jira.com/browse/MIFOSX-1756
The Mifos release artifact contains two launch scripts with names starting with "**runmifosx**". One of them (the one with the *.bat* file extension) is used to launch the platform on a Windows machine while the other (which has the *.sh* file extension) is used to launch the platform on Mac OS X and Linux. Just double-click on the respective script (depending on your OS) and voila! you have your own Mifos X platform running locally on your computer.
**Note**: *In case your script does not launch by double clicking on Linux or Mac OS X, here's what you can do. Head over to bash and type the following:*
```
$ cd /path/where/runmifosx.sh/is/located
$ chmod 0755 ./runmifosx.sh
$ ./runmifosx.sh
```
## 2. 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=ap-southeast-1#launchAmi=ami-2a734b78" title="Latest Mifos Platform Public AMI">Mifos Platform AMI (ami-2a734b78)</a>
*Note:* Read through the following as you step through the AWS Wizard
@@ -47,29 +64,29 @@ The two ways to get up and running with mifos platform is:
- 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.24.0.RELEASE Public AMI
*Name:* Mifos Platform 15.03.1.RELEASE Public AMI
- AMI ID: ami-a6035af4
- AMI ID: ami-2a734b78
- Kernel ID: aki-503e7402
- Name: Mifos Platform 1.24.0.RELEASE Public AMI
- Owner: 540782944231
- Source: 540782944231/Mifos X-1.24.0 release
- Name: Mifos Platform 15.03.1.RELEASE Public AMI
- Owner: 239215483039
- Source: 239215483039/Mifos X-15.03.1 release
- Architecture: Ubuntu12.04 LTS x86_64
- Built starting from Ubuntu AMI ami-35acbb41
- Built starting from Ubuntu AMI ami-2a734b78
- Java 1.7.0_51 64 bit JVM
- Tomcat 7.0.39 (with SSL configured for self-signed certificate)
- MySql 5.5.31
## 2. Manual Installation
## 3. Manual Installation
### 2.1 Prerequisite Software
### 3.1 Prerequisite Software
Before running mifos platform you must have the following software installed:
- Oracle Java - JDK 7 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
- Oracle MySQL - (http://dev.mysql.com/downloads/)
- Apache Tomcat 7 - (http://tomcat.apache.org/download-70.cgi)
### 2.2 MySQL Setup
### 3.2 MySQL Setup
Assumption: MySQL server is now installed.
@@ -81,7 +98,7 @@ The two ways to get up and running with mifos platform is:
If you have never installed mifosplatform before follow section 2.2.1 for first time setup of database, otherwise read section 2.2.2 on database upgrades.
#### 2.2.1 First Time Database setup
#### 3.2.1 First Time Database setup
Mifos platform has support for hosting multiple tenants so we use two database schemas:
- *mifosplatform-tenants*: which is responsible for persisting the tenant information which is used when deciding what schema each incoming request in the platform should route to. It acts as a registry which contains the details of all the tenant databases, and their connection information, which is used by MifosX to connect to the appropriate tenant.
@@ -115,13 +132,13 @@ The two ways to get up and running with mifos platform is:
UPDATE tenants SET schema_username = "your_username", schema_password = "your_password" WHERE identifier = "default";
```
#### 2.2.2 Upgrade existing database(s)
#### 3.2.2 Upgrade existing database(s)
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
##### 3.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.
@@ -155,7 +172,7 @@ INSERT INTO `schema_version` (`version_rank`, `installed_rank`, `version`, `desc
(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)
#### 3.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
```
@@ -163,11 +180,11 @@ INSERT INTO `schema_version` (`version_rank`, `installed_rank`, `version`, `desc
```
### 2.3 Tomcat 7 Setup
### 3.3 Tomcat 7 Setup
Assumption: You have downloaded and installed Tomcat 7 correctly for your operation system: see http://tomcat.apache.org/tomcat-7.0-doc/setup.html
#### 2.3.1 Environment Variables Check
#### 3.3.1 Environment Variables Check
Check that the following environment variables exist:
- JAVA_HOME ... should point to directory where a 1.7 JDK or JRE is on machine
@@ -176,25 +193,26 @@ INSERT INTO `schema_version` (`version_rank`, `installed_rank`, `version`, `desc
Check that the following is on your path:
- %JAVA_HOME%\bin;
#### 2.3.2 Logging
#### 3.3.2 Logging
- In the [TOMCAT_HOME]/logs create a file called ```mifos-platform.log```
#### 2.3.3 Libraries
#### 3.3.3 Libraries
Ensure the following libraries are in the [TOMCAT_HOME]/lib folder
- tomcat-jdbc.jar
- mysql-connector-java-5.1.22 (You will need to download latest MySQL Connector/J Jar file from http://dev.mysql.com/downloads/connector/j/)
- tomcat-jdbc.jar (You can download the same from http://central.maven.org/maven2/org/apache/tomcat/tomcat-jdbc/7.0.57/tomcat-jdbc-7.0.57.jar)
- mysql-connector-java-5.1.22 (You will need to download the latest MySQL Connector/J Jar file from http://dev.mysql.com/downloads/connector/j/)
#### 2.3.4 Configure for SSL
#### 3.3.4 Configure for SSL
Generate a new keystore using java keytool (if you havent already done this):
- Follow docs to create keystore.(http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration)
- Update server.xml as in docs. (Ther server.xml configuration given in the configure tomcat 7 below is what is need.)
```sudo keytool -genkey -alias mifostom -keyalg RSA -keystore /home/ubuntu/.keystore```
#### 2.3.5 Update tomcat configuration files for SSL, compression and JNDI connection to MySql
#### 3.3.5 Update tomcat configuration files for SSL, compression and JNDI connection to MySql
```
<?xml version='1.0' encoding='utf-8'?>
@@ -263,7 +281,7 @@ INSERT INTO `schema_version` (`version_rank`, `installed_rank`, `version`, `desc
</Server>
```
#### 2.3.6 Drop application into tomcat webapps folder
#### 3.3.6 Drop application into tomcat webapps folder
Drop the following from the release artifact into the [TOMCAT_HOME]/webapps folder:
- mifosng-provider.war
@@ -272,8 +290,15 @@ INSERT INTO `schema_version` (`version_rank`, `installed_rank`, `version`, `desc
- The entire ```apps/community-app``` folder.
- The entire api-docs folder
#### 2.3.7 Startup tomcat
#### 3.3.7 Startup tomcat
Startup tomcat:
- Platform application should be available @ https://[server ip address]:8443/mifosng-provider/api/v1/offices?tenantIdentifier=default&pretty=true
- Community application should be available @ https://[server ip address]:8443/community-app?baseApiUrl=https://[server ip address]:8443/mifosng-provider/api/v1/
- API docs should be available @ https://[server ip address]:8443/api-docs/apiLive.htm
*where [server ip address] is the hostname or IP address of your computer. For instance, if you've installed Mifos on your local machine then [server ip address] is localhost*
## How to integrate the web front-end UI with the back-end
To be able to use the front-end UI along with the back-end, you simply need to copy the webapp's source code files to the ```apps``` folder. For instance, you could copy the source code files of the community app to ```apps/community-app```. This would enable you to access the commuity app from the following URL:
*https://[server ip address]:8443/mifosng-provider/apps/community-app?baseApiUrl=https://[server ip address]:8443*
+20 -28
View File
@@ -1,54 +1,46 @@
Versioning
=====
For releases, we follow a simplified date versioning scheme which ties in nicely with our time based release cycle (with stables releases being promoted on a three month cycle)
For releases we will follow semantic versioning approach. (http://semver.org/)
Prior to 15.03.RELEASE, we followed a semantic versioning approach. (http://semver.org/)
Semantic Versioning
Date Versioning
===================
Semantic versioning is a very simple scheme built around the X.Y.Z-buildNo concept (for example 2.6.0-x or 2.6.0-BUILD-SNAPSHOT):
Our date versioning scheme is built around the YY.MM.{PATCH}.{release_type} concept (for example 15.06.RELEASE or 15.06.1.BUILD-SNAPSHOT) where
Increment Z when you fix something
Increment Y when you add a new feature
Increment X when you break backwards-compatibility or add major features
Use the buildNo to differentiate different builds off the same branch, and to differentiate between development, test and production builds.
YY represents the year of the release
MM represents the month of the major release
PATCH (optional) gets incremented whenever a new release is made from an existing major release
release_type differentiates different builds off the same branch. It also differentiates between development, test and production builds.
Version structure
{number}.{release_type}
where {number} is further broken down as {major}.{minor}.{micro}.
where {number} is further broken down as YY.MM.{PATCH}.
Examples:
1.0.0.BUILD-SNAPSHOT
1.0.0.M1
1.0.0.RC1
1.0.0.RELEASE
15.03.BUILD-SNAPSHOT
15.03.M1
15.03.RC1
15.03.RELEASE
15.03.1.RC1
15.03.1.RELEASE
Number semantics
major/minor/micro semantics may have some variance across projects but in general this is what we mean.
In general:
a major version suggests many significant new features, an associated marketing campaign, and possible breaking of backward compatibility.
a minor version may also contain serious new features, but should not break compatibility. You can expect minor releases every 1-3 months.
a micro version typically contains many bug fixes and improvements and perhaps several smaller new features. You can expect micro version approximately every 5-20 days (depending on bugs or suggested improvements).
a major version (Ex:15.03) does not have a patch number and suggests many significant new features, an associated marketing campaign, and possible breaking of backward compatibility. You can expect major releases every 3 months
a minor version (Ex:15.03.1) may also contain serious new features, but typically contains many bug fixes and improvements and does not break compatibility. You can expect minor releases between the quarterly major release cycle.
Order matters
Notice that the following sequence of versions is in ordered ascending both alphabetically and toward GA:
1.0.0.BUILD-SNAPSHOT
1.0.0.M1
1.0.0.RC1
1.0.0.RELEASE
What You Should Install Where
As a rule of thumb …
As a rule of thumb …
Snapshot or Milestone versions should only be installed on dev boxes and integration environments. They shouldn’t be deployed to any of the dedicated test environments.
Snapshot or Milestone versions should only be installed on dev boxes and integration environments. They shouldn’t be deployed to any of the dedicated test environments.
Release candidates should be installed in the dedicated test environments. In an emergency, a release candidate can be installed into the production environment.
Production releases can be installed anywhere - and they are the only kind of build that should be installed into the production environment.
Production releases can be installed anywhere - and they are the only kind of build that should be installed into the production environment.
+3809 -1083
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -192,7 +192,7 @@ body {
.flybar-nav {
display: block;
float: left;
width: 90px;
min-width: 90px;
position: relative;
}
+14
View File
@@ -3,6 +3,20 @@ Mifos Platform Apps
Community created apps built on top of mifosplatform are stored in source control repository @ https://github.com/openMF/
To get the Git sub modules from here, use "--recursive" in your original git clone, or, if already cloned, do:
git submodule update --init --recursive; git submodule status
Later to update both this main repo but also get the latest from the submodule(s), do:
git pull; git submodule update --remote
Here is how a new Git submodule can (was originally) added here:
git submodule add -b develop https://github.com/openMF/community-app.git
git submodule init
The Community App (AngularJS-based)
===============
https://github.com/openMF/community-app
Submodule apps/community-app added at e4cf52eb74
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
# https://developer.cloudbees.com/bin/view/DEV/Node+Builds
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.11.12 . ./use-node
./build.sh
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Exit the script if any command returns a non-true return value (http://www.davidpashley.com/articles/writing-robust-shell-scripts/)
set -e
git --version
# TODO UNCOMMENT THIS once https://github.com/openMF/mifosx/pull/1291 is merged!
# git pull
# This does NOT get the most recent revision from the submodule repository.
# Instead, it only gets the revision of the submodule that is recorded in the revision of the main repository.
## NOT git submodule update --remote
# The following is very important, because even if the main (API) repo is latest,
# the sub-module initially will be a fixed old rev. and only this grabs real latest:
git submodule foreach 'git checkout develop && git pull --ff-only origin develop'
cd apps/community-app
./build.sh
cd ../../mifosng-provider/
./gradlew -Penv=dev clean dist
+36 -98
View File
@@ -24,6 +24,7 @@ apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'tomcat'
apply plugin: 'project-report'
apply plugin: 'java'
/* define the valid syntax level for source files */
sourceCompatibility = JavaVersion.VERSION_1_7
@@ -44,7 +45,7 @@ group = 'org.mifosplatform'
repositories {
jcenter()
maven {
url "http://repository.pentaho.org/artifactory/pentaho/"
url "http://nexus.pentaho.org/content/repositories/pentaho-public-release-repos/"
}
// mavenLocal() // useful for local dev using MariaDB4j SNAPSHOTs (not needed for real-world non-SNAPHOT builds)
}
@@ -56,110 +57,28 @@ configurations {
runtime
all*.exclude group: 'commons-logging'
}
dependencies {
def tomcatVersion = '7.0.54'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${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'],
)
compile(
[group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.1'],
[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],
[group: 'com.sun.jersey', name: 'jersey-servlet', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-server', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-json', version: jerseyVersion],
[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: '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.3'],
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
// 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: 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'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions-scripting', version: '3.9.1-GA'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-wizard-core', version: '3.9.1-GA'],
[group: 'pentaho-report-designer', name: 'pentaho-reporting-engine-wizard-xul', version: '3.9.1-GA'],
[group: 'pentaho-library', name: 'libbase', version: '1.2.8'],
[group: 'pentaho-library',name: 'libdocbundle', version: '1.2.8'],
[group: 'pentaho-library',name: 'libfonts', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformat', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformula', version: '1.2.8'],
[group: 'pentaho-library',name: 'libloader', version: '1.2.8'],
[group: 'pentaho-library',name: 'librepository', version: '1.2.8'],
[group: 'pentaho-library',name: 'libserializer', version: '1.2.8'],
[group: 'pentaho-library',name: 'libsparkline', version: '1.2.8'],
[group: 'pentaho-library',name: 'libxml', version: '1.2.8'],
[group: 'org.apache.poi',name: 'poi', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml-schemas', version: '3.9'],
[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-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.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
// 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]
/* Pick up dependencies based on the environemnt, defaults to production */
if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
apply from: 'dev-dependencies.gradle'
} else {
apply from: 'dependencies.gradle'
}
task dist(type:Zip){
baseName= 'mifosplatform'
baseName = 'mifosplatform'
version = qualifyVersionIfNecessary(releaseVersion)
includeEmptyDirs = true
from('../') {
fileMode = 0755
include '*.md'
}
from('src/main/dist') {
fileMode = 0755
include '*'
}
from('../apps') {
fileMode = 0755
include '*.md'
include '**/*'
into('apps')
}
from('src/main/pentahoReports/') {
@@ -206,7 +125,7 @@ war {
license {
header rootProject.file('../LICENSE.md')
excludes(["**/*.mustache", "**/*.sql", "**/package-info.java", "**/keystore.jks"])
excludes(["**/*.html", "**/*.mustache", "**/*.sql", "**/package-info.java", "**/keystore.jks"])
strictCheck true
}
@@ -234,8 +153,26 @@ tomcatRunWar {
sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir
sourceSets.test.output.resourcesDir = sourceSets.test.output.classesDir
/* Exclude maria db and embedded tomcat related files for non dev builds */
if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
sourceSets {
integrationTest {
main {
java {
exclude '**/Server*'
exclude '**/MariaDB4j*'
exclude '**/EmbeddedTomcatWithSSLConfiguration.java'
}
}
test {
java {
exclude '**/core/boot/tests/**'
}
}
}
}
sourceSets {
integrationTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
@@ -325,7 +262,8 @@ task migrateTenantDB<<{
flyway.url= "jdbc:mysql://localhost:3306/$tenantDbName"
flyway.locations= [filePath]
/**We use ${ as the prefix for strecthy reporting, do not want them to be interpreted by Flyway**/
flyway.placeholderPrefix = "\$\${"
flywayMigrate.execute()
}
+94
View File
@@ -0,0 +1,94 @@
dependencies {
def tomcatVersion = '7.0.54'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${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'],
)
compile(
// [group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.3'],
[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],
[group: 'com.sun.jersey', name: 'jersey-servlet', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-server', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-json', version: jerseyVersion],
[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: '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.3'],
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
// 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: 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'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions-scripting', version: '3.9.1-GA'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-wizard-core', version: '3.9.1-GA'],
[group: 'pentaho-report-designer', name: 'pentaho-reporting-engine-wizard-xul', version: '3.9.1-GA'],
[group: 'pentaho-library', name: 'libbase', version: '1.2.8'],
[group: 'pentaho-library',name: 'libdocbundle', version: '1.2.8'],
[group: 'pentaho-library',name: 'libfonts', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformat', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformula', version: '1.2.8'],
[group: 'pentaho-library',name: 'libloader', version: '1.2.8'],
[group: 'pentaho-library',name: 'librepository', version: '1.2.8'],
[group: 'pentaho-library',name: 'libserializer', version: '1.2.8'],
[group: 'pentaho-library',name: 'libsparkline', version: '1.2.8'],
[group: 'pentaho-library',name: 'libxml', version: '1.2.8'],
[group: 'org.apache.poi',name: 'poi', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml-schemas', version: '3.9'],
[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-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.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
// 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'],
// Once we've switched to Java 8 this dep can be removed.
[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
)
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]
}
+94
View File
@@ -0,0 +1,94 @@
dependencies {
def tomcatVersion = '7.0.54'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${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'],
)
compile(
[group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.3'],
[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],
[group: 'com.sun.jersey', name: 'jersey-servlet', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-server', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-json', version: jerseyVersion],
[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: '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.3'],
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
// 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: 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'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions-scripting', version: '3.9.1-GA'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-wizard-core', version: '3.9.1-GA'],
[group: 'pentaho-report-designer', name: 'pentaho-reporting-engine-wizard-xul', version: '3.9.1-GA'],
[group: 'pentaho-library', name: 'libbase', version: '1.2.8'],
[group: 'pentaho-library',name: 'libdocbundle', version: '1.2.8'],
[group: 'pentaho-library',name: 'libfonts', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformat', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformula', version: '1.2.8'],
[group: 'pentaho-library',name: 'libloader', version: '1.2.8'],
[group: 'pentaho-library',name: 'librepository', version: '1.2.8'],
[group: 'pentaho-library',name: 'libserializer', version: '1.2.8'],
[group: 'pentaho-library',name: 'libsparkline', version: '1.2.8'],
[group: 'pentaho-library',name: 'libxml', version: '1.2.8'],
[group: 'org.apache.poi',name: 'poi', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml-schemas', version: '3.9'],
[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-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.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
// 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'],
// Once we've switched to Java 8 this dep can be removed.
[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
)
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]
}
+1 -1
View File
@@ -1,4 +1,4 @@
releaseVersion=1.25.1.RELEASE
releaseVersion=15.03.1.RELEASE
+2 -2
View File
@@ -9,8 +9,8 @@
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8005,server=y,suspend=n"
CATALINA_OPTS="-Xms512m -Xmx512m"
JAVA_OPTS="-Xms512m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=512m"
CATALINA_OPTS="-Xms512m -Xmx2048m"
JAVA_OPTS="-Xms512m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m"
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
@@ -0,0 +1,473 @@
/**
* 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.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.CenterDomain;
import org.mifosplatform.integrationtests.common.CenterHelper;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.GroupHelper;
import org.mifosplatform.integrationtests.common.OfficeHelper;
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.LoanTransactionHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
import org.mifosplatform.integrationtests.common.savings.SavingsProductHelper;
import org.mifosplatform.integrationtests.common.system.AccountNumberPreferencesHelper;
import org.mifosplatform.integrationtests.common.system.CodeHelper;
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 AccountNumberPreferencesTest {
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
private ResponseSpecification responseValidationError;
private ResponseSpecification responseNotFoundError;
private ResponseSpecification responseForbiddenError;
private Integer clientId;
private Integer loanProductId;
private Integer loanId;
private Integer savingsProductId;
private Integer savingsId;
private final String loanPrincipalAmount = "100000.00";
private final String numberOfRepayments = "12";
private final String interestRatePerPeriod = "18";
private final String dateString = "4 September 2014";
private final String minBalanceForInterestCalculation = null;
private final String minRequiredBalance = null;
private final String enforceMinRequiredBalance = "false";
private LoanTransactionHelper loanTransactionHelper;
private SavingsAccountHelper savingsAccountHelper;
private AccountNumberPreferencesHelper accountNumberPreferencesHelper;
private Integer clientAccountNumberPreferenceId;
private Integer loanAccountNumberPreferenceId;
private Integer savingsAccountNumberPreferenceId;
private Integer groupsAccountNumberPreferenceId;
private Integer centerAccountNumberPreferenceId;
private final String MINIMUM_OPENING_BALANCE = "1000.0";
private final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
private Boolean isAccountPreferenceSetUp = false;
private Integer clientTypeCodeId;
private String clientCodeValueName;
private Integer clientCodeValueId;
private final String clientTypeName = "CLIENT_TYPE";
private final String officeName = "OFFICE_NAME";
private final String loanShortName = "LOAN_PRODUCT_SHORT_NAME";
private final String savingsShortName = "SAVINGS_PRODUCT_SHORT_NAME";
private Integer groupID;
private Integer centerId;
private String groupAccountNo;
@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.responseValidationError = new ResponseSpecBuilder().expectStatusCode(400).build();
this.responseNotFoundError = new ResponseSpecBuilder().expectStatusCode(404).build();
this.responseForbiddenError = new ResponseSpecBuilder().expectStatusCode(403).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.accountNumberPreferencesHelper = new AccountNumberPreferencesHelper(this.requestSpec, this.responseSpec);
}
@Test
public void testAccountNumberPreferences() {
/* Create Loan and Savings Product */
this.createLoanAndSavingsProduct();
/* Ensure no account number preferences are present in the system */
this.deleteAllAccountNumberPreferences();
/*
* Validate the default account number generation rules for clients,
* loans and savings accounts.
*/
this.validateDefaultAccountNumberGeneration();
/* Create and Validate account number preferences */
this.createAccountNumberPreference();
/*
* Validate account number preference rules apply to Clients,Loans and
* Saving Accounts
*/
this.validateAccountNumberGenerationWithPreferences();
/* Validate account number preferences Updation */
this.updateAccountNumberPreference();
/*
* Validate account number preference rules apply to Clients,Loans and
* Saving Accounts after Updation
*/
this.validateAccountNumberGenerationWithPreferences();
/* Delete all account number preferences */
this.deleteAllAccountNumberPreferences();
}
private void createLoanAndSavingsProduct() {
this.createLoanProduct();
this.createSavingsProduct();
}
private void deleteAllAccountNumberPreferences() {
ArrayList<HashMap<String, Object>> preferenceIds = this.accountNumberPreferencesHelper.getAllAccountNumberPreferences();
/* Deletion of valid account preference ID */
for (HashMap<String, Object> preferenceId : preferenceIds) {
Integer id = (Integer) preferenceId.get("id");
HashMap<String, Object> delResponse = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(id, this.responseSpec,
"");
System.out.println("Successfully deleted account number preference (ID: " + delResponse.get("resourceId") + ")");
}
/* Deletion of invalid account preference ID should fail */
System.out
.println("---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
HashMap<String, Object> deletionError = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(10,
this.responseNotFoundError, "");
Assert.assertEquals("error.msg.resource.not.found", deletionError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
private void validateDefaultAccountNumberGeneration() {
this.createAndValidateClientEntity(this.isAccountPreferenceSetUp);
this.createAndValidateLoanEntity(this.isAccountPreferenceSetUp);
this.createAndValidateSavingsEntity(this.isAccountPreferenceSetUp);
this.createAndValidateGroup(this.isAccountPreferenceSetUp);
this.createAndValidateCenter(this.isAccountPreferenceSetUp);
}
private void validateAccountNumberGenerationWithPreferences() {
this.isAccountPreferenceSetUp = true;
this.createAndValidateClientEntity(this.isAccountPreferenceSetUp);
this.createAndValidateLoanEntity(this.isAccountPreferenceSetUp);
this.createAndValidateSavingsEntity(this.isAccountPreferenceSetUp);
this.createAndValidateGroup(this.isAccountPreferenceSetUp);
this.createAndValidateCenter(this.isAccountPreferenceSetUp);
}
private void createAccountNumberPreference() {
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createClientAccountNumberPreference(
this.responseSpec, "resourceId");
System.out.println("Successfully created account number preferences for Client (ID: " + this.clientAccountNumberPreferenceId);
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createLoanAccountNumberPreference(
this.responseSpec, "resourceId");
System.out.println("Successfully created account number preferences for Loan (ID: " + this.loanAccountNumberPreferenceId);
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
this.responseSpec, "resourceId");
System.out.println("Successfully created account number preferences for Savings (ID: " + this.savingsAccountNumberPreferenceId);
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createGroupsAccountNumberPreference(
this.responseSpec, "resourceId");
System.out.println("Successfully created account number preferences for Groups (ID: " + this.groupsAccountNumberPreferenceId);
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createCenterAccountNumberPreference(
this.responseSpec, "resourceId");
System.out.println("Successfully created account number preferences for Center (ID: " + this.centerAccountNumberPreferenceId);
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
this.centerAccountNumberPreferenceId, this.responseSpec, this.requestSpec);
this.createAccountNumberPreferenceInvalidData("1000", "1001");
this.createAccountNumberPreferenceDuplicateData("1", "101");
}
private void createAccountNumberPreferenceDuplicateData(final String accountType, final String prefixType) {
/* Creating account Preference with duplicate data should fail */
System.out
.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
this.responseForbiddenError, accountType, prefixType, "");
Assert.assertEquals("error.msg.account.number.format.duplicate.account.type",
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
private void createAccountNumberPreferenceInvalidData(final String accountType, final String prefixType) {
/* Creating account Preference with invalid data should fail */
System.out
.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
HashMap<String, Object> creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
this.responseValidationError, accountType, prefixType, "");
if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
"validation.msg.accountNumberFormat.accountType.is.not.within.expected.range")) {
Assert.assertEquals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range",
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
} else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals(
"validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations")) {
Assert.assertEquals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations",
creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
}
private void updateAccountNumberPreference() {
HashMap<String, Object> accountNumberPreferences = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
System.out.println("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID "
+ accountNumberPreferences.get("resourceId"));
this.accountNumberPreferencesHelper.verifyUpdationOfAccountNumberPreferences((Integer) accountNumberPreferences.get("resourceId"),
this.responseSpec, this.requestSpec);
/* Update invalid account preference id should fail */
System.out
.println("---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
/* Invalid Account Type */
HashMap<String, Object> updationError = this.accountNumberPreferencesHelper.updateAccountNumberPreference(9999, "101",
this.responseNotFoundError, "");
if (updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals("error.msg.resource.not.found")) {
Assert.assertEquals("error.msg.resource.not.found", updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
/* Invalid Prefix Type */
HashMap<String, Object> updationError1 = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
this.clientAccountNumberPreferenceId, "103", this.responseValidationError, "");
Assert.assertEquals("validation.msg.validation.errors.exist", updationError1.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
private void createAndValidateClientEntity(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
if (isAccountPreferenceSetUp) {
this.createAndValidateClientBasedOnAccountPreference();
} else {
this.createAndValidateClientWithoutAccountPreference();
}
}
private void createAndValidateGroup(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec);
GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
this.groupID = GroupHelper.activateGroup(this.requestSpec, this.responseSpec, groupID.toString());
GroupHelper.verifyGroupActivatedOnServer(this.requestSpec, this.responseSpec, groupID, true);
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + this.groupID + "?" + Utils.TENANT_IDENTIFIER;
this.groupAccountNo = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "accountNo");
if (isAccountPreferenceSetUp) {
String groupsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.groupsAccountNumberPreferenceId, "prefixType.value");
if (groupsPrefixName.equals(this.officeName)) {
final String groupOfficeName = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, groupOfficeName);
}
} else {
validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, null);
}
}
private void createAndValidateCenter(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
String name = "CenterCreation" + new Timestamp(new java.util.Date().getTime());
this.centerId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
Assert.assertNotNull(center);
Assert.assertTrue(center.getName().equals(name));
if (isAccountPreferenceSetUp) {
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.centerAccountNumberPreferenceId, "prefixType.value");
final String CENTER_URL = "/mifosng-provider/api/v1/centers/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
if (centerPrefixName.equals(this.officeName)) {
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), centerOfficeName);
}
} else {
validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), null);
}
}
private void createAndValidateClientWithoutAccountPreference() {
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(this.clientId);
String clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo");
validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, null);
}
private void createAndValidateClientBasedOnAccountPreference() {
final String codeName = "ClientType";
String clientAccountNo = null;
String clientPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.clientAccountNumberPreferenceId, "prefixType.value");
if (clientPrefixName.equals(this.clientTypeName)) {
/* Retrieve Code id for the Code "ClientType" */
HashMap<String, Object> code = CodeHelper.getCodeByName(this.requestSpec, this.responseSpec, codeName);
this.clientTypeCodeId = (Integer) code.get("id");
/* Retrieve/Create Code Values for the Code "ClientType" */
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(this.clientTypeCodeId, this.requestSpec,
this.responseSpec);
this.clientCodeValueName = (String) codeValue.get("name");
this.clientCodeValueId = (Integer) codeValue.get("id");
/* Create Client with Client Type */
this.clientId = ClientHelper.createClientForAccountPreference(this.requestSpec, this.responseSpec, this.clientCodeValueId,
"clientId");
Assert.assertNotNull(clientId);
clientAccountNo = (String) ClientHelper.getClient(this.requestSpec, this.responseSpec, this.clientId.toString(), "accountNo");
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, this.clientCodeValueName);
} else if (clientPrefixName.equals(this.officeName)) {
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId);
clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo");
String officeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, officeName);
}
}
private void validateAccountNumberLengthAndStartsWithPrefix(final String accountNumber, final String prefix) {
if (prefix != null) {
Assert.assertEquals(accountNumber.length(), prefix.length() + 9);
Assert.assertTrue(accountNumber.startsWith(prefix));
} else {
Assert.assertEquals(accountNumber.length(), 9);
}
}
private void createLoanProduct() {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
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 + ")");
}
private void createAndValidateLoanEntity(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
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);
System.out.println("Loan Application :" + loanApplicationJSON);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
String loanAccountNo = (String) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, this.loanId,
"accountNo");
if (isAccountPreferenceSetUp) {
String loanPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.loanAccountNumberPreferenceId, "prefixType.value");
if (loanPrefixName.equals(this.officeName)) {
String loanOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanOfficeName);
} else if (loanPrefixName.equals(this.loanShortName)) {
String loanShortName = (String) this.loanTransactionHelper.getLoanProductDetail(this.requestSpec, this.responseSpec,
this.loanProductId, "shortName");
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanShortName);
}
System.out.println("SUCCESSFULLY CREATED LOAN APPLICATION BASED ON ACCOUNT PREFERENCES (ID: " + this.loanId + ")");
} else {
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, null);
System.out.println("SUCCESSFULLY CREATED LOAN APPLICATION (ID: " + loanId + ")");
}
}
private void createSavingsProduct() {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
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(this.MINIMUM_OPENING_BALANCE).build();
this.savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, this.requestSpec, this.responseSpec);
System.out.println("Sucessfully created savings product (ID: " + this.savingsProductId + ")");
}
private void createAndValidateSavingsEntity(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.savingsId = this.savingsAccountHelper
.applyForSavingsApplication(this.clientId, this.savingsProductId, ACCOUNT_TYPE_INDIVIDUAL);
String savingsAccountNo = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "accountNo");
if (isAccountPreferenceSetUp) {
String savingsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.savingsAccountNumberPreferenceId, "prefixType.value");
if (savingsPrefixName.equals(this.officeName)) {
String savingsOfficeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(),
"officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, savingsOfficeName);
} else if (savingsPrefixName.equals(this.savingsShortName)) {
String loanShortName = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "shortName");
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, loanShortName);
}
System.out.println("SUCCESSFULLY CREATED SAVINGS APPLICATION BASED ON ACCOUNT PREFERENCES (ID: " + this.loanId + ")");
} else {
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, null);
System.out.println("SUCCESSFULLY CREATED SAVINGS APPLICATION (ID: " + this.savingsId + ")");
}
}
}
@@ -658,6 +658,64 @@ public class AccountingScenarioIntegrationTest {
System.out.println("Repayment 5 Done ......");
}
@Test
public void checkPeriodicAccrualAccountingFlow_OVER_PAYMENT() {
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);
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);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// 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, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
final String jobName = "Add Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
// MAKE 1
System.out.println("Repayment 1 ......");
final float FIRST_INTEREST = 200.0f;
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.makeRepayment(this.REPAYMENT_DATE[1], 15000f, loanID);
float expected_value = this.LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, expected_value, loanID);
final JournalEntry[] assetAccountEntry = { new JournalEntry(15000f, JournalEntry.TransactionType.DEBIT),
new JournalEntry(1000f, JournalEntry.TransactionType.CREDIT), new JournalEntry(10000f, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1], new JournalEntry(4000f,
JournalEntry.TransactionType.CREDIT));
System.out.println("Repayment Done......");
}
@Test
public void checkPeriodicAccrualAccountingTillCurrentDateFlow() {
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -0,0 +1,248 @@
/**
* 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.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.CenterDomain;
import org.mifosplatform.integrationtests.common.CenterHelper;
import org.mifosplatform.integrationtests.common.OfficeHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.organisation.StaffHelper;
import com.google.gson.Gson;
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 CenterIntegrationTest {
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
@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 testBasicCenterCreation() {
int officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
String name = "TestBasicCreation" + new Timestamp(new java.util.Date().getTime());
int resourceId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
Assert.assertNotNull(center);
Assert.assertTrue(center.getName().equals(name));
Assert.assertTrue(center.getOfficeId() == officeId);
Assert.assertTrue(center.isActive() == false);
// Test retrieval by listing all centers
int id = CenterHelper.listCenters(requestSpec, responseSpec).get(0).getId();
Assert.assertTrue(id > 0);
CenterDomain retrievedCenter = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
Assert.assertNotNull(retrievedCenter);
Assert.assertNotNull(retrievedCenter.getName());
Assert.assertNotNull(retrievedCenter.getHierarchy());
Assert.assertNotNull(retrievedCenter.getOfficeName());
}
@Test
public void testFullCenterCreation() {
int officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime());
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
int staffId = StaffHelper.createStaff(requestSpec, responseSpec);
int[] groupMembers = generateGroupMembers(3, officeId);
int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec);
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
Assert.assertNotNull(center);
Assert.assertTrue(center.getName().equals(name));
Assert.assertTrue(center.getOfficeId() == officeId);
Assert.assertTrue(center.getExternalId().equals(externalId));
Assert.assertTrue(center.getStaffId() == staffId);
Assert.assertTrue(center.isActive() == false);
Assert.assertArrayEquals(center.getGroupMembers(), groupMembers);
}
@Test
public void testListCenters() {
ArrayList<CenterDomain> paginatedList = CenterHelper.paginatedListCenters(requestSpec, responseSpec);
ArrayList<CenterDomain> list = CenterHelper.listCenters(requestSpec, responseSpec);
Assert.assertNotNull(paginatedList);
Assert.assertNotNull(list);
Assert.assertTrue(Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]),
list.toArray(new CenterDomain[list.size()])));
}
@Test
public void testVoidCenterRetrieval() {
ArrayList<CenterDomain> arr = CenterHelper.listCenters(requestSpec, responseSpec);
int id = arr.get(arr.size() - 1).getId() + 1;
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
Assert.assertNotNull(center);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testCenterUpdate() {
int officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime());
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
int staffId = StaffHelper.createStaff(requestSpec, responseSpec);
int[] groupMembers = generateGroupMembers(3, officeId);
int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec);
String newName = "TestCenterUpdateNew" + new Timestamp(new java.util.Date().getTime());
String newExternalId = Utils.randomStringGenerator("newID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
int newStaffId = StaffHelper.createStaff(requestSpec, responseSpec);
int[] associateGroupMembers = generateGroupMembers(2, officeId);
int[] associateResponse = CenterHelper.associateGroups(resourceId, associateGroupMembers, requestSpec, responseSpec);
Arrays.sort(associateResponse);
Arrays.sort(associateGroupMembers);
Assert.assertArrayEquals(associateResponse, associateGroupMembers);
int[] newGroupMembers = new int[5];
for (int i = 0; i < 5; i++) {
if (i < 3) {
newGroupMembers[i] = groupMembers[i];
} else {
newGroupMembers[i] = associateGroupMembers[i % 3];
}
}
HashMap request = new HashMap();
request.put("name", newName);
request.put("externalId", newExternalId);
request.put("staffId", newStaffId);
HashMap response = CenterHelper.updateCenter(resourceId, request, requestSpec, responseSpec);
Assert.assertNotNull(response);
Assert.assertEquals(newName, response.get("name"));
Assert.assertEquals(newExternalId, response.get("externalId"));
Assert.assertEquals(newStaffId, response.get("staffId"));
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
Assert.assertNotNull(center);
Assert.assertEquals(newName, center.getName());
Assert.assertEquals(newExternalId, center.getExternalId());
Assert.assertEquals((Integer)newStaffId, center.getStaffId());
Assert.assertArrayEquals(newGroupMembers, center.getGroupMembers());
}
@Test
public void testCenterDeletion() {
int officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
String name = "TestBasicCreation" + new Timestamp(new java.util.Date().getTime());
int resourceId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
CenterHelper.deleteCenter(resourceId, requestSpec, responseSpec);
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec);
Assert.assertNotNull(center);
}
private int[] generateGroupMembers(int size, int officeId) {
int[] groupMembers = new int[size];
for (int i = 0; i < groupMembers.length; i++) {
final HashMap<String, String> map = new HashMap<>();
map.put("officeId", "" + officeId);
map.put("name", Utils.randomStringGenerator("Group_Name_", 5));
map.put("externalId", Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
map.put("active", "true");
map.put("activationDate", "04 March 2011");
groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/mifosng-provider/api/v1/groups?"
+ Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId");
}
return groupMembers;
}
@Test
public void testStaffAssignmentDuringCenterCreation() {
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
System.out.println("--------------creating first staff with id-------------" + staffId);
Assert.assertNotNull(staffId);
int centerWithStaffId = CenterHelper.createCenterWithStaffId(this.requestSpec, this.responseSpec, staffId);
CenterDomain center = CenterHelper.retrieveByID(centerWithStaffId, requestSpec, responseSpec);
Assert.assertNotNull(center);
Assert.assertTrue(center.getId() == centerWithStaffId);
Assert.assertTrue(center.getStaffId() == staffId);
Assert.assertTrue(center.isActive() == true);
}
@Test
public void testAssignStaffToCenter() {
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
System.out.println("--------------creating first staff with id-------------" + staffId);
Assert.assertNotNull(staffId);
Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(),
staffId.longValue());
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId);
CenterDomain center = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
Assert.assertNotNull(center);
Assert.assertTrue(center.getId() == groupID);
Assert.assertTrue(center.getStaffId() == staffId);
}
@Test
public void testUnassignStaffToCenter() {
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
System.out.println("--------------creating first staff with id-------------" + staffId);
Assert.assertNotNull(staffId);
Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(),
staffId.longValue());
assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId);
CenterDomain centerWithStaffAssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
Assert.assertNotNull(centerWithStaffAssigned);
Assert.assertTrue(centerWithStaffAssigned.getId() == groupID);
Assert.assertTrue(centerWithStaffAssigned.getStaffId() == staffId);
HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec, this.responseSpec, groupID.toString(),
staffId.longValue());
assertEquals("Verify staffId is null after unassigning ", unassignStaffToCenterResponseMap.get("staffId"), null);
CenterDomain centerWithStaffUnssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec);
Assert.assertNotNull(centerWithStaffUnssigned);
Assert.assertTrue(centerWithStaffUnssigned.getId() == groupID);
Assert.assertTrue(centerWithStaffUnssigned.getStaffId() == null);
}
}
@@ -205,7 +205,7 @@ public class ClientSavingsIntegrationTest {
final String openningBalance = "1600";
final String enforceMinRequiredBalance = "true";
final boolean allowOverdraft = false;
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, openningBalance ,
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, openningBalance,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
Assert.assertNotNull(savingsProductID);
@@ -552,6 +552,13 @@ public class ClientSavingsIntegrationTest {
HashMap paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForPay.get("id"));
assertEquals(savingsChargeForPay.get("amount"), paidCharge.get("amountPaid"));
// temporary fix, this test case needs to be re-factored (will fail
// again on Jan 15 2016)
cal.set(Calendar.YEAR, (Integer) dates.get(0) + 1);
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"));
Integer inactivatedChargeId = (Integer) this.savingsAccountHelper.inactivateCharge(annualSavingsChargeId, savingsId,
CommonConstants.RESPONSE_RESOURCE_ID);
assertEquals("Inactivated Savings Charges Id", annualSavingsChargeId, inactivatedChargeId);
@@ -6,43 +6,43 @@
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");
}
public static void verifyClientIsActive(final HashMap<String, Object> clientStatusHashMap) {
assertEquals((int) clientStatusHashMap.get("id"), 300);
}
public static void verifyClientClosed(final HashMap<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> clientStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING CLIENT IS WITHDRAWN ------------------------------------");
assertEquals((int) clientStatusHashMap.get("id"), 800);
System.out.println("Client Status:" + clientStatusHashMap + "\n");
}
}
@@ -11,14 +11,7 @@ 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;
@@ -46,32 +39,30 @@ public class ClientTest {
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));
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientIsActive(status);
HashMap clientStatusHashMap = this.clientHelper.closeClient(clientId);
HashMap<String, Object> 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,147 @@
/**
* 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.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.ClientHelper;
import org.mifosplatform.integrationtests.common.Utils;
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 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 ConcurrencyIntegrationTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
private static final String NO_ACCOUNTING = "1";
final int MYTHREADS = 30;
@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.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
}
@Test
public void verifyConcurrentLoanRepayments() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer loanProductID = createLoanProduct(false, NO_ACCOUNTING);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, "12,000.00");
this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
this.loanTransactionHelper.disburseLoan("20 September 2011", loanID, "12,000.00");
ExecutorService executor = Executors.newFixedThreadPool(MYTHREADS);
Calendar date = Calendar.getInstance();
date.set(2011, 9, 20);
Float repaymentAmount = 100.0f;
for (int i = 0; i < 10; i++) {
System.out.println("Starting concurrent transaction number " + i);
date.add(Calendar.DAY_OF_MONTH, 1);
repaymentAmount = repaymentAmount + 100;
Runnable worker = new LoanRepaymentExecutor(loanTransactionHelper, loanID, repaymentAmount, date);
executor.execute(worker);
}
executor.shutdown();
// Wait until all threads are finish
while (!executor.isTerminated()) {
}
System.out.println("\nFinished all threads");
}
private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("12,000.00") //
.withNumberOfRepayments("4") //
.withRepaymentAfterEvery("1") //
.withRepaymentTypeAsMonth() //
.withinterestRatePerPeriod("1") //
.withInterestRateFrequencyTypeAsMonths() //
.withAmortizationTypeAsEqualInstallments() //
.withInterestTypeAsDecliningBalance() //
.withTranches(multiDisburseLoan) //
.withAccounting(accountingRule, accounts).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 2011") //
.withSubmittedOnDate("20 September 2011") //
.build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
public static class LoanRepaymentExecutor implements Runnable {
private final Integer loanId;
private final Float repaymentAmount;
private final String repaymentDate;
private final LoanTransactionHelper loanTransactionHelper;
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
LoanRepaymentExecutor(LoanTransactionHelper loanTransactionHelper, Integer loanId, Float repaymentAmount, Calendar repaymentDate) {
this.loanId = loanId;
this.repaymentAmount = repaymentAmount;
this.repaymentDate = dateFormat.format(repaymentDate.getTime());
this.loanTransactionHelper = loanTransactionHelper;
}
@Override
public void run() {
try {
this.loanTransactionHelper.makeRepayment(repaymentDate, repaymentAmount, loanId);
} catch (Exception e) {
System.out.println("Found an exception" + e.getMessage());
System.out.println("Details of failed concurrent transaction (date, amount, loanId) are " + repaymentDate + ","
+ repaymentAmount + "," + loanId);
throw (e);
}
System.out.println("Details of passed concurrent transaction, details (date, amount, loanId) are " + repaymentDate + ","
+ repaymentAmount + "," + loanId);
}
}
}
@@ -0,0 +1,82 @@
/**
* 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.Collections;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.CurrenciesHelper;
import org.mifosplatform.integrationtests.common.CurrencyDomain;
import org.mifosplatform.integrationtests.common.Utils;
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({ "unused", "rawtypes" })
public class CurrenciesTest {
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();
}
@Test
public void testCurrencyElements() {
CurrencyDomain currency = CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, "USD");
CurrencyDomain usd = CurrencyDomain.create("USD", "US Dollar", 2, "$", "currency.USD", "US Dollar ($)").build();
Assert.assertTrue(currency.getDecimalPlaces() >= 0);
Assert.assertNotNull(currency.getName());
Assert.assertNotNull(currency.getDisplaySymbol());
Assert.assertNotNull(currency.getDisplayLabel());
Assert.assertNotNull(currency.getNameCode());
Assert.assertEquals(usd, currency);
}
@Test
public void testUpdateCurrencySelection() {
// Test updation
ArrayList<String> currenciestoUpdate = new ArrayList<String>();
currenciestoUpdate.add("KES");
currenciestoUpdate.add("BND");
currenciestoUpdate.add("LBP");
currenciestoUpdate.add("GHC");
currenciestoUpdate.add("USD");
ArrayList<String> currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec,
currenciestoUpdate);
Assert.assertNotNull(currenciesOutput);
Assert.assertEquals("Verifying Do Outputed Currencies Match after Updation", currenciestoUpdate, currenciesOutput);
// Test that output matches updation
ArrayList<CurrencyDomain> currenciesBeforeUpdate = new ArrayList<CurrencyDomain>();
for (String e : currenciestoUpdate) {
currenciesBeforeUpdate.add(CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, e));
}
Collections.sort(currenciesBeforeUpdate);
ArrayList<CurrencyDomain> currenciesAfterUpdate = CurrenciesHelper.getSelectedCurrencies(requestSpec, responseSpec);
Assert.assertNotNull(currenciesAfterUpdate);
Assert.assertEquals("Verifying Do Selected Currencies Match after Updation", currenciesBeforeUpdate, currenciesAfterUpdate);
}
}
@@ -0,0 +1,32 @@
/**
* 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;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
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 CurrencyIntegrationTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
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();
}
}
@@ -0,0 +1,355 @@
/**
* 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.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.*;
import org.mifosplatform.integrationtests.common.loans.*;
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;
/**
* Tests loan schedule change based on group meeting changes and loan
* rescheduling
**/
@SuppressWarnings({ "rawtypes" })
@Ignore
public class DisbursalAndRepaymentScheduleTest {
private ResponseSpecification responseSpec;
private ResponseSpecification responseSpecForStatusCode403;
private ResponseSpecification generalResponseSpec;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
private LoanRescheduleRequestHelper loanRescheduleRequestHelper;
private Integer loanRescheduleRequestId;
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 SimpleDateFormat dateFormatterMifosStandard = new SimpleDateFormat("dd MMMM yyyy");
@Before
public void setup() {
Utils.initializeRESTAssured();
}
@Test
public void testRescheduleJLGLoanSynk() {
System.out.println("---------------------------------STARTING RESCHEDULE JLG LOAN TEST ------------------------------------------");
Calendar meetingCalendar = Calendar.getInstance();
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
meetingCalendar.setTime(new java.util.Date());
int today = meetingCalendar.get(Calendar.DAY_OF_WEEK);
// making sure that the meeting calendar is set for the coming monday.
if (today >= Calendar.MONDAY) {
meetingCalendar.add(Calendar.DAY_OF_YEAR, +(Calendar.MONDAY - today + 7));
} else {
meetingCalendar.add(Calendar.DAY_OF_YEAR, +(Calendar.MONDAY - today));
}
Calendar groupMeetingChangeCalendar = (Calendar) meetingCalendar.clone();
meetingCalendar.add(Calendar.WEEK_OF_YEAR, -3);
final String groupMeetingDate = this.dateFormatterMifosStandard.format(meetingCalendar.getTime());
final String disbursalDate = groupMeetingDate; // first meeting date
// after group creation
final String rescheduleSubmittedDate = this.dateFormatterMifosStandard.format(new java.util.Date());
final String loanType = "jlg";
final String rescheduleInterestRate = "28.0";
groupMeetingChangeCalendar.add(Calendar.DAY_OF_YEAR, 1);
final String groupMeetingNewStartDate = this.dateFormatterMifosStandard.format(groupMeetingChangeCalendar.getTime());
// The date
// from
// which we
// start the
// new group
// meeting
// occasion,
// this is a
// tuesday.
groupMeetingChangeCalendar.add(Calendar.WEEK_OF_YEAR, 2);
final String rescheduleDate = this.dateFormatterMifosStandard.format(groupMeetingChangeCalendar.getTime());
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("X-Mifos-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.generalResponseSpec = new ResponseSpecBuilder().build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
System.out.println("---------------------------------CREATING ENTITIES AND JLG LOAN ------------------------------------------");
// create all required entities
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount).withLoanTermFrequency("24")
.withLoanTermFrequencyAsWeeks().withNumberOfRepayments("12").withRepaymentEveryAfter("2")
.withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod).withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate)
.withExpectedDisbursementDate(disbursalDate).withLoanType(loanType).withSyncDisbursementWithMeetin()
.withCalendarID(this.groupCalendarId.toString())
.build(this.clientId.toString(), this.groupId.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);
System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
groupMeetingNewStartDate, "2", "2", "2"); // New meeting dates
// will be the tuesday
// after the
// coming
// monday
ArrayList loanRepaymnetSchedule = this.loanTransactionHelper
.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, this.loanId);
ArrayList dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
Calendar dueDateCalendar = Calendar.getInstance();
dueDateCalendar.setFirstDayOfWeek(Calendar.MONDAY);
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
(Integer) dueDateLoanSchedule.get(2));
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY", 3, dueDateCalendar.get(Calendar.DAY_OF_WEEK));
System.out.println("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest("2").updateGraceOnPrincipal("2")
.updateNewInterestRate(rescheduleInterestRate).updateRescheduleFromDate(rescheduleDate)
.updateSubmittedOnDate(rescheduleSubmittedDate).build(this.loanId.toString());
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, this.loanId);
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
(Integer) dueDateLoanSchedule.get(2));
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER LOAN RESCHEDULE REQUEST WAS SENT", 3,
dueDateCalendar.get(Calendar.DAY_OF_WEEK));
System.out.println("Successfully created loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
System.out.println("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate(rescheduleSubmittedDate)
.getApproveLoanRescheduleRequestJSON();
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
assertTrue((Boolean) response.get("approved"));
loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, this.loanId);
dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate");
dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1,
(Integer) dueDateLoanSchedule.get(2));
assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER RESCHEDULE", 3,
dueDateCalendar.get(Calendar.DAY_OF_WEEK));
System.out.println("Successfully changed group meeting date (CAELNDAR ID: " + this.groupCalendarId
+ ") and rescheduled loan (RESCHEDULE ID: " + this.loanRescheduleRequestId + ")");
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
}
@Test
public void testChangeGroupMeetingMaturedOnDate() {
System.out
.println("---------------------------------STARTING GROUP LOAN MEETING CHANGE DATE EXPECTED MATURED CHANGE------------------------------------------");
Calendar meetingCalendar = Calendar.getInstance();
meetingCalendar.setFirstDayOfWeek(Calendar.MONDAY);
meetingCalendar.setTime(new java.util.Date());
int today = meetingCalendar.get(Calendar.DAY_OF_WEEK);
// making sure that the meeting calendar is set for the coming monday.
if (today >= Calendar.MONDAY) {
meetingCalendar.add(Calendar.DAY_OF_YEAR, +(Calendar.MONDAY - today + 7));
} else {
meetingCalendar.add(Calendar.DAY_OF_YEAR, +(Calendar.MONDAY - today));
}
Calendar groupMeetingChangeCalendar = (Calendar) meetingCalendar.clone();
meetingCalendar.add(Calendar.WEEK_OF_YEAR, -3);
final String groupMeetingDate = this.dateFormatterMifosStandard.format(meetingCalendar.getTime());
final String disbursalDate = groupMeetingDate; // first meeting date
// after group creation
final String loanType = "jlg";
groupMeetingChangeCalendar.add(Calendar.DAY_OF_YEAR, 1);
final String groupMeetingNewStartDate = this.dateFormatterMifosStandard.format(groupMeetingChangeCalendar.getTime());
// The date
// from
// which we
// start the
// new group
// meeting
// occasion,
// this is a
// tuesday.
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.requestSpec.header("X-Mifos-Platform-TenantId", "default");
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.generalResponseSpec = new ResponseSpecBuilder().build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
System.out.println("---------------------------------CREATING ENTITIES AND JLG LOAN ------------------------------------------");
// create all required entities
this.createRequiredEntitiesForJLGLoanSync(groupMeetingDate);
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount).withLoanTermFrequency("24")
.withLoanTermFrequencyAsWeeks().withNumberOfRepayments("12").withRepaymentEveryAfter("2")
.withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeAsDays()
.withInterestRatePerPeriod(interestRatePerPeriod).withRepaymentFrequencyTypeAsWeeks().withSubmittedOnDate(disbursalDate)
.withExpectedDisbursementDate(disbursalDate).withLoanType(loanType).withSyncDisbursementWithMeetin()
.withCalendarID(this.groupCalendarId.toString())
.build(this.clientId.toString(), this.groupId.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);
System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------");
CalendarHelper.updateMeetingCalendarForGroup(this.requestSpec, this.responseSpec, this.groupId, this.groupCalendarId.toString(),
groupMeetingNewStartDate, "2", "2", "2"); // New meeting dates
// will be the tuesday
// after the
// coming
// monday
Calendar expectedMaturityCalendar = Calendar.getInstance();
expectedMaturityCalendar.setFirstDayOfWeek(Calendar.MONDAY);
ArrayList expectedMaturityDate = ((ArrayList) ((HashMap) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec,
this.loanId, "timeline")).get("expectedMaturityDate"));
expectedMaturityCalendar.set((Integer) expectedMaturityDate.get(0), (Integer) expectedMaturityDate.get(1) - 1,
(Integer) expectedMaturityDate.get(2));
assertEquals("AFTER MEETING CHANGE DATE THE EXPECTED MATURITY SHOULD BE ON TUESDAY", 3,
expectedMaturityCalendar.get(Calendar.DAY_OF_WEEK));
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
}
/**
* entities for jlg loan
**/
private void createRequiredEntitiesForJLGLoanSync(final String groupActivationDate) {
this.createGroupEntityWithCalendar("2", "2", "1", groupActivationDate);// frequency=2:Weekly
// , interval=2:
// Every two weeks ,
// repeatsOnDay=1:Monday
// groupActivationDate is decided by the current date
this.createClientEntity();
this.associateClientToGroup(this.groupId, this.clientId);
this.createLoanProductEntity();
}
/*
* 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);
}
private void createGroupEntityWithCalendar(final String frequency, final String interval, final String repeatsOnDay,
final String groupActivationDate) {
this.groupId = GroupHelper.createGroup(this.requestSpec, this.responseSpec, groupActivationDate);
GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, this.responseSpec, this.groupId);
final String startDate = groupActivationDate;
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 loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear().build(null);
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
public void setGroupCalendarId(Integer groupCalendarId) {
this.groupCalendarId = groupCalendarId;
}
}
@@ -0,0 +1,102 @@
/**
* 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.HashMap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.ExternalServicesConfigurationHelper;
import org.mifosplatform.integrationtests.common.Utils;
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", "unchecked", "static-access" })
public class ExternalServicesConfigurationTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private ExternalServicesConfigurationHelper externalServicesConfigurationHelper;
private ResponseSpecification httpStatusForidden;
@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.httpStatusForidden = new ResponseSpecBuilder().expectStatusCode(403).build();
}
@Test
public void testExternalServicesConfiguration() {
this.externalServicesConfigurationHelper = new ExternalServicesConfigurationHelper(this.requestSpec, this.responseSpec);
// Checking for S3
String configName = "s3_access_key";
ArrayList<HashMap> externalServicesConfig = this.externalServicesConfigurationHelper
.getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "S3");
Assert.assertNotNull(externalServicesConfig);
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) {
String name = (String) externalServicesConfig.get(configIndex).get("name");
String value = null;
if (name.equals(configName)) {
value = (String) externalServicesConfig.get(configIndex).get("value");
if(value == null){
value = "testnull";
}
String newValue = "test";
System.out.println(name + ":" + value);
HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
responseSpec, "S3", name, newValue);
Assert.assertNotNull(arrayListValue.get("value"));
Assert.assertEquals(arrayListValue.get("value"), newValue);
HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
responseSpec, "S3", name, value);
Assert.assertNotNull(arrayListValue1.get("value"));
Assert.assertEquals(arrayListValue1.get("value"), value);
}
}
// Checking for SMTP:
configName = "username";
externalServicesConfig = this.externalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
responseSpec, "SMTP");
Assert.assertNotNull(externalServicesConfig);
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) {
String name = (String) externalServicesConfig.get(configIndex).get("name");
String value = null;
if (name.equals(configName)) {
value = (String) externalServicesConfig.get(configIndex).get("value");
if(value == null){
value = "testnull";
}
String newValue = "test";
System.out.println(name + ":" + value);
HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
responseSpec, "SMTP", name, newValue);
Assert.assertNotNull(arrayListValue.get("value"));
Assert.assertEquals(arrayListValue.get("value"), newValue);
HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec,
responseSpec, "SMTP", name, value);
Assert.assertNotNull(arrayListValue1.get("value"));
Assert.assertEquals(arrayListValue1.get("value"), value);
}
}
}
}
@@ -7,6 +7,7 @@ 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;
@@ -1407,6 +1408,7 @@ public class FixedDepositTest {
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
System.out.println("Submitted Date:"+SUBMITTED_ON_DATE);
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId);
@@ -1450,10 +1452,8 @@ public class FixedDepositTest {
principal = this.fixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod,
interestPerDay, DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount));
principal = new BigDecimal(principal).setScale(0, BigDecimal.ROUND_FLOOR).floatValue();
maturityAmount = new BigDecimal(maturityAmount).setScale(0, BigDecimal.ROUND_FLOOR).floatValue();
System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount);
@@ -31,14 +31,14 @@ import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "rawtypes", "unused", "unchecked" })
public class FlexibleSavingsInterestPostingIntegrationTest {
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
private ResponseSpecification responseSpec;
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();
@@ -47,47 +47,46 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
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);
// 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);
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate,
CommonConstants.RESPONSE_RESOURCE_ID);
/***
* Perform Post interest transaction and verify the posted transaction date
* 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());
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions");
HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2);
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();
final Integer savingsProductID = createSavingsProduct();
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplicationOnDate(clientID,
savingsProductID, ACCOUNT_TYPE_INDIVIDUAL, startDate);
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);
@@ -95,54 +94,48 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
return savingsId;
}
private void configureInterestPosting(final Boolean periodEndEnable,
final Integer financialYearBeginningMonth) {
final ArrayList<HashMap> globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec,
this.responseSpec);
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());
periodEndConfigId.toString());
Assert.assertNotNull(periodEndConfigData);
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
if (enabled != periodEndEnable)
if (enabled != periodEndEnable)
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
periodEndConfigId.toString(), periodEndEnable);
//Updating value for financial year beginning month
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());
HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec,
this.responseSpec, financialYearBeginningConfigId.toString());
Assert.assertNotNull(financialYearBeginningConfigData);
financialYearBeginningConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec,
financialYearBeginningConfigId.toString(), financialYearBeginningMonth.toString());
financialYearBeginningConfigId.toString(), financialYearBeginningMonth.toString());
Assert.assertNotNull(financialYearBeginningConfigId);
}
private Integer createSavingsProduct() {
final String savingsProductJSON = this.savingsProductHelper
.withInterestCompoundingPeriodTypeAsDaily()
.withInterestPostingPeriodTypeAsAnnual()
.withInterestCalculationPeriodTypeAsDailyBalance()
.build();
final String savingsProductJSON = this.savingsProductHelper.withInterestCompoundingPeriodTypeAsDaily()
.withInterestPostingPeriodTypeAsAnnual().withInterestCalculationPeriodTypeAsDailyBalance().build();
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
//Reset configuration fields
// Reset configuration fields
@After
public void tearDown() {
configureInterestPosting(false, 1);
configureInterestPosting(false, 1);
}
}
@@ -11,6 +11,7 @@ import java.util.HashMap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.GlobalConfigurationHelper;
@@ -26,6 +27,7 @@ public class GlobalConfigurationTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private GlobalConfigurationHelper globalConfigurationHelper;
private ResponseSpecification httpStatusForidden;
@Before
public void setup() {
@@ -33,6 +35,7 @@ public class GlobalConfigurationTest {
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.httpStatusForidden = new ResponseSpecBuilder().expectStatusCode(403).build();
}
@Test
@@ -121,4 +124,85 @@ public class GlobalConfigurationTest {
Assert.assertEquals("Verifying Is Cache Enabled Global Config after Updation", cacheTypeId, changes.get("cacheType"));
}
}
@Test
public void testGlobalConfigForcePasswordResetDays() {
// Retrieving All Global Configuration details
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
Assert.assertNotNull(globalConfig);
String configName = "force-password-reset-days";
String newValue = "0";
String newBooleanValue = "true";
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
if (globalConfig.get(configIndex).get("name").equals(configName)) {
Integer configId = (Integer) globalConfig.get(configIndex).get(
"id");
Assert.assertNotNull(configId);
/*
* Update force-password-reset-days with value as 0 and Enable
* as true - failure case
*/
ArrayList error = (ArrayList) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.httpStatusForidden,
configId, newValue, newBooleanValue,
CommonConstants.RESPONSE_ERROR);
HashMap hash = (HashMap) error.get(0);
Assert.assertEquals(
"Force Password Reset days value must be greater than zero.",
"error.msg.password.reset.days.value.must.be.greater.than.zero",
hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/*
* Update force-password-reset-days with value as 50 and Enable
* as true - success case
*/
final HashMap updateSuccess = (HashMap) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId,
"50", newBooleanValue, "changes");
Assert.assertNotNull(updateSuccess);
/* Update with value as 0 and Enable as false - success case */
final HashMap updateSuccess1 = (HashMap) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId,
newValue, "false", "changes");
Assert.assertNotNull(updateSuccess1);
/* Update without sending value and Enable as true - failure case*/
ArrayList failure = (ArrayList) this.globalConfigurationHelper
.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.httpStatusForidden, configId,
null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
HashMap failureHash = (HashMap) failure.get(0);
Assert.assertEquals(
"Force Password Reset days value must be greater than zero.",
"error.msg.password.reset.days.value.must.be.greater.than.zero",
failureHash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
break;
}
}
/* Update other global configuration property */
String otherConfigName = "maker-checker";
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) {
if (globalConfig.get(configIndex).get("name")
.equals(otherConfigName)) {
String configId = (globalConfig.get(configIndex).get("id"))
.toString();
Integer updateConfigId = this.globalConfigurationHelper
.updateValueForGlobalConfiguration(this.requestSpec,
this.responseSpec, configId, newValue);
Assert.assertNotNull(updateConfigId);
break;
}
}
}
}
@@ -105,17 +105,17 @@ public class GroupLoanIntegrationTest {
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 Principal Due for 2nd Month", new Float("2969.72"), 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<>(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 Principal Due for 3rd Month", new Float("3029.11"), 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<>(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 Principal Due for 4th Month", new Float("3089.68"), loanSchedule.get(4).get("principalDue"));
assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
}
}
@@ -5,29 +5,27 @@
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
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.GroupHelper;
import org.mifosplatform.integrationtests.common.StaffHelper;
import org.mifosplatform.integrationtests.common.organisation.StaffHelper;
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.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;
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,
@@ -38,11 +36,10 @@ 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";
private final String principal = "10000.00";
private final String accountingRule = "1";
private final String numberOfRepayments = "5";
private final String interestRatePerPeriod = "18";
@Before
public void setup() {
@@ -73,29 +70,32 @@ public class GroupTest {
groupID = GroupHelper.updateGroup(this.requestSpec, this.responseSpec, updatedGroupName, groupID.toString());
GroupHelper.verifyGroupDetails(this.requestSpec, this.responseSpec, groupID, "name", updatedGroupName);
// NOTE: removed as consistently provides false positive result on cloudbees server.
// groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec);
// GroupHelper.deleteGroup(this.requestSpec, this.responseSpec, groupID.toString());
// GroupHelper.verifyGroupDeleted(this.requestSpec, this.responseSpec, groupID);
// NOTE: removed as consistently provides false positive result on
// cloudbees server.
// groupID = GroupHelper.createGroup(this.requestSpec,
// this.responseSpec);
// GroupHelper.deleteGroup(this.requestSpec, this.responseSpec,
// groupID.toString());
// GroupHelper.verifyGroupDeleted(this.requestSpec, this.responseSpec,
// groupID);
}
@Test
public void assignStaffToGroup(){
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);
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());
Integer updateGroupId = GroupHelper.updateGroup(this.requestSpec, this.responseSpec, updateGroupName, groupID.toString());
//create client and add client to group
// 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) ;
// create staff
Integer createStaffId1 = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
System.out.println("--------------creating first staff with id-------------" + createStaffId1);
Assert.assertNotNull(createStaffId1);
@@ -103,45 +103,43 @@ public class GroupTest {
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);
// 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);
final Integer loanId = this.applyForLoanApplication(clientID, loanProductId, this.principal);
this.loanTransactionHelper.approveLoan("20 September 2014",loanId);
this.loanTransactionHelper.disburseLoan("20 September 2014",loanId);
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());
final HashMap assignStaffAndInheritStaffForClientAccounts = (HashMap) GroupHelper.assignStaffInheritStaffForClientAccounts(
this.requestSpec, this.responseSpec, groupID.toString(), createStaffId1.toString());
final Integer getClientStaffId = ClientHelper.getClientsStaffId(this.requestSpec, this.responseSpec, clientID.toString());
//assert if client staff officer has change Note client was assigned staff with createStaffId2
// 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);
assertEquals("Verify if client inherited staff assigned above", assignStaffAndInheritStaffForClientAccounts.get("staffId"),
getClientStaffId);
//assert if clients loan officer has changed
// 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);
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.principal)
.withNumberOfRepayments(this.numberOfRepayments).withinterestRatePerPeriod(this.interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear().build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
@@ -5,7 +5,8 @@
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import org.junit.Assert;
import static org.junit.Assert.fail;
import java.util.concurrent.TimeUnit;
@@ -62,7 +63,7 @@ public class HookIntegrationTest {
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,
Assert.assertEquals("Equality check for created officeId and hook received payload officeId", createdOfficeID,
notificationOfficeId);
System.out.println("Notification Office Id - " + notificationOfficeId);
i = 6;
@@ -80,4 +81,22 @@ public class HookIntegrationTest {
}
}
@Test
public void createUpdateAndDeleteHook(){
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
final String updateURL = "http://localhost";
Long hookId = this.hookHelper.createHook(payloadURL).longValue();
Assert.assertNotNull(hookId);
this.hookHelper.verifyHookCreatedOnServer(hookId);
System.out.println("---------------------SUCCESSFULLY CREATED AND VERIFIED HOOK-------------------------"+hookId);
this.hookHelper.updateHook(updateURL, hookId);
this.hookHelper.verifyUpdateHook(updateURL, hookId);
System.out.println("---------------------SUCCESSFULLY UPDATED AND VERIFIED HOOK-------------------------"+hookId);
this.hookHelper.deleteHook(hookId);
this.hookHelper.verifyDeleteHook(hookId);
System.out.println("---------------------SUCCESSFULLY DELETED AND VERIFIED HOOK-------------------------"+hookId);
}
}
@@ -5,20 +5,14 @@
*/
package org.mifosplatform.integrationtests;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
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;
@@ -27,11 +21,18 @@ 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;
@SuppressWarnings("rawtypes")
public class LoanApplicationApprovalTest {
private ResponseSpecification responseSpec;
private ResponseSpecification responseSpecForStatusCode403;
private ResponseSpecification responseSpecForStatusCode400;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
@@ -42,20 +43,20 @@ public class LoanApplicationApprovalTest {
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.responseSpecForStatusCode403 = new ResponseSpecBuilder().expectStatusCode(403).build();
this.responseSpecForStatusCode400 = new ResponseSpecBuilder().expectStatusCode(400).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
}
/*
* Positive test case: Approved amount non zero is less than proposed amount
*
* 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);
@@ -63,22 +64,25 @@ public class LoanApplicationApprovalTest {
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, approvalAmount, loanID);
final String expectedDisbursementDate = null;
List<HashMap> approveTranches = null;
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
loanID, approveTranches);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
}
/*
* Negative test case: Approved amount non zero is greater than proposed amount
*
* 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);
@@ -87,14 +91,147 @@ public class LoanApplicationApprovalTest {
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
@SuppressWarnings("unchecked")
List<HashMap> error = (List<HashMap>) this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, approvalAmount, loanID,
List<HashMap> error = (List<HashMap>) this.loanTransactionHelper.approveLoan(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));
assertEquals("error.msg.loan.approval.amount.can't.be.greater.than.loan.amount.demanded",
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
private HashMap createTrancheDetail(final String date, final String amount) {
HashMap<String, Object> detail = new HashMap<>();
detail.put("expectedDisbursementDate", date);
detail.put("principal", amount);
return detail;
}
@Test
public void loanApplicationApprovalAndValidationForMultiDisburseLoans() {
List<HashMap> createTranches = new ArrayList<>();
createTranches.add(createTrancheDetail("1 March 2014", "1000"));
createTranches.add(createTrancheDetail("23 March 2014", "4000"));
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
+ clientID);
final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(new LoanProductTestBuilder()
.withInterestTypeAsDecliningBalance().withTranches(true).build(null));
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
+ loanProductID);
this.trancheLoansApprovedAmountLesserThanProposedAmount(clientID, loanProductID, createTranches);
this.trancheLoansApprovalValidation(clientID, loanProductID, createTranches);
}
private void trancheLoansApprovedAmountLesserThanProposedAmount(Integer clientID, Integer loanProductID, List<HashMap> createTranches) {
final String proposedAmount = "5000";
final String approvalAmount = "2000";
final String approveDate = "1 March 2014";
final String expectedDisbursementDate = "1 March 2014";
List<HashMap> approveTranches = new ArrayList<>();
approveTranches.add(createTrancheDetail("1 March 2014", "1000"));
approveTranches.add(createTrancheDetail("23 March 2014", "1000"));
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
+ loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
loanID, approveTranches);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
System.out
.println("-----------------------------------MULTI DISBURSAL LOAN APPROVED SUCCESSFULLY---------------------------------------");
}
private void trancheLoansApprovalValidation(Integer clientID, Integer loanProductID, List<HashMap> createTranches) {
final String proposedAmount = "5000";
final String approvalAmount1 = "10000";
final String approvalAmount2 = "3000";
final String approvalAmount3 = "400";
final String approvalAmount4 = "200";
final String approveDate = "1 March 2014";
final String expectedDisbursementDate = "1 March 2014";
List<HashMap> approveTranche1 = new ArrayList<>();
approveTranche1.add(createTrancheDetail("1 March 2014", "5000"));
approveTranche1.add(createTrancheDetail("23 March 2014", "5000"));
List<HashMap> approveTranche2 = new ArrayList<>();
approveTranche2.add(createTrancheDetail("1 March 2014", "1000"));
approveTranche2.add(createTrancheDetail("23 March 2014", "1000"));
approveTranche2.add(createTrancheDetail("23 March 2014", "1000"));
List<HashMap> approveTranche3 = new ArrayList<>();
approveTranche3.add(createTrancheDetail("1 March 2014", "100"));
approveTranche3.add(createTrancheDetail("23 March 2014", "100"));
approveTranche3.add(createTrancheDetail("24 March 2014", "100"));
approveTranche3.add(createTrancheDetail("25 March 2014", "100"));
List<HashMap> approveTranche4 = new ArrayList<>();
approveTranche4.add(createTrancheDetail("1 March 2014", "100"));
approveTranche4.add(createTrancheDetail("23 March 2014", "100"));
approveTranche4.add(createTrancheDetail("24 March 2014", "100"));
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
+ loanID);
HashMap<String, Object> loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode400);
/* Tranches with same expected disbursement date */
List<HashMap<String, Object>> error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate,
approvalAmount2, loanID, approveTranche2, CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.loan.expectedDisbursementDate.disbursement.date.must.be.unique.for.tranches",
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/* Sum of tranches is greater than approved amount */
error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate, approvalAmount4, loanID,
approveTranche4, CommonConstants.RESPONSE_ERROR);
assertEquals("validation.msg.loan.principal.sum.of.multi.disburse.amounts.must.be.equal.to.or.lesser.than.approved.principal",
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
/* Sum of tranches exceeds the proposed amount */
error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate, approvalAmount1, loanID,
approveTranche1, 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));
/* No. of tranches exceeds the max tranche count at product level */
error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate, approvalAmount3, loanID,
approveTranche3, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.disbursementData.exceeding.max.tranche.count", error.get(0)
.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/* If tranches are not specified for a multi-disburse loan */
/**
* error =
* this.loanTransactionHelper.approveLoanForTranches(approveDate,
* expectedDisbursementDate, approvalAmount5, loanID, approveTranche5,
* CommonConstants.RESPONSE_ERROR);
* assertEquals("error.msg.disbursementData.required",
* error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
**/
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String proposedAmount) {
@@ -104,4 +241,27 @@ public class LoanApplicationApprovalTest {
.withSubmittedOnDate("02 April 2012").build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplication);
}
private Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, String principal,
List<HashMap> tranches) {
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder()
//
.withPrincipal(principal)
//
.withLoanTermFrequency("5")
//
.withLoanTermFrequencyAsMonths()
//
.withNumberOfRepayments("5").withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths() //
.withInterestRatePerPeriod("2") //
.withExpectedDisbursementDate("1 March 2014") //
.withTranches(tranches) //
.withInterestTypeAsDecliningBalance() //
.withSubmittedOnDate("1 March 2014") //
.build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
}
@@ -7,6 +7,7 @@ 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;
@@ -116,6 +117,56 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
}
@Test
public void checkClientLoan_WRITTEN_OFF() {
// CREATE CLIENT
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
// CREATE LOAN PRODUCT
final Integer loanProductID = createLoanProduct();
// APPLY FOR LOAN
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("28 September 2010", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
// DISBURSE
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
System.out.println("DISBURSE " + loanStatusHashMap);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// MAKE REPAYMENTS
final float repayment_with_interest = 680.0f;
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, loanID);
this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID);
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
Assert.assertTrue("Checking for Principal paid ",
new Float("500.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0);
Assert.assertTrue("Checking for interestPaid paid ",
new Float("180.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0);
Assert.assertTrue("Checking for total paid ",
new Float("680.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0);
// WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID));
toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
Assert.assertTrue("Checking for Principal written off ",
new Float("4000.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0);
Assert.assertTrue("Checking for interestPaid written off ",
new Float("1440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0);
Assert.assertTrue("Checking for total written off ",
new Float("5440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0);
}
private Integer createLoanProduct() {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
@@ -0,0 +1,53 @@
/**
* 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.OfficeDomain;
import org.mifosplatform.integrationtests.common.OfficeHelper;
import org.mifosplatform.integrationtests.common.Utils;
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 OfficeIntegrationTest {
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();
}
@Test
public void testOfficeModification() {
OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
int officeId = oh.createOffice("01 July 2007");
String name = Utils.randomNameGenerator("New_Office_", 4);
String date = "02 July 2007";
String[] dateArr = { "2007", "7", "2" };
oh.updateOffice(officeId, name, date);
OfficeDomain newOffice = oh.retrieveOfficeByID(officeId);
Assert.assertTrue(name.equals(newOffice.getName()));
Assert.assertArrayEquals(dateArr, newOffice.getOpeningDate());
}
}
@@ -0,0 +1,65 @@
/**
* 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.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.PasswordPreferencesHelper;
import org.mifosplatform.integrationtests.common.Utils;
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", "unchecked" })
public class PasswordPreferencesIntegrationTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private ResponseSpecification generalResponseSpec;
@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();
}
@Test
public void updatePasswordPreferences() {
String validationPolicyId = "2";
PasswordPreferencesHelper.updatePasswordPreferences(requestSpec, responseSpec, validationPolicyId);
this.validateIfThePasswordIsUpdated(validationPolicyId);
}
private void validateIfThePasswordIsUpdated(String validationPolicyId){
Integer id = PasswordPreferencesHelper.getActivePasswordPreference(requestSpec, responseSpec);
assertEquals(validationPolicyId, id.toString());
System.out.println("---------------------------------PASSWORD PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");
}
@Test
public void updateWithInvalidPolicyId() {
String invalidValidationPolicyId = "2000";
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec, invalidValidationPolicyId,
CommonConstants.RESPONSE_ERROR);
assertEquals("Password Validation Policy with identifier 2000 does not exist", "error.msg.password.validation.policy.id.invalid",
error.get(0).get("userMessageGlobalisationCode"));
}
}
@@ -0,0 +1,80 @@
/**
* 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.PaymentTypeDomain;
import org.mifosplatform.integrationtests.common.PaymentTypeHelper;
import org.mifosplatform.integrationtests.common.Utils;
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 PaymentTypeIntegrationTest {
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({ "rawtypes", "unchecked" })
@Test
public void testPaymentType() {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true;
Integer position = 1;
Integer paymentTypeId = PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, description, isCashPayment, position);
Assert.assertNotNull(paymentTypeId);
PaymentTypeHelper.verifyPaymentTypeCreatedOnServer(requestSpec, responseSpec, paymentTypeId);
PaymentTypeDomain paymentTypeResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
Assert.assertEquals(name, paymentTypeResponse.getName());
Assert.assertEquals(description, paymentTypeResponse.getDescription());
Assert.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment());
Assert.assertEquals(position, paymentTypeResponse.getPosition());
// Update Payment Type
String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5);
String newDescription = PaymentTypeHelper.randomNameGenerator("PTU_Desc", 15);
Boolean isCashPaymentUpdatedValue = false;
Integer newPosition = 2;
HashMap request = new HashMap();
request.put("name", newName);
request.put("description", newDescription);
request.put("isCashPayment", isCashPaymentUpdatedValue);
request.put("position", newPosition);
PaymentTypeHelper.updatePaymentType(paymentTypeId, request, requestSpec, responseSpec);
PaymentTypeDomain paymentTypeUpdatedResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId);
Assert.assertEquals(newName, paymentTypeUpdatedResponse.getName());
Assert.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription());
Assert.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment());
Assert.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition());
// Delete
Integer deletedPaymentTypeId = PaymentTypeHelper.deletePaymentType(paymentTypeId, requestSpec, responseSpec);
Assert.assertEquals(paymentTypeId, deletedPaymentTypeId);
ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build();
PaymentTypeHelper.retrieveById(requestSpec, responseSpecification, paymentTypeId);
}
}
@@ -0,0 +1,154 @@
/**
* 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.assertNotEquals;
import java.util.HashMap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.organisation.StaffHelper;
import org.mifosplatform.integrationtests.useradministration.roles.RolesHelper;
import org.mifosplatform.integrationtests.useradministration.users.UserHelper;
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 RolesTest {
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("cast")
@Test
public void testCreateRolesStatus() {
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
Assert.assertNotNull(roleId);
System.out.println("--------------------------------- Getting ROLE -------------------------------");
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId);
}
@SuppressWarnings("cast")
@Test
public void testDisableRolesStatus() {
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
Assert.assertNotNull(roleId);
System.out.println("--------------------------------- Getting ROLE -------------------------------");
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId);
System.out.println("--------------------------------- DISABLING ROLE -------------------------------");
final Integer disableRoleId = RolesHelper.disableRole(this.requestSpec, this.responseSpec, roleId);
assertEquals(disableRoleId, roleId);
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId);
assertEquals((Boolean) role.get("disabled"), true);
}
@SuppressWarnings("cast")
@Test
public void testEnableRolesStatus() {
System.out.println("---------------------------------CREATING A ROLE---------------------------------------------");
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
Assert.assertNotNull(roleId);
System.out.println("--------------------------------- Getting ROLE -------------------------------");
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId);
System.out.println("--------------------------------- DISABLING ROLE -------------------------------");
final Integer disableRoleId = RolesHelper.disableRole(this.requestSpec, this.responseSpec, roleId);
assertEquals(disableRoleId, roleId);
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId);
assertEquals((Boolean) role.get("disabled"), true);
System.out.println("--------------------------------- ENABLING ROLE -------------------------------");
final Integer enableRoleId = RolesHelper.enableRole(this.requestSpec, this.responseSpec, roleId);
assertEquals(enableRoleId, roleId);
role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId);
assertEquals((Boolean) role.get("disabled"), false);
}
@SuppressWarnings("cast")
@Test
public void testDeleteRoleStatus() {
System.out.println("-------------------------------- CREATING A ROLE---------------------------------------------");
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
Assert.assertNotNull(roleId);
System.out.println("--------------------------------- Getting ROLE -------------------------------");
HashMap<String, Object> role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId);
assertEquals((Integer) role.get("id"), roleId);
System.out.println("--------------------------------- DELETE ROLE -------------------------------");
final Integer deleteRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
assertEquals(deleteRoleId, roleId);
}
@Test
public void testRoleShouldGetDeletedIfNoActiveUserExists() {
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
Assert.assertNotNull(roleId);
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Assert.assertNotNull(staffId);
final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId);
Assert.assertNotNull(userId);
final Integer deletedUserId = UserHelper.deleteUser(this.requestSpec, this.responseSpec, userId);
Assert.assertEquals(deletedUserId, userId);
final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
assertEquals(deletedRoleId, roleId);
}
@Test
public void testRoleShouldNotGetDeletedIfActiveUserExists() {
final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec);
Assert.assertNotNull(roleId);
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Assert.assertNotNull(staffId);
final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId);
Assert.assertNotNull(userId);
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId);
assertNotEquals(deletedRoleId, roleId);
}
}
@@ -0,0 +1,95 @@
/**
* 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 com.sun.jersey.core.util.Base64;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.ImageHelper;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.accounting.AccountHelper;
import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
import org.mifosplatform.integrationtests.common.organisation.StaffHelper;
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.io.IOException;
public class StaffImageApiTest {
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
private LoanTransactionHelper loanTransactionHelper;
private AccountHelper accountHelper;
@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.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
}
@Test
public void createStaffImage() {
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageId);
}
@Test
public void getStaffImage(){
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageId);
String imageAsText = ImageHelper.getStaffImageAsText(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageAsText);
}
@Test
public void getStaffImageAsBinary(){
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageId);
byte[] imageAsBytes = ImageHelper.getStaffImageAsBinary(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image content should not be null", imageAsBytes);
}
@Test
public void updateImage() {
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageId);
imageId = ImageHelper.updateImageForStaff(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageId);
}
@Test
public void deleteStaffImage() {
Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageId);
imageId = ImageHelper.deleteStaffImage(this.requestSpec, this.responseSpec, staffId);
Assert.assertNotNull("Image id should not be null", imageId);
}
}
@@ -0,0 +1,226 @@
/**
* 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.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.organisation.StaffHelper;
import com.google.gson.Gson;
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 StaffTest {
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
private ResponseSpecification responseSpecForValidationError;
private ResponseSpecification responseSpecForNotFoundError;
@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.responseSpecForNotFoundError = new ResponseSpecBuilder().expectStatusCode(404).build();
}
@Test
public void testStaffCreate() {
final HashMap response = StaffHelper.createStaffMap(requestSpec, responseSpec);
Assert.assertNotNull(response);
Assert.assertEquals(response.get("officeId"), 1);
Assert.assertNotNull(response.get("resourceId"));
}
@Test
public void testStaffCreateValidationError() {
final String noOfficeJson = StaffHelper.createStaffWithJSONFields("firstname", "lastname");
final String noFirstnameJson = StaffHelper.createStaffWithJSONFields("officeId", "lastname");
final String noLastnameJson = StaffHelper.createStaffWithJSONFields("officeId", "firstname");
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noOfficeJson);
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noFirstnameJson);
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, noLastnameJson);
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));
/** Long firstname test */
map.put("firstname", Utils.randomNameGenerator("michael_", 43));
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
/** Long lastname test */
map.put("lastname", Utils.randomNameGenerator("Doe_", 47));
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
map.put("lastname", Utils.randomNameGenerator("Doe_",4));
/** Long mobileNo test */
map.put("mobileNo", Utils.randomNameGenerator("num_", 47));
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
}
public void testStaffCreateMaxNameLength() {
final HashMap<String, Object> map = new HashMap<>();
map.put("officeId", 1);
map.put("firstname", Utils.randomNameGenerator("michael_", 42));
map.put("lastname", Utils.randomNameGenerator("Doe_", 46));
StaffHelper.createStaffWithJson(requestSpec, responseSpec, new Gson().toJson(map));
}
public void testStaffCreateExternalIdValidationError() {
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("externalId", Utils.randomStringGenerator("EXT", 98));
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
}
@Test
public void testStaffFetch() {
final HashMap response = StaffHelper.getStaff(requestSpec, responseSpec, 1);
Assert.assertNotNull(response);
Assert.assertNotNull(response.get("id"));
Assert.assertEquals(response.get("id"), 1);
}
@Test
public void testStaffListFetch() {
StaffHelper.getStaffList(requestSpec, responseSpec);
}
@Test
public void testStaffListStatusAll() {
StaffHelper.getStaffListWithState(requestSpec, responseSpec, "all");
}
@Test
public void testStaffListStatusActive() {
final List<HashMap> responseActive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
for(final HashMap staff : responseActive) {
Assert.assertNotNull(staff.get("id"));
Assert.assertEquals(staff.get("isActive"), true);
}
}
@Test
public void testStaffListStatusInactive() {
final List<HashMap> responseInactive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
for(final HashMap staff : responseInactive) {
Assert.assertNotNull(staff.get("id"));
Assert.assertEquals(staff.get("isActive"), false);
}
}
@Test
public void testStaffListFetchWrongState() {
StaffHelper.getStaffListWithState(requestSpec, responseSpecForValidationError, "xyz");
}
@Test
public void testStaffFetchNotFound() {
StaffHelper.getStaff(requestSpec, responseSpecForNotFoundError, Integer.MAX_VALUE);
}
@Test
public void testStaffUpdate() {
final HashMap<String, Object> map = new HashMap<>();
final String firstname = Utils.randomNameGenerator("michael_", 10);
final String lastname = Utils.randomNameGenerator("Doe_", 10);
final String externalId = Utils.randomStringGenerator("EXT", 97);
final String mobileNo = Utils.randomStringGenerator("num_", 10);
map.put("firstname", firstname);
map.put("lastname", lastname);
map.put("externalId", externalId);
map.put("mobileNo", mobileNo);
final HashMap response = (HashMap) StaffHelper.updateStaff(requestSpec, responseSpec, 1, map);
final HashMap changes = (HashMap) response.get("changes");
Assert.assertEquals(1, response.get("resourceId"));
Assert.assertEquals(firstname, changes.get("firstname"));
Assert.assertEquals(lastname, changes.get("lastname"));
Assert.assertEquals(externalId, changes.get("externalId"));
Assert.assertEquals(mobileNo, changes.get("mobileNo"));
}
public void testStaffUpdateLongExternalIdError() {
final HashMap<String, Object> map = new HashMap<>();
map.put("externalId", Utils.randomStringGenerator("EXT", 98));
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
}
public void testStaffUpdateWrongActiveState() {
final HashMap<String, Object> map = new HashMap<>();
map.put("isActive", "xyz");
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
}
@Test
public void testStaffUpdateNotFoundError() {
final HashMap<String, Object> map = new HashMap<>();
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
StaffHelper.updateStaff(requestSpec, responseSpecForNotFoundError, Integer.MAX_VALUE, map);
}
@Test
public void testStaffUpdateValidationError() {
final HashMap<String, Object> map = new HashMap<>();
final String firstname = Utils.randomNameGenerator("michael_", 5);
final String lastname = Utils.randomNameGenerator("Doe_", 4);
final String firstnameLong = Utils.randomNameGenerator("michael_", 43);
final String lastnameLong = Utils.randomNameGenerator("Doe_", 47);
map.put("firstname", firstname);
map.put("lastname", lastname);
/** Test long firstname */
map.put("firstname", firstnameLong);
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
map.put("firstname", firstname);
/** Test long lastname */
map.put("lastname", lastnameLong);
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
map.put("lastname", lastname);
/** Long mobileNo test */
map.put("mobileNo", Utils.randomNameGenerator("num_", 47));
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
map.remove("mobileNo");
/** Test unsupported parameter */
map.put("xyz", "xyz");
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
}
}
@@ -160,7 +160,7 @@ public class SystemCodeTest {
@Test
public void testCodeValuesNotAssignedToTable() {
final String codeName = "Marital Status1";
final String codeName = Utils.randomNameGenerator("Marital Status1", 10);
final String codeValue1 = "Married1";
final String codeValue2 = "Unmarried1";
@@ -0,0 +1,57 @@
/**
* 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.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.WorkingDaysHelper;
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", "unchecked" })
public class WorkingDaysTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private ResponseSpecification generalResponseSpec;
@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();
}
@Test
public void updateWorkingDays() {
HashMap response = (HashMap) WorkingDaysHelper.updateWorkingDays(requestSpec, responseSpec);
Assert.assertNotNull(response.get("resourceId"));
}
@Test
public void updateWorkingDaysWithWrongRecurrencePattern() {
final List<HashMap> error = (List) WorkingDaysHelper.updateWorkingDaysWithWrongRecurrence(requestSpec, generalResponseSpec,
CommonConstants.RESPONSE_ERROR);
assertEquals("Verify wrong recurrence pattern error", "error.msg.recurring.rule.parsing.error",
error.get(0).get("userMessageGlobalisationCode"));
}
}
@@ -20,29 +20,43 @@ public class CalendarHelper {
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) {
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;
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");
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) {
public static Integer updateMeetingCalendarForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer groupId, String calendarID, final String startDate, final String frequency, final String interval,
final String repeatsOnDay) {
System.out.println("---------------------------------UPDATING A MEETING CALENDAR FOR THE GROUP------------------------------");
final String CALENDAR_RESOURCE_URL = BASE_URL + PARENT_ENTITY_NAME + groupId + ENITY_NAME + "/" + calendarID;
System.out.println(CALENDAR_RESOURCE_URL);
// TODO: check that resource id indeed exists in calendar update put.
return Utils.performServerPut(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("repeatsOnDay", repeatsOnDay);
map.put("title", Utils.randomNameGenerator("groups_CollectionMeeting", 4));
map.put("typeId", "1");
map.put("startDate", startDate);
@@ -54,7 +68,8 @@ public class CalendarHelper {
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 String responseCalendarDetailsinJSON = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL,
"collectionMeetingCalendar");
final Integer responseCalendarId = from(responseCalendarDetailsinJSON).get("id");
assertEquals("ERROR IN CREATING THE CALENDAR", generatedCalendarId, responseCalendarId);
}
@@ -0,0 +1,235 @@
/**
* 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 org.mifosplatform.infrastructure.core.service.DateUtils;
import com.google.gson.Gson;
public class CenterDomain implements Comparable<CenterDomain> {
public static class Builder {
private Integer id;
private String accountNo;
private HashMap status;
private boolean active;
private String name;
private String externalId;
private Integer staffId;
private Integer officeId;
private String officeName;
private String hierarchy;
private ArrayList<HashMap> groupMembers;
private Builder(final Integer id, final Integer statusid, final String statuscode, final String statusvalue, final boolean active,
final String name, final String externalId, final Integer staffId, final int officeID, final String officeName,
final String hierarchy, final ArrayList<HashMap> groupMembers) {
this.id = id;
this.accountNo = accountNo;
this.status = new HashMap();
this.status.put("id", statusid);
this.status.put("code", statuscode);
this.status.put("value", statusvalue);
this.active = active;
this.name = name;
this.externalId = externalId;
this.staffId = staffId;
this.officeId = officeID;
this.officeName = officeName;
this.hierarchy = hierarchy;
this.groupMembers = groupMembers;
}
public CenterDomain build() {
return new CenterDomain(this.id, this.accountNo, (int) this.status.get("id"), (String) this.status.get("code"),
(String) this.status.get("value"), this.active, this.name, this.externalId, this.staffId, this.officeId,
this.officeName, this.hierarchy, groupMembers);
}
}
private Integer id;
private String accountNo;
private HashMap status;
private boolean active;
private String name;
private String externalId;
private Integer staffId;
private Integer officeId;
private String officeName;
private String hierarchy;
private ArrayList<HashMap> groupMembers;
CenterDomain() {
/* super(); */
}
private CenterDomain(final Integer id, final String accountNo, final Integer statusid, final String statuscode, final String statusvalue, final boolean active,
final String name, final String externalId, final Integer staffId, final Integer officeID, final String officeName,
final String hierarchy, final ArrayList<HashMap> groupMembers) {
this.id = id;
this.accountNo = accountNo;
this.status = new HashMap();
this.status.put("id", statusid);
this.status.put("code", statuscode);
this.status.put("value", statusvalue);
this.active = active;
this.name = name;
this.externalId = externalId;
this.staffId = staffId;
this.officeId = officeID;
this.officeName = officeName;
this.hierarchy = hierarchy;
this.groupMembers = groupMembers;
}
public String toJSON() {
return new Gson().toJson(this);
}
public static CurrencyDomain fromJSON(final String jsonData) {
return new Gson().fromJson(jsonData, CurrencyDomain.class);
}
public static Builder create(final Integer id, final Integer statusid, final String statuscode, final String statusvalue,
final boolean active, final String name, final String externalId, final Integer staffId, final Integer officeID,
final String officeName, final String hierarchy, final ArrayList<HashMap> groupMembers) {
return new Builder(id, statusid, statuscode, statusvalue, active, name, externalId, staffId, officeID, officeName, hierarchy,
groupMembers);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static String jsonRequestToCreateCenter(Integer id, Integer statusId, String statusCode, String statusValue, Boolean active,
String activationDate, String submittedDate, String name, String externalId, Integer staffId, Integer officeID,
String officeName, String hierarchy, final int[] groupMembers) {
// String ids = String.valueOf(id);
final HashMap map = new HashMap<>();
if (id != null) map.put("id", id);
if (statusId != null) map.put("statusId", statusId);
if (statusCode != null) map.put("statusCode", statusCode);
if (statusValue != null) map.put("statusValue", statusValue);
map.put("officeId", "1");
map.put("name", randomNameGenerator("Center_Name_", 5));
map.put("externalId", randomIDGenerator("ID_", 7));
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
if (staffId != null) {
map.put("staffId", String.valueOf(staffId));
}
if (active) {
map.put("active", "true");
map.put("locale", "en");
map.put("dateFormat", "dd MMM yyyy");
map.put("activationDate", activationDate);
} else {
map.put("active", "false");
if (submittedDate == null)
map.put("submittedOnDate", DateUtils.getDateOfTenant());
else
map.put("submittedOnDate", submittedDate);
}
if (externalId != null) map.put("externalId", externalId);
if (groupMembers != null) map.put("groupMembers", groupMembers);
System.out.println(map);
return new Gson().toJson(map);
}
public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
}
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
public String getExternalId() {
return this.externalId;
}
public Integer getStaffId() {
return this.staffId;
}
public Integer getId() {
return this.id;
}
public HashMap getStatus() {
return this.status;
}
public boolean isActive() {
return this.active;
}
public String getName() {
return this.name;
}
public Integer getOfficeId() {
return this.officeId;
}
public String getOfficeName() {
return this.officeName;
}
public String getHierarchy() {
return this.hierarchy;
}
public String getAccountNo(){
return this.accountNo;
}
public int[] getGroupMembers() {
int[] groupMemberList = new int[this.groupMembers.size()];
for (int i = 0; i < groupMemberList.length; i++) {
groupMemberList[i] = ((Double) this.groupMembers.get(i).get("id")).intValue();
}
return groupMemberList;
}
@Override
public int hashCode() {
int hash = 1;
if (this.id >= 0) hash += this.id;
if (this.status != null) {
if ((Double) this.status.get("id") >= 0) hash += (Double) this.status.get("id");
if ((String) this.status.get("code") != null) hash += this.status.get("code").hashCode();
if ((String) this.status.get("value") != null) hash += this.status.get("value").hashCode();
}
if (this.name != null) hash += this.name.hashCode();
if (this.officeId >= 0) hash += this.officeId;
if (this.officeName != null) hash += this.officeName.hashCode();
if (this.hierarchy != null) hash += this.hierarchy.hashCode();
if (this.groupMembers != null) hash += this.groupMembers.hashCode();
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == this) { return true; }
if (!(obj instanceof CenterDomain)) return false;
CenterDomain cd = (CenterDomain) obj;
if (this.hashCode() == cd.hashCode()) return true;
return false;
}
@Override
public int compareTo(CenterDomain cd) {
return ((Integer) this.id).compareTo(cd.getId());
}
}
@@ -0,0 +1,255 @@
/**
* 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 static org.junit.Assert.assertEquals;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class CenterHelper {
private static final String CENTERS_URL = "/mifosng-provider/api/v1/centers";
public static final String CREATED_DATE = "29 December 2014";
private static final String CREATE_CENTER_URL = "/mifosng-provider/api/v1/centers?" + Utils.TENANT_IDENTIFIER;
public static CenterDomain retrieveByID(int id, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String GET_CENTER_BY_ID_URL = CENTERS_URL + "/" + id + "?associations=groupMembers&" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING CENTER AT " + id + "-------------------------");
final String jsonData = new Gson().toJson(Utils.performServerGet(requestSpec, responseSpec, GET_CENTER_BY_ID_URL, ""));
return new Gson().fromJson(jsonData, new TypeToken<CenterDomain>() {}.getType());
}
public static ArrayList<CenterDomain> paginatedListCenters(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String GET_CENTER = CENTERS_URL + "?paged=true&limit=-1&" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING CENTERS-------------------------");
final String jsonData = new Gson().toJson(Utils.performServerGet(requestSpec, responseSpec, GET_CENTER, "pageItems"));
return new Gson().fromJson(jsonData, new TypeToken<ArrayList<CenterDomain>>() {}.getType());
}
public static ArrayList<CenterDomain> listCenters(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String GET_CENTER = CENTERS_URL + "?limit=-1&" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING CENTERS-------------------------");
final String jsonData = new Gson().toJson(Utils.performServerGet(requestSpec, responseSpec, GET_CENTER, ""));
return new Gson().fromJson(jsonData, new TypeToken<ArrayList<CenterDomain>>() {}.getType());
}
public static int createCenter(final String name, final int officeId, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return createCenter(name, officeId, null, -1, null, null, requestSpec, responseSpec);
}
public static int createCenter(final String name, final int officeId, final String activationDate,
final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createCenter(name, officeId, null, -1, null, activationDate, requestSpec, responseSpec);
}
public static int createCenter(final String name, final int officeId, final String externalId, final int staffId,
final int[] groupMembers, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createCenter(name, officeId, externalId, staffId, groupMembers, null, requestSpec, responseSpec);
}
public static int createCenter(final String name, final int officeId, final String externalId, final int staffId,
final int[] groupMembers, final String activationDate, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String CREATE_CENTER_URL = CENTERS_URL + "?" + Utils.TENANT_IDENTIFIER;
HashMap hm = new HashMap();
hm.put("name", name);
hm.put("officeId", officeId);
hm.put("active", false);
if (externalId != null) hm.put("externalId", externalId);
if (staffId != -1) hm.put("staffId", staffId);
if (groupMembers != null) hm.put("groupMembers", groupMembers);
if (activationDate != null) {
hm.put("active", true);
hm.put("locale", "en");
hm.put("dateFormat", "dd MMM yyyy");
hm.put("activationDate", activationDate);
}
System.out.println("------------------------CREATING CENTER-------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CENTER_URL, new Gson().toJson(hm), "resourceId");
}
public static HashMap<String, String> updateCenter(final int id, HashMap request, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String UPDATE_CENTER_URL = CENTERS_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE CENTER AT " + id + "---------------------------------------------");
HashMap<String, String> hash = Utils.performServerPut(requestSpec, responseSpec, UPDATE_CENTER_URL, new Gson().toJson(request),
"changes");
return hash;
}
public static int[] associateGroups(final int id, final int[] groupMembers, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String ASSOCIATE_GROUP_CENTER_URL = CENTERS_URL + "/" + id + "?command=associateGroups&" + Utils.TENANT_IDENTIFIER;
HashMap groupMemberHashMap = new HashMap();
groupMemberHashMap.put("groupMembers", groupMembers);
System.out.println("---------------------------------ASSOCIATING GROUPS AT " + id + "--------------------------------------------");
HashMap hash = Utils.performServerPost(requestSpec, responseSpec, ASSOCIATE_GROUP_CENTER_URL,
new Gson().toJson(groupMemberHashMap), "changes");
System.out.println(hash);
ArrayList<String> arr = (ArrayList<String>) hash.get("groupMembers");
int[] ret = new int[arr.size()];
for (int i = 0; i < ret.length; i++) {
ret[i] = Integer.parseInt(arr.get(i));
}
return ret;
}
public static void deleteCenter(final int id, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String DELETE_CENTER_URL = CENTERS_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------DELETING CENTER AT " + id + "--------------------------------------------");
Utils.performServerDelete(requestSpec, responseSpec, DELETE_CENTER_URL, "");
}
public static Integer createCenter(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
@SuppressWarnings("unused") final boolean active) {
System.out.println("---------------------------------CREATING A CENTER---------------------------------------------");
return createCenter(requestSpec, responseSpec, "CREATED_DATE");
}
public static Integer createCenter(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate) {
System.out.println("---------------------------------CREATING A CENTER---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CENTER_URL, getTestCenterAsJSON(true, activationDate), "groupId");
}
public static Integer createCenter(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
System.out.println("---------------------------------CREATING A CENTER---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CENTER_URL, getTestCenterAsJSON(true, CenterHelper.CREATED_DATE),
"groupId");
}
public static int createCenterWithStaffId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer staffId) {
System.out.println("---------------------------------CREATING A CENTER---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CENTER_URL,
getTestCenterWithStaffAsJSON(true, CenterHelper.CREATED_DATE, staffId), "groupId");
}
public static void verifyCenterCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedCenterID) {
System.out.println("------------------------------CHECK CENTER DETAILS------------------------------------\n");
final String CENTER_URL = "/mifosng-provider/api/v1/centers/" + generatedCenterID + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseCenterID = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "id");
assertEquals("ERROR IN CREATING THE CENTER", generatedCenterID, responseCenterID);
}
public static void verifyCenterActivatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedCenterID, final boolean generatedCenterStatus) {
System.out.println("------------------------------CHECK CENTER STATUS------------------------------------\n");
final String CENTER_URL = "/mifosng-provider/api/v1/centers/" + generatedCenterID + "?" + Utils.TENANT_IDENTIFIER;
final Boolean responseCenterStatus = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "active");
assertEquals("ERROR IN ACTIVATING THE CENTER", generatedCenterStatus, responseCenterStatus);
}
public static Integer activateCenter(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String centerId) {
final String CENTER_ASSOCIATE_URL = "/mifosng-provider/api/v1/centers/" + centerId + "?command=activate&" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------ACTIVATE A CENTER---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CENTER_ASSOCIATE_URL, activateCenterAsJSON(""), "groupId");
}
public static String getTestCenterWithStaffAsJSON(final boolean active, final String activationDate, final Integer staffId) {
Integer id = null;
Integer statusid = null;
String statuscode = null;
String statusvalue = null;
String name = null;
String externalId = null;
Integer officeID = null;
String officeName = null;
String hierarchy = null;
int[] groupMembers = null;
String submittedDate = null;
return CenterDomain.jsonRequestToCreateCenter(id, statusid, statuscode, statusvalue, active, activationDate,submittedDate,name,
externalId, staffId, officeID, officeName, hierarchy, groupMembers);
}
public static String getTestCenterAsJSON(final boolean active, final String activationDate) {
Integer id = null;
Integer statusid = null;
String statuscode = null;
String statusvalue = null;
String name = null;
String externalId = null;
Integer officeID = null;
String officeName = null;
Integer staffId = null;
String hierarchy = null;
final int[] groupMembers = null;
String submittedDate = null;
return CenterDomain.jsonRequestToCreateCenter(id, statusid, statuscode, statusvalue, active, activationDate,submittedDate,name,
externalId, staffId, officeID, officeName, hierarchy, groupMembers);
}
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 unassignStaffAsJSON(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 activateCenterAsJSON(final String activationDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
if (StringUtils.isNotEmpty(activationDate)) {
map.put("activationDate", activationDate);
} else {
map.put("activationDate", "CREATED_DATE");
System.out.println("defaulting to fixed date: CREATED_DATE");
}
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
}
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
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("---------------------------------Assign Staff---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSIGN_STAFF_URL, assignStaffAsJSON(staffId), "changes");
}
public static Object unassignStaff(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=unassignStaff";
System.out.println("---------------------------------Unassign Staff---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, GROUP_ASSIGN_STAFF_URL, unassignStaffAsJSON(staffId), "changes");
}
}
@@ -9,6 +9,8 @@ import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import org.mifosplatform.integrationtests.common.system.CodeHelper;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@@ -23,7 +25,7 @@ public class ClientHelper {
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 ACTIVATE_CLIENT_COMMAND = "activate";
private static final String WITHDRAW_CLIENT_COMMAND = "withdraw";
public static final String CREATED_DATE = "27 November 2014";
@@ -53,6 +55,16 @@ public class ClientHelper {
"clientId");
}
public static Integer createClientForAccountPreference(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer clientType, String jsonAttributeToGetBack) {
final String activationDate = "04 March 2011";
final String officeId = "1";
System.out
.println("---------------------------------CREATING A CLIENT BASED ON ACCOUNT PREFERENCE---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL,
getTestClientWithClientTypeAsJSON(activationDate, officeId, clientType.toString()), jsonAttributeToGetBack);
}
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
@@ -62,7 +74,8 @@ public class ClientHelper {
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) {
public static Integer getClientsStaffId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId) {
return (Integer) getClient(requestSpec, responseSpec, clientId, "staffId");
}
@@ -80,6 +93,21 @@ public class ClientHelper {
return new Gson().toJson(map);
}
public static String getTestClientWithClientTypeAsJSON(final String dateOfJoining, final String officeId, final String clientType) {
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));
map.put("externalId", randomIDGenerator("ID_", 7));
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
map.put("active", "true");
map.put("activationDate", dateOfJoining);
map.put("clientTypeId", clientType);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String assignStaffToClientAsJson(final String staffId) {
final HashMap<String, String> map = new HashMap<>();
map.put("staffId", staffId);
@@ -98,15 +126,16 @@ public class ClientHelper {
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,
/* Client status is a map.So adding SuppressWarnings */
@SuppressWarnings("unchecked")
public static HashMap<String, Object> getClientStatus(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String clientId) {
return (HashMap) getClient(requestSpec, responseSpec, clientId, "status");
return (HashMap<String, Object>) getClient(requestSpec, responseSpec, clientId, "status");
}
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
@@ -115,15 +144,27 @@ public class ClientHelper {
private String getCloseClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
/* Retrieve Code id for the Code "ClientClosureReason" */
String codeName = "ClientClosureReason";
HashMap<String, Object> code = CodeHelper.getCodeByName(this.requestSpec, this.responseSpec, codeName);
Integer clientClosureCodeId = (Integer) code.get("id");
/* Retrieve/Create Code Values for the Code "ClientClosureReason" */
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientClosureCodeId, this.requestSpec, this.responseSpec);
Integer closureReasonId = (Integer) codeValue.get("id");
map.put("closureReasonId", closureReasonId.toString());
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);
@@ -134,17 +175,29 @@ public class ClientHelper {
return clientJson;
}
private String getRejectClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
/* Retrieve Code id for the Code "ClientRejectReason" */
String codeName = "ClientRejectReason";
HashMap<String, Object> code = CodeHelper.getCodeByName(this.requestSpec, this.responseSpec, codeName);
Integer clientRejectionReasonCodeId = (Integer) code.get("id");
/* Retrieve/Create Code Values for the Code "ClientRejectReason" */
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientRejectionReasonCodeId, this.requestSpec,
this.responseSpec);
Integer rejectionReasonId = (Integer) codeValue.get("id");
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("rejectDate", CREATED_DATE_PLUS_ONE);
map.put("rejectReasonId", "15");
map.put("rejectionDate", CREATED_DATE_PLUS_ONE);
map.put("rejectionReasonId", rejectionReasonId.toString());
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);
@@ -158,45 +211,58 @@ public class ClientHelper {
private String getWithdrawClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
/* Retrieve Code id for the Code "ClientWithdrawReason" */
String codeName = "ClientWithdrawReason";
HashMap<String, Object> code = CodeHelper.getCodeByName(this.requestSpec, this.responseSpec, codeName);
Integer clientWithdrawReasonCodeId = (Integer) code.get("id");
/* Retrieve/Create Code Values for the Code "ClientWithdrawReason" */
HashMap<String, Object> codeValue = CodeHelper.retrieveOrCreateCodeValue(clientWithdrawReasonCodeId, this.requestSpec,
this.responseSpec);
Integer withdrawalReasonId = (Integer) codeValue.get("id");
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("withdrawDate", CREATED_DATE_PLUS_ONE);
map.put("withdrawReasonId", "17");
map.put("withdrawalDate", CREATED_DATE_PLUS_ONE);
map.put("withdrawalReasonId", withdrawalReasonId.toString());
String clientJson = new Gson().toJson(map);
System.out.println(clientJson);
return clientJson;
}
public HashMap closeClient(final Integer clientId) {
public HashMap<String, Object> closeClient(final Integer clientId) {
System.out.println("--------------------------------- CLOSE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(CLOSE_CLIENT_COMMAND, clientId), getCloseClientAsJSON(), clientId);
}
public HashMap reactivateClient(final Integer clientId) {
public HashMap<String, Object> reactivateClient(final Integer clientId) {
System.out.println("--------------------------------- REACTIVATE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(REACTIVATE_CLIENT_COMMAND, clientId), getReactivateClientAsJSON(), clientId);
}
public HashMap rejectClient(final Integer clientId) {
public HashMap<String, Object> rejectClient(final Integer clientId) {
System.out.println("--------------------------------- REJECT CLIENT -------------------------------");
return performClientActions(createClientOperationURL(REJECT_CLIENT_COMMAND, clientId), getRejectClientAsJSON(), clientId);
}
public HashMap activateClient(final Integer clientId) {
public HashMap<String, Object> activateClient(final Integer clientId) {
System.out.println("--------------------------------- ACTIVATE CLIENT -------------------------------");
return performClientActions(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId), getActivateClientAsJSON(), clientId);
}
public HashMap withdrawClient(final Integer clientId) {
public HashMap<String, Object> 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;
private HashMap<String, Object> performClientActions(final String postURLForClient, final String jsonToBeSent, final Integer clientId) {
Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent, CommonConstants.RESPONSE_STATUS);
HashMap response = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
HashMap<String, Object> response = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
return response;
}
@@ -0,0 +1,65 @@
/**
* 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.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
public class CurrenciesHelper {
private static final String CURRENCIES_URL = "/mifosng-provider/api/v1/currencies";
public static ArrayList<CurrencyDomain> getAllCurrencies(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String GET_ALL_CURRENCIES_URL = CURRENCIES_URL + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING ALL CURRENCIES -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_CURRENCIES_URL, "");
ArrayList<HashMap> selectedCurrencyOptions = (ArrayList<HashMap>) response.get("selectedCurrencyOptions");
ArrayList<HashMap> currencyOptions = (ArrayList<HashMap>) response.get("currencyOptions");
currencyOptions.addAll(selectedCurrencyOptions);
final String jsonData = new Gson().toJson(new ArrayList<HashMap>(selectedCurrencyOptions));
return new Gson().fromJson(jsonData, new TypeToken<ArrayList<CurrencyDomain>>() {}.getType());
}
public static ArrayList<CurrencyDomain> getSelectedCurrencies(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String GET_ALL_SELECTED_CURRENCIES_URL = CURRENCIES_URL + "?fields=selectedCurrencyOptions" + "&" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING ALL SELECTED CURRENCIES -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_SELECTED_CURRENCIES_URL, "");
final String jsonData = new Gson().toJson(response.get("selectedCurrencyOptions"));
return new Gson().fromJson(jsonData, new TypeToken<ArrayList<CurrencyDomain>>() {}.getType());
}
public static CurrencyDomain getCurrencybyCode(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String code) {
ArrayList<CurrencyDomain> currenciesList = getAllCurrencies(requestSpec, responseSpec);
for (CurrencyDomain e : currenciesList) {
if (e.getCode().equals(code)) return e;
}
return null;
}
public static ArrayList<String> updateSelectedCurrencies(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final ArrayList<String> currencies) {
final String CURRENCIES_UPDATE_URL = CURRENCIES_URL + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE SELECTED CURRENCIES LIST---------------------------------------------");
HashMap hash = Utils.performServerPut(requestSpec, responseSpec, CURRENCIES_UPDATE_URL, currenciesToJSON(currencies), "changes");
return (ArrayList<String>) hash.get("currencies");
}
private static String currenciesToJSON(final ArrayList<String> currencies) {
HashMap map = new HashMap<>();
map.put("currencies", currencies);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
}
@@ -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.common;
import com.google.gson.Gson;
public class CurrencyDomain implements Comparable<CurrencyDomain> {
public static class Builder {
private String code;
private String name;
private int decimalPlaces;
private String displaySymbol;
private String nameCode;
private String displayLabel;
private Builder(final String code, final String name, final int decimalPlaces, final String displaySymbol, final String nameCode,
final String displayLabel) {
this.code = code;
this.name = name;
this.decimalPlaces = decimalPlaces;
this.displaySymbol = displaySymbol;
this.nameCode = nameCode;
this.displayLabel = displayLabel;
}
public CurrencyDomain build() {
return new CurrencyDomain(this.code, this.name, this.decimalPlaces, this.displaySymbol, this.nameCode, this.displayLabel);
}
}
private String code;
private String name;
private int decimalPlaces;
private String displaySymbol;
private String nameCode;
private String displayLabel;
CurrencyDomain() {
super();
}
private CurrencyDomain(final String code, final String name, final int decimalPlaces, final String displaySymbol,
final String nameCode, final String displayLabel) {
super();
this.code = code;
this.name = name;
this.decimalPlaces = decimalPlaces;
this.displaySymbol = displaySymbol;
this.nameCode = nameCode;
this.displayLabel = displayLabel;
}
public String getCode() {
return this.code;
}
public int getDecimalPlaces() {
return this.decimalPlaces;
}
public String getDisplaySymbol() {
return this.displaySymbol;
}
public String getNameCode() {
return this.nameCode;
}
public String getDisplayLabel() {
return this.displayLabel;
}
public String getName() {
return this.name;
}
public String toJSON() {
return new Gson().toJson(this);
}
public static CurrencyDomain fromJSON(final String jsonData) {
return new Gson().fromJson(jsonData, CurrencyDomain.class);
}
public static Builder create(final String code, final String name, final int decimalPlaces, final String displaySymbol,
final String nameCode, final String displayLabel) {
return new Builder(code, name, decimalPlaces, displaySymbol, nameCode, displayLabel);
}
@Override
public int hashCode() {
int hash = 1;
if (this.name != null) hash += this.name.hashCode();
if (this.code != null) hash += this.code.hashCode();
if (this.decimalPlaces >= 0) hash += this.decimalPlaces;
if (this.displaySymbol != null) hash += this.displaySymbol.hashCode();
if (this.nameCode != null) hash += this.nameCode.hashCode();
if (this.displayLabel != null) hash += this.displayLabel.hashCode();
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == this) { return true; }
if (!(obj instanceof CurrencyDomain)) return false;
CurrencyDomain cd = (CurrencyDomain) obj;
if (this.name.equals(cd.name) && this.code.equals(cd.code) && this.decimalPlaces == cd.decimalPlaces
&& this.displaySymbol.equals(cd.displaySymbol) && this.nameCode.equals(cd.nameCode)
&& this.displayLabel.equals(cd.displayLabel)) return true;
return false;
}
@Override
public int compareTo(CurrencyDomain cd) {
return this.name.compareTo(cd.getName());
}
}
@@ -0,0 +1,51 @@
/**
* 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 ExternalServicesConfigurationHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public ExternalServicesConfigurationHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public static ArrayList<HashMap> getExternalServicesConfigurationByServiceName(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String serviceName) {
final String GET_EXTERNAL_SERVICES_CONFIG_BY_SERVICE_NAME_URL = "/mifosng-provider/api/v1/externalservice/" + serviceName + "?"
+ Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING GLOBAL CONFIGURATION BY ID -------------------------");
return Utils.performServerGet(requestSpec, responseSpec, GET_EXTERNAL_SERVICES_CONFIG_BY_SERVICE_NAME_URL, "");
}
public static HashMap updateValueForExternaServicesConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String serviceName, final String name, final String value) {
final String EXTERNAL_SERVICES_CONFIG_UPDATE_URL = "/mifosng-provider/api/v1/externalservice/" + serviceName + "?"
+ Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE VALUE FOR GLOBAL CONFIG---------------------------------------------");
HashMap map = Utils.performServerPut(requestSpec, responseSpec, EXTERNAL_SERVICES_CONFIG_UPDATE_URL,
updateExternalServicesConfigUpdateValueAsJSON(name, value), "");
return (HashMap) map.get("changes");
}
public static String updateExternalServicesConfigUpdateValueAsJSON(final String name, final String value) {
final HashMap<String, String> map = new HashMap<>();
map.put(name, value);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
}
@@ -7,6 +7,7 @@ package org.mifosplatform.integrationtests.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import com.google.gson.Gson;
@@ -70,6 +71,14 @@ public class GlobalConfigurationHelper {
return Utils.performServerPut(requestSpec, responseSpec, IS_CACHE_GLOBAL_CONFIG_UPDATE_URL,
updateIsCacheEnabledGlobalConfigUpdateAsJSON(cacheType), "changes");
}
public static Object updatePasswordResetDaysForGlobalConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer configId, final String value, final String enabled, final String jsonAttributeToGetBack) {
final String UPDATE_URL = "/mifosng-provider/api/v1/configurations/" + configId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------UPDATE GLOBAL CONFIG FOR FORCE PASSWORD RESET DAYS----------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_URL,
updatePasswordResetDaysGlobalConfigAsJSON(value, enabled), jsonAttributeToGetBack);
}
public static String updateGlobalConfigUpdateValueAsJSON(final String value) {
final HashMap<String, String> map = new HashMap<>();
@@ -77,6 +86,16 @@ public class GlobalConfigurationHelper {
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String updatePasswordResetDaysGlobalConfigAsJSON(final String value, final String enabled) {
final HashMap<String, String> map = new HashMap<>();
if(value != null){
map.put("value", value);
}
map.put("enabled", enabled);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String updateGlobalConfigUpdateEnabledFlagAsJSON(final Boolean enabled) {
final HashMap<String, Boolean> map = new HashMap<String, Boolean>();
@@ -5,10 +5,13 @@
*/
package org.mifosplatform.integrationtests.common;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.HashMap;
import com.google.gson.Gson;
import com.jayway.restassured.builder.ResponseSpecBuilder;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@@ -18,7 +21,7 @@ public class HookHelper {
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;
@@ -48,5 +51,40 @@ public class HookHelper {
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public Integer updateHook(final String payloadURL, final Long hookId) {
System.out.println("---------------------------------UPDATING HOOK---------------------------------------------");
final String UPDATE_HOOK_URL = "/mifosng-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPut(this.requestSpec, this.responseSpec, UPDATE_HOOK_URL, getTestHookAsJson(payloadURL), "resourceId");
}
public Integer deleteHook(final Long hookId) {
System.out.println("---------------------------------DELETING HOOK---------------------------------------------");
final String DELETE_HOOK_URL = "/mifosng-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(this.requestSpec, this.responseSpec, DELETE_HOOK_URL, "resourceId");
}
public void verifyHookCreatedOnServer(final Long hookId) {
System.out.println("------------------------------CHECK CREATE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/mifosng-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseHookId = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_URL, "id");
assertEquals(hookId.toString(), responseHookId.toString());
}
public void verifyUpdateHook(final String updateURL, final Long hookId) {
System.out.println("------------------------------CHECK UPDATE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/mifosng-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
ArrayList map = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_URL, "config");
HashMap<String, String> hash = (HashMap<String, String>) map.get(1);
assertEquals(updateURL, hash.get("fieldValue"));
}
public void verifyDeleteHook(final Long hookId) {
System.out.println("------------------------------CHECK DELETE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/mifosng-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
ResponseSpecification responseSpec404 = new ResponseSpecBuilder().expectStatusCode(404).build();
ArrayList array = Utils.performServerGet(this.requestSpec, responseSpec404, GET_URL, "errors");
HashMap<String, String> map = (HashMap<String, String>)array.get(0);
assertEquals("error.msg.hook.identifier.not.found",map.get("userMessageGlobalisationCode"));
}
}
@@ -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 org.apache.http.HttpHeaders;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class ImageHelper {
private static final String STAFF_IMAGE_URL = "/mifosng-provider/api/v1/staff/";
private static final String IMAGES_URI = "/images";
public static Integer createImageForStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
Integer staffId) {
System.out.println("---------------------------------CREATING AN IMAGE FOR STAFF---------------------------------------------");
String URL = STAFF_IMAGE_URL + staffId + IMAGES_URI + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, URL, generateImageAsText(), "resourceId");
}
public static Integer updateImageForStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
Integer staffId) {
System.out.println("---------------------------------UPDATING AN IMAGE FOR STAFF---------------------------------------------");
String URL = STAFF_IMAGE_URL + staffId + IMAGES_URI + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPut(requestSpec, responseSpec, URL, generateImageAsText(), "resourceId");
}
public static String getStaffImageAsText(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
Integer staffId) {
System.out.println("---------------------------------RETRIEVING STAFF IMAGE---------------------------------------------");
String URL = STAFF_IMAGE_URL + staffId + IMAGES_URI + "?" + Utils.TENANT_IDENTIFIER;
requestSpec.header(HttpHeaders.ACCEPT, "text/plain");
return Utils.performGetTextResponse(requestSpec, responseSpec, URL);
}
public static byte[] getStaffImageAsBinary(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
Integer staffId) {
System.out.println("---------------------------------RETRIEVING STAFF IMAGE---------------------------------------------");
String URL = STAFF_IMAGE_URL + staffId + IMAGES_URI + "?" + Utils.TENANT_IDENTIFIER;
requestSpec.header(HttpHeaders.ACCEPT, "application/octet-stream");
return Utils.performGetBinaryResponse(requestSpec, responseSpec, URL);
}
public static Integer deleteStaffImage(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, Integer staffId) {
System.out.println("---------------------------------RETRIEVING STAFF IMAGE---------------------------------------------");
String URL = STAFF_IMAGE_URL + staffId + IMAGES_URI + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(requestSpec, responseSpec, URL, "resourceId");
}
private static String generateImageAsText() {
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ\n"
+ "bWFnZVJlYWR5ccllPAAAAJ1JREFUeNpi+P//PwMIA4E9EG8E4idQDGLbw+WhiiqA+D8OXAFVAzbp\n"
+ "DxBvB2JLIGaGYkuoGEjOhhFIHAbij0BdPgxYACMj42ogJQpifwBiXSDeC8JIbt4LxSC5DyxQjTeB\n"
+ "+BeaYb+Q5EBOAVutCzMJHUNNPADzzDokiYdAfAmJvwLkGeTgWQfyKZICS6hYBTwc0QL8ORSjBDhA\n" + "gAEAOg13B6R/SAgAAAAASUVORK5CYII=";
}
}
@@ -0,0 +1,140 @@
/**
* 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;
public class OfficeDomain {
public static class Builder {
private int id;
private String name;
private String nameDecorated;
private String externalId;
private String[] openingDate;
private String hierarchy;
private Builder(final int id, final String name,
final String nameDecorated, final String externalId,
final String[] openingDate, final String hierarchy) {
this.id = id;
this.name = name;
this.nameDecorated = nameDecorated;
this.externalId = externalId;
this.openingDate = openingDate;
this.hierarchy = hierarchy;
}
public OfficeDomain build() {
return new OfficeDomain(this.id, this.name, this.nameDecorated,
this.externalId, this.openingDate, this.hierarchy);
}
}
private int id;
private String name;
private String nameDecorated;
private String externalId;
private String[] openingDate;
private String hierarchy;
OfficeDomain() {
super();
}
private OfficeDomain(final int id, final String name,
final String nameDecorated, final String externalId,
final String[] openingDate, final String hierarchy) {
super();
this.id = id;
this.name = name;
this.nameDecorated = nameDecorated;
this.externalId = externalId;
this.openingDate = openingDate;
this.hierarchy = hierarchy;
}
public String toJSON() {
return new Gson().toJson(this);
}
public static OfficeDomain fromJSON(final String jsonData) {
return new Gson().fromJson(jsonData, OfficeDomain.class);
}
public static Builder create(final int id, final String name,
final String nameDecorated, final String externalId,
final String[] openingDate, final String hierarchy) {
return new Builder(id, name, nameDecorated, externalId, openingDate,
hierarchy);
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public String getNameDecorated() {
return this.nameDecorated;
}
public String getExternalId() {
return this.externalId;
}
public String[] getOpeningDate() {
return this.openingDate;
}
public String getHierarchy() {
return this.hierarchy;
}
@Override
public int hashCode() {
int hash = 1;
if (this.id > 0)
hash += this.id;
if (this.name != null)
hash += this.name.hashCode();
if (this.nameDecorated != null)
hash += this.nameDecorated.hashCode();
if (this.externalId != null)
hash += this.externalId.hashCode();
if (this.openingDate != null)
hash += this.openingDate.hashCode();
if (this.hierarchy != null)
hash += this.hierarchy.hashCode();
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof OfficeDomain))
return false;
OfficeDomain od = (OfficeDomain) obj;
if (this.id == od.getId() && this.name.equals(od.getName())
&& this.nameDecorated.equals(od.getName())
&& this.externalId.equals(od.getExternalId())
&& this.openingDate.equals(od.getOpeningDate())
&& this.hierarchy.equals(od.getHierarchy()))
return true;
return false;
}
}
@@ -7,37 +7,60 @@ package org.mifosplatform.integrationtests.common;
import java.util.HashMap;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class OfficeHelper {
private static final String OFFICE_URL = "/mifosng-provider/api/v1/offices";
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String OFFICE_URL = "/mifosng-provider/api/v1/offices";
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public OfficeHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public OfficeHelper(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Integer createOffice(final String openingDate) {
String json = getAsJSON(openingDate);
return Utils.performServerPost(this.requestSpec, this.responseSpec, OFFICE_URL + "?" + Utils.TENANT_IDENTIFIER, json,
CommonConstants.RESPONSE_RESOURCE_ID);
}
public OfficeDomain retrieveOfficeByID(int id) {
final String json = new Gson().toJson(Utils.performServerGet(
requestSpec, responseSpec, OFFICE_URL + "/" + id + "?"
+ Utils.TENANT_IDENTIFIER, ""));
return new Gson().fromJson(json, new TypeToken<OfficeDomain>() {
}.getType());
}
public static String getAsJSON(final String openingDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("parentId", "1");
map.put("name", Utils.randomNameGenerator("Office_", 4));
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
map.put("openingDate", openingDate);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public Integer createOffice(final String openingDate) {
String json = getAsJSON(openingDate);
return Utils.performServerPost(this.requestSpec, this.responseSpec,
OFFICE_URL + "?" + Utils.TENANT_IDENTIFIER, json,
CommonConstants.RESPONSE_RESOURCE_ID);
}
public Integer updateOffice(int id, String name, String openingDate) {
final HashMap map = new HashMap<>();
map.put("name", name);
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
map.put("openingDate", openingDate);
System.out.println("map : " + map);
return Utils.performServerPut(requestSpec, responseSpec, OFFICE_URL
+ "/" + id + "?" + Utils.TENANT_IDENTIFIER,
new Gson().toJson(map), "resourceId");
}
public static String getAsJSON(final String openingDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("parentId", "1");
map.put("name", Utils.randomNameGenerator("Office_", 4));
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
map.put("openingDate", openingDate);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
}
@@ -0,0 +1,57 @@
/**
* 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 com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class PasswordPreferencesHelper {
private static final String PASSWORD_PREFERENCES_URL = "/mifosng-provider/api/v1/passwordpreferences";
public static Object updatePasswordPreferences(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
String validationPolicyId) {
final String UPDATE_PASSWORD_PREFERENCES_URL = PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE PASSWORD PREFERENCE---------------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_PASSWORD_PREFERENCES_URL, updatePreferencesAsJson(validationPolicyId), "");
}
public static Object updateWithInvalidValidationPolicyId(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec,String invalidValidationPolicyId, String jsonAttributeToGetback) {
final String UPDATE_PASSWORD_PREFERENCES_URL = PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER;
System.out
.println("---------------------------------UPDATE PASSWORD PREFERENCES WITH INVALID ID-----------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_PASSWORD_PREFERENCES_URL, updatePreferencesWithInvalidId(invalidValidationPolicyId),
jsonAttributeToGetback);
}
public static String updatePreferencesAsJson(String validationPolicyId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("validationPolicyId", validationPolicyId);
return new Gson().toJson(map);
}
public static String updatePreferencesWithInvalidId(String invalidValidationPolicyId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("validationPolicyId", invalidValidationPolicyId);
return new Gson().toJson(map);
}
public static int getActivePasswordPreference(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec, PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER, "id");
}
public static HashMap<String, Object> getAllPreferences(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec, PASSWORD_PREFERENCES_URL + "/template" + "?" + Utils.TENANT_IDENTIFIER, "");
}
}
@@ -0,0 +1,66 @@
/**
* 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;
public class PaymentTypeDomain {
private Integer id;
private String name;
private String description;
private Boolean isCashPayment;
private Integer position;
private PaymentTypeDomain(final Integer id, final String name, final String description, final Boolean isCashPayment,
final Integer position) {
this.id = id;
this.name = name;
this.description = description;
this.isCashPayment = isCashPayment;
this.position = position;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public Boolean getIsCashPayment() {
return this.isCashPayment;
}
public void setIsCashPayment(Boolean isCashPayment) {
this.isCashPayment = isCashPayment;
}
public Integer getPosition() {
return this.position;
}
public void setPosition(Integer position) {
this.position = position;
}
}
@@ -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.common;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class PaymentTypeHelper {
private static final String CREATE_PAYMENTTYPE_URL = "/mifosng-provider/api/v1/paymenttypes?" + Utils.TENANT_IDENTIFIER;
private static final String PAYMENTTYPE_URL = "/mifosng-provider/api/v1/paymenttypes";
public static Integer createPaymentType(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String name, final String description, final Boolean isCashPayment, final Integer position) {
System.out.println("---------------------------------CREATING A PAYMENT TYPE---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_PAYMENTTYPE_URL,
getJsonToCreatePaymentType(name, description, isCashPayment, position), "resourceId");
}
public static String getJsonToCreatePaymentType(final String name, final String description, final Boolean isCashPayment,
final Integer position) {
HashMap hm = new HashMap();
hm.put("name", name);
if (description != null) hm.put("description", description);
hm.put("isCashPayment", isCashPayment);
if (position != null) hm.put("position", position);
System.out.println("------------------------CREATING PAYMENT TYPE-------------------------" + hm);
return new Gson().toJson(hm);
}
public static void verifyPaymentTypeCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer generatedPaymentTypeID) {
System.out.println("------------------------------CHECK PAYMENT DETAILS------------------------------------\n");
final String GET_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + generatedPaymentTypeID + "?" + Utils.TENANT_IDENTIFIER;
final Integer responsePaymentTypeID = Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL, "id");
assertEquals("ERROR IN CREATING THE PAYMENT TYPE", generatedPaymentTypeID, responsePaymentTypeID);
}
public static PaymentTypeDomain retrieveById(RequestSpecification requestSpec, ResponseSpecification responseSpec,
final Integer paymentTypeId) {
final String GET_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + paymentTypeId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------GET PAYMENT TYPE---------------------------------------------");
final String jsonData = new Gson().toJson(Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL, ""));
return new Gson().fromJson(jsonData, new TypeToken<PaymentTypeDomain>() {}.getType());
}
public static HashMap<String, String> updatePaymentType(final int id, HashMap request, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String UPDATE_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE PAYMENT TYPE " + id + "---------------------------------------------");
HashMap<String, String> hash = Utils.performServerPut(requestSpec, responseSpec, UPDATE_PAYMENTTYPE_URL,
new Gson().toJson(request), "changes");
return hash;
}
public static Integer deletePaymentType(final int id, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String DELETE_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + id + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------DELETING PAYMENT TYPE " + id + "--------------------------------------------");
return Utils.performServerDelete(requestSpec, responseSpec, DELETE_PAYMENTTYPE_URL, "resourceId");
}
public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
}
}
@@ -118,6 +118,12 @@ public class SchedulerJobHelper {
ArrayList<HashMap> jobHistoryData = getSchedulerJobHistory(this.requestSpec, this.responseSpec, jobId.toString());
// print error associated with recent job failure (if any)
System.out.println("Job run error message (printed only if the job fails: "
+ jobHistoryData.get(jobHistoryData.size() - 1).get("jobRunErrorMessage"));
System.out.println("Job failure error log (printed only if the job fails: "
+ jobHistoryData.get(jobHistoryData.size() - 1).get("jobRunErrorLog"));
// Verifying the Status of the Recently executed Scheduler Job
Assert.assertEquals("Verifying Last Scheduler Job Status", "success",
jobHistoryData.get(jobHistoryData.size() - 1).get("status"));
@@ -1,60 +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.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);
}
}
@@ -11,29 +11,35 @@ import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.Random;
import java.util.TimeZone;
import org.apache.commons.lang.StringUtils;
import org.apache.http.conn.HttpHostConnectException;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalDate;
import com.jayway.restassured.RestAssured;
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.
* 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 {
public static final String TENANT_IDENTIFIER = "tenantIdentifier=default";
public static final String TENANT_TIME_ZONE = "Asia/Kolkata";
private static final String LOGIN_URL = "/mifosng-provider/api/v1/authentication?username=mifos&password=password&" + TENANT_IDENTIFIER;
public static void initializeRESTAssured() {
@@ -61,9 +67,20 @@ public class Utils {
public static <T> T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
if (jsonAttributeToGetBack == null) { return (T) json; }
return (T) from(json).get(jsonAttributeToGetBack);
}
public static String performGetTextResponse(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL){
return given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
}
public static byte[] performGetBinaryResponse(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL){
return given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asByteArray();
}
public static <T> T performServerPost(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String postURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().post(postURL)
@@ -116,4 +133,23 @@ public class Utils {
return randomStringGenerator(prefix, lenOfRandomSuffix);
}
public static String convertDateToURLFormat(final Calendar dateToBeConvert) {
DateFormat dateFormat = new SimpleDateFormat("dd MMMMMM yyyy");
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
return dateFormat.format(dateToBeConvert.getTime());
}
public static LocalDate getLocalDateOfTenant() {
LocalDate today = new LocalDate();
final DateTimeZone zone = DateTimeZone.forID(TENANT_TIME_ZONE);
if (zone != null) {
today = new LocalDate(zone);
}
return today;
}
public static TimeZone getTimeZoneOfTenant() {
return TimeZone.getTimeZone(TENANT_TIME_ZONE);
}
}
@@ -0,0 +1,70 @@
/**
* 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.Random;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class WorkingDaysHelper {
private static final String WORKINGDAYS_URL = "/mifosng-provider/api/v1/workingdays";
public static Object updateWorkingDays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String UPDATE_WORKINGDAYS_URL = WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE WORKINGDAY---------------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_WORKINGDAYS_URL, updateWorkingDaysAsJson(), "");
}
public static Object updateWorkingDaysWithWrongRecurrence(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, String jsonAttributeToGetback) {
final String UPDATE_WORKINGDAYS_URL = WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER;
System.out
.println("---------------------------------UPDATE WORKINGDAY WITH WRONG RECURRENCE-----------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_WORKINGDAYS_URL, updateWorkingDayWithWrongRecur(),
jsonAttributeToGetback);
}
public static String updateWorkingDaysAsJson() {
final HashMap<String, Object> map = new HashMap<>();
map.put("recurrence", "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU");
map.put("locale", "en");
map.put("repaymentRescheduleType", randomInt(1, 4));
map.put("extendTermForDailyRepayments", false);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String updateWorkingDayWithWrongRecur() {
final HashMap<String, Object> map = new HashMap<>();
map.put("recurrence", "FREQ=WEEKLY;INTERVAL=1;BYDAY=MP,TI,TE,TH");
map.put("locale", "en");
map.put("repaymentRescheduleType", randomInt(1, 4));
map.put("extendTermForDailyRepayments", false);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static int randomInt(int low, int high) {
int i = new Random().nextInt(high) + low;
return i;
}
public static int workingDaysId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
HashMap<String, Object> workingDays = getAllWorkingDays(requestSpec, responseSpec);
return (int) workingDays.get("id");
}
public static HashMap<String, Object> getAllWorkingDays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return Utils.performServerGet(requestSpec, responseSpec, WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER, "");
}
}
@@ -47,18 +47,40 @@ public class LoanApplicationTestBuilder {
private List<HashMap> disbursementData = null;
private List<HashMap> charges = new ArrayList<HashMap>();
private String recalculationRestFrequencyDate = null;
private String recalculationCompoundingFrequencyDate = null;
private String repaymentsStartingFromDate = null;
private String calendarId;
private boolean syncDisbursementWithMeeting = false;
public String build(final String clientID, final String groupID, final String loanProductId, final String savingsID) {
final HashMap<String, Object> map = new HashMap<>();
map.put("groupId", groupID);
map.put("clientId", clientID);
if (this.loanType == "jlg") {
if (this.calendarId != null) {
map.put("calendarId", this.calendarId);
}
map.put("syncDisbursementWithMeeting", this.syncDisbursementWithMeeting);
}
return build(map, loanProductId, savingsID);
}
public String build(final String ID, final String loanProductId, final String savingsID) {
final HashMap<String, Object> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en_GB");
if (this.loanType == "group") {
map.put("groupId", ID);
} else {
map.put("clientId", ID);
}
return build(map, loanProductId, savingsID);
}
private String build(final HashMap<String, Object> map, final String loanProductId, final String savingsID) {
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en_GB");
map.put("productId", loanProductId);
map.put("principal", this.principal);
map.put("loanTermFrequency", this.loanTermFrequency);
@@ -74,8 +96,9 @@ public class LoanApplicationTestBuilder {
map.put("expectedDisbursementDate", this.expectedDisbursmentDate);
map.put("submittedOnDate", this.submittedOnDate);
map.put("loanType", this.loanType);
map.put("repaymentsStartingFromDate", this.repaymentsStartingFromDate);
if (repaymentsStartingFromDate != null) {
map.put("repaymentsStartingFromDate", this.repaymentsStartingFromDate);
}
if (charges != null) {
map.put("charges", charges);
}
@@ -100,7 +123,11 @@ public class LoanApplicationTestBuilder {
if (recalculationRestFrequencyDate != null) {
map.put("recalculationRestFrequencyDate", recalculationRestFrequencyDate);
}
if (recalculationCompoundingFrequencyDate != null) {
map.put("recalculationCompoundingFrequencyDate", recalculationCompoundingFrequencyDate);
}
System.out.println("Loan Application request : " + map);
return new Gson().toJson(map);
}
@@ -243,9 +270,42 @@ public class LoanApplicationTestBuilder {
this.recalculationRestFrequencyDate = recalculationRestFrequencyDate;
return this;
}
public LoanApplicationTestBuilder withCompoundingFrequencyDate(final String recalculationCompoundingFrequencyDate) {
this.recalculationCompoundingFrequencyDate = recalculationCompoundingFrequencyDate;
return this;
}
public LoanApplicationTestBuilder withFirstRepaymentDate(final String firstRepaymentDate) {
this.repaymentsStartingFromDate = firstRepaymentDate;
return this;
}
/**
* calendarID parameter is used to sync repayments with group meetings,
* especially when using jlg loans
*
* @param calendarId
* the id of the calender record of the group meeting from
* m_calendar table
* @return
*/
public LoanApplicationTestBuilder withCalendarID(String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* This indicator is used mainly for jlg loans when we want to sync
* disbursement with the group meetings (it seems that if we do use this
* parameter we should also use calendarID to sync repayment with group
* meetings)
*
* @return
*/
public LoanApplicationTestBuilder withSyncDisbursementWithMeetin() {
this.syncDisbursementWithMeeting = true;
return this;
}
}
@@ -14,6 +14,7 @@ import org.mifosplatform.integrationtests.common.Utils;
import org.mifosplatform.integrationtests.common.accounting.Account;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class LoanProductTestBuilder {
@@ -52,6 +53,9 @@ public class LoanProductTestBuilder {
private static final String ACCRUAL_PERIODIC = "3";
private static final String ACCRUAL_UPFRONT = "4";
public static final String INTEREST_APPLICABLE_STRATEGY_REST_DATE = "2";
public static final String INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE = "1";
private String digitsAfterDecimal = "2";
private String inMultiplesOf = "0";
@@ -77,17 +81,29 @@ public class LoanProductTestBuilder {
private Boolean multiDisburseLoan = false;
private final String outstandingLoanBalance = "35000";
private final String maxTrancheCount = "35000";
private final String maxTrancheCount = "3";
private Boolean isInterestRecalculationEnabled = false;
private String daysInYearType = "1";
private String daysInMonthType = "1";
private String interestRecalculationCompoundingMethod = "0";
private String preCloseInterestCalculationStrategy = INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE;
private String rescheduleStrategyMethod = "1";
private String recalculationRestFrequencyType = "1";
private String recalculationRestFrequencyInterval = "0";
private String recalculationRestFrequencyDate = null;
private String recalculationCompoundingFrequencyType = null;
private String recalculationCompoundingFrequencyInterval = null;
private String recalculationCompoundingFrequencyDate = null;
private String minimumDaysBetweenDisbursalAndFirstRepayment = null;
private Boolean holdGuaranteeFunds = null;
private String mandatoryGuarantee = null;
private String minimumGuaranteeFromOwnFunds = null;
private String minimumGuaranteeFromGuarantor = null;
private String isArrearsBasedOnOriginalSchedule = null;
private String graceOnPrincipalPayment = "1";
private String graceOnInterestPayment = "1";
private JsonObject allowAttributeOverrides = null;
public String build(final String chargeId) {
final HashMap<String, Object> map = new HashMap<>();
@@ -144,6 +160,28 @@ public class LoanProductTestBuilder {
map.put("recalculationRestFrequencyType", recalculationRestFrequencyType);
map.put("recalculationRestFrequencyInterval", recalculationRestFrequencyInterval);
map.put("recalculationRestFrequencyDate", recalculationRestFrequencyDate);
if (!RECALCULATION_COMPOUNDING_METHOD_NONE.equals(this.interestRecalculationCompoundingMethod)) {
map.put("recalculationCompoundingFrequencyType", recalculationCompoundingFrequencyType);
map.put("recalculationCompoundingFrequencyInterval", recalculationCompoundingFrequencyInterval);
map.put("recalculationCompoundingFrequencyDate", recalculationCompoundingFrequencyDate);
}
map.put("preClosureInterestCalculationStrategy", preCloseInterestCalculationStrategy);
if (isArrearsBasedOnOriginalSchedule != null) {
map.put("isArrearsBasedOnOriginalSchedule", isArrearsBasedOnOriginalSchedule);
}
}
if (holdGuaranteeFunds != null) {
map.put("holdGuaranteeFunds", this.holdGuaranteeFunds);
if (this.holdGuaranteeFunds) {
map.put("mandatoryGuarantee", this.mandatoryGuarantee);
map.put("minimumGuaranteeFromGuarantor", this.minimumGuaranteeFromGuarantor);
map.put("minimumGuaranteeFromOwnFunds", this.minimumGuaranteeFromOwnFunds);
}
}
map.put("graceOnPrincipalPayment", graceOnPrincipalPayment);
map.put("graceOnInterestPayment", graceOnInterestPayment);
if (allowAttributeOverrides != null) {
map.put("allowAttributeOverrides", this.allowAttributeOverrides);
}
return new Gson().toJson(map);
}
@@ -365,10 +403,11 @@ public class LoanProductTestBuilder {
}
public LoanProductTestBuilder withInterestRecalculationDetails(final String interestRecalculationCompoundingMethod,
final String rescheduleStrategyMethod) {
final String rescheduleStrategyMethod, String preCloseInterestCalculationStrategy) {
this.isInterestRecalculationEnabled = true;
this.interestRecalculationCompoundingMethod = interestRecalculationCompoundingMethod;
this.rescheduleStrategyMethod = rescheduleStrategyMethod;
this.preCloseInterestCalculationStrategy = preCloseInterestCalculationStrategy;
return this;
}
@@ -380,9 +419,43 @@ public class LoanProductTestBuilder {
this.recalculationRestFrequencyDate = recalculationRestFrequencyDate;
return this;
}
public LoanProductTestBuilder withInterestRecalculationCompoundingFrequencyDetails(final String recalculationCompoundingFrequencyType,
final String recalculationCompoundingFrequencyInterval, final String recalculationCompoundingFrequencyDate) {
this.isInterestRecalculationEnabled = true;
this.recalculationCompoundingFrequencyType = recalculationCompoundingFrequencyType;
this.recalculationCompoundingFrequencyInterval = recalculationCompoundingFrequencyInterval;
this.recalculationCompoundingFrequencyDate = recalculationCompoundingFrequencyDate;
return this;
}
public LoanProductTestBuilder withMinimumDaysBetweenDisbursalAndFirstRepayment(final String minimumDaysBetweenDisbursalAndFirstRepayment) {
this.minimumDaysBetweenDisbursalAndFirstRepayment = minimumDaysBetweenDisbursalAndFirstRepayment;
return this;
}
public LoanProductTestBuilder withArrearsConfiguration() {
this.isArrearsBasedOnOriginalSchedule = "true";
return this;
}
public LoanProductTestBuilder withOnHoldFundDetails(final String mandatoryGuarantee, final String minimumGuaranteeFromGuarantor,
final String minimumGuaranteeFromOwnFunds) {
this.holdGuaranteeFunds = true;
this.mandatoryGuarantee = mandatoryGuarantee;
this.minimumGuaranteeFromGuarantor = minimumGuaranteeFromGuarantor;
this.minimumGuaranteeFromOwnFunds = minimumGuaranteeFromOwnFunds;
return this;
}
public LoanProductTestBuilder withMoratorium(String principal, String interest) {
this.graceOnPrincipalPayment = principal;
this.graceOnInterestPayment = interest;
return this;
}
public LoanProductTestBuilder withLoanProductConfiguration(JsonObject loanProductConfigurableAttributes) {
this.allowAttributeOverrides = loanProductConfigurableAttributes;
return this;
}
}
@@ -11,126 +11,133 @@ 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");
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("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 LoanRescheduleRequestTestBuilder updateSubmittedOnDate(final String submittedOnDate) {
this.submittedOnDate = submittedOnDate;
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<>();
}
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);
}
}
}
@@ -46,7 +46,7 @@ public class LoanStatusChecker {
assertTrue(getStatus(loanStatusHashMap, "overpaid"));
}
public static HashMap getStatusOfLoan(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
public static HashMap<String, Object> getStatusOfLoan(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanID) {
final String url = "/mifosng-provider/api/v1/loans/" + loanID + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "status");
@@ -10,6 +10,7 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.joda.time.LocalDate;
import org.mifosplatform.integrationtests.common.Utils;
@@ -35,6 +36,8 @@ public class LoanTransactionHelper {
private static final String WAIVE_INTEREST_COMMAND = "waiveinterest";
private static final String MAKE_REPAYMENT_COMMAND = "repayment";
private static final String WITHDRAW_LOAN_APPLICATION_COMMAND = "withdrawnByApplicant";
private static final String RECOVER_FROM_GUARANTORS_COMMAND = "recoverGuarantees";
private static final String MAKE_REFUND_BY_CASH_COMMAND = "refundByCash";
public LoanTransactionHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
@@ -48,19 +51,19 @@ 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
+ "?" + Utils.TENANT_IDENTIFIER, loanApplicationJSON, "loanId");
return Utils.performServerPut(this.requestSpec, this.responseSpec, "/mifosng-provider/api/v1/loans/" + id + "?"
+ Utils.TENANT_IDENTIFIER, loanApplicationJSON, "loanId");
}
public ArrayList getLoanRepaymentSchedule(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
@@ -69,10 +72,11 @@ public class LoanTransactionHelper {
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 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");
}
@@ -89,25 +93,53 @@ public class LoanTransactionHelper {
return Utils.performServerGet(requestSpec, responseSpec, URL, param);
}
public String getLoanDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) {
final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, null);
}
public Object getLoanProductDetail(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanProductId, final String jsonAttributeToGetBack) {
final String URL = "/mifosng-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, jsonAttributeToGetBack);
}
public String getLoanProductDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer loanProductId) {
final String URL = "/mifosng-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, null);
}
public ArrayList getLoanCharges(final Integer loanId) {
final String GET_LOAN_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, GET_LOAN_CHARGES_URL, "");
}
public HashMap approveLoan(final String approvalDate, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID), getApproveLoanAsJSON(approvalDate));
String loanApprovalCommand = createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID);
String loanApprovalRequest = getApproveLoanAsJSON(approvalDate);
System.out.println("Loan approval command:" + loanApprovalCommand);
System.out.println("Loan approval request:" + loanApprovalRequest);
return performLoanTransaction(loanApprovalCommand, loanApprovalRequest);
}
public HashMap approveLoanWithApproveAmount(final String approvalDate, final String approvalAmount, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID), getApproveLoanAsJSON(approvalDate, approvalAmount));
public HashMap approveLoanWithApproveAmount(final String approvalDate, final String expectedDisbursementDate,
final String approvalAmount, final Integer loanID, List<HashMap> tranches) {
return performLoanTransaction(createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID),
getApproveLoanAsJSON(approvalDate, expectedDisbursementDate, approvalAmount, tranches));
}
public Object approveLoanWithApproveAmount(final String approvalDate, final String approvalAmount, final Integer loanID,
final String responseAttribute) {
public List<HashMap<String, Object>> approveLoanForTranches(final String approvalDate, final String expectedDisbursementDate,
final String approvalAmount, final Integer loanID, List<HashMap> tranches, final String responseAttribute) {
return (List<HashMap<String, Object>>) performLoanTransaction(createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID),
getApproveLoanAsJSON(approvalDate, expectedDisbursementDate, approvalAmount, tranches), responseAttribute);
}
public Object approveLoan(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);
final String approvalJSONData = getApproveLoanAsJSON(approvalDate, null, approvalAmount, null);
return performLoanTransaction(approvalURL, approvalJSONData, responseAttribute);
}
@@ -136,6 +168,10 @@ public class LoanTransactionHelper {
return performLoanTransaction(createLoanOperationURL(UNDO_DISBURSE_LOAN_COMMAND, loanID), undoDisburseJson);
}
public void recoverFromGuarantor(final Integer loanID) {
performLoanTransaction(createLoanOperationURL(RECOVER_FROM_GUARANTORS_COMMAND, loanID), "", "");
}
public HashMap writeOffLoan(final String date, final Integer loanID) {
return performLoanTransaction(createLoanTransactionURL(WRITE_OFF_LOAN_COMMAND, loanID), getWriteOffBodyAsJSON(date));
}
@@ -151,8 +187,8 @@ public class LoanTransactionHelper {
}
public HashMap makeRepayment(final String date, final Float amountToBePaid, final Integer loanID) {
return performLoanTransaction(createLoanTransactionURL(MAKE_REPAYMENT_COMMAND, loanID),
getRepaymentBodyAsJSON(date, amountToBePaid));
return (HashMap) performLoanTransaction(createLoanTransactionURL(MAKE_REPAYMENT_COMMAND, loanID),
getRepaymentBodyAsJSON(date, amountToBePaid), "");
}
public HashMap withdrawLoanApplicationByClient(final String date, final Integer loanID) {
@@ -169,32 +205,32 @@ 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
+ "?" + Utils.TENANT_IDENTIFIER;
final String UPDATE_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPut(requestSpec, responseSpec, UPDATE_CHARGES_URL, request, "");
return (Integer) response.get("resourceId");
}
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
+ "?" + Utils.TENANT_IDENTIFIER;
final String DELETE_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerDelete(requestSpec, responseSpec, DELETE_CHARGES_URL, "");
return (Integer) response.get("resourceId");
}
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&" + Utils.TENANT_IDENTIFIER;
final String CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?command=waive&"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return (Integer) response.get("resourceId");
}
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&" + Utils.TENANT_IDENTIFIER;
final String CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?command=pay&"
+ Utils.TENANT_IDENTIFIER;
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
return (Integer) response.get("resourceId");
}
@@ -208,24 +244,29 @@ public class LoanTransactionHelper {
if (transactionAmount != null) {
map.put("transactionAmount", transactionAmount);
}
System.out.println("Loan Application disburse request : " + map);
return new Gson().toJson(map);
}
private String getApproveLoanAsJSON(final String approvalDate) {
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);
return getApproveLoanAsJSON(approvalDate, null, null, null);
}
private String getApproveLoanAsJSON(final String approvalDate, final String approvalAmount) {
final HashMap<String, String> map = new HashMap<>();
private String getApproveLoanAsJSON(final String approvalDate, final String expectedDisbursementDate, final String approvalAmount,
List<HashMap> tranches) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("approvedLoanAmount", approvalAmount);
if (approvalAmount != null) {
map.put("approvedLoanAmount", approvalAmount);
}
map.put("approvedOnDate", approvalDate);
if (expectedDisbursementDate != null) {
map.put("expectedDisbursementDate", expectedDisbursementDate);
}
if (tranches != null && tranches.size() > 0) {
map.put("disbursementData", tranches);
}
map.put("note", "Approval NOTE");
return new Gson().toJson(map);
}
@@ -378,18 +419,44 @@ 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 Object adjustLoanTransaction(final Integer loanId, final Integer transactionId, final String date,
final String transactionAmount, final String responseAttribute) {
return adjustLoanTransaction(loanId, transactionId, getAdjustTransactionJSON(date, transactionAmount), responseAttribute);
}
private Object adjustLoanTransaction(final Integer loanId, final Integer tansactionId, final String jsonToBeSent,
final String responseAttribute) {
final String URL = "/mifosng-provider/api/v1/loans/" + loanId + "/transactions/" + tansactionId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, jsonToBeSent, responseAttribute);
}
private String getAdjustTransactionJSON(final String date, final String transactionAmount) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en_GB");
map.put("dateFormat", "dd MMMM yyyy");
map.put("transactionDate", date);
map.put("transactionAmount", transactionAmount);
String json = new Gson().toJson(map);
System.out.println(json);
return json;
}
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 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;
}
private String createLoanRefundTransferURL() {
return "/mifosng-provider/api/v1/accounttransfers/refundByTransfer?tenantIdentifier=default";
}
public void verifyRepaymentScheduleEntryFor(final int repaymentNumber, final float expectedPrincipalOutstanding, final Integer loanID) {
System.out.println("---------------------------GETTING LOAN REPAYMENT SCHEDULE--------------------------------");
final ArrayList<HashMap> repaymentPeriods = getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -426,4 +493,44 @@ public class LoanTransactionHelper {
assertTrue("No Accrual entries are posted", isTransactionFound);
}
public HashMap makeRefundByCash(final String date, final Float amountToBeRefunded, final Integer loanID) {
return performLoanTransaction(createLoanTransactionURL(MAKE_REFUND_BY_CASH_COMMAND, loanID),
getRefundByCashBodyAsJSON(date, amountToBeRefunded));
}
public HashMap makeRefundByTransfer(final Integer fromAccountId, final Integer toClientId, final Integer toAccountId,
final Integer fromClientId, final String date, final Float amountToBeRefunded) {
return performLoanTransaction(createLoanRefundTransferURL(),
getRefundByTransferBodyAsJSON(fromAccountId, toClientId, toAccountId, fromClientId, date, amountToBeRefunded));
}
private String getRefundByCashBodyAsJSON(final String transactionDate, final Float transactionAmount) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
map.put("dateFormat", "dd MMMM yyyy");
map.put("transactionDate", transactionDate);
map.put("transactionAmount", transactionAmount.toString());
map.put("note", "Refund Made!!!");
return new Gson().toJson(map);
}
private String getRefundByTransferBodyAsJSON(final Integer fromAccountId, final Integer toClientId, final Integer toAccountId,
final Integer fromClientId, final String transactionDate, final Float transactionAmount) {
final HashMap<String, String> map = new HashMap<>();
map.put("fromAccountId", fromAccountId.toString());
map.put("fromAccountType", "1");
map.put("toOfficeId", "1");
map.put("toClientId", toClientId.toString());
map.put("toAccountType", "2");
map.put("toAccountId", toAccountId.toString());
map.put("dateFormat", "dd MMMM yyyy");
map.put("transferDate", transactionDate);
map.put("transferAmount", transactionAmount.toString());
map.put("transferDescription", "Refund Made!!!");
map.put("fromClientId", fromClientId.toString());
map.put("fromOfficeId", "1");
map.put("locale", "en");
return new Gson().toJson(map);
}
}
@@ -0,0 +1,35 @@
/**
* 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.organisation;
public class Currency {
String code;
String name;
Integer decimalPlaces;
String displaySymbol;
String nameCode;
String displayLabel;
public Currency(String code, String name, Integer decimalPlaces, String displaySymbol,
String nameCode, String displayLabel) {
this.code = code;
this.name = name;
this.decimalPlaces = decimalPlaces;
this.displaySymbol = displaySymbol;
this.nameCode = nameCode;
this.displayLabel = displayLabel;
}
public boolean isValid() {
return (this.code != null && this.code.length() == 3) &&
(this.name != null && this.name.length() > 0) &&
(this.decimalPlaces != null && this.decimalPlaces >= 0) &&
(this.nameCode != null && this.nameCode.startsWith("currency.")) &&
(this.displayLabel != null && this.displayLabel.length() > 0);
}
}
@@ -0,0 +1,86 @@
/**
* 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.organisation;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.mifosplatform.integrationtests.common.Utils;
import org.springframework.util.Assert;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import static com.jayway.restassured.RestAssured.given;
public class CurrencyHelper {
private static final String CURRENCY_URL = "/mifosng-provider/api/v1/currencies?" + Utils.TENANT_IDENTIFIER;
private static final String CURRENCY_URL_SELECTED = CURRENCY_URL + "&fields=selectedCurrencyOptions";
private static final List<String> permittedCurrencyArray = Arrays.asList("currencyOptions",
"selectedCurrencyOptions");
private static final List<String> permittedCurrencyArraySelected = Arrays.asList("selectedCurrencyOptions");
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public CurrencyHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public ArrayList<Currency> getPermittedCurrencies() {
return getCurrencies(CURRENCY_URL, permittedCurrencyArray);
}
public ArrayList<Currency> getSelectedCurrencies() {
return getCurrencies(CURRENCY_URL_SELECTED, permittedCurrencyArraySelected);
}
private ArrayList<Currency> getCurrencies(final String getUrl, final List<String> permittedCurrencyArrays) {
System.out.println("--------------------------------- GET CURRENCY OPTIONS -------------------------------");
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when()
.get(getUrl).andReturn().asString();
final Gson gson = new Gson();
Assert.notNull(json);
final ArrayList<Currency> currencyList = new ArrayList<Currency>();
final Type typeOfHashMap = new TypeToken<Map<String, List<Currency>>>() { }.getType();
final Map<String, List<Currency>> responseMap = gson.fromJson(json, typeOfHashMap);
for(Map.Entry<String, List<Currency>> entry : responseMap.entrySet()) {
Assert.isTrue(permittedCurrencyArrays.contains(entry.getKey()));
for(Currency currency : entry.getValue()) {
currencyList.add(currency);
}
}
return currencyList;
}
public List<String> updateCurrencies(final List<String> currencies) {
System.out.println("--------------------------------- UPDATE CURRENCY OPTIONS -------------------------------");
final String json = given().spec(requestSpec).body(getUpdateJSON(currencies)).expect().spec(responseSpec).log().ifError().when()
.put(CURRENCY_URL).andReturn().asString();
final Gson gson = new Gson();
Assert.notNull(json);
final Type typeOfHashMap = new TypeToken<Map<String,Map<String, List<String>>>>() { }.getType();
final Map<String,Map<String, List<String>>> responseMap = gson.fromJson(json, typeOfHashMap);
return responseMap.get("changes").get("currencies");
}
private String getUpdateJSON(final List<String> currencies) {
final HashMap<String, List<String>> map = new HashMap<>();
map.put("currencies", currencies);
return new Gson().toJson(map);
}
}
@@ -0,0 +1,112 @@
/**
* 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.organisation;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
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 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) {
return (Integer) createStaffWithJson(requestSpec, responseSpec, createStaffAsJSON()).get("resourceId");
}
public static HashMap createStaffMap(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createStaffWithJson(requestSpec, responseSpec, createStaffAsJSON());
}
public static HashMap createStaffWithJson(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String json) {
final String url = CREATE_STAFF_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, url, json, "");
}
public static HashMap getStaff(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer staffId) {
final String url = CREATE_STAFF_URL + "/" + staffId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "");
}
public static List<HashMap> getStaffList(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String url = CREATE_STAFF_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "");
}
public static Object getStaffListWithState(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String status) {
final String url = CREATE_STAFF_URL + "?" + Utils.TENANT_IDENTIFIER + "&status=" + status;
return Utils.performServerGet(requestSpec, responseSpec, url, "");
}
public static Object updateStaff(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer staffId, final HashMap<String, Object> changes) {
final String url = CREATE_STAFF_URL + "/" + staffId + "?" + Utils.TENANT_IDENTIFIER;
final String json = new Gson().toJson(changes);
return Utils.performServerPut(requestSpec, responseSpec, url, json, "");
}
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);
}
public static String createStaffWithJSONFields(String... fields) {
final HashMap<String, Object> map = new HashMap<>();
final List<String> fieldList = Arrays.asList(fields);
if(fieldList.contains("officeId")) {
map.put("officeId", 1);
}
if(fieldList.contains("firstname")) {
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
}
if(fieldList.contains("lastname")) {
map.put("lastname", Utils.randomNameGenerator("Doe_", 4));
}
if(fieldList.contains("isLoanOfficer")) {
map.put("isLoanOfficer", true);
}
if(fieldList.contains("mobileNo")) {
map.put("mobileNo", "+123515198");
}
System.out.println("map : " + map);
return new Gson().toJson(map);
}
}
@@ -16,6 +16,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class AccountTransferHelper {
private static final String ACCOUNT_TRANSFER_URL = "/mifosng-provider/api/v1/accounttransfers";
private static final String LOAN_REFUND_BY_TRANSFER_URL = "/mifosng-provider/api/v1/accounttransfers/refundByTransfer";
private static final String LOCALE = "en_GB";
private static final String OFFICE_ID = "1";
private static final String TRANSFER_DESCRIPTION = "Transfer";
@@ -70,4 +71,15 @@ public class AccountTransferHelper {
return Utils.performServerPost(this.requestSpec, this.responseSpec, ACCOUNT_TRANSFER_URL + "?" + Utils.TENANT_IDENTIFIER,
accountTransferJSON, "savingsId");
}
public Integer refundLoanByTransfer(final String date, final Integer fromClientId, final Integer fromAccountId, final Integer toClientId,
final Integer toAccountId, final String fromAccountType, final String toAccountType, final String transferAmount) {
System.out.println("--------------------------------ACCOUNT TRANSFER--------------------------------");
final String accountTransferJSON = new AccountTransferHelper(this.requestSpec, this.responseSpec) //
.withTransferOnDate(date) //
.build(fromAccountId.toString(), fromClientId.toString(), toAccountId.toString(), toClientId.toString(), fromAccountType,
toAccountType, transferAmount);
return Utils.performServerPost(this.requestSpec, this.responseSpec, LOAN_REFUND_BY_TRANSFER_URL + "?" + Utils.TENANT_IDENTIFIER,
accountTransferJSON, "savingsId");
}
}
@@ -12,6 +12,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.junit.Assert;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
@@ -45,6 +46,7 @@ public class SavingsAccountHelper {
public static final String CREATED_DATE_MINUS_ONE = "07 January 2013";
public static final String TRANSACTION_DATE = "01 March 2013";
public static final String LAST_TRANSACTION_DATE = "01 March 2013";
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
public SavingsAccountHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
@@ -59,12 +61,12 @@ public class SavingsAccountHelper {
}
public Integer applyForSavingsApplication(final Integer ID, final Integer savingsProductID, final String accountType) {
return applyForSavingsApplicationOnDate(ID, savingsProductID, accountType, CREATED_DATE);
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 submittedOnDate) {
System.out.println("--------------------------------APPLYING FOR SAVINGS APPLICATION--------------------------------");
final String savingsApplicationJSON = new SavingsApplicationTestBuilder() //
.withSubmittedOnDate(submittedOnDate) //
.build(ID.toString(), savingsProductID.toString(), accountType);
@@ -82,15 +84,15 @@ public class SavingsAccountHelper {
}
public HashMap approveSavings(final Integer savingsID) {
return approveSavingsOnDate(savingsID, null);
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));
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) {
@@ -124,7 +126,8 @@ public class SavingsAccountHelper {
public HashMap closeSavingsAccount(final Integer savingsID, String withdrawBalance) {
System.out.println("---------------------------------- CLOSE SAVINGS APPLICATION ----------------------------------");
return performSavingApplicationActions(createSavingsOperationURL(CLOSE_SAVINGS_COMMAND, savingsID), getCloseAccountJSON(withdrawBalance, LAST_TRANSACTION_DATE));
return performSavingApplicationActions(createSavingsOperationURL(CLOSE_SAVINGS_COMMAND, savingsID),
getCloseAccountJSON(withdrawBalance, LAST_TRANSACTION_DATE));
}
public Object deleteSavingsApplication(final Integer savingsId, final String jsonAttributeToGetBack) {
@@ -199,9 +202,9 @@ public class SavingsAccountHelper {
private String getApproveSavingsAsJSON() {
return getApproveSavingsAsJsonOnDate(CREATED_DATE_PLUS_ONE);
}
private String getApproveSavingsAsJsonOnDate(final String approvalDate) {
final HashMap<String, String> map = new HashMap<>();
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
map.put("dateFormat", CommonConstants.dateFormat);
map.put("approvedOnDate", approvalDate);
@@ -325,6 +328,11 @@ public class SavingsAccountHelper {
final ArrayList<HashMap> response = Utils.performServerGet(requestSpec, responseSpec, URL, jSONAttribute);
return response;
}
public Object getSavingsAccountDetail(final Integer savingsID, final String jsonAttribute){
final String URL = SAVINGS_ACCOUNT_URL + "/" + savingsID + "?associations=all&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, jsonAttribute);
}
public ArrayList getSavingsCharges(final Integer savingsID) {
final String URL = SAVINGS_ACCOUNT_URL + "/" + savingsID + "/charges?" + Utils.TENANT_IDENTIFIER;
@@ -352,13 +360,19 @@ 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;
}
public Object getSavingsDetails(final Integer savingsID, final String returnAttribute) {
final String URL = SAVINGS_ACCOUNT_URL + "/" + savingsID + "?" + Utils.TENANT_IDENTIFIER;
final Object response = Utils.performServerGet(requestSpec, responseSpec, URL, returnAttribute);
return response;
}
private HashMap performSavingApplicationActions(final String postURLForSavingsTransaction, final String jsonToBeSent) {
HashMap status = null;
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForSavingsTransaction, jsonToBeSent,
@@ -421,4 +435,38 @@ public class SavingsAccountHelper {
String josn = new Gson().toJson(map);
return josn;
}
public static Integer openSavingsAccount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer clientId, final String minimumOpeningBalance) {
final Integer savingsProductID = createSavingsProduct(requestSpec, responseSpec, minimumOpeningBalance);
Assert.assertNotNull(savingsProductID);
SavingsAccountHelper savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
final Integer savingsId = savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertNotNull(savingsProductID);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(requestSpec, responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
savingsStatusHashMap = savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
savingsStatusHashMap = savingsAccountHelper.activateSavings(savingsId);
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
return savingsId;
}
private static Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance) {
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
final String savingsProductJSON = savingsProductHelper //
.withInterestCompoundingPeriodTypeAsDaily() //
.withInterestPostingPeriodTypeAsMonthly() //
.withInterestCalculationPeriodTypeAsDailyBalance() //
.withMinimumOpenningBalance(minOpenningBalance).build();
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
}
@@ -0,0 +1,213 @@
/**
* 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 java.util.ArrayList;
import java.util.HashMap;
import org.mifosplatform.integrationtests.common.Utils;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class AccountNumberPreferencesHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String ACCOUNT_NUMBER_FORMATS_REQUEST_URL = "/mifosng-provider/api/v1/accountnumberformats";
public AccountNumberPreferencesHelper(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Object createClientAccountNumberPreference(
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
.println("---------------------------------CREATING CLIENT ACCOUNT NUMBER PREFERENCE------------------------------------------");
final String requestJSON = new AccountNumberPreferencesTestBuilder()
.clientBuild();
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
requestJSON, jsonAttributeToGetBack);
}
public Object createLoanAccountNumberPreference(
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
.println("---------------------------------CREATING LOAN ACCOUNT NUMBER PREFERENCE------------------------------------------");
final String requestJSON = new AccountNumberPreferencesTestBuilder()
.loanBuild();
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
requestJSON, jsonAttributeToGetBack);
}
public Object createSavingsAccountNumberPreference(
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
.println("---------------------------------CREATING SAVINGS ACCOUNT NUMBER PREFERENCE------------------------------------------");
final String requestJSON = new AccountNumberPreferencesTestBuilder()
.savingsBuild();
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
requestJSON, jsonAttributeToGetBack);
}
public Object createGroupsAccountNumberPreference(
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
.println("---------------------------------CREATING GROUPS ACCOUNT NUMBER PREFERENCE------------------------------------------");
final String requestJSON = new AccountNumberPreferencesTestBuilder()
.groupsBuild();
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
requestJSON, jsonAttributeToGetBack);
}
public Object createCenterAccountNumberPreference(
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
.println("---------------------------------CREATING CENTER ACCOUNT NUMBER PREFERENCE------------------------------------------");
final String requestJSON = new AccountNumberPreferencesTestBuilder()
.centerBuild();
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
requestJSON, jsonAttributeToGetBack);
}
public HashMap<String, Object> createAccountNumberPreferenceWithInvalidData(
ResponseSpecification responseSpec, String accountType,
String prefixType, String jsonAttributeToGetBack) {
final String requestJSON = new AccountNumberPreferencesTestBuilder()
.invalidDataBuild(accountType, prefixType);
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
+ Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
requestJSON, jsonAttributeToGetBack);
}
public HashMap<String, Object> updateAccountNumberPreference(
final Integer accountNumberFormatId, final String prefixType,
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
final String requestJSON = new AccountNumberPreferencesTestBuilder()
.updatePrefixType(prefixType);
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ accountNumberFormatId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPut(this.requestSpec, responseSpec, URL,
requestJSON, jsonAttributeToGetBack);
}
public HashMap<String, Object> deleteAccountNumberPreference(
final Integer accountNumberFormatId,
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
.println("---------------------------------DELETING ACCOUNT NUMBER PREFERENCE------------------------------------------");
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ accountNumberFormatId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(this.requestSpec, responseSpec, URL,
jsonAttributeToGetBack);
}
public Object getAccountNumberPreference(
final Integer accountNumberFormatId,
final String jsonAttributeToGetBack) {
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ accountNumberFormatId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL,
jsonAttributeToGetBack);
}
public ArrayList<HashMap<String, Object>> getAllAccountNumberPreferences() {
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
+ Utils.TENANT_IDENTIFIER;
final ArrayList<HashMap<String, Object>> response = Utils
.performServerGet(requestSpec, responseSpec, URL, "");
return response;
}
public void verifyCreationOfAccountNumberPreferences(
final Integer clientAccountNumberPreferenceId,
final Integer loanAccountNumberPreferenceId,
final Integer savingsAccountNumberPreferenceId,
final Integer groupsAccountNumberPreferenceId,
final Integer centerAccountNumberPreferenceId,
ResponseSpecification responseSpec, RequestSpecification requestSpec) {
final String clientURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ clientAccountNumberPreferenceId + "?"
+ Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, clientURL, "id");
final String loanURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ loanAccountNumberPreferenceId + "?" + Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, loanURL, "id");
final String savingsURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ savingsAccountNumberPreferenceId + "?"
+ Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, savingsURL, "id");
final String groupsURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ groupsAccountNumberPreferenceId + "?"
+ Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, groupsURL, "id");
final String centerURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ centerAccountNumberPreferenceId + "?"
+ Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, centerURL, "id");
}
public void verifyUpdationOfAccountNumberPreferences(
final Integer accountNumberPreferenceId,
ResponseSpecification responseSpec, RequestSpecification requestSpec) {
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ accountNumberPreferenceId + "?" + Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, URL, "id");
}
}
@@ -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.common.system;
import java.util.HashMap;
import com.google.gson.Gson;
public class AccountNumberPreferencesTestBuilder {
private String clientAccountType = "1";
private String clientPrefixType = "101";
private String loanAccountType = "2";
private String loanPrefixType = "1";
private String savingsAccountType = "3";
private String savingsPrefixType = "1";
private String centerAccountType = "4";
private String centerPrefixType = "1";
private String groupsAccountType = "5";
private String groupsPrefixType = "1";
public String clientBuild() {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", clientAccountType);
map.put("prefixType", clientPrefixType);
return new Gson().toJson(map);
}
public String loanBuild() {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", loanAccountType);
map.put("prefixType", loanPrefixType);
return new Gson().toJson(map);
}
public String savingsBuild() {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", savingsAccountType);
map.put("prefixType", savingsPrefixType);
return new Gson().toJson(map);
}
public String groupsBuild() {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", groupsAccountType);
map.put("prefixType", groupsPrefixType);
return new Gson().toJson(map);
}
public String centerBuild() {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", centerAccountType);
map.put("prefixType", centerPrefixType);
return new Gson().toJson(map);
}
public String invalidDataBuild(String accountType, String prefixType) {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", accountType);
map.put("prefixType", prefixType);
return new Gson().toJson(map);
}
public String updatePrefixType(final String prefixType) {
final HashMap<String, Object> map = new HashMap<>();
map.put("prefixType", prefixType);
return new Gson().toJson(map);
}
}
@@ -7,7 +7,9 @@ package org.mifosplatform.integrationtests.common.system;
import static com.jayway.restassured.RestAssured.given;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.mifosplatform.integrationtests.common.Utils;
@@ -18,132 +20,221 @@ 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_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 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 HashMap<String, Object> getCodeByName(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String codeName) {
return Utils.performServerGet(requestSpec, responseSpec, CODE_URL + "?" + Utils.TENANT_IDENTIFIER, "");
final HashMap<String, Object> code = new HashMap<>();
}
ArrayList<HashMap<String, Object>> getAllCodes = CodeHelper
.getAllCodes(requestSpec, responseSpec);
for (HashMap<String, Object> map : getAllCodes) {
String name = (String) map.get("name");
if (name.equals(codeName)) {
code.put("id", map.get("id"));
code.put("name", map.get("name"));
code.put("systemDefined", map.get("systemDefined"));
break;
}
}
return code;
}
public static Object getSystemDefinedCodes(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public static HashMap<String, Object> retrieveOrCreateCodeValue(
Integer codeId, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
Integer codeValueId = null;
final List<HashMap<String, Object>> codeValuesList = CodeHelper
.getCodeValuesForCode(requestSpec, responseSpec, codeId, "");
/* If Code Values doesn't exist,then create Code value */
if (codeValuesList.size() == 0) {
final Integer codeValuePosition = 0;
final String codeValue = Utils.randomNameGenerator("", 3);
codeValueId = (Integer) CodeHelper.createCodeValue(requestSpec,
responseSpec, codeId, codeValue, codeValuePosition,
"subResourceId");
} else {
return codeValuesList.get(0);
}
return Utils.performServerGet(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId.toString() + "?"
+ Utils.TENANT_IDENTIFIER, "");
}
final String getResponse = given().spec(requestSpec).expect().spec(responseSpec).when()
.get(CodeHelper.CODE_URL + "?" + Utils.TENANT_IDENTIFIER).asString();
public static ArrayList<HashMap<String, Object>> getAllCodes(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final JsonPath getResponseJsonPath = new JsonPath(getResponse);
return Utils.performServerGet(requestSpec, responseSpec, CODE_URL + "?"
+ Utils.TENANT_IDENTIFIER, "");
// get any systemDefined code
return getResponseJsonPath.get("find { e -> e.systemDefined == true }");
}
}
public static Object getSystemDefinedCodes(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
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);
}
final String getResponse = given().spec(requestSpec).expect()
.spec(responseSpec).when()
.get(CodeHelper.CODE_URL + "?" + Utils.TENANT_IDENTIFIER)
.asString();
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);
}
final JsonPath getResponseJsonPath = new JsonPath(getResponse);
public static Object deleteCodeById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final String jsonAttributeToGetback) {
// get any systemDefined code
return getResponseJsonPath.get("find { e -> e.systemDefined == true }");
return Utils.performServerDelete(requestSpec, responseSpec, CODE_URL + "/" + codeId + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
}
}
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 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);
}
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 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 deleteCodeById(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.performServerDelete(requestSpec, responseSpec, CODE_URL
+ "/" + codeId + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
public static Object getCodeValuesForCode(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final String jsonAttributeToGetback) {
}
return Utils.performServerGet(requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ 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) {
String description = null;
return createCodeValue(requestSpec, responseSpec, codeId,
codeValueName, description, position, jsonAttributeToGetback);
}
public static Object getCodeValueById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final Integer codeValueId, final String 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) {
return Utils.performServerGet(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/" + codeValueId.toString() + "?" + Utils.TENANT_IDENTIFIER,
jsonAttributeToGetback);
}
return Utils.performServerPost(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ Utils.TENANT_IDENTIFIER,
getTestCodeValueAsJSON(codeValueName, description, position),
jsonAttributeToGetback);
}
public static Object deleteCodeValueById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer codeId, final Integer codeValueId, final String jsonAttributeToGetback) {
public static List<HashMap<String, Object>> getCodeValuesForCode(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final String jsonAttributeToGetback) {
return Utils.performServerDelete(requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId.toString() + "?" + Utils.TENANT_IDENTIFIER, jsonAttributeToGetback);
}
return Utils.performServerGet(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ Utils.TENANT_IDENTIFIER, 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 getCodeValueById(
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 String description, final Integer position,
final String jsonAttributeToGetback) {
return Utils.performServerGet(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, description, position), jsonAttributeToGetback);
}
public static Object deleteCodeValueById(
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer codeId,
final Integer codeValueId, final String jsonAttributeToGetback) {
return Utils.performServerDelete(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId.toString() + "?"
+ Utils.TENANT_IDENTIFIER, 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);
}
}
@@ -0,0 +1,59 @@
/**
* 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.loanaccount.guarantor;
import java.util.HashMap;
import java.util.List;
import org.mifosplatform.integrationtests.common.CommonConstants;
import org.mifosplatform.integrationtests.common.Utils;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class GuarantorHelper {
private static final String LOAN_URL = "/mifosng-provider/api/v1/loans/";
private static final String GUARANTOR_API_URL = "/guarantors/";
private static final String TENANT = "?" + Utils.TENANT_IDENTIFIER;
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public GuarantorHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Integer createGuarantor(final Integer loanId, final String guarantorJSON) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, LOAN_URL + loanId + GUARANTOR_API_URL + TENANT, guarantorJSON,
CommonConstants.RESPONSE_RESOURCE_ID);
}
public HashMap updateGuarantor(final Integer guarantorId, final Integer loanId, final String guarantorJSON) {
return Utils.performServerPut(this.requestSpec, this.responseSpec, LOAN_URL + loanId + GUARANTOR_API_URL + guarantorId + TENANT,
guarantorJSON, CommonConstants.RESPONSE_CHANGES);
}
public HashMap deleteGuarantor(final Integer guarantorId, final Integer fundId, final Integer loanId) {
return Utils.performServerDelete(this.requestSpec, this.responseSpec, LOAN_URL + loanId + GUARANTOR_API_URL + guarantorId + TENANT
+ "&guarantorFundingId=" + fundId, "");
}
public HashMap deleteGuarantor(final Integer guarantorId, final Integer loanId) {
return Utils.performServerDelete(this.requestSpec, this.responseSpec, LOAN_URL + loanId + GUARANTOR_API_URL + guarantorId + TENANT,
"");
}
public Object getGuarantor(final Integer guarantorId, final Integer loanId, final String jsonToGetBack) {
return Utils.performServerGet(this.requestSpec, this.responseSpec, LOAN_URL + loanId + GUARANTOR_API_URL + guarantorId + TENANT,
jsonToGetBack);
}
public List getAllGuarantor(final Integer loanId) {
return Utils.performServerGet(this.requestSpec, this.responseSpec, LOAN_URL + loanId + GUARANTOR_API_URL + TENANT, "");
}
}
@@ -0,0 +1,681 @@
/**
* 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.loanaccount.guarantor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
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.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.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 org.mifosplatform.integrationtests.common.savings.SavingsAccountHelper;
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 GuarantorTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private LoanTransactionHelper loanTransactionHelper;
private GuarantorHelper guarantorHelper;
private SavingsAccountHelper savingsAccountHelper;
private final Float self1_balance = new Float(5000);
private final Float external1_balance = new Float(5000);
private final Float external2_balance = new Float(5000);
private final Float self1_guarantee = new Float(2000);
private final Float external1_guarantee = new Float(2000);
private final Float external2_guarantee = new Float(1000);
@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().build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.guarantorHelper = new GuarantorHelper(this.requestSpec, this.responseSpec);
savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testGuarantor() {
Float self1_hold_funds = new Float(0);
Float external1_hold_funds = new Float(0);
Float external2_hold_funds = new Float(0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
final Integer clientID_external2 = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
String.valueOf(self1_balance));
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
String.valueOf(external1_balance));
final Integer externalSavigsId_2 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external2,
String.valueOf(external2_balance));
final Integer loanProductID = createLoanProductWithHoldFunds("50", "20", "20");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 4);
String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime());
final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
String guarantorJSON = new GuarantorTestBuilder().externalCustomer().build();
Integer externalGuarantor = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
Assert.assertNotNull(externalGuarantor);
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithoutGuaranteeAmount(String.valueOf(clientID_external)).build();
Integer withoutGuaranteeAmount = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
Assert.assertNotNull(withoutGuaranteeAmount);
ArrayList<HashMap> errorData = (ArrayList<HashMap>) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID,
CommonConstants.RESPONSE_ERROR);
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.self.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(selfSavigsId, null);
Assert.assertNotNull(selfGuarantee);
errorData = (ArrayList<HashMap>) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID,
CommonConstants.RESPONSE_ERROR);
assertFalse(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.self.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(externalSavigsId_1, null);
Assert.assertNotNull(externalGuarantee_1);
errorData = (ArrayList<HashMap>) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID,
CommonConstants.RESPONSE_ERROR);
assertFalse(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.self.guarantee.required"));
assertFalse(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external2),
String.valueOf(externalSavigsId_2), String.valueOf(external2_guarantee)).build();
Integer externalGuarantee_2 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(externalSavigsId_2, null);
Assert.assertNotNull(externalGuarantee_2);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
self1_hold_funds += self1_guarantee;
external1_hold_funds += external1_guarantee;
external2_hold_funds += external2_guarantee;
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0));
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// First repayment
ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod");
external1_hold_funds -= new Float(827.5867);
external2_hold_funds -= new Float(413.7933);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
// Second repayment
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod");
external1_hold_funds -= new Float(831.4067);
external2_hold_funds -= new Float(415.7033333);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
// third repayment
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod");
self1_hold_funds -= new Float(741.355);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0));
// forth repayment
todaysDate = Calendar.getInstance();
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod");
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0));
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testGuarantor_UNDO_DISBURSAL() {
Float self1_hold_funds = new Float(0);
Float external1_hold_funds = new Float(0);
Float external2_hold_funds = new Float(0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
final Integer clientID_external2 = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
String.valueOf(self1_balance));
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
String.valueOf(external1_balance));
final Integer externalSavigsId_3 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
String.valueOf(external1_balance));
final Integer externalSavigsId_2 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external2,
String.valueOf(external2_balance));
final Integer loanProductID = createLoanProductWithHoldFunds("50", "20", "20");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 4);
String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime());
final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
String guarantorJSON = new GuarantorTestBuilder().externalCustomer().build();
Integer externalGuarantor = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
Assert.assertNotNull(externalGuarantor);
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithoutGuaranteeAmount(String.valueOf(clientID_external)).build();
Integer withoutGuaranteeAmount = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
Assert.assertNotNull(withoutGuaranteeAmount);
ArrayList<HashMap> errorData = (ArrayList<HashMap>) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID,
CommonConstants.RESPONSE_ERROR);
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.self.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(selfSavigsId, null);
Assert.assertNotNull(selfGuarantee);
errorData = (ArrayList<HashMap>) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID,
CommonConstants.RESPONSE_ERROR);
assertFalse(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.self.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(externalSavigsId_1, null);
Assert.assertNotNull(externalGuarantee_1);
errorData = (ArrayList<HashMap>) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID,
CommonConstants.RESPONSE_ERROR);
assertFalse(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.self.guarantee.required"));
assertFalse(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external2),
String.valueOf(externalSavigsId_2), String.valueOf(external2_guarantee)).build();
Integer externalGuarantee_2 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
Assert.assertNotNull(externalGuarantee_2);
verifySavingsOnHoldBalance(externalSavigsId_2, null);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
self1_hold_funds += self1_guarantee;
external1_hold_funds += external1_guarantee;
external2_hold_funds += external2_guarantee;
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0));
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
List<HashMap> guarantors = this.guarantorHelper.getAllGuarantor(loanID);
this.guarantorHelper.deleteGuarantor(externalGuarantor, loanID);
assertFalse((Boolean) this.guarantorHelper.getGuarantor(externalGuarantor, loanID, "status"));
HashMap errorlog = this.guarantorHelper.deleteGuarantor(withoutGuaranteeAmount, loanID);
ArrayList<HashMap> error = (ArrayList<HashMap>) errorlog.get(CommonConstants.RESPONSE_ERROR);
assertTrue(checkForErrorCode(error, "error.msg.loan.guarantor.not.found"));
guarantors = this.guarantorHelper.getAllGuarantor(loanID);
assertEquals(4, guarantors.size());
List<HashMap> externalGuarantee_1_details = (List<HashMap>) this.guarantorHelper.getGuarantor(externalGuarantee_1, loanID,
"guarantorFundingDetails");
Integer fundDetailId = (Integer) externalGuarantee_1_details.get(0).get("id");
errorlog = this.guarantorHelper.deleteGuarantor(externalGuarantee_1, fundDetailId, loanID);
error = (ArrayList<HashMap>) errorlog.get(CommonConstants.RESPONSE_ERROR);
assertTrue(checkForErrorCode(error, "validation.msg.loan.guarantor.min.external.guarantee.required"));
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
String.valueOf(externalSavigsId_3), String.valueOf(external1_guarantee)).build();
Integer externalGuarantee_3 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(externalSavigsId_3, external1_guarantee);
Assert.assertNotNull(externalGuarantee_3);
this.guarantorHelper.deleteGuarantor(externalGuarantee_1, fundDetailId, loanID);
guarantors = this.guarantorHelper.getAllGuarantor(loanID);
assertEquals(4, guarantors.size());
externalGuarantee_1_details = (List<HashMap>) this.guarantorHelper.getGuarantor(externalGuarantee_1, loanID,
"guarantorFundingDetails");
assertEquals(2, externalGuarantee_1_details.size());
for (HashMap map : externalGuarantee_1_details) {
if (map.get("id").equals(fundDetailId)) {
HashMap status = (HashMap) map.get("status");
assertEquals("guarantorFundStatusType.withdrawn", status.get("code"));
}
}
System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// First repayment
ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod");
external1_hold_funds -= new Float(827.5867);
external2_hold_funds -= new Float(413.7933);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
// Second repayment
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod");
external1_hold_funds -= new Float(831.4067);
external2_hold_funds -= new Float(415.7033333);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
// third repayment
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -7);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod");
Float self1_hold_funds_temp = self1_hold_funds - new Float(741.355);
HashMap transactionDetail = this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds_temp);
verifySavingsOnHoldBalance(externalSavigsId_3, new Float(0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0));
// undo repayment
this.loanTransactionHelper.adjustLoanTransaction(loanID, (Integer) transactionDetail.get(CommonConstants.RESPONSE_RESOURCE_ID),
LOAN_REPAYMENT_DATE, "0", "");
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
// undo disbursal
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, new Float(self1_guarantee));
verifySavingsOnHoldBalance(externalSavigsId_3, new Float(external1_guarantee));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(external2_guarantee));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testGuarantor_RECOVER_GUARANTEES() {
Float self1_hold_funds = new Float(0);
Float external1_hold_funds = new Float(0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
String.valueOf(self1_balance));
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
String.valueOf(external1_balance));
final Integer loanProductID = createLoanProductWithHoldFunds("40", "20", "20");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -21);
String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime());
final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
String guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(selfSavigsId, null);
Assert.assertNotNull(selfGuarantee);
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(externalSavigsId_1, null);
Assert.assertNotNull(externalGuarantee_1);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
self1_hold_funds += self1_guarantee;
external1_hold_funds += external1_guarantee;
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// First repayment
ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -14);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod");
external1_hold_funds -= new Float(993.104);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
this.loanTransactionHelper.recoverFromGuarantor(loanID);
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), self1_balance - self1_hold_funds);
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), external1_balance - external1_hold_funds);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testGuarantor_RECOVER_GUARANTEES_WITH_MORE_GUARANTEE() {
Float self1_hold_funds = new Float(0);
Float external1_hold_funds = new Float(0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
Float selfBalance = new Float(10000);
Float externalBalance = new Float(10000);
Float selfguarantee = new Float(6000);
Float externalguarantee = new Float(7000);
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
String.valueOf(selfBalance));
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
String.valueOf(externalBalance));
final Integer loanProductID = createLoanProductWithHoldFunds("40", "20", "20");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -21);
String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime());
final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
String guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
String.valueOf(selfSavigsId), String.valueOf(selfguarantee)).build();
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(selfSavigsId, null);
Assert.assertNotNull(selfGuarantee);
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
String.valueOf(externalSavigsId_1), String.valueOf(externalguarantee)).build();
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(externalSavigsId_1, null);
Assert.assertNotNull(externalGuarantee_1);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
self1_hold_funds += selfguarantee;
external1_hold_funds += externalguarantee;
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// First repayment
ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -14);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod");
external1_hold_funds -= new Float(3227.588);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
this.loanTransactionHelper.recoverFromGuarantor(loanID);
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), selfBalance - new Float(4615.385));
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), externalBalance - new Float(2901.8553));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testGuarantor_WRITE_OFF_LOAN() {
Float self1_hold_funds = new Float(0);
Float external1_hold_funds = new Float(0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
String.valueOf(self1_balance));
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
String.valueOf(external1_balance));
final Integer loanProductID = createLoanProductWithHoldFunds("40", "20", "20");
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -21);
String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime());
final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
String guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
verifySavingsOnHoldBalance(selfSavigsId, null);
Assert.assertNotNull(selfGuarantee);
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
Assert.assertNotNull(externalGuarantee_1);
verifySavingsOnHoldBalance(externalSavigsId_1, null);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
self1_hold_funds += self1_guarantee;
external1_hold_funds += external1_guarantee;
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(LOAN_DISBURSEMENT_DATE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// First repayment
ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DAY_OF_MONTH, -14);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod");
external1_hold_funds -= new Float(993.104);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
todaysDate = Calendar.getInstance();
String LOAN_WRITEOFF_DATE = dateFormat.format(todaysDate.getTime());
this.loanTransactionHelper.writeOffLoan(LOAN_WRITEOFF_DATE, loanID);
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), self1_balance);
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), external1_balance);
}
private void verifySavingsOnHoldBalance(final Integer savingsId, final Float expectedBalance) {
Float onHoldAmount = (Float) this.savingsAccountHelper.getSavingsDetails(savingsId, "onHoldFunds");
assertEquals("Verifying On Hold Funds", expectedBalance, onHoldAmount);
}
@SuppressWarnings({ "rawtypes", "cast" })
private void verifySavingsBalanceAndOnHoldBalance(final Integer savingsId, final Float expectedBalance, final Float accountBalance) {
HashMap savingsDetails = (HashMap) this.savingsAccountHelper.getSavingsDetails(savingsId);
assertEquals("Verifying On Hold Funds", expectedBalance, savingsDetails.get("onHoldFunds"));
HashMap summary = (HashMap) savingsDetails.get("summary");
assertEquals("Verifying Account balance", accountBalance, summary.get("accountBalance"));
}
@SuppressWarnings("rawtypes")
private boolean checkForErrorCode(final ArrayList<HashMap> errorData, final String errorcode) {
boolean isExists = false;
for (HashMap errorMap : errorData) {
String actualErrorCode = (String) errorMap.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE);
if (actualErrorCode != null && actualErrorCode.equals(errorcode)) {
isExists = true;
break;
}
}
return isExists;
}
private Integer createLoanProductWithHoldFunds(final String mandatoryGuarantee, final String minimumGuaranteeFromGuarantor,
final String minimumGuaranteeFromOwnFunds) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
LoanProductTestBuilder builder = new LoanProductTestBuilder().withPrincipal("10000.00").withNumberOfRepayments("4")
.withRepaymentAfterEvery("1").withRepaymentTypeAsWeek().withinterestRatePerPeriod("2")
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsDecliningBalance()
.withOnHoldFundDetails(mandatoryGuarantee, minimumGuaranteeFromGuarantor, minimumGuaranteeFromOwnFunds);
final String loanProductJSON = builder.build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String disbursementDate) {
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal("10000.00") //
.withLoanTermFrequency("4") //
.withLoanTermFrequencyAsWeeks() //
.withNumberOfRepayments("4") //
.withRepaymentEveryAfter("1") //
.withRepaymentFrequencyTypeAsWeeks() //
.withInterestRatePerPeriod("2") //
.withAmortizationTypeAsEqualInstallments() //
.withInterestTypeAsDecliningBalance() //
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
.withExpectedDisbursementDate(disbursementDate) //
.withSubmittedOnDate(disbursementDate) //
.build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
}
@@ -0,0 +1,74 @@
/**
* 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.loanaccount.guarantor;
import java.util.HashMap;
import org.mifosplatform.integrationtests.common.Utils;
import com.google.gson.Gson;
public class GuarantorTestBuilder {
private static final String GUARANTOR_TYPE_CUSTOMER = "1";
@SuppressWarnings("unused")
private static final String GUARANTOR_TYPE_STAFF = "2";
private static final String GUARANTOR_TYPE_EXTERNAL = "3";
private String guarantorTypeId = "1";
private String entityId = null;
private String addressLine1 = "addressLine1";
private String addressLine2 = "addressLine2";
private String city = "city";
private String state = "state";
private String zip = "123456";
private String guaranteeAmount = "500";
private String savingsId = null;
public String build() {
final HashMap<String, String> map = new HashMap<>();
map.put("guarantorTypeId", guarantorTypeId);
map.put("locale", "en");
if (GUARANTOR_TYPE_EXTERNAL.equals(guarantorTypeId)) {
map.put("firstname", Utils.randomNameGenerator("guarantor_FirstName_", 5));
map.put("lastname", Utils.randomNameGenerator("guarantor_LastName_", 4));
map.put("addressLine1", addressLine1);
map.put("addressLine2", addressLine2);
map.put("city", city);
map.put("state", state);
map.put("zip", zip);
} else if (GUARANTOR_TYPE_CUSTOMER.equals(guarantorTypeId)) {
map.put("entityId", entityId);
map.put("amount", guaranteeAmount);
map.put("savingsId", savingsId);
}
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public GuarantorTestBuilder existingCustomerWithGuaranteeAmount(final String entityId, final String savingsId,
final String guaranteeAmount) {
this.entityId = entityId;
this.savingsId = savingsId;
this.guaranteeAmount = guaranteeAmount;
this.guarantorTypeId = GUARANTOR_TYPE_CUSTOMER;
return this;
}
public GuarantorTestBuilder existingCustomerWithoutGuaranteeAmount(final String entityId) {
this.entityId = entityId;
this.savingsId = null;
this.guaranteeAmount = null;
this.guarantorTypeId = GUARANTOR_TYPE_CUSTOMER;
return this;
}
public GuarantorTestBuilder externalCustomer() {
this.guarantorTypeId = GUARANTOR_TYPE_EXTERNAL;
return this;
}
}
@@ -0,0 +1,57 @@
/**
* 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.useradministration.roles;
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 RolesHelper {
private static final String CREATE_ROLE_URL = "/mifosng-provider/api/v1/roles?" + Utils.TENANT_IDENTIFIER;
private static final String ROLE_URL = "/mifosng-provider/api/v1/roles";
private static final String DISABLE_ROLE_COMMAND = "disable";
private static final String ENABLE_ROLE_COMMAND = "enable";
public static Integer createRole(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_ROLE_URL, getTestCreaRoleAsJSON(), "resourceId");
}
public static String getTestCreaRoleAsJSON() {
final HashMap<String, String> map = new HashMap<>();
map.put("name", Utils.randomNameGenerator("Role_Name_", 5));
map.put("description", Utils.randomNameGenerator("Role_Description_", 10));
return new Gson().toJson(map);
}
public static HashMap<String, Object> getRoleDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer roleId) {
final String GET_ROLE_URL = "/mifosng-provider/api/v1/roles/" + roleId + "?" + Utils.TENANT_IDENTIFIER;
HashMap<String, Object> role = Utils.performServerGet(requestSpec, responseSpec, GET_ROLE_URL, "");
return role;
}
public static Integer disableRole(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer roleId) {
return Utils.performServerPost(requestSpec, responseSpec, createRoleOperationURL(DISABLE_ROLE_COMMAND, roleId), "", "resourceId");
}
public static Integer enableRole(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer roleId) {
return Utils.performServerPost(requestSpec, responseSpec, createRoleOperationURL(ENABLE_ROLE_COMMAND, roleId), "", "resourceId");
}
public static Integer deleteRole(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer roleId) {
return Utils.performServerDelete(requestSpec, responseSpec, createRoleOperationURL(ENABLE_ROLE_COMMAND, roleId), "resourceId");
}
private static String createRoleOperationURL(final String command, final Integer roleId) {
return ROLE_URL + "/" + roleId + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
}
@@ -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.integrationtests.useradministration.users;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import org.mifosplatform.integrationtests.common.Utils;
public class UserHelper {
private static final String CREATE_USER_URL = "/mifosng-provider/api/v1/users?" + Utils.TENANT_IDENTIFIER;
private static final String USER_URL = "/mifosng-provider/api/v1/users";
public static Integer createUser(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, int roleId, int staffId) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_USER_URL, getTestCreateUserAsJSON(roleId, staffId), "resourceId");
}
public static String getTestCreateUserAsJSON(int roleId, int staffId) {
String json = "{ \"username\": \"" + Utils.randomNameGenerator("User_Name_", 3)
+ "\", \"firstname\": \"Test\", \"lastname\": \"User\", \"email\": \"whatever@mifos.org\","
+ " \"officeId\": \"1\", \"staffId\": " + "\""
+ Integer.toString(staffId)+"\",\"roles\": [\""
+ Integer.toString(roleId) + "\"], \"sendPasswordToEmail\": false}";
System.out.println(json);
return json;
}
public static Integer deleteUser(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer userId) {
return Utils.performServerDelete(requestSpec, responseSpec, createRoleOperationURL(userId), "resourceId");
}
private static String createRoleOperationURL(final Integer userId) {
return USER_URL + "/" + userId + "?" + Utils.TENANT_IDENTIFIER;
}
}
+30
View File
@@ -0,0 +1,30 @@
Welcome to the Mifos community!
===============================
Depending on the OS you're running, you should have "runmifosx.sh" (for Linux and Mac) and
"runmifosx.bat" (for Windows) in this directory. These are small scripts that allow you to
run MifosX on your computer locally. To be able to run MifosX, just double-click on the script,
that is, "runmifosx.sh" if you are on Linux or Mac, or "runmifosx.bat" if you are on Windows.
If you have a web front-end that you want to use along with the backend server, put your index.html
along with all the other source files inside a (sub-folder of) the "apps" folder in the current
directory from where runmifosx.bat/.sh is launched. The web UI front-end is then accessible
under mifosng-provider/apps - for example:
https://localhost:8443/mifosng-provider/apps/community-app/index.html?baseApiUrl=https://localhost:8443&tenantIdentifier=default#/home
We hope you'll have an amazing experience working with MifosX!
PS, internal note to Mifos developers preparing packages, only: For this to work, the WAR of
the Mifos X distribution ZIP package will (currently) have to be built using
the Gradle 'dev' environment profile - e.g. using this command:
./gradlew -Penv=dev clean war dist
We now also have a script which convenently prepares both the
UI front-end and the API back-end together into a ZIP:
git clone --recursive https://github.com/openMF/mifosx/
git submodule update --init --recursive; git submodule status
./build.sh
+10
View File
@@ -0,0 +1,10 @@
java -version >nul 2>&1 && (
echo "Found Java."
) || (
echo "Java should be installed to run MifosX."
exit
)
echo "Starting MifosX ..... "
java -Djava.awt.headless=false -jar mifosng-provider.war
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# First of all, check if Java is installed on this computer
if hash java; then
echo "Found Java:"
echo $(java -version)
else
echo "Java should be installed to run MifosX."
exit
fi
echo "Starting MifosX ..... "
java -Djava.awt.headless=false -jar mifosng-provider.war
@@ -5,13 +5,20 @@
*/
package org.mifosplatform;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.Resource;
/**
* Mifos main() application which launches Mifos X in an embedded Tomcat HTTP
@@ -27,13 +34,59 @@ import org.springframework.context.annotation.Import;
* @see ServerApplication for the same without the embedded MariaDB4j database
*/
public class ServerWithMariaDB4jApplication {
private final static Logger logger = LoggerFactory.getLogger(ServerWithMariaDB4jApplication.class);
@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);
if (!Desktop.isDesktopSupported()) {
logger.info("Not going to open UI homepage in local web browser, because !Desktop.isDesktopSupported()");
} else {
// apps/community-app/dist/community-app/index.html
Resource distResource = ctx.getResource("file:" + System.getProperty("user.dir") +
System.getProperty("file.separator") + "apps" +
System.getProperty("file.separator") + "community-app" +
System.getProperty("file.separator") + "dist" +
System.getProperty("file.separator") + "community-app" +
System.getProperty("file.separator") + "index.html");
URI distURI = URI.create("https://localhost:8443/mifosng-provider" +
"/apps/community-app/index.html?baseApiUrl=https://localhost:8443" +
"&tenantIdentifier=default#/");
// apps/community-app/app/index.html
Resource devResource = ctx.getResource("file:" + System.getProperty("user.dir") +
System.getProperty("file.separator") + "apps" +
System.getProperty("file.separator") + "community-app" +
System.getProperty("file.separator") + "app" +
System.getProperty("file.separator") + "index.html");
URI devURI = URI.create("https://localhost:8443/mifosng-provider" +
"/apps/community-app/app/index.html?baseApiUrl=https://localhost:8443" +
"&tenantIdentifier=default#/");
if (distResource.exists()) {
openWebBrowser(distURI);
} else if (devResource.exists()) {
openWebBrowser(devURI);
} else {
logger.error("Cannot open Mifos X UI in browser; not found: " + distResource.toString());
}
}
// TODO Tray Icon stuff; dig out my very own old @see https://github.com/mifos/head/tree/hudsonBuild-MIFOS-5157_Launch4j-EXE_NewDist-squash1/server-jetty/src/main/java/org/mifos/server/tray
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
}
private static void openWebBrowser(URI uri) {
try {
logger.info("Opening Mifos X UI in browser: " + uri.toString());
Desktop.getDesktop().browse(uri);
} catch (IOException e) {
logger.error("IOException when opening Mifos X UI in browser: " + uri.toString(), e);
}
}
}
@@ -6,6 +6,7 @@
package org.mifosplatform.accounting.accrual.handler;
import org.mifosplatform.accounting.accrual.service.AccrualAccountingWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "PERIODICACCRUALACCOUNTING", action = "EXECUTE")
public class ExecutePeriodicAccrualCommandHandler implements NewCommandSourceHandler {
private final AccrualAccountingWritePlatformService writePlatformService;
@@ -22,6 +22,7 @@ import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
import org.mifosplatform.infrastructure.core.serialization.FromApiJsonDeserializer;
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
import org.mifosplatform.infrastructure.core.service.DateUtils;
import org.mifosplatform.portfolio.loanaccount.guarantor.command.GuarantorCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -54,7 +55,7 @@ public final class AccrualAccountingDataValidator {
.resource(PERIODIC_ACCRUAL_ACCOUNTING_RESOURCE_NAME);
final LocalDate date = this.fromApiJsonHelper.extractLocalDateNamed(accrueTillParamName, element);
baseDataValidator.reset().parameter(accrueTillParamName).value(date).notNull().validateDateBefore(LocalDate.now());
baseDataValidator.reset().parameter(accrueTillParamName).value(date).notNull().validateDateBefore(DateUtils.getLocalDateOfTenant());
throwExceptionIfValidationWarningsExist(dataValidationErrors);
@@ -19,20 +19,20 @@ import org.mifosplatform.infrastructure.core.data.ApiParameterError;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
import org.mifosplatform.portfolio.loanaccount.service.LoanAccrualWritePlatformService;
import org.mifosplatform.portfolio.loanaccount.service.LoanAccrualPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AccrualAccountingWritePlatformServiceImpl implements AccrualAccountingWritePlatformService {
private final LoanAccrualWritePlatformService loanAccrualWritePlatformService;
private final LoanAccrualPlatformService loanAccrualPlatformService;
private final AccrualAccountingDataValidator accountingDataValidator;
@Autowired
public AccrualAccountingWritePlatformServiceImpl(final LoanAccrualWritePlatformService loanAccrualWritePlatformService,
public AccrualAccountingWritePlatformServiceImpl(final LoanAccrualPlatformService loanAccrualPlatformService,
final AccrualAccountingDataValidator accountingDataValidator) {
this.loanAccrualWritePlatformService = loanAccrualWritePlatformService;
this.loanAccrualPlatformService = loanAccrualPlatformService;
this.accountingDataValidator = accountingDataValidator;
}
@@ -40,7 +40,7 @@ public class AccrualAccountingWritePlatformServiceImpl implements AccrualAccount
public CommandProcessingResult executeLoansPeriodicAccrual(JsonCommand command) {
this.accountingDataValidator.validateLoanPeriodicAccrualData(command.json());
LocalDate tilldate = command.localDateValueOfParameterNamed(accrueTillParamName);
String errorlog = this.loanAccrualWritePlatformService.addPeriodicAccruals(tilldate);
String errorlog = this.loanAccrualPlatformService.addPeriodicAccruals(tilldate);
if (errorlog.length() > 0) {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -6,6 +6,7 @@
package org.mifosplatform.accounting.closure.handler;
import org.mifosplatform.accounting.closure.service.GLClosureWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "GLCLOSURE", action = "CREATE")
public class CreateGLClosureCommandHandler implements NewCommandSourceHandler {
private final GLClosureWritePlatformService writePlatformService;
@@ -6,6 +6,7 @@
package org.mifosplatform.accounting.closure.handler;
import org.mifosplatform.accounting.closure.service.GLClosureWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "GLCLOSURE", action = "DELETE")
public class DeleteGLClosureCommandHandler implements NewCommandSourceHandler {
private final GLClosureWritePlatformService closureWritePlatformService;
@@ -6,6 +6,7 @@
package org.mifosplatform.accounting.closure.handler;
import org.mifosplatform.accounting.closure.service.GLClosureWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "GLCLOSURE", action = "UPDATE")
public class UpdateGLClosureCommandHandler implements NewCommandSourceHandler {
private final GLClosureWritePlatformService writePlatformService;
@@ -221,7 +221,9 @@ public class AccountingConstants {
}
public static enum FINANCIAL_ACTIVITY {
ASSET_TRANSFER(100, "assetTransfer", GLAccountType.ASSET), LIABILITY_TRANSFER(200, "liabilityTransfer", GLAccountType.LIABILITY);
ASSET_TRANSFER(100, "assetTransfer", GLAccountType.ASSET), LIABILITY_TRANSFER(200, "liabilityTransfer", GLAccountType.LIABILITY),
CASH_AT_MAINVAULT (101, "cashAtMainVault", GLAccountType.ASSET),
CASH_AT_TELLER (102, "cashAtTeller", GLAccountType.ASSET),OPENING_BALANCES_TRANSFER_CONTRA (300,"openingBalancesTransferContra",GLAccountType.EQUITY);;
private final Integer value;
private final String code;
@@ -86,6 +86,14 @@ public class AccountingDropdownReadPlatformServiceImpl implements AccountingDrop
liabilityAccountOptions = null;
}
accountOptions.put("liabilityAccountOptions", liabilityAccountOptions);
List<GLAccountData> equityAccountOptions = this.accountReadPlatformService
.retrieveAllEnabledDetailGLAccounts(GLAccountType.EQUITY);
if (equityAccountOptions.isEmpty()) {
equityAccountOptions = null;
}
accountOptions.put("equityAccountOptions",equityAccountOptions);
return accountOptions;
}
@@ -19,7 +19,7 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Table(name = "acc_gl_financial_activity_account")
public class FinancialActivityAccount extends AbstractPersistable<Long> {
@ManyToOne(fetch = FetchType.LAZY)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "gl_account_id")
private GLAccount glAccount;
@@ -6,6 +6,7 @@
package org.mifosplatform.accounting.financialactivityaccount.handler;
import org.mifosplatform.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "CREATE")
public class CreateFinancialActivityAccountHandler implements NewCommandSourceHandler {
private final FinancialActivityAccountWritePlatformService writePlatformService;
@@ -6,6 +6,7 @@
package org.mifosplatform.accounting.financialactivityaccount.handler;
import org.mifosplatform.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "DELETE")
public class DeleteFinancialActivityAccountCommandHandler implements NewCommandSourceHandler {
private final FinancialActivityAccountWritePlatformService writePlatformService;
@@ -6,6 +6,7 @@
package org.mifosplatform.accounting.financialactivityaccount.handler;
import org.mifosplatform.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "UPDATE")
public class UpdateFinancialActivityAccountCommandHandler implements NewCommandSourceHandler {
private final FinancialActivityAccountWritePlatformService writePlatformService;
@@ -53,7 +53,8 @@ public final class FinancialActivityAccountDataValidator {
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).notNull()
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue());
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
FINANCIAL_ACTIVITY.CASH_AT_MAINVAULT.getValue(), FINANCIAL_ACTIVITY.CASH_AT_TELLER.getValue(),FINANCIAL_ACTIVITY.OPENING_BALANCES_TRANSFER_CONTRA.getValue());
final Long glAccountId = this.fromApiJsonHelper.extractLongNamed(paramNameForGLAccount, element);
baseDataValidator.reset().parameter(paramNameForGLAccount).value(glAccountId).notNull().integerGreaterThanZero();
@@ -78,7 +79,7 @@ public final class FinancialActivityAccountDataValidator {
final Integer financialActivityId = this.fromApiJsonHelper
.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).ignoreIfNull()
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue());
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),FINANCIAL_ACTIVITY.OPENING_BALANCES_TRANSFER_CONTRA.getValue());
}
if (this.fromApiJsonHelper.parameterExists(paramNameForGLAccount, element)) {
@@ -173,4 +173,13 @@ public class GLAccountData {
return this.glCode;
}
public EnumOptionData getType() {
return this.type;
}
public Integer getTypeId() {
if (this.type != null) { return this.type.getId().intValue(); }
return null;
}
}

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