mariiaKraievska commented on code in PR #6109:
URL: https://github.com/apache/fineract/pull/6109#discussion_r3552345946
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanDelinquencyRangeScheduleServiceImpl.java:
##########
@@ -152,42 +147,32 @@ public void applyRepayment(WorkingCapitalLoan loan,
LocalDate transactionDate, B
@Override
public void reprocessDelinquencySchedule(final WorkingCapitalLoan loan) {
- final List<WorkingCapitalLoanTransaction> replayableTransactions =
transactionRepository
-
.findByWcLoan_IdOrderByTransactionDateAscIdAsc(loan.getId()).stream()
- .filter(txn -> !txn.isReversed() &&
txn.getTransactionType().isRepaymentType()).toList();
-
final LocalDate businessDate = DateUtils.getBusinessLocalDate();
- resetAllPeriodsForReprocessing(loan.getId());
generateNextPeriodIfNeeded(loan, businessDate);
-
- if (replayableTransactions.isEmpty()) {
- evaluateExpiredPeriods(loan, businessDate);
- delinquencyClassificationService.classifyDelinquency(loan,
businessDate);
- return;
- }
-
- final Map<Long, WorkingCapitalLoanTransactionAllocation>
allocationsByTxnId = allocationRepository
-
.findByWcLoanTransactionIdIn(replayableTransactions.stream().map(WorkingCapitalLoanTransaction::getId).toList()).stream()
- .collect(Collectors.toMap(allocation ->
allocation.getWcLoanTransaction().getId(), Function.identity()));
-
- for (final WorkingCapitalLoanTransaction txn : replayableTransactions)
{
- final WorkingCapitalLoanTransactionAllocation allocation =
allocationsByTxnId.get(txn.getId());
- if (allocation == null) {
- continue;
- }
- final BigDecimal principalPortion =
allocation.getPrincipalPortion();
- if (principalPortion != null &&
principalPortion.compareTo(BigDecimal.ZERO) > 0) {
- allocateRepayment(loan, txn.getTransactionDate(),
principalPortion);
- }
+ List<WorkingCapitalLoanDelinquencyRangeSchedule>
delinquencyRangePeriods = resetAllPeriodsForReprocessing(loan.getId());
+
+ final List<TransactionDateAndAmountHolder>
transactionDateAndAmountHolderList = transactionRepository
+ .fetchTransactionDateAndAmount(loan.getId(),
LoanTransactionType.getRepaymentLikeTransactionTypes());
Review Comment:
This reprocess method now replays transactionAmount, while
WorkingCapitalLoanWritePlatformServiceImpl.applyRepayment (line 775) still
passes principalPortion to delinquency. Could we align both delinquency paths
on transactionAmount?
--
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]