final BigDecimal withdrawalFee = null;
// deal with potential minRequiredBalance and
// enforceMinRequiredBalance
if (!isWithdrawBalance && this.minRequiredBalance != null && this.enforceMinRequiredBalance && transaction.isWithdrawal()) {
if (runningBalance.minus(this.minRequiredBalance).isLessThanZero()) { throw new InsufficientAccountBalanceException(
"transactionAmount", getAccountBalance(), withdrawalFee, transactionAmount); }
}
if (runningBalance.isLessThanZero()) {
Money limit = runningBalance.zero();
if (this.allowOverdraft) {
if (this.overdraftLimit != null) {
limit = limit.plus(this.overdraftLimit);
}
}
if (limit.plus(runningBalance).isLessThanZero()) { throw new InsufficientAccountBalanceException("transactionAmount",
getAccountBalance(), withdrawalFee, transactionAmount); }
}
}
}