somasorosdpc commented on code in PR #6457:
URL: https://github.com/apache/fineract/pull/6457#discussion_r4071300782


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanWritePlatformServiceImpl.java:
##########
@@ -1307,18 +1307,19 @@ private WorkingCapitalLoanTransaction 
reverseDisbursementTransactionAndResetBala
         final List<WorkingCapitalLoanTransaction> accrualsToReverse = 
transactions.stream()
                 .filter(t -> t.getTypeOf() == LoanTransactionType.ACCRUAL && 
!t.isReversed()).toList();
 
-        transactions.forEach(this::markReversed);
-
-        if 
(loan.getLoanProduct().getAccountingRule().isAccrualWithDeferredRevenueAmortization())
 {
-            accountingProcessor.postReversalJournalEntries(loan, txn);
-        }
+        transactions.stream().filter(t -> !t.isReversed()) // reverse only 
unreversed transaction
+                .peek(this::markReversed) // mark them reversed
+                .forEach(t -> { // post journal entries if accounting is 
enabled
+                    if 
(loan.getLoanProduct().getAccountingRule().isAccrualWithDeferredRevenueAmortization())
 {

Review Comment:
   I think accounting processor should handle only the specific accounting 
"type". The proper solution should be a 
WorkingCapitalAccountingDelegatorService ( or something like that ) what 
handles the lookup of accounting processors and decides which Accounting 
processor to use according the loan(product) configuration, and call processor 
accordingly. What do you think @adamsaghy ?



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