[fineract] branch Fineract-614 updated (8311fbb -> 8a72917)

2020-02-26 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


from 8311fbb  Fineract-614: Updating Global Configurations Fixing some 
rebase conflicts Change to imports on IntegrationTest for CheckStyle
 add 8a72917  Fineract-614 Changes to comply with Checkstyle rules

No new revisions were added by this update.

Summary of changes:
 .../loanaccount/api/LoansApiResource.java  | 42 ++---
 .../loanaccount/service/LoanAssembler.java |  3 -
 .../portfolio/rate/api/RateApiResource.java| 14 +++--
 .../fineract/portfolio/rate/data/RateData.java |  3 +-
 .../fineract/portfolio/rate/domain/Rate.java   | 29 -
 .../portfolio/rate/domain/RateAppliesTo.java   | 73 +++---
 .../portfolio/rate/domain/RateRepository.java  | 13 ++--
 .../portfolio/rate/service/RateEnumerations.java   | 33 +-
 .../portfolio/rate/service/RateReadService.java|  3 +-
 .../rate/service/RateReadServiceImpl.java  | 21 +++
 10 files changed, 117 insertions(+), 117 deletions(-)



[fineract] branch Fineract-614 updated (7321f77 -> 8311fbb)

2020-02-05 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


from 7321f77  Fineract-614: Updating Global Configurations Fixing some 
rebase conflicts
 add 8311fbb  Fineract-614: Updating Global Configurations Fixing some 
rebase conflicts Change to imports on IntegrationTest for CheckStyle

No new revisions were added by this update.

Summary of changes:
 .../fineract/integrationtests/RatesTest.java   |  58 +--
 .../integrationtests/common/rates/RatesHelper.java | 109 +++--
 2 files changed, 88 insertions(+), 79 deletions(-)



[fineract] branch Fineract-614 updated (7167850 -> 7321f77)

2020-02-05 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


 discard 7167850  Fineract-614: Updating Global Configurations
 add 7321f77  Fineract-614: Updating Global Configurations Fixing some 
rebase conflicts

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (7167850)
\
 N -- N -- N   refs/heads/Fineract-614 (7321f77)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .../java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java | 1 +
 .../org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)



[fineract] branch Fineract-614 updated (1c3be1c -> 7167850)

2020-02-05 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


omit 1c3be1c  Fineract-614: Renaming SQL file for a higher version number
omit 971c30c  Fixing some code to be compatible with Spring update
omit e5cbaeb  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update
omit 9d90d7c  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add fbccc57  enforce initial set of Checkstyle rules (FINERACT-821)
 add 3790fdb  Merge pull request #689 from vorburger/checkstyle1
 add e1666ba  FINERACT-839: NPE when creating a Loan for a client fix
 add dfcad32  Merge pull request #696 from adamsaghy/bugfix/loanproductdata
 add 216566f  Add link to mailing list to README
 add 1c7bea6  Merge pull request #697 from 
apache/vorburger-README-link-mailinglist
 add e9e0bbc  FINERACT-820 - Fixing Integration Test which fails on Sundays
 add 7774766  Update Gradle version from 5.6.1 to 6.1
 add 1848056  Revert "FINERACT-820 - Fixing Integration Test which fails on 
Sundays"
 add 5c19ed9  FINERACT-820: Add a new condition so the Java Calendar Sunday 
value matches witch Fineract
 add 66ae79b  Upgrade Spring Boot from 2.1.7 to 2.2.4
 add 14175a1  Minor: Remove comment in build.gradle re. 
