sayhaed commented on code in PR #4904:
URL: https://github.com/apache/fineract/pull/4904#discussion_r2304453678
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccrualWritePlatformServiceImpl.java:
##########
@@ -158,13 +158,19 @@ private void addAccrualTransactions(SavingsAccount
savingsAccount, final LocalDa
final List<LocalDate> accrualTransactionDates =
savingsAccount.retrieveOrderedAccrualTransactions().stream()
.map(transaction -> transaction.getTransactionDate()).toList();
+ final List<LocalDate> accrualTransactionDatesReverse =
savingsAccount.retrieveOrderedAccrualTransactions().stream()
+ .filter(transaction ->
transaction.isReversed()).map(transaction ->
transaction.getTransactionDate()).toList();
+
LocalDate accruedTillDate = fromDate;
for (PostingPeriod period : allPostingPeriods) {
+ LocalDate valueDate = period.getPeriodInterval().endDate();
+ List<LocalDate> matchingAccrualDates =
accrualTransactionDatesReverse.stream()
Review Comment:
Hey @adamsaghy
Basically, that code handles the cleanup after a user reverses an old
accrual. It makes sure we create a new transaction to replace the reversed one,
even if the new interest amount is zero.
This is to avoid leaving a "hole" in the transaction history and to keep the
accounting records correct.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccrualWritePlatformServiceImpl.java:
##########
@@ -158,13 +158,19 @@ private void addAccrualTransactions(SavingsAccount
savingsAccount, final LocalDa
final List<LocalDate> accrualTransactionDates =
savingsAccount.retrieveOrderedAccrualTransactions().stream()
.map(transaction -> transaction.getTransactionDate()).toList();
+ final List<LocalDate> accrualTransactionDatesReverse =
savingsAccount.retrieveOrderedAccrualTransactions().stream()
Review Comment:
Sure we will change that part
--
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]