- Introduction
- Technologies Used
- Swagger
- Commands
- API Documentation
- Github Actions
- Contribution
- Contact Information
This project contains an application which can be used to:
- Create a new bank account with an initial deposit for a customer.
- A single customer may have multiple accounts.
- Transfer amounts between two accounts, including those owned by different customers.
- Retrieve balance for a given account.
- Retrieve transaction history for a given account.
- Java 11
- SpringBoot: Used to create easy stand-alone, production-grade Spring based Applications.
- H2 database engine: Embedded relational database
- Maven: Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
- Swagger: Swagger is an Interface Description Language for describing RESTful APIs expressed using JSON. Swagger is used together with a set of open-source software tools to design, build, document, and use RESTful web services. Swagger includes automated documentation, code generation, and test-case generation.
- Git Actions: GitHub Actions helps automate tasks within the software development life cycle. GitHub Actions are event-driven, meaning that you can run a series of commands after a specified event has occurred. They happen directly on the Github repo itself.
Following are the available endpoints
- POST http://localhost:8080/v1/accounts Creates a new account
Input:
{
"initial_amount": 0,
"user_id": 0
}
Output:
{
"body": {},
"statusCode": "ACCEPTED",
"statusCodeValue": 0
}
- GET http://localhost:8080/v1/accounts/{id} Retrieves the account balance
Output:
{
"account_id": 0,
"balance": 0,
"created_at": "2021-04-01T17:26:40.264Z"
}
- POST http://localhost:8080/v1/operations Creates a transfer between accounts
Input:
{
"receiver_account_id": 0,
"sender_account_id": 0,
"value": 0
}
Output:
{
"body": {},
"statusCode": "ACCEPTED",
"statusCodeValue": 0
}
- GET http://localhost:8080/v1/operations/fromAccount/{accountId} Get the history of operations for the provided account Id.
Output:
{
"account_id": 0,
"created_at": "2021-04-01T17:29:13.493Z",
"operations": [
{
"created_at": "2021-04-01T17:29:13.493Z",
"operation_id": 0,
"receiver_account_id": 0,
"sender_account_id": 0,
"value": 0
}
]
}
To compile and test, please execute
mvn clean install
To run the application, please execute
mvn spring-boot:run
In order to read the API documentation in Swagger, please first start the application and the visit API Documentation in Swagger
To ensure the correctness of the code committed, github action for 'building the java project using Maven' is used. This ensures that all tests are green and the projects runs correctly on Windows, MacOS and Linux systems.
Feature requests, issues, pull requests and questions are welcome.
How to reach me? At github specific gmail account. Original idea for this project came from Joao Carlos Sousa do Vale