The project is a RESTful API service built using Spring Boot framework to manage transactions. It provides endpoints for adding transactions, retrieving transactions within a specified amount range, and fetching transactions sorted by their amount.
- Clone the repository.
- Set up the SQL database and tables.
- Run the HTTP server.
- Method: POST
- Endpoint:
http://localhost:8080/txn/add
- Request Body:
{
"txnId": "74001755",
"customerName": "John",
"service": "UPI",
"amount": 3548,
"gst": 0.18,
"commission": 10
}
- Response:Status: 200 OK
- Method: GET
- Endpoint:
http://localhost:8080/txn/amount/{initialRange}/{finalRange}
- Request Parameters:
- {initialRange}: Initial amount range (float)
- {finalRange}: Final amount range (float)
- Response Body:
[
{
"txnId":"74001755",
"customerName":"John",
"service":"UPI",
"amount":3548,
"gst":0.18,
"commission":10
},
{
"txnId":"74002423",
"customerName":"James",
"service":"UPI",
"amount":758,
"gst":0.36,
"commission":20
}
]
- Response:Status: 200 OK
- Method: GET
- Endpoint:
http://localhost:8080/txn/sort/amount
- Response Body:
[
{
"txnId":"74002423",
"customerName":"James",
"service":"UPI",
"amount":758,
"gst":0.36,
"commission":20
},
{
"txnId":"74001755",
"customerName":"John",
"service":"UPI",
"amount":3548,
"gst":0.18,
"commission":10
}
]
- Response:Status: 200 OK
Ensure that you have PostgreSQL installed and configured with the appropriate database schema and credentials as per the application's requirements. Update the application.properties file with the correct database connection details before running the application. Use an API testing tool like Postman to test the endpoints with sample requests and verify the responses.
For any inquiries or feedback, please contact us at anshul.markwade786@gmail.com