somasorosdpc commented on code in PR #6457:
URL: https://github.com/apache/fineract/pull/6457#discussion_r4074128306
##########
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 made the refactor, that pulls the check into the
`AccrualWithDeferredRevenueAmortizationAccountingProcessorForWorkingCapitalLoan`
implementation. All the public API checks at the first step if it is enabled
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]