You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "ruchiD (via GitHub)" <gi...@apache.org> on 2023/12/22 16:21:08 UTC

[PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

ruchiD opened a new pull request, #3651:
URL: https://github.com/apache/fineract/pull/3651

   ## Description
   Modifications for N+1 installment for loan reschedule for cumulative loan schedule generator.
   Tests
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   
   - [ ] Create/update unit or integration tests for verifying the changes made.
   
   - [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are 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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #3651:
URL: https://github.com/apache/fineract/pull/3651


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1440172018


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -410,6 +410,10 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
             scheduleParams.addTotalCumulativeInterest(totalInterest);
         }
 
+        // add charges only repayment schedule for charges with due date after maturity date (N+1)
+        addChargesOnlyRepaymentSchedule(currency, scheduleParams, periods, loanCharges, mc, loanApplicationTerms, transactions,

Review Comment:
   It is required for progressive ones also, but since interest handling, reschedule, prepayment  and related stories for progressive schedule handling are pending i did not changed for progressive.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1438868024


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -423,6 +427,87 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
                 scheduleParams.getTotalRepaymentExpected().getAmount(), totalOutstanding);
     }
 
+    private void addChargesOnlyRepaymentSchedule(MonetaryCurrency currency, LoanScheduleParams scheduleParams,
+            List<LoanScheduleModelPeriod> periods, Set<LoanCharge> loanCharges, MathContext mc, LoanApplicationTerms loanApplicationTerms,
+            Collection<RecalculationDetail> transactions,
+            LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor, final HolidayDetailDTO holidayDetailDTO,
+            final LocalDate lastRestDate, final LocalDate firstRepaymentDate, final LocalDate idealDisbursementDate) {
+        if (periods.size() > 0) {
+            LoanScheduleModelPeriod lastInstallment = periods.get(periods.size() - 1);
+            // get end date for the schedule from loan charges
+            LocalDate scheduleDueDate = null;
+            if (!(BigDecimal.ZERO.compareTo(loanApplicationTerms.getAnnualNominalInterestRate()) < 0)) {

Review Comment:
   Can you please simplify this condition?
   Negating whether annual nominal interest rate is higher than 0 is not easy to read. 
   
   Also interest rate cannot be negative.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "bharathcgowda (via GitHub)" <gi...@apache.org>.
bharathcgowda commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1441650724


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -423,6 +427,87 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
                 scheduleParams.getTotalRepaymentExpected().getAmount(), totalOutstanding);
     }
 
+    private void addChargesOnlyRepaymentSchedule(MonetaryCurrency currency, LoanScheduleParams scheduleParams,
+            List<LoanScheduleModelPeriod> periods, Set<LoanCharge> loanCharges, MathContext mc, LoanApplicationTerms loanApplicationTerms,
+            Collection<RecalculationDetail> transactions,
+            LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor, final HolidayDetailDTO holidayDetailDTO,
+            final LocalDate lastRestDate, final LocalDate firstRepaymentDate, final LocalDate idealDisbursementDate) {
+        if (periods.size() > 0) {
+            LoanScheduleModelPeriod lastInstallment = periods.get(periods.size() - 1);
+            // get end date for the schedule from loan charges
+            LocalDate scheduleDueDate = null;
+            if (!(BigDecimal.ZERO.compareTo(loanApplicationTerms.getAnnualNominalInterestRate()) < 0)) {
+                for (final LoanCharge loanCharge : loanCharges) {
+                    if (loanCharge.isSpecifiedDueDate() && DateUtils.isAfter(loanCharge.getDueDate(), lastInstallment.periodDueDate())) {
+                        scheduleDueDate = loanCharge.getDueDate();
+                    }
+                }
+            }
+            if (scheduleDueDate != null) {
+                final Collection<LoanTermVariationsData> interestRates = loanApplicationTerms.getLoanTermVariations()
+                        .getInterestRateChanges();
+
+                LocalDate periodStartDateApplicableForInterest = calculateInterestStartDateForPeriod(loanApplicationTerms,

Review Comment:
   @ruchiD As discussed there is not interest calculcation involved for N+1 Installment that is after the maturity date.
   
   N+1 Installment scenario happens only for 2 cases
   1. for charges - here user entered amount will be the installment amount
   2. for Charge-backs- here amounts are inherited from the repayment that charge-back was triggered from.
   
   @adamsaghy cc



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1455477875


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -78,6 +79,7 @@ public ChangedTransactionDetail reprocessLoanTransactions(final LocalDate disbur
                 }
             }
         }
+        addChargeOnlyRepaymentInstallmentIfRequired(charges, installments);

Review Comment:
   @adamsaghy, when reschedule happens N+1 installment is not created/retained for loan installments and hence the issue.  When reprocess is called after schedule regeneration we are adding the missing installment if required.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1438868315


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -410,6 +410,10 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
             scheduleParams.addTotalCumulativeInterest(totalInterest);
         }
 
+        // add charges only repayment schedule for charges with due date after maturity date (N+1)
+        addChargesOnlyRepaymentSchedule(currency, scheduleParams, periods, loanCharges, mc, loanApplicationTerms, transactions,

Review Comment:
   Is this only needed for cumulative loans? What about progressive ones?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1440172291


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -423,6 +427,87 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
                 scheduleParams.getTotalRepaymentExpected().getAmount(), totalOutstanding);
     }
 
+    private void addChargesOnlyRepaymentSchedule(MonetaryCurrency currency, LoanScheduleParams scheduleParams,
+            List<LoanScheduleModelPeriod> periods, Set<LoanCharge> loanCharges, MathContext mc, LoanApplicationTerms loanApplicationTerms,
+            Collection<RecalculationDetail> transactions,
+            LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor, final HolidayDetailDTO holidayDetailDTO,
+            final LocalDate lastRestDate, final LocalDate firstRepaymentDate, final LocalDate idealDisbursementDate) {
+        if (periods.size() > 0) {
+            LoanScheduleModelPeriod lastInstallment = periods.get(periods.size() - 1);
+            // get end date for the schedule from loan charges
+            LocalDate scheduleDueDate = null;
+            if (!(BigDecimal.ZERO.compareTo(loanApplicationTerms.getAnnualNominalInterestRate()) < 0)) {
+                for (final LoanCharge loanCharge : loanCharges) {
+                    if (loanCharge.isSpecifiedDueDate() && DateUtils.isAfter(loanCharge.getDueDate(), lastInstallment.periodDueDate())) {
+                        scheduleDueDate = loanCharge.getDueDate();
+                    }
+                }
+            }
+            if (scheduleDueDate != null) {
+                final Collection<LoanTermVariationsData> interestRates = loanApplicationTerms.getLoanTermVariations()
+                        .getInterestRateChanges();
+
+                LocalDate periodStartDateApplicableForInterest = calculateInterestStartDateForPeriod(loanApplicationTerms,

Review Comment:
   @bharathc27 Please comment.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1440223018


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -410,6 +410,10 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
             scheduleParams.addTotalCumulativeInterest(totalInterest);
         }
 
+        // add charges only repayment schedule for charges with due date after maturity date (N+1)
+        addChargesOnlyRepaymentSchedule(currency, scheduleParams, periods, loanCharges, mc, loanApplicationTerms, transactions,

Review Comment:
   @adamsaghy, verified with latest, for progressive loans also N+1 installment vanishes after reschedule. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1438868248


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -423,6 +427,87 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
                 scheduleParams.getTotalRepaymentExpected().getAmount(), totalOutstanding);
     }
 
+    private void addChargesOnlyRepaymentSchedule(MonetaryCurrency currency, LoanScheduleParams scheduleParams,
+            List<LoanScheduleModelPeriod> periods, Set<LoanCharge> loanCharges, MathContext mc, LoanApplicationTerms loanApplicationTerms,
+            Collection<RecalculationDetail> transactions,
+            LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor, final HolidayDetailDTO holidayDetailDTO,
+            final LocalDate lastRestDate, final LocalDate firstRepaymentDate, final LocalDate idealDisbursementDate) {
+        if (periods.size() > 0) {
+            LoanScheduleModelPeriod lastInstallment = periods.get(periods.size() - 1);
+            // get end date for the schedule from loan charges
+            LocalDate scheduleDueDate = null;
+            if (!(BigDecimal.ZERO.compareTo(loanApplicationTerms.getAnnualNominalInterestRate()) < 0)) {
+                for (final LoanCharge loanCharge : loanCharges) {
+                    if (loanCharge.isSpecifiedDueDate() && DateUtils.isAfter(loanCharge.getDueDate(), lastInstallment.periodDueDate())) {
+                        scheduleDueDate = loanCharge.getDueDate();
+                    }
+                }
+            }
+            if (scheduleDueDate != null) {
+                final Collection<LoanTermVariationsData> interestRates = loanApplicationTerms.getLoanTermVariations()
+                        .getInterestRateChanges();
+
+                LocalDate periodStartDateApplicableForInterest = calculateInterestStartDateForPeriod(loanApplicationTerms,

Review Comment:
   I dont think we need to calculate interest after maturity date. @bharathc27 Thoughts?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1455451076


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -205,6 +207,33 @@ public ChangedTransactionDetail reprocessLoanTransactions(final LocalDate disbur
         return changedTransactionDetail;
     }
 
+    protected void addChargeOnlyRepaymentInstallmentIfRequired(Set<LoanCharge> charges,
+            List<LoanRepaymentScheduleInstallment> installments) {
+        if (!CollectionUtils.isEmpty(charges) && !CollectionUtils.isEmpty(installments)) {
+            LoanRepaymentScheduleInstallment latestRepaymentScheduleInstalment = installments.get(installments.size() - 1);
+            LocalDate installmentDueDate = null;
+            for (final LoanCharge loanCharge : charges) {

Review Comment:
   charges are a set, there is no order how you are iterating through on it, and it can happen multiple charges are after the last installment due date, no?
   
   I would be happier if we were taking the latest charge which was after the maturity date and set that one instead of iterating though on them.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1455479366


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -205,6 +207,33 @@ public ChangedTransactionDetail reprocessLoanTransactions(final LocalDate disbur
         return changedTransactionDetail;
     }
 
+    protected void addChargeOnlyRepaymentInstallmentIfRequired(Set<LoanCharge> charges,
+            List<LoanRepaymentScheduleInstallment> installments) {
+        if (!CollectionUtils.isEmpty(charges) && !CollectionUtils.isEmpty(installments)) {
+            LoanRepaymentScheduleInstallment latestRepaymentScheduleInstalment = installments.get(installments.size() - 1);
+            LocalDate installmentDueDate = null;
+            for (final LoanCharge loanCharge : charges) {

Review Comment:
   Thanks, Will make this change.
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1438868118


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -423,6 +427,87 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
                 scheduleParams.getTotalRepaymentExpected().getAmount(), totalOutstanding);
     }
 
+    private void addChargesOnlyRepaymentSchedule(MonetaryCurrency currency, LoanScheduleParams scheduleParams,
+            List<LoanScheduleModelPeriod> periods, Set<LoanCharge> loanCharges, MathContext mc, LoanApplicationTerms loanApplicationTerms,
+            Collection<RecalculationDetail> transactions,
+            LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor, final HolidayDetailDTO holidayDetailDTO,
+            final LocalDate lastRestDate, final LocalDate firstRepaymentDate, final LocalDate idealDisbursementDate) {
+        if (periods.size() > 0) {
+            LoanScheduleModelPeriod lastInstallment = periods.get(periods.size() - 1);
+            // get end date for the schedule from loan charges
+            LocalDate scheduleDueDate = null;
+            if (!(BigDecimal.ZERO.compareTo(loanApplicationTerms.getAnnualNominalInterestRate()) < 0)) {

Review Comment:
   However i am not fully sure why does it matter whether there is interest or not...



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1455446773


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -78,6 +79,7 @@ public ChangedTransactionDetail reprocessLoanTransactions(final LocalDate disbur
                 }
             }
         }
+        addChargeOnlyRepaymentInstallmentIfRequired(charges, installments);

Review Comment:
   I dont really understand why we need this here.
   I am assuming when we are reprocessing the transactions, the installments list containing all the installments including the N+1... no?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1440175501


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -410,6 +410,10 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
             scheduleParams.addTotalCumulativeInterest(totalInterest);
         }
 
+        // add charges only repayment schedule for charges with due date after maturity date (N+1)
+        addChargesOnlyRepaymentSchedule(currency, scheduleParams, periods, loanCharges, mc, loanApplicationTerms, transactions,

Review Comment:
   I will test and confirm. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1440167841


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -423,6 +427,87 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
                 scheduleParams.getTotalRepaymentExpected().getAmount(), totalOutstanding);
     }
 
+    private void addChargesOnlyRepaymentSchedule(MonetaryCurrency currency, LoanScheduleParams scheduleParams,
+            List<LoanScheduleModelPeriod> periods, Set<LoanCharge> loanCharges, MathContext mc, LoanApplicationTerms loanApplicationTerms,
+            Collection<RecalculationDetail> transactions,
+            LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor, final HolidayDetailDTO holidayDetailDTO,
+            final LocalDate lastRestDate, final LocalDate firstRepaymentDate, final LocalDate idealDisbursementDate) {
+        if (periods.size() > 0) {
+            LoanScheduleModelPeriod lastInstallment = periods.get(periods.size() - 1);
+            // get end date for the schedule from loan charges
+            LocalDate scheduleDueDate = null;
+            if (!(BigDecimal.ZERO.compareTo(loanApplicationTerms.getAnnualNominalInterestRate()) < 0)) {

Review Comment:
   Hi Adam, here i tried to mimic the condition we have for add charge scenario in LoanChargeWritePlatformService->addCharge, where for n+1 case we are checking whether the loan is interest bearing or not.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1440173485


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -410,6 +410,10 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
             scheduleParams.addTotalCumulativeInterest(totalInterest);
         }
 
+        // add charges only repayment schedule for charges with due date after maturity date (N+1)
+        addChargesOnlyRepaymentSchedule(currency, scheduleParams, periods, loanCharges, mc, loanApplicationTerms, transactions,

Review Comment:
   does that mean if a progressive N+1 loan got rescheduled the N+1 charge will disappear?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on code in PR #3651:
URL: https://github.com/apache/fineract/pull/3651#discussion_r1440167841


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractCumulativeLoanScheduleGenerator.java:
##########
@@ -423,6 +427,87 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
                 scheduleParams.getTotalRepaymentExpected().getAmount(), totalOutstanding);
     }
 
+    private void addChargesOnlyRepaymentSchedule(MonetaryCurrency currency, LoanScheduleParams scheduleParams,
+            List<LoanScheduleModelPeriod> periods, Set<LoanCharge> loanCharges, MathContext mc, LoanApplicationTerms loanApplicationTerms,
+            Collection<RecalculationDetail> transactions,
+            LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor, final HolidayDetailDTO holidayDetailDTO,
+            final LocalDate lastRestDate, final LocalDate firstRepaymentDate, final LocalDate idealDisbursementDate) {
+        if (periods.size() > 0) {
+            LoanScheduleModelPeriod lastInstallment = periods.get(periods.size() - 1);
+            // get end date for the schedule from loan charges
+            LocalDate scheduleDueDate = null;
+            if (!(BigDecimal.ZERO.compareTo(loanApplicationTerms.getAnnualNominalInterestRate()) < 0)) {

Review Comment:
   Hi Adam, here i tried to mimic the condition we have for add charge scenario in LoanChargeWritePlatformServiceImpl->addCharge, where for n+1 case we are checking whether the loan is interest bearing or not.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1971: N plus one installment loan reschedule [fineract]

Posted by "ruchiD (via GitHub)" <gi...@apache.org>.
ruchiD commented on PR #3651:
URL: https://github.com/apache/fineract/pull/3651#issuecomment-1895592065

   Made changes to Loan Repayment schedule transaction processors for adding N+1 installments, for loan reschedule cases.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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