log.warning("Insufficient funds for tranfer attempted by user " + currentUser.username + " (amount=" + formatAmount(amount) + ", balance=" + formatAmount(currentUser.balance) + ").");
throw new CaprabankException("Insufficient funds.");
}
}
BankTransaction transferTransaction = new BankTransaction();
transferTransaction.transactionId = generateId();
transferTransaction.timestamp = new Date();
transferTransaction.fromAccount = currentUser.accountNum;
transferTransaction.toAccount = toAccount;
transferTransaction.amount = amount;