Simple Payment Gateway is an example of how to approach a real-world problem using:
- Event Sourcing
- CQRS
- Mediator Pattern
- Hexagonal/Clean architecture
This is an exploration project. Please don't expect a production-ready code.
The solution includes a Payment Gateway Service and a Bank Simulator. The Bank Simulator is a Fake service for development purposes.
The system is currently storing the information in memory.
Before you begin, ensure you have met the following requirements:
- You have installed .net core 3.1
To build simple-payment-gateway, follow these steps:
Linux and macOS:
./build.sh
Windows:
.\build.ps1
To use simple-payment-gateway, follow these steps:
- Configure the FakeBank service endpoint at the PaymentGateway.Api
appsettings.json
file - Start the FakeBank Service
- Start the PaymentGateway.Api Service
- You can interact with it using the REST API or accessing the Swagger page at
/swagger
- You can interact with it using the REST API or accessing the Swagger page at
Send a POST request to the endpoint /api/Payments
.
JSON payload example:
{
"amount": 200,
"currency": "EUR",
"card": {
"type": "VISA",
"name": "GF",
"number": "1111222233334444",
"expireMonth": 12,
"expireYear": 2020,
"cvv": 123
}
}
- Implement a Database
- Idempotency
- Logging
- Use Correlation Id for tracking requests
- Implement an enumeration with the accepted Card Types
- Unit tests - Implement the Builder pattern to simplify data initialization
- Implement Integration Tests
- Ensure that Personal Identifiable Information is anonymized