budaidev commented on code in PR #6585:
URL: https://github.com/apache/fineract/pull/6585#discussion_r4323268721


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java:
##########
@@ -686,6 +686,11 @@ private String retrieveTransactionTemplate(Long loanId, 
String loanExternalIdStr
             }
             transactionData = 
this.loanReadPlatformService.retrieveLoanPrePaymentTemplate(LoanTransactionType.REPAYMENT,
 resolvedLoanId,
                     transactionDate);
+        } else if (CommandParameterUtil.is(commandParam, 
LoanApiConstants.CONTRACT_TERMINATION_COMMAND)
+                || CommandParameterUtil.is(commandParam, 
LoanApiConstants.LOAN_WITHDRAWAL_COMMAND)) {

Review Comment:
   Yes, deliberate. QA found the preview overstated the amount on loans without 
interest recalculation (C115223), and contract termination had the same 
problem, so both now go through fetchEarlyTerminationDetail.
   
   On installment fees: they did differ. With a 1.00 installment fee, a 
withdrawal on 31 March previewed 107.45 but posted 104.45, because posting 
drops the fees of the installments after it. The preview now leaves those out 
too



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java:
##########
@@ -173,6 +173,36 @@ public OutstandingAmountsDTO fetchPrepaymentDetail(final 
ScheduleGeneratorDTO sc
         return outstandingAmounts;
     }
 
+    @Override
+    public OutstandingAmountsDTO fetchEarlyTerminationDetail(final 
ScheduleGeneratorDTO scheduleGeneratorDTO, final LocalDate onDate,
+            final Loan loan) {
+        final LoanRepaymentScheduleInstallment currentInstallment = 
loan.getRelatedRepaymentScheduleInstallment(onDate);
+        if (loan.isInterestBearingAndInterestRecalculationEnabled() || 
currentInstallment == null
+                || !DateUtils.isBefore(onDate, loan.getMaturityDate())) {
+            return fetchPrepaymentDetail(scheduleGeneratorDTO, onDate, loan);
+        }
+        // Without interest recalculation the termination prorates the 
interest of the installment it lands in and drops

Review Comment:
   fixed



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