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


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -3490,26 +3490,47 @@ private void 
processIncomeAccrualTransactionOnLoanClosure() {
             LoanTransaction finalIncomeTransaction = 
LoanTransaction.incomePosting(this, this.getOffice(), closedDate, amountToPost,
                     interestToPost, feeToPost, penaltyToPost, externalId);
             addLoanTransaction(finalIncomeTransaction);
-            if (isPeriodicAccrualAccountingEnabledOnLoanProduct()) {
-                List<LoanTransaction> updatedAccrualTransactions = 
retrieveListOfAccrualTransactions();
-                LocalDate lastAccruedDate = this.getDisbursementDate();
-                if (!updatedAccrualTransactions.isEmpty()) {
-                    lastAccruedDate = 
updatedAccrualTransactions.get(updatedAccrualTransactions.size() - 
1).getTransactionDate();
-                }
-                HashMap<String, Object> feeDetails = new HashMap<>();
-                determineFeeDetails(lastAccruedDate, closedDate, feeDetails);
-                if (isExternalIdAutoGenerationEnabled) {
-                    externalId = ExternalId.generate();
-                }
-                LoanTransaction finalAccrual = 
LoanTransaction.accrueTransaction(this, this.getOffice(), closedDate, 
amountToPost,
-                        interestToPost, feeToPost, penaltyToPost, externalId);
-                updateLoanChargesPaidBy(finalAccrual, feeDetails, null);
-                addLoanTransaction(finalAccrual);
-            }
+
+            applyIncomeAccrualTransaction(closedDate);
         }
         updateLoanOutstandingBalances();
     }
 
+    public void applyIncomeAccrualTransaction(LocalDate closedDate) {
+        if (isPeriodicAccrualAccountingEnabledOnLoanProduct()) {
+            ExternalId externalId = ExternalId.empty();
+            final boolean isExternalIdAutoGenerationEnabled = 
TemporaryConfigurationServiceContainer.isExternalIdAutoGenerationEnabled();
+            if (isExternalIdAutoGenerationEnabled) {
+                externalId = ExternalId.generate();
+            }
+
+            HashMap<String, BigDecimal> cumulativeIncomeFromInstallments = new 
HashMap<>();

Review Comment:
   The two logic is not matching!
   Things that got extracted from 3493 to 3508 is not matching with the new 
logic of the "applyIncomeAccrualTransaction" method. Please double check and 
remove the unnecessary pieces!



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