springDataJpaVersion (#702)
 add 3a17da4  Activate and Enforce Checkstyle EqualsHashCode check. (#703)
 add 28db242  Activate and Enforce new Checkstyle check related to import 
statement order (FINERACT-821) (#704)
 add f590603  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add 972f910  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update
 add efb94fa  Fixing some code to be compatible with Spring update
 add 82cd67c  Fineract-614: Renaming SQL file for a higher version number
 add 7167850  Fineract-614: Updating Global Configurations

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1c3be1c)
\
 N -- N -- N   refs/heads/Fineract-614 (7167850)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 README.md  |  13 +
 config/fineractdev-eclipse-preferences.epf | 552 +
 fineract-provider/build.gradle |  11 +-
 fineract-provider/config/checkstyle/checkstyle.xml | 268 ++
 .../gradle/wrapper/gradle-wrapper.jar  | Bin 55190 -> 55616 bytes
 .../gradle/wrapper/gradle-wrapper.properties   |   2 +-
 fineract-provider/gradlew  |  22 +-
 fineract-provider/gradlew.bat  |  18 +-
 .../AccountNumberPreferencesTest.java  |  26 +-
 .../integrationtests/AccountTransferTest.java  |  14 +-
 .../AccountingScenarioIntegrationTest.java |  12 +-
 .../fineract/integrationtests/BatchApiTest.java|  18 +-
 .../BatchRequestsIntegrationTest.java  |  12 +-
 .../integrationtests/CenterIntegrationTest.java|  13 +-
 .../fineract/integrationtests/ChargesTest.java |  12 +-
 .../ClientLoanIntegrationTest.java |  26 +-
 .../ClientSavingsIntegrationTest.java  |  30 +-
 .../fineract/integrationtests/ClientTest.java  |  12 +-
 ...ientUndoRejectAndWithdrawalIntegrationTest.java |  17 +-
 .../ConcurrencyIntegrationTest.java|  12 +-
 .../fineract/integrationtests/CurrenciesTest.java  |   5 +-
 .../integrationtests/CurrencyIntegrationTest.java  |   7 +-
 .../DisbursalAndRepaymentScheduleTest.java |  25 +-
 .../ExternalServicesConfigurationTest.java |  12 +-
 .../FinancialActivityAccountsTest.java  

[fineract] branch Fineract-614 updated (565999a -> 1c3be1c)

2020-01-20 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


 discard 565999a  Fineract-614: Renaming SQL file for a higher version number
 discard bf0393b  Fixing some code to be compatible with Spring update
 discard 01c5231  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update
 discard c7a27f9  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add 54b7ddf  add GitHub Action to autoclose stale pull requests
 add efb0a55  FINERACT-824: Removed the second validation since 
realCause.getCause() is null if it is equal to realCause
 add 6ca1a67  more SpotBugs related / inspired code clean up (see 
FINERACT-702)
 add fc786fa  Merge pull request #684 from vorburger/spotbugs-extra
 add a5c60b0  clean up GLAccountBuilder, following SpotBugs (FINERACT-702)
 add eee163a  Merge pull request #685 from 
vorburger/spotbugs-extra-GLAccountBuilder
 add 653b0b7  add /rebase comment support for Pull Requests
 add 091710e  Minor typo fix in rebase.yml (FINERACT-829)
 add b0dce97  fix broken Dockerfile build (FINERACT-833)
 add e424471  Initial Swagger related changes from GSOC 2019 contrib 
(FINERACT-733)
 add 1259243  Temporarily remove the build realted Swagger changes 
(FINERACT-733)
 add 68006ae  convert all Java files from DOS to UNIX line ending 
(FINERACT-821)
 add b019604  replace 51013 Tabs with 4 Spaces in 3122 Java files 
(FINERACT-821)
 add dd7503f  remove all trailing spaces in Java files (FINERACT-821)
 add 9d90d7c  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add e5cbaeb  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update
 add 971c30c  Fixing some code to be compatible with Spring update
 add 1c3be1c  Fineract-614: Renaming SQL file for a higher version number

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (565999a)
\
 N -- N -- N   refs/heads/Fineract-614 (1c3be1c)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .github/workflows/rebase.yml   |23 +
 .github/workflows/stale.yml|20 +
 Dockerfile | 3 +-
 fineract-provider/build.gradle |12 +-
 .../AccountNumberPreferencesTest.java  |38 +-
 .../fineract/integrationtests/BatchApiTest.java|22 +-
 .../BatchRequestsIntegrationTest.java  | 6 +-
 .../integrationtests/CenterIntegrationTest.java| 6 +-
 .../ClientSavingsIntegrationTest.java  |  1408 +-
 .../fineract/integrationtests/ClientTest.java  |12 +-
 ...ientUndoRejectAndWithdrawalIntegrationTest.java |   526 +-
 .../integrationtests/FixedDepositTest.java |50 +-
 ...restChargedFromDateSameAsDisbursalDateTest.java |14 +-
 .../integrationtests/GlobalConfigurationTest.java  |   160 +-
 .../GroupSavingsIntegrationTest.java   | 8 +-
 .../integrationtests/HookIntegrationTest.java  |20 +-
 .../LoanDisbursalDateValidationTest.java   |12 +-
 .../LoanDisbursementDetailsIntegrationTest.java|40 +-
 .../LoanRepaymentRescheduleAtDisbursementTest.java |72 +-
 .../LoanRescheduleRequestTest.java |   218 +-
 .../LoanReschedulingWithinCenterTest.java  |16 +-
 .../integrationtests/OfficeIntegrationTest.java|52 +-
 .../PasswordPreferencesIntegrationTest.java| 4 +-
 .../integrationtests/RecurringDepositTest.java |44 +-
 .../integrationtests/SchedulerJobsTestResults.java |16 +-
 .../SkipRepaymentOnMonthFirstTest.java |   

[fineract] branch Fineract-614 updated (bf0393b -> 565999a)

2020-01-13 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


from bf0393b  Fixing some code to be compatible with Spring update
 add 565999a  Fineract-614: Renaming SQL file for a higher version number

No new revisions were added by this update.

Summary of changes:
 .../resources/sql/migrations/core_db/{V352__rates.sql => V354__rates.sql} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename 
fineract-provider/src/main/resources/sql/migrations/core_db/{V352__rates.sql => 
V354__rates.sql} (100%)



[fineract] branch Fineract-614 updated (867e7e1 -> bf0393b)

2020-01-13 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


 discard 867e7e1  Merge branch 'develop' into Fineract-614
 discard c66c55f  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update
 discard 68345a4  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add cc181b5  reset/verify all default global configurations in some 
integration tests (PR #671 for FINERACT-722)
 add 0da4cdd  Parallelization of Jobs: Parallelizing and paging of 
recalculate interest for loans (PR #524 for FINERACT-428)
 add 030d9c8  fix potential NPE in JobParameter.equals() (FINERACT-428)
 add f739f91  Merge pull request #672 from vorburger/fix-equals-NPE
 add 5bce242  change .travis.yml to only run docker test if integration 
test passed
 add ba6f778  Merge pull request #675 from apache/vorburger-travis
 add a93a6b8  Change /authentication API to pass data in request body 
instead of URL arguments (FINERACT-726)
 add ff702db  FINERACT-803 fix exception handling for username duplication
 add 865e5a5  FINERACT-803 change the license comment type
 add 75f7c59  add .project and .settings/ to .gitignore
 add af0dd7e  use SpotBugs & fix over 300 high priority rule violations 
(FINERACT-702)
 add 89b996c  Revert changes made to LoanReschedulingWithinCenterTest 
(FINERACT-702)
 add 4e1d87f  fix broken docker-compose set up (re. FINERACT-773)
 add 7420545  Merge pull request #690 from 
vorburger/FINERACT-773_fix-docker-compose
 add 0379ba7  fix build.gradle for RAT to ignore .github/workflows/
 add c7a27f9  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add 01c5231  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update
 add bf0393b  Fixing some code to be compatible with Spring update

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (867e7e1)
\
 N -- N -- N   refs/heads/Fineract-614 (bf0393b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .gitignore |   3 +
 .travis.yml|   9 +-
 fineract-provider/build.gradle |  17 +-
 fineract-provider/dependencies.gradle  |   2 +-
 .../integrationtests/CenterIntegrationTest.java|  27 +-
 .../ClientLoanIntegrationTest.java |  53 ++--
 .../ClientSavingsIntegrationTest.java  |  64 ++---
 ...ientUndoRejectAndWithdrawalIntegrationTest.java |  37 +--
 .../fineract/integrationtests/CurrenciesTest.java  |  15 +-
 ...xibleSavingsInterestPostingIntegrationTest.java |   3 +-
 ...restChargedFromDateSameAsDisbursalDateTest.java |   7 +
 .../integrationtests/GlobalConfigurationTest.java  |   7 +
 .../LoanReschedulingWithinCenterTest.java  |   9 +-
 .../integrationtests/SchedulerJobsTestResults.java |  53 ++--
 .../SkipRepaymentOnMonthFirstTest.java |   7 +
 .../integrationtests/UserAdministrationTest.java   | 126 +
 .../integrationtests/common/CenterDomain.java  |   8 +-
 .../integrationtests/common/CurrenciesHelper.java  |   6 +-
 .../common/GlobalConfigurationHelper.java  | 280 +++-
 .../fineract/integrationtests/common/Utils.java|  11 +-
 .../integrationtests/common/WorkingDaysHelper.java |  15 +-
 .../common/accounting/GLAccountBuilder.java|  90 +++
 .../common/savings/SavingsAccountHelper.java   |  28 +-
 .../savings/SavingsApplicationTestBuilder.java |   6 +-
 .../shares/ShareAccountIntegrationTests.java   |  24 +-
 .../shares/ShareAccountTransactionHelper.java  |   7 +-
 .../com

[fineract] branch develop updated: Stop creating unnecessary overdue charge when amount is 0

2019-07-24 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
 new fa6794c  Stop creating unnecessary overdue charge when amount is 0
 new 4d3d37c  Merge pull request #614 from mohitsinha/new-develop
fa6794c is described below

commit fa6794c22c9d0510aa5075d9bae891c844f99432
Author: Mohit Sinha 
AuthorDate: Wed Jul 24 20:26:28 2019 +0700

Stop creating unnecessary overdue charge when amount is 0
---
 .../ClientLoanIntegrationTest.java |  2 +-
 .../integrationtests/SchedulerJobsTestResults.java | 64 ++
 .../common/charges/ChargesHelper.java  |  4 +-
 .../common/loans/LoanTransactionHelper.java|  6 ++
 .../LoanWritePlatformServiceJpaRepositoryImpl.java |  3 +
 5 files changed, 76 insertions(+), 3 deletions(-)

diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
index 66740c8..0c20d99 100644
--- 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
@@ -3787,7 +3787,7 @@ public class ClientLoanIntegrationTest {
 todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
 
 Integer overdueFeeChargeId = 
ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
-
ChargesHelper.getLoanOverdueFeeJSONWithCalculattionTypePercentage());
+
ChargesHelper.getLoanOverdueFeeJSONWithCalculattionTypePercentage("10"));
 Assert.assertNotNull(overdueFeeChargeId);
 
 final Integer clientID = ClientHelper.createClient(this.requestSpec, 
this.responseSpec);
diff --git 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java
 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java
index 64a4d13..e559850 100644
--- 
a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java
+++ 
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java
@@ -725,6 +725,70 @@ public class SchedulerJobsTestResults {
 }
 
 @Test
+public void 
testAvoidUnncessaryPenaltyWhenAmountZeroForOverdueLoansJobOutcome() throws 
InterruptedException {
+this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, 
this.responseSpec);
+this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, 
this.responseSpec);
+this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+
+final Integer clientID = ClientHelper.createClient(this.requestSpec, 
this.responseSpec);
+Assert.assertNotNull(clientID);
+
+Integer overdueFeeChargeId = ChargesHelper
+.createCharges(this.requestSpec, this.responseSpec, 
ChargesHelper.getLoanOverdueFeeJSONWithCalculattionTypePercentage("0.01"));
+Assert.assertNotNull(overdueFeeChargeId);
+
+final Integer loanProductID = 
createLoanProduct(overdueFeeChargeId.toString());
+Assert.assertNotNull(loanProductID);
+
+final Integer loanID = applyForLoanApplication(clientID.toString(), 
loanProductID.toString(), null);
+Assert.assertNotNull(loanID);
+
+HashMap loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
+LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+loanStatusHashMap = 
this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, 
loanID);
+LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+
+loanStatusHashMap = 
this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_APPROVAL_DATE_PLUS_ONE,
 loanID);
+LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+
+ArrayList repaymentScheduleDataBefore = 
this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+this.responseSpec, loanID);
+
+String JobName = "Apply penalty to overdue loans";
+Integer jobId = 12;
+
+this.schedulerJobHelper.executeJob(JobName);
+
+HashMap schedulerJob = 
this.schedulerJobHelper.getSchedulerJobById(this.requestSpec, 
this.responseSpec, jobId.toString());
+
+Assert.assertNotNull(schedulerJob);
+while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
+Thread.sleep(15000);
+schedulerJob = 
thi

