adamsaghy commented on code in PR #4783:
URL: https://github.com/apache/fineract/pull/4783#discussion_r2155199582
##########
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()) {
Review Comment:
This looks not right... why to ignore `openingBalance.isGreaterThanZero()`
if this is a withdrawal??
##########
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:
use mapper please
--
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]