This is a banking application built with Spring Boot and Angular. The fraud detection system in the backend is not functioning correctly, allowing fraudulent transactions to go through. Fix the functionality to enforce fraud rules are applied properly and prevent unauthorized transactions.
Note: The code repository may intentionally contain other unrelated issues to this specific task. Please focus only on the described task requirements and address bugs or errors directly associated with them.
Issue #1: Fraud Detection Not Triggered for Repeat Transactions
Rule: If a user makes more than three transactions to the same recipient within a 3-minute window, the activity should be flagged as potential fraud.
Issue: These repeat transactions are not being flagged and continue to be processed without restriction.
Issue #2: Transactions to fraudulent merchant IDs not flagged
Rule: Transactions to recipient account IDs starting with '9' are associated with known fraud and should be automatically flagged.
Issue: These transactions are still being processed without any fraud detection or restriction.
Issue #3: Locking suspicious accounts
Rule: If a sender account is flagged for fraud three times, it must be locked and prevented from making any further transactions.
Issue: Currently, locked accounts are still able to process transactions.
Expected Behavior:
Fix the Transaction service and Fraud Detection service. Below are the relevant exception classes: