adamsaghy commented on code in PR #4837:
URL: https://github.com/apache/fineract/pull/4837#discussion_r2212787801
##########
fineract-core/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionData.java:
##########
@@ -388,16 +421,28 @@ public EndOfDayBalance toEndOfDayBalance(final Money
openingBalance) {
Money endOfDayBalance = openingBalance.copy();
if (isDeposit() || isDividendPayoutAndNotReversed()) {
endOfDayBalance = openingBalance.plus(getAmount());
+ endOfDayBalance = Money.of(currency, this.runningBalance);
} else if (isWithdrawal() || isChargeTransactionAndNotReversed()) {
-
- if (openingBalance.isGreaterThanZero()) {
+ if (isWithdrawal()) {
+ endOfDayBalance = Money.of(currency, this.runningBalance);
+ } else if (openingBalance.isGreaterThanZero()) {
endOfDayBalance = openingBalance.minus(getAmount());
} else {
endOfDayBalance = Money.of(currency, this.runningBalance);
}
}
- return EndOfDayBalance.from(getTransactionDate(), openingBalance,
endOfDayBalance, this.balanceNumberOfDays);
+ return EndOfDayBalance.from(getTransactionDate(), openingBalance,
endOfDayBalance, this.balanceNumberOfDays,
+ currency.getDigitsAfterDecimal());
+ }
+
+ public EndOfDayBalance toEndOfDayBalanceDates(final Money openingBalance,
LocalDateInterval date) {
Review Comment:
Move this logic into a mapper instead?
--
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]