[fineract] 02/02: FINERACT-737: Updated Api Docs to include loan charges paid by FINERACT-736: Api Docs were updated to include rates documentation FINERACT-735: Integration test were created for rate

2019-06-12 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a commit to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit c66c55f58cfb448d1d7da653f8b0ecd8183590cc
Author: Angel Cajas 
AuthorDate: Mon May 27 09:35:15 2019 -0600

FINERACT-737: Updated Api Docs to include loan charges paid by
FINERACT-736: Api Docs were updated to include rates documentation
FINERACT-735: Integration test were created for rates creation, retrieval 
and update
---
 api-docs/apiLive.htm   | 227 -
 .../fineract/integrationtests/RatesTest.java   |  71 +++
 .../integrationtests/common/rates/RatesHelper.java |  91 +
 .../fineract/portfolio/rate/data/RateData.java |   8 +-
 .../fineract/portfolio/rate/domain/Rate.java   |  36 ++--
 .../portfolio/rate/domain/RateAppliesTo.java   |  66 ++
 .../portfolio/rate/service/RateEnumerations.java   |  47 +
 .../rate/service/RateReadServiceImpl.java  |  12 +-
 .../sql/migrations/core_db/V352__rates.sql |   3 +-
 9 files changed, 533 insertions(+), 28 deletions(-)

diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index 67dfc71..b91380c 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -2546,6 +2546,24 @@



+
+Rates
+rates
+Create Rate
+List Rates
+
+
+
+
+
+
+rates/{rateId}
+
+Retrieve 
Rate
+Update Rate
+
+
+



@@ -12141,7 +12159,17 @@ GET 
https://DomainName/api/v1/loans/{loanId}/transactions/{transactionId}
 "displayLabel": "US Dollar ($)"
   },
   "amount": 559.88,
-  "interestPortion": 559.88
+  "interestPortion": 559.88,
+  "loanChargePaidByList": [
+{
+  "id": 29,
+  "amount": 138.70,
+  "installmentNumber": 0,
+  "chargeId": 7,
+  "transactionId": 35,
+  "name": "Late Penalty Charge"
+} 
+  ]
 }


@@ -16173,7 +16201,7 @@ GET https://DomainName/api/v1/loanproducts/{productId}

numberOfRepaymentVariationsForBorrowerCycle,

interestRateVariationsForBorrowerCycle,

multiDisburseLoan,maxTrancheCount,
-   
outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, 
principalThresholdForLastInstalment, 
accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, 
installmentAmountInMultiplesOf, allowAttributeOverrides, 
allowPartialPeriodInterestCalcualtion
+   
outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, 
principalThresholdForLastInstalment, 
accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, 
installmentAmountInMultiplesOf, allowAttributeOverrides, 
allowPartialPeriodInterestCalcualtion, rates



@@ -43264,7 +43292,198 @@ No Request Body:


 
-   
+
+ 
+
+
+Rates
+This defines the Rates
+
+
+
+Field 
Descriptions
+
+
+
+name
+
+
+Name of Rate
+
+
+
+productApply
+
+
+
+Enum value that defines to which ent

[fineract] branch Fineract-614 updated (5ac6ae7 -> c66c55f)

2019-06-12 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


 discard 5ac6ae7  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update
 discard 4e3d36c  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add 2f80674  remove gradle-wrapper.jar requirement from README
 add 92bdd53  remove Instructions to download gradle wrapper from README
 add aea7ee7  Merge pull request #581 from apache/rm-gradle-wrapper-doc
 add 02d51b1  use Ubuntu Trusty instead of Xenial on Travis CI (fixes 
FINERACT-763)
 new 68345a4  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 new c66c55f  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5ac6ae7)
\
 N -- N -- N   refs/heads/Fineract-614 (c66c55f)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .travis.yml |  4 
 README.md   | 11 ---
 2 files changed, 4 insertions(+), 11 deletions(-)



[fineract] 02/02: FINERACT-737: Updated Api Docs to include loan charges paid by FINERACT-736: Api Docs were updated to include rates documentation FINERACT-735: Integration test were created for rate

2019-06-12 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a commit to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 5ac6ae79c81584a79b0af02d4c40ab0147c48201
Author: Angel Cajas 
AuthorDate: Mon May 27 09:35:15 2019 -0600

FINERACT-737: Updated Api Docs to include loan charges paid by
FINERACT-736: Api Docs were updated to include rates documentation
FINERACT-735: Integration test were created for rates creation, retrieval 
and update
---
 api-docs/apiLive.htm   | 227 -
 .../fineract/integrationtests/RatesTest.java   |  71 +++
 .../integrationtests/common/rates/RatesHelper.java |  91 +
 .../fineract/portfolio/rate/data/RateData.java |   8 +-
 .../fineract/portfolio/rate/domain/Rate.java   |  36 ++--
 .../portfolio/rate/domain/RateAppliesTo.java   |  66 ++
 .../portfolio/rate/service/RateEnumerations.java   |  47 +
 .../rate/service/RateReadServiceImpl.java  |  12 +-
 .../sql/migrations/core_db/V352__rates.sql |   3 +-
 9 files changed, 533 insertions(+), 28 deletions(-)

diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index 67dfc71..b91380c 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -2546,6 +2546,24 @@



+
+Rates
+rates
+Create Rate
+List Rates
+
+
+
+
+
+
+rates/{rateId}
+
+Retrieve 
Rate
+Update Rate
+
+
+



@@ -12141,7 +12159,17 @@ GET 
https://DomainName/api/v1/loans/{loanId}/transactions/{transactionId}
 "displayLabel": "US Dollar ($)"
   },
   "amount": 559.88,
-  "interestPortion": 559.88
+  "interestPortion": 559.88,
+  "loanChargePaidByList": [
+{
+  "id": 29,
+  "amount": 138.70,
+  "installmentNumber": 0,
+  "chargeId": 7,
+  "transactionId": 35,
+  "name": "Late Penalty Charge"
+} 
+  ]
 }


