The payment gateway acts as a intermediary between the merchant and financial institution and providing the status of the payment when requested. Technology used to build this solution are:
- Application -> .NET Core 3.1
- Mock Bank -> Wiremock (http://wiremock.org/)
- Messaging -> RabbitMQ
- Docker
To get the application running locally follow these steps:
Build and start the application in docker compose:
docker-compose up -d --build
This is the stucture of the request that I have assumed is coming from the Merchant.
{
"Amount": 9.99,
"Currency": "USD",
"PaymentMethod": {
"Type": "Amex",
"Number": "4111111111111111",
"ExpirationMonth": "10",
"ExpirationYear": "20",
"Cvv": "123"
},
"MerchantId": "1"
}
To access RabbitMQ to view the queue the messages are being published to and consumed from go to:
http://localhost:15672
I have included a postman collection which includes tests to show the flow of a payment being accepted and declined. Accepted:
- All payment types except Amex
- Status will be Submitted -> Accepted
Declined
- Payment type of Amex (just to show a failure state - in future this would be based on the real response from the bank)
- Status will be Submitted -> Declined
A list of features I am currently working on adding
- Containerized [x]
- RabbitMQ for event driven architecture [x]
- Build pipeline [x]
- Retry policies for application dependencies
- Logging
- Serilog would probably be the best choice here for simple logging
- Validation of card details
- Checking credit card numbers match the type submitted
- CVV numbers for different providers
- Expiry date isn't in the past
- Full end-to-end acceptance tests