MIFOSX-627: closing balance is calculated wrongly for same day transactions which can results in negative interest been calculated.

This commit is contained in:
Keith Woodlock
2013-08-31 21:41:39 +01:00
parent 81bde6ddad
commit 3544f5cd5c
@@ -302,9 +302,15 @@ public final class SavingsAccountTransaction extends AbstractPersistable<Long> {
numberOfDaysOfBalance = spanOfBalance.daysInPeriodInclusiveOfEndDate();
} else {
if (isDeposit()) {
endOfDayBalance = openingBalance.plus(getAmount(currency));
// endOfDayBalance = openingBalance.plus(getAmount(currency));
// if (endOfDayBalance.isLessThanZero()) {
endOfDayBalance = Money.of(currency, this.runningBalance);
// }
} else if (isWithdrawal() || isWithdrawalFeeAndNotReversed()) {
endOfDayBalance = openingBalance.minus(getAmount(currency));
// endOfDayBalance = openingBalance.minus(getAmount(currency));
// if (endOfDayBalance.isLessThanZero()) {
endOfDayBalance = Money.of(currency, this.runningBalance);
// }
}
}