@@ -16173,7 +16201,7 @@ GET https://DomainName/api/v1/loanproducts/{productId}

numberOfRepaymentVariationsForBorrowerCycle,

interestRateVariationsForBorrowerCycle,

multiDisburseLoan,maxTrancheCount,
-   
outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, 
principalThresholdForLastInstalment, 
accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, 
installmentAmountInMultiplesOf, allowAttributeOverrides, 
allowPartialPeriodInterestCalcualtion
+   
outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, 
principalThresholdForLastInstalment, 
accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, 
installmentAmountInMultiplesOf, allowAttributeOverrides, 
allowPartialPeriodInterestCalcualtion, rates



@@ -43264,7 +43292,198 @@ No Request Body:


 
-   
+
+ 
+
+
+Rates
+This defines the Rates
+
+
+
+Field 
Descriptions
+
+
+
+name
+
+
+Name of Rate
+
+
+
+productApply
+
+
+
+Enum value that defines to which ent

[fineract] branch Fineract-614 updated (ba42a10 -> 5ac6ae7)

2019-06-12 Thread angelboxes
This is an automated email from the ASF dual-hosted git repository.

angelboxes pushed a change to branch Fineract-614
in repository https://gitbox.apache.org/repos/asf/fineract.git.


omit ba42a10  Fineract-614
omit aaa6169  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 add b03e70f  FINERACT-718
 add 210e380  Merge pull request #551 from vishwasbabu/develop
 add b3320b7  fixed broken link to section and closed tags appropriately
 add 80ae332  Merge pull request #552 from muarachmann/FINERACT-738
 add 3ee051c  Loan Disbursement validation - timezone of tenant
 add 2ae9166  LocalDate check should be according to timezone of tenant.
 add 746090c   Placed break tag appropriately and removed blank spaces in 
create client section, corrected grammatical errors and added punctuation to 
sentences.
 add 8af4943  Merge pull request #553 from kangbreder/fix-tag
 add f8c5de3  [FINERACT-747] change String.replaceAll() to replace() to 
improve performance
 add 22716d7  Merge pull request #558 from bd2019us/FINERACT-747-PATCH
 add b8d4afe  Fixed typos in SPM API Java Files
 add 67ba10f  Merge pull request #561 from apoorva-mk/FINERACT-748
 add bbb32f5  FINERACT-751 Fix CenterIntegrationTest Case
 add 57b7303  Merge pull request #564 from awasum/develop
 add 7bf648a  Revert "Adding a compress response filter,registering filter"
 add 82568d9  FINERACT-757: Use of sqlEncodeString function isn't needed as 
parameters are passed as an array of Objects and SqlInjection validation is 
done by Spring JdbcTemplate.
 add cc05940  Merge pull request #572 from angelboxes/FINERACT-757
 add 61045ca  FINERACT-758
 add 93e0137  Merge pull request #573 from vishwasbabu/develop
 new 4e3d36c  A new rates module was added to define new rates that can be 
used to set min and max nominal interest rate, when a new loan account is 
created they can be used to determine which rates may be applicable for the 
loan account.
 new 5ac6ae7  FINERACT-737: Updated Api Docs to include loan charges paid 
by FINERACT-736: Api Docs were updated to include rates documentation 
FINERACT-735: Integration test were created for rates creation, retrieval and 
update

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ba42a10)
\
 N -- N -- N   refs/heads/Fineract-614 (5ac6ae7)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 api-docs/apiLive.htm   | 375 -
 fineract-provider/dev-dependencies.gradle  |   2 +-
 .../integrationtests/CenterIntegrationTest.java|  41 +--
 .../{XBRLIntegrationTest.java => RatesTest.java}   |  53 +--
 .../integrationtests/common/rates/RatesHelper.java |  91 +
 .../shares/ShareAccountIntegrationTests.java   |   3 +-
 .../rule/api/AccountingRuleJsonInputParams.java|   4 +-
 .../FixedDepositTransactionWorkbookPopulator.java  |   2 +-
 .../LoanRepaymentWorkbookPopulator.java|   4 +-
 .../SavingsTransactionsWorkbookPopulator.java  |   2 +-
 .../core/boot/WebXmlConfiguration.java |   3 -
 .../core/filters/ResponseCompressFilter.java   |  43 ---
 .../core/writer/GZipResponseWriter.java|  45 ---
 .../service/ClientReadPlatformServiceImpl.java |   8 +-
 .../portfolio/common/domain/ConditionType.java |   4 +-
 .../service/CenterReadPlatformServiceImpl.java |   6 +-
 .../service/GroupReadPlatformServiceImpl.java  |   6 +-
 .../portfolio/loanaccount/domain/Loan.java |   6 +-
 .../service/LoanReadPlatformServiceImpl.java   |   2 +-
 .../LoanWritePlatformServiceJpaRepositoryImpl.java |   4 +-
 .../fineract/portfolio/rate/data/RateData.java |   8 +-
 .../fineract/portfolio/rate/domain/Rate.java   |  36 +-
 .../domain/RateAppliesTo.java} |  48 +--
 .../service/RateEnumerations.java} |  30 +-
 .../rate/service/RateReadServiceImpl.java  |  12 +-

