MIFOSX-601: fix issue with negative interest been calculated due to incorrect calculation of end of day balance.

This commit is contained in:
Keith Woodlock
2013-08-12 15:23:36 +01:00
parent ef5c040a9e
commit 5d8cd54dfb
@@ -277,7 +277,10 @@ public final class SavingsAccountTransaction extends AbstractPersistable<Long> {
if (isDeposit()) {
endOfDayBalance = openingBalance.plus(getAmount(currency));
} else if (isWithdrawal() || isWithdrawalFeeAndNotReversed()) {
endOfDayBalance = openingBalance.minus(getAmount(currency));
if (openingBalance.isGreaterThanZero()) {
endOfDayBalance = openingBalance.minus(getAmount(currency));
}
}
return EndOfDayBalance.from(getTransactionLocalDate(), openingBalance, endOfDayBalance, this.balanceNumberOfDays);