The Fund Transfer API is a RESTful service built with Spring Boot that allows users to transfer funds between accounts with currency exchange. It supports concurrent invocation by multiple users or systems and includes functionality to retrieve exchange rates from external APIs.
- Transfer funds between accounts with currency conversion
- Retrieve exchange rates from external APIs
- Support for concurrent invocation
- Error handling for various scenarios such as insufficient balance and invalid account details
- Java
- Spring Boot
- OpenAPI (Swagger)
- Mockito
- JUnit
To run the Fund Transfer API locally, follow these steps:
- Clone this repository to your local machine.
- Make sure you have Java and Maven installed.
- Navigate to the project directory and run the following command to build the project:
mvn clean install
- Start the application using the following command:
mvn spring-boot:run
- The application will start locally at
http://localhost:8080
.
The API documentation is available using Swagger UI. After starting the application, you can access the API documentation by visiting the following URL:
http://localhost:8080/swagger-ui.html
Once the application is running, you can interact with the API using tools like cURL, Postman, or any HTTP client.
Transfer Funds
To transfer funds between accounts, send a POST request to the /api/transfers
endpoint with the following payload:
{
"debitAccountId": 123,
"creditAccountId": 456,
"amount": 100.00,
"currency": "USD"
}
Retrieve Account Balance
To retrieve the balance of an account, send a GET request to the /api/accounts/{ownerId}
endpoint, replacing {ownerId} with the ID of the account owner.
The project includes unit tests and integration tests to ensure the functionality works as expected. You can run the tests using the following command:
mvn test
Contributions to the Fund Transfer API are welcome! To contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them to your branch.
- Push your changes to your fork.
- Submit a pull request to the main repository.