[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-09 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r209071812
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/domain/RateRepositoryWrapper.java
 ---
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.rate.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import org.apache.fineract.portfolio.rate.exception.RateNotFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RateRepositoryWrapper {
+
+  private final RateRepository repository;
+
+  @Autowired
+  public RateRepositoryWrapper(final RateRepository repository) {
+this.repository = repository;
+  }
+
+  public Rate findOneWithNotFoundDetection(final Long rateId) {
+
+final Rate rate = this.repository.findOne(rateId);
+if (rate == null) {
+  throw new RateNotFoundException(rateId);
+}
+
+return rate;
+  }
+
+  public List findMultipleWithNotFoundDetection(final List 
rateIds) {
+List rates = new ArrayList<>();
+if (rateIds != null && !rateIds.isEmpty()) {
+  final List foundRates = this.repository.findAll(rateIds);
+  System.out.println("ids "+rateIds.toString());
+  System.out.println("found "+foundRates.toString());
--- End diff --

Ok


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-09 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r209071876
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java
 ---
@@ -304,6 +318,29 @@ private boolean 
anyChangeInCriticalFloatingRateLinkedParams(JsonCommand command,
 return charges;
 }
 
+private List assembleListOfProductRates(final JsonCommand 
command) {
+
+final List rates = new ArrayList<>();
+
+if (command.parameterExists("rates")) {
+final JsonArray ratesArray = 
command.arrayOfParameterNamed("rates");
+if (ratesArray != null) {
+List idList = new ArrayList<>();
+for (int i = 0; i < ratesArray.size(); i++) {
+final JsonObject jsonObject = 
ratesArray.get(i).getAsJsonObject();
+if (jsonObject.has("id")) {
+idList.add(jsonObject.get("id").getAsLong());
+}
+}
+System.out.println(idList.toString());
--- End diff --

Ok


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-09 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r209071842
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java
 ---
@@ -304,6 +318,29 @@ private boolean 
anyChangeInCriticalFloatingRateLinkedParams(JsonCommand command,
 return charges;
 }
 
+private List assembleListOfProductRates(final JsonCommand 
command) {
+
+final List rates = new ArrayList<>();
+
+if (command.parameterExists("rates")) {
+final JsonArray ratesArray = 
command.arrayOfParameterNamed("rates");
+if (ratesArray != null) {
+List idList = new ArrayList<>();
+for (int i = 0; i < ratesArray.size(); i++) {
+final JsonObject jsonObject = 
ratesArray.get(i).getAsJsonObject();
+if (jsonObject.has("id")) {
+idList.add(jsonObject.get("id").getAsLong());
+}
+}
+System.out.println(idList.toString());
+
rates.addAll(this.rateRepository.findMultipleWithNotFoundDetection(idList));
+System.out.println(rates.toString());
--- End diff --

Ok


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-09 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r209071792
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/serialization/RateDefinitionCommandFromApiJsonDeserializer.java
 ---
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.rate.serialization;
+
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang.StringUtils;
+import org.apache.fineract.infrastructure.core.data.ApiParameterError;
+import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
+import 
org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
+import 
org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
+import 
org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RateDefinitionCommandFromApiJsonDeserializer {
+
+  /**
+   * The parameters supported for this command.
+   */
+  private final Set supportedParameters = new HashSet<>(
+  Arrays.asList("id", "name", "percentage", "productApply", "active", 
"approveUser", "locale"));
+
+  private final FromJsonHelper fromApiJsonHelper;
+
+  @Autowired
+  public RateDefinitionCommandFromApiJsonDeserializer(final FromJsonHelper 
fromApiJsonHelper) {
+this.fromApiJsonHelper = fromApiJsonHelper;
+  }
+
+  public void validateForCreate(final String json) {
+if (StringUtils.isBlank(json)) {
+  throw new InvalidJsonException();
+}
+
+final Type typeOfMap = new TypeToken>() {
+}.getType();
+
+this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, 
this.supportedParameters);
+
+final List dataValidationErrors = new ArrayList<>();
+
+final DataValidatorBuilder baseDataValidator = new 
DataValidatorBuilder(dataValidationErrors)
+.resource("rate");
+
+final JsonElement element = this.fromApiJsonHelper.parse(json);
+
+final String name = this.fromApiJsonHelper.extractStringNamed("name", 
element);
--- End diff --

Ok


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-08 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r208664567
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
 ---
@@ -465,7 +473,7 @@ public LoanProductData mapRow(final ResultSet rs, 
@SuppressWarnings("unused") fi
 installmentAmountInMultiplesOf, 
allowAttributeOverrides, isLinkedToFloatingInterestRates, floatingRateId,
 floatingRateName, interestRateDifferential, 
minDifferentialLendingRate, defaultDifferentialLendingRate,
 maxDifferentialLendingRate, 
isFloatingInterestRateCalculationAllowed, isVariableIntallmentsAllowed, 
minimumGap,
-maximumGap, syncExpectedWithDisbursementDate, 
canUseForTopup, isEqualAmortization);
+maximumGap, syncExpectedWithDisbursementDate, 
canUseForTopup, isEqualAmortization, null, this.rates);
--- End diff --

Ok


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-08 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r208664400
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
 ---
@@ -325,4 +332,35 @@ private LocalDate 
generateCalculatedRepaymentStartDate(final CalendarHistoryData
 return disbursementDatas;
 }
 
+public List fetchRateData(final JsonArray element) {
+List rates = new ArrayList<>();
+
+if (element != null) {
+for (JsonElement jsonElement : element) {
+final JsonObject rateElement = 
jsonElement.getAsJsonObject();
+if (rateElement.has("id")) {
+final Long rateId = 
this.fromApiJsonHelper.extractLongNamed("id", rateElement);
+Rate rate = findRateByIdIfProvided(rateId);
+rates.add(rate);
+}
+}
+}else{
--- End diff --

removed


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-07 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r208390127
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java
 ---
@@ -304,6 +319,32 @@ private boolean 
anyChangeInCriticalFloatingRateLinkedParams(JsonCommand command,
 return charges;
 }
 
+private List assembleListOfProductRates(final JsonCommand 
command) {
+
+final List rates = new ArrayList<>();
+
+if (command.parameterExists("rates")) {
+final JsonArray ratesArray = 
command.arrayOfParameterNamed("rates");
+if (ratesArray != null) {
+for (int i = 0; i < ratesArray.size(); i++) {
+
+final JsonObject jsonObject = 
ratesArray.get(i).getAsJsonObject();
+if (jsonObject.has("id")) {
+final Long id = jsonObject.get("id").getAsLong();
+
+final Rate rate = this.rateRepository.findOne(id);
--- End diff --

Ok


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207370679
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
 ---
@@ -392,20 +395,24 @@
 @OneToOne(cascade = CascadeType.ALL, mappedBy = "loan", optional = 
true, orphanRemoval = true, fetch=FetchType.EAGER)
 private LoanTopupDetails loanTopupDetails;
 
+@ManyToMany(fetch = FetchType.EAGER)
--- End diff --

About this change I think that ManyToMany is okay as we use a third table 
to join the loan and rate tables just like in the LoanProduct class. I'll make 
the change and test if the same result can be achieved.


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207369492
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
 ---
@@ -178,30 +180,30 @@
 private final EntityDatatableChecksReadService 
entityDatatableChecksReadService;
 private final BulkImportWorkbookService bulkImportWorkbookService;
 private final BulkImportWorkbookPopulatorService 
bulkImportWorkbookPopulatorService;
-
+private final RateReadService rateReadService;
 
 @Autowired
 public LoansApiResource(final PlatformSecurityContext context, final 
LoanReadPlatformService loanReadPlatformService,
-final LoanProductReadPlatformService 
loanProductReadPlatformService,
-final LoanDropdownReadPlatformService 
dropdownReadPlatformService, final FundReadPlatformService 
fundReadPlatformService,
-final ChargeReadPlatformService chargeReadPlatformService, 
final LoanChargeReadPlatformService loanChargeReadPlatformService,
-final CollateralReadPlatformService 
loanCollateralReadPlatformService,
-final LoanScheduleCalculationPlatformService 
calculationPlatformService,
-final GuarantorReadPlatformService 
guarantorReadPlatformService,
-final CodeValueReadPlatformService 
codeValueReadPlatformService, final GroupReadPlatformService 
groupReadPlatformService,
-final DefaultToApiJsonSerializer 
toApiJsonSerializer,
-final DefaultToApiJsonSerializer 
loanApprovalDataToApiJsonSerializer,
-final DefaultToApiJsonSerializer 
loanScheduleToApiJsonSerializer,
-final ApiRequestParameterHelper apiRequestParameterHelper, 
final FromJsonHelper fromJsonHelper,
-final PortfolioCommandSourceWritePlatformService 
commandsSourceWritePlatformService,
-final CalendarReadPlatformService calendarReadPlatformService, 
final NoteReadPlatformServiceImpl noteReadPlatformService,
-final PortfolioAccountReadPlatformService 
portfolioAccountReadPlatformServiceImpl,
-final AccountAssociationsReadPlatformService 
accountAssociationsReadPlatformService,
-final LoanScheduleHistoryReadPlatformService 
loanScheduleHistoryReadPlatformService,
-final AccountDetailsReadPlatformService 
accountDetailsReadPlatformService,
-final EntityDatatableChecksReadService 
entityDatatableChecksReadService,
-final BulkImportWorkbookService bulkImportWorkbookService,
-final BulkImportWorkbookPopulatorService 
bulkImportWorkbookPopulatorService) {
+final LoanProductReadPlatformService 
loanProductReadPlatformService,
+final LoanDropdownReadPlatformService dropdownReadPlatformService, 
final FundReadPlatformService fundReadPlatformService,
+final ChargeReadPlatformService chargeReadPlatformService, final 
LoanChargeReadPlatformService loanChargeReadPlatformService,
+final CollateralReadPlatformService 
loanCollateralReadPlatformService,
+final LoanScheduleCalculationPlatformService 
calculationPlatformService,
+final GuarantorReadPlatformService guarantorReadPlatformService,
+final CodeValueReadPlatformService codeValueReadPlatformService, 
final GroupReadPlatformService groupReadPlatformService,
+final DefaultToApiJsonSerializer 
toApiJsonSerializer,
+final DefaultToApiJsonSerializer 
loanApprovalDataToApiJsonSerializer,
+final DefaultToApiJsonSerializer 
loanScheduleToApiJsonSerializer,
+final ApiRequestParameterHelper apiRequestParameterHelper, final 
FromJsonHelper fromJsonHelper,
+final PortfolioCommandSourceWritePlatformService 
commandsSourceWritePlatformService,
+final CalendarReadPlatformService calendarReadPlatformService, 
final NoteReadPlatformServiceImpl noteReadPlatformService,
+final PortfolioAccountReadPlatformService 
portfolioAccountReadPlatformServiceImpl,
+final AccountAssociationsReadPlatformService 
accountAssociationsReadPlatformService,
+final LoanScheduleHistoryReadPlatformService 
loanScheduleHistoryReadPlatformService,
+final AccountDetailsReadPlatformService 
accountDetailsReadPlatformService,
+final EntityDatatableChecksReadService 
entityDatatableChecksReadService, RateReadService rateReadService,
+final BulkImportWorkbookService bulkImportWorkbookService,
--- End diff --

Ok.


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207369345
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/handler/DeleteRateCommandHandler.java
 ---
@@ -0,0 +1,26 @@
+/**
--- End diff --

It is not, consider it as gone.


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207369442
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java
 ---
@@ -454,7 +454,7 @@ public static LocalDateTime convertDateTimeFrom(final 
String dateTimeAsString, f
 LocalDateTime eventLocalDateTime = null;
 if (StringUtils.isNotBlank(dateTimeAsString)) {
 try {
-eventLocalDateTime = 
DateTimeFormat.forPattern(dateTimeFormat).withLocale(clientApplicationLocale)
+eventLocalDateTime = 
DateTimeFormat.forPattern(dateTimeFormat).withLocale(clientApplicationLocale)
--- End diff --

Ok


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207369167
  
--- Diff: 
fineract-provider/src/main/resources/sql/migrations/core_db/V343__rates.sql ---
@@ -0,0 +1,62 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied. See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+--
+
+CREATE TABLE IF NOT EXISTS `m_rate` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `name` varchar(250) NOT NULL,
+  `percentage` decimal(10,2) NOT NULL,
+  `active` tinyint(1) DEFAULT '0',
+  `product_apply` varchar(100) NOT NULL,
+  `created_date` datetime NULL DEFAULT NULL,
+  `createdby_id` bigint(20) NOT NULL,
+  `lastmodifiedby_id` bigint(20) NOT NULL,
+  `lastmodified_date` datetime NULL DEFAULT NULL,
+  `approve_user` bigint(20) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `FK_M_RATE_CREATE_USER` (`createdby_id`),
+  KEY `FK_M_RATE_APPROVE_USER` (`approve_user`),
+  CONSTRAINT `FK_M_RATE_APPROVE_USER` FOREIGN KEY (`approve_user`) 
REFERENCES `m_appuser` (`id`),
+  CONSTRAINT `FK_M_RATE_CREATE_USER` FOREIGN KEY (`createdby_id`) 
REFERENCES `m_appuser` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
--- End diff --

Some of the scripts included this part and we guessed it was needed. We'll 
remove all of them in this new script.


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207365498
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
 ---
@@ -325,4 +332,35 @@ private LocalDate 
generateCalculatedRepaymentStartDate(final CalendarHistoryData
 return disbursementDatas;
 }
 
+public List fetchRateData(final JsonArray element) {
+List rates = new ArrayList<>();
+
+if (element != null) {
+for (JsonElement jsonElement : element) {
+final JsonObject rateElement = 
jsonElement.getAsJsonObject();
+if (rateElement.has("id")) {
+final Long rateId = 
this.fromApiJsonHelper.extractLongNamed("id", rateElement);
+Rate rate = findRateByIdIfProvided(rateId);
+rates.add(rate);
+}
+}
+}else{
+System.out.println("");
+}
+
+return rates;
+}
+
+public Rate findRateByIdIfProvided(final Long rateId) {
+Rate rate = null;
+if (rateId != null) {
+rate = this.rateRepository.findOne(rateId);
--- End diff --

I'll use a wrapper class, I just noticed that it is used for the Loan 
repository but there are some others that don't make use of it so it was a bit 
misleading.


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207364751
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
 ---
@@ -102,6 +103,10 @@
 @JoinTable(name = "m_product_loan_charge", joinColumns = 
@JoinColumn(name = "product_loan_id"), inverseJoinColumns = @JoinColumn(name = 
"charge_id"))
 private List charges;
 
+@ManyToMany(fetch = FetchType.EAGER)
+@JoinTable(name = "m_product_loan_rate", joinColumns = 
@JoinColumn(name = "product_loan_id"), inverseJoinColumns = @JoinColumn(name = 
"rate_id"))
--- End diff --

It should be ManyToMany as we use a third table to join the rate and 
loan_product tables in the same way that the charges and loan_products are 
joined.  About the fetch type Lazy I guess it should work the same but I will 
do some tests to be sure.


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-08-02 Thread angelboxes
Github user angelboxes commented on a diff in the pull request:

https://github.com/apache/fineract/pull/465#discussion_r207358094
  
--- Diff: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
 ---
@@ -325,4 +332,35 @@ private LocalDate 
generateCalculatedRepaymentStartDate(final CalendarHistoryData
 return disbursementDatas;
 }
 
+public List fetchRateData(final JsonArray element) {
+List rates = new ArrayList<>();
+
+if (element != null) {
+for (JsonElement jsonElement : element) {
+final JsonObject rateElement = 
jsonElement.getAsJsonObject();
+if (rateElement.has("id")) {
+final Long rateId = 
this.fromApiJsonHelper.extractLongNamed("id", rateElement);
+Rate rate = findRateByIdIfProvided(rateId);
+rates.add(rate);
+}
+}
+}else{
+System.out.println("");
+}
+
+return rates;
+}
+
+public Rate findRateByIdIfProvided(final Long rateId) {
--- End diff --

Ok. The name is based on the names used by the methods in the class 
LoanAssembler. We were just following what we assumed it was a name pattern.


---


[GitHub] fineract pull request #465: Fineract 614: Rates module

2018-07-30 Thread angelboxes
GitHub user angelboxes opened a pull request:

https://github.com/apache/fineract/pull/465

Fineract 614: Rates module

Previously defined sub-rates can be added to set the nominal interest rate 
of a loan product. When a loan account is created you can choose which rates 
from the associated rates to the loan product should be applied to the new loan 
account. This is an optional way of defining the nominal rate for loans.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/angelboxes/fineract FINERACT-614

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/fineract/pull/465.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #465


commit 471a4c88fbcaec4f9200adc32a38a7d428404e20
Author: Angel Cajas 
Date:   2018-07-30T22:52:17Z

A new rates module was added to define new rates that can be used to set 
min and max nominal interest rate, when a new loan account is created they can 
be used to determine which rates may be applicable for the loan account.




---