Design: Dependency Inversion Principle Application
Focus on the design of the payment processing system applying the Dependency Inversion Principle. Out of scope are actual payment gateway integrations and UI design.
Functional Requirements
FR1: Design a simple payment processing system that supports multiple payment methods (e.g., credit card, PayPal, bank transfer).
FR2: The system should allow easy addition of new payment methods without changing existing code.
FR3: High-level modules (payment processing logic) should not depend on low-level modules (specific payment method implementations).
FR4: Both should depend on abstractions (interfaces).
FR5: Abstractions should not depend on details; details should depend on abstractions.
Non-Functional Requirements
NFR1: The system should be modular and maintainable.
NFR2: It should be easy to extend with new payment methods.
NFR3: Latency for processing a payment should be under 500ms.
NFR4: The system should be testable with mock payment methods.