This repository contains a mocked RESTful API simulating a simple payment gateway middleware. It facilitates transactions between a mock retail application and a banking service.
The payment gateway middleware provides endpoints for initiating a transaction, checking transaction status, and receiving webhook notifications for transaction updates. It uses mock data to simulate transaction records and banking service responses, and incorporates basic authentication to secure the API endpoints.
-
Endpoints:
api/transaction/initiate
: POST endpoint for initiating a transaction.api/transaction/status/{transactionId}
: GET endpoint for checking transaction status.api/webhook/notification
: POST endpoint for receiving webhook notifications.
-
Authentication:
- Basic authentication is implemented to secure the API endpoints. Users must provide valid credentials to access the endpoints.
- For test purpose:
- username = admin
- password = password
-
Data Simulation:
- Mock data or in-memory database is used to simulate transaction records and banking service responses.
-
Documentation:
- API endpoints are documented using Swagger, providing detailed information on request/response formats and authentication requirements.
- The code is structured logically, with clear separation of concerns.
- Naming conventions are consistent and descriptive.
- Comments are provided where necessary to explain complex logic or implementation details.
- Endpoints follow RESTful principles, using appropriate HTTP methods and resource naming conventions.
- Response formats adhere to RESTful standards, providing meaningful status codes and response bodies.
- Basic authentication is implemented securely.
- Access to endpoints is restricted to authenticated users only, ensuring data security.
To review the API implementation:
- Clone this repository to your local machine.
- Navigate to the directory where the repository was cloned.
- Run the application and access the API endpoints using tools like cURL or Postman.
- Refer to the Swagger documentation for detailed information on each endpoint and authentication requirements.
- On your local machine, the swagger documentation can be accessed via http://localhost:8080/swagger-ui.html