adamsaghy commented on code in PR #5102:
URL: https://github.com/apache/fineract/pull/5102#discussion_r2490162487


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java:
##########
@@ -2847,18 +2857,30 @@ private static final class Balances {
     }
 
     private void mergeReAgedInstallment(final LoanRepaymentScheduleInstallment 
target,
-            final LoanRepaymentScheduleInstallment reAgedInstallment, 
MonetaryCurrency currency, LocalDate transactionDate) {
+            final LoanRepaymentScheduleInstallment reAgedInstallment, 
MonetaryCurrency currency, LocalDate transactionDate,
+            boolean isEqualInstallmentForInterest, boolean 
isEqualInstallmentForFeesAndPenalties) {
         target.setAdditional(false);
         target.setReAged(true);
         target.setFromDate(reAgedInstallment.getFromDate());
         target.setDueDate(reAgedInstallment.getDueDate());
         
target.setPrincipal(reAgedInstallment.getPrincipal().add(MathUtil.nullToZero(target.getPrincipalCompleted())));
-        
target.setInterestCharged(MathUtil.add(reAgedInstallment.getInterestCharged(), 
target.getInterestPaid()));
+
+        if (isEqualInstallmentForInterest) {
+            
target.setInterestCharged(MathUtil.add(reAgedInstallment.getInterestCharged(), 
target.getInterestPaid()));
+            
target.setInterestAccrued(MathUtil.add(target.getInterestAccrued(), 
reAgedInstallment.getInterestAccrued()));
+        }
+        if (isEqualInstallmentForFeesAndPenalties) {
+            
target.setFeeChargesCharged(MathUtil.add(reAgedInstallment.getFeeChargesCharged(),
 target.getFeeChargesPaid()));
+            target.setFeeAccrued(MathUtil.add(target.getInterestAccrued(), 
reAgedInstallment.getFeeAccrued()));
+            
target.setPenaltyCharges(MathUtil.add(reAgedInstallment.getPenaltyCharges(), 
target.getPenaltyChargesPaid()));
+            target.setPenaltyAccrued(MathUtil.add(target.getInterestAccrued(), 
reAgedInstallment.getPenaltyAccrued()));
+        }

Review Comment:
   Lets keep the logic where we calculate the model and simply update the 
balance from there. I dont want to have N+1 logic



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to