Fineract-521
This commit is contained in:
+13
-1
@@ -1085,13 +1085,21 @@ public class SavingsAccount extends AbstractPersistableCustom<Long> {
|
||||
|
||||
// deal with potential minRequiredBalance and
|
||||
// enforceMinRequiredBalance
|
||||
if (!isException && transaction.canProcessBalanceCheck()) {
|
||||
if (!isException && transaction.canProcessBalanceCheck() && !isOverdraft()) {
|
||||
if (runningBalance.minus(minRequiredBalance).isLessThanZero()) { throw new InsufficientAccountBalanceException(
|
||||
"transactionAmount", getAccountBalance(), withdrawalFee, transactionAmount); }
|
||||
}
|
||||
lastSavingsDate = transaction.transactionLocalDate();
|
||||
|
||||
}
|
||||
|
||||
//In overdraft cases, minRequiredBalance can be in violation after interest posting
|
||||
//and should be checked after processing all transactions
|
||||
if(isOverdraft()) {
|
||||
if (runningBalance.minus(minRequiredBalance).isLessThanZero()) { throw new InsufficientAccountBalanceException(
|
||||
"transactionAmount", getAccountBalance(), withdrawalFee, transactionAmount); }
|
||||
}
|
||||
|
||||
if (this.getSavingsHoldAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (runningBalance.minus(this.getSavingsHoldAmount()).isLessThanZero()) {
|
||||
throw new InsufficientAccountBalanceException("transactionAmount", getAccountBalance(), withdrawalFee,
|
||||
@@ -3048,5 +3056,9 @@ public class SavingsAccount extends AbstractPersistableCustom<Long> {
|
||||
public void releaseAmount(BigDecimal amount) {
|
||||
this.savingsOnHoldAmount = getSavingsHoldAmount().subtract(amount);
|
||||
}
|
||||
|
||||
private boolean isOverdraft() {
|
||||
return allowOverdraft;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user