You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/07/31 16:58:29 UTC

[GitHub] [fineract] fynmanoj opened a new pull request #1220: AL-14-approppritae-interest-larger-than-emi

fynmanoj opened a new pull request #1220:
URL: https://github.com/apache/fineract/pull/1220


   ## Description
   Describe the changes made and why they were made. Ignore if these details are present on the associated Jira ticket
   https://mifosforge.jira.com/browse/AL-14
   ## Checklist
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [x] Commit message starts with the issue number from https://issues.apache.org/jira/projects/FINERACT/. Ex: FINERACT-646 Pockets API.
   
   - [x] Coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions have been followed.
   
   - [ ] API documentation at fineract-provider/src/main/resources/static/api-docs/apiLive.htm has been updated with details of any API changes.
   
   - [ ] Integration tests have been created/updated for verifying the changes made.
   
   - [ ] All Integrations tests are passing with the new commits.
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the list.)
   
   Our guidelines for code reviews is at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] xurror commented on pull request #1220: AL-14-approppritae-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
xurror commented on pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#issuecomment-667246086


   You got checkstyle violations. Run `./gradlew build` and  `./gradlew check` and make sure everything works fine.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] edcable commented on pull request #1220: FINERACT-1109 appropriate-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
edcable commented on pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#issuecomment-675691232


   @avikganguly01 Did the recent changes made by @fynmanoj address the feedback you provided?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] fynmanoj commented on a change in pull request #1220: FINERACT-1109 appropriate-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
fynmanoj commented on a change in pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#discussion_r472736753



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanScheduleModelRepaymentPeriod.java
##########
@@ -154,7 +154,7 @@ public boolean isRecalculatedInterestComponent() {
     @Override
     public void addInterestAmount(Money interestDue) {
         this.interestDue = this.interestDue.plus(interestDue);
-        this.totalDue = this.totalDue.plus(principalDue);
+        this.totalDue = this.totalDue.plus(interestDue);

Review comment:
       In the add Interest method principle was added to the total due instead of the interest. which is wrong, as the added interest must reflect in the total due.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] edcable commented on pull request #1220: FINERACT-1109 appropriate-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
edcable commented on pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#issuecomment-671524948


   @vorburger I opened up tickets on JIRA for these pull requests and referenced them in the title of the PR. I tagged @avikganguly01 as a reviewer and assume he can do the needful in reviewing and merging the PRs as we are going to start testing this development branch with these pull requests merged on the user's test server. 
   
   @fynmanoj we also have to address the failing build for this PR. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] fynmanoj commented on a change in pull request #1220: FINERACT-1109 appropriate-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
fynmanoj commented on a change in pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#discussion_r470589804



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanScheduleModelRepaymentPeriod.java
##########
@@ -154,7 +154,7 @@ public boolean isRecalculatedInterestComponent() {
     @Override
     public void addInterestAmount(Money interestDue) {
         this.interestDue = this.interestDue.plus(interestDue);
-        this.totalDue = this.totalDue.plus(principalDue);
+        this.totalDue = this.totalDue.plus(interestDue);

Review comment:
       yes, found this while testing the new feature.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] avikganguly01 merged pull request #1220: FINERACT-1109 appropriate-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
avikganguly01 merged pull request #1220:
URL: https://github.com/apache/fineract/pull/1220


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vorburger commented on pull request #1220: AL-14-approppritae-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
vorburger commented on pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#issuecomment-667538021


   @avikganguly01 knowing that @fynmanoj works with you, and assuming that you are still an active committer to this project (are you?), I was wondering if you would like to engage on code review feedback and possible evental merge of PRs such as this one? (I don't want to be a bottleneck on this project, and won't have the spare time to help review changes like this. If there are other active commiters such as @awasum @ptuomola @xurror or others reading this who want to engage on this PR, please don't let me hold you up / wait for me - I'll ignore this one, and try to help on others.)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] avikganguly01 commented on a change in pull request #1220: FINERACT-1109 appropriate-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
avikganguly01 commented on a change in pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#discussion_r470247807



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
##########
@@ -252,6 +252,16 @@ public boolean isSkippingMeetingOnFirstDayOfMonthEnabled() {
         return getGlobalConfigurationPropertyData("skip-repayment-on-first-day-of-month").isEnabled();
     }
 
+    @Override
+    public boolean isFirstRepaymentDateAfterRescheduleAllowedOnHoliday() {
+        return getGlobalConfigurationPropertyData("loan-reschedule-is-first-payday-allowed-on-holiday").isEnabled();
+    }

Review comment:
       This should have been part of PR FIN-1106.

##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
##########
@@ -279,7 +282,8 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
 
             // will check for EMI amount greater than interest calculated
             if (loanApplicationTerms.getFixedEmiAmount() != null
-                    && loanApplicationTerms.getFixedEmiAmount().compareTo(principalInterestForThisPeriod.interest().getAmount()) < 0) {
+                    && loanApplicationTerms.getFixedEmiAmount().compareTo(principalInterestForThisPeriod.interest().getAmount()) < 0
+                    && !loanApplicationTerms.isInterestToBeAppropriatedEquallyWhenGreaterThanEMIEnabled()) {

Review comment:
       Is tranche loan approval failing due to flag?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/DecliningBalanceInterestLoanScheduleGenerator.java
##########
@@ -125,7 +125,30 @@ public PrincipalInterest calculatePrincipalInterestComponentsForPeriod(final Pay
                 interestCalculationGraceOnRepaymentPeriodFraction, periodNumber, mc, cumulatingInterestDueToGrace,
                 balanceForInterestCalculation, interestStartDate, periodEndDate);
 
-        interestForThisInstallment = interestForThisInstallment.plus(result.interest());
+        if (loanApplicationTerms.isInterestToBeAppropriatedEquallyWhenGreaterThanEMIEnabled() && !result.interest().isZero()
+                && !interestForThisInstallment.isZero()) {
+            loanApplicationTerms.setInterestTobeApproppriated(result.interest());
+        } else {
+            interestForThisInstallment = interestForThisInstallment.plus(result.interest());
+        }
+
+        if (loanApplicationTerms.getFixedEmiAmount() != null
+                && loanApplicationTerms.isInterestToBeAppropriatedEquallyWhenGreaterThanEMIEnabled() && interestForThisInstallment
+                        .isGreaterThan(Money.of(interestForThisInstallment.getCurrency(), loanApplicationTerms.getFixedEmiAmount()))) {
+            LocalDate actualPeriodEndDate = this.scheduledDateGenerator.generateNextRepaymentDate(interestStartDate, loanApplicationTerms,
+                    false);
+            // AdjustedDateDetailsDTO adjustedDateDetailsDTO = this.scheduledDateGenerator
+            // .adjustRepaymentDate(actualPeriodEndDate, loanApplicationTerms,
+            // loanApplicationTerms.getHolidayDetailDTO());
+
+            PrincipalInterest tempInterest = loanApplicationTerms.calculateTotalInterestForPeriod(calculator,
+                    interestCalculationGraceOnRepaymentPeriodFraction, periodNumber, mc, cumulatingInterestDueToGrace,
+                    balanceForInterestCalculation, interestStartDate, actualPeriodEndDate);
+
+            loanApplicationTerms.setInterestTobeApproppriated(interestForThisInstallment.minus(tempInterest.interest()));
+            interestForThisInstallment = tempInterest.interest();
+        }

Review comment:
       LGTM

##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanScheduleModelRepaymentPeriod.java
##########
@@ -154,7 +154,7 @@ public boolean isRecalculatedInterestComponent() {
     @Override
     public void addInterestAmount(Money interestDue) {
         this.interestDue = this.interestDue.plus(interestDue);
-        this.totalDue = this.totalDue.plus(principalDue);
+        this.totalDue = this.totalDue.plus(interestDue);

Review comment:
       Looks like a different bug got squashed here. What effects could this bug have been producing? Shall we create a different ticket to track this?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vorburger commented on pull request #1220: AL-14-approppritae-interest-larger-than-emi

Posted by GitBox <gi...@apache.org>.
vorburger commented on pull request #1220:
URL: https://github.com/apache/fineract/pull/1220#issuecomment-667538352


   @fynmanoj this PR needs to have a JIRA issue on the ASF JIRA, instead of referencing an issue on https://mifosforge.jira.com.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org