FINERACT-1447 : Fix - Overdraft interest calculated is wrong

This commit is contained in:
sheminanto
2021-11-30 02:55:15 +08:00
committed by Petri Tuomola
parent b845fe277b
commit d1bbf57d9a
@@ -571,7 +571,7 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
endOfDayBalance = openingBalance.plus(getAmount(currency));
} else if (isWithdrawal() || isChargeTransactionAndNotReversed()) {
if (openingBalance.isGreaterThanZero()) {
if (openingBalance.isGreaterThanZero() || this.savingsAccount.allowOverdraft()) {
endOfDayBalance = openingBalance.minus(getAmount(currency));
} else {
endOfDayBalance = Money.of(currency, this.runningBalance);
@@ -603,7 +603,7 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
// }
} else if (isWithdrawal() || isChargeTransactionAndNotReversed()) {
// endOfDayBalance = openingBalance.minus(getAmount(currency));
if (endOfDayBalance.isGreaterThanZero()) {
if (endOfDayBalance.isGreaterThanZero() || this.savingsAccount.allowOverdraft()) {
endOfDayBalance = endOfDayBalance.minus(getAmount(currency));
} else {
endOfDayBalance = Money.of(currency, this.runningBalance);