Build a service that processes financial transactions (like payments) with the following requirements:

Core Requirements:

  1. Idempotency: The same transaction should not be processed multiple times, even if the request is sent multiple times
  2. Double-charging prevention: Ensure a customer is never charged twice for the same transaction
  3. Transaction states: Track transaction lifecycle (PENDING → SUCCESS/FAILED)
  4. Concurrent request handling: Handle multiple simultaneous requests safely

Features to implement:

Key considerations:

Go ahead and code your solution in Java