Skip to content

Commit c36cc92

Browse files
committed
Feat: Adds more auditLogging features in BankATM
1 parent 36f06a1 commit c36cc92

File tree

1 file changed

+3
-0
lines changed
  • lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank

1 file changed

+3
-0
lines changed

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/BankAtm.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public void addAccount(CheckingAccount account) {
3636
* @return The unique set of accounts owned by the customer.
3737
*/
3838
public Set<CheckingAccount> findAccountsByCustomerId(UUID customerId) {
39+
auditLog.log("Finding accounts for customer " + customerId);
3940
return customerById.containsKey(customerId)
4041
? customerById.get(customerId).getAccounts()
4142
: Set.of();
@@ -75,6 +76,7 @@ public void depositFunds(String accountNumber, Check check) {
7576
public void withdrawFunds(String accountNumber, double amount) {
7677
CheckingAccount account = getAccountOrThrow(accountNumber);
7778
account.withdraw(amount);
79+
auditLog.log("Withdrew " + amount + " from account " + accountNumber);
7880
}
7981

8082
/**
@@ -88,6 +90,7 @@ private CheckingAccount getAccountOrThrow(String accountNumber) {
8890
if (account == null || account.isClosed()) {
8991
throw new AccountNotFoundException("Account not found");
9092
}
93+
auditLog.log("Retrieved account " + accountNumber);
9194
return account;
9295
}
9396
}

0 commit comments

Comments
 (0)