This API allows users to perform internal account-to-account transfers and external transfers to a withdrawal address. It also provides endpoints to create accounts and check account balances. The service supports concurrent requests and ensures transaction integrity.
- Endpoint:
/create-account - Method: POST
- Description: Creates a new account with an initial balance.
{
"accountId": "string",
"userId": "string",
"initialBalance": "number"
}{
"status": "SUCCESS",
"message": "Account created successfully"
}- Endpoint: /transfer
- Method: POST
- Description: Transfers an amount from one account to another account.
{
"fromAccountId": "string",
"toAccountId": "string",
"amount": "number"
}{
"status": "SUCCESS | FAILURE",
"message": "string",
"taskId": "string"
}- Endpoint: /external-transfer
- Method: POST
- Description: Transfers an amount from an account to an external withdrawal address.
{
"fromAccountId": "string",
"externalAddress": "string",
"amount": "number"
}{
"status": "SUCCESS | FAILURE",
"message": "string",
"taskId": "string"
}- Endpoint : /balance
- Method: GET
- Description: Checks the balance of a specific account.
{
"accountId": "string"
}{
"status": "SUCCESS | FAILURE",
"balance": "number",
"message": "string"
}POST /create-account
{
"accountId": "acc123",
"userId": "user123",
"initialBalance": 1000.0
}
{
"status": "SUCCESS",
"message": "Account created successfully"
}
POST /transfer
{
"fromAccountId": "acc123",
"toAccountId": "acc456",
"amount": 100.0
}
{
"status": "SUCCESS",
"message": "Transfer successful",
"taskId": "task123"
}
POST /external-transfer
{
"fromAccountId": "acc123",
"externalAddress": "addr789",
"amount": 100.0
}
{
"status": "SUCCESS",
"message": "Transfer successful",
"taskId": "task124"
}
GET /balance
{
"accountId": "acc123"
}
{
"status": "SUCCESS",
"balance": 900.0
}
Clone the Repository:
git clone https://github.com/mrapaul/MoveMoney.git
cd MoveMoney./gradlew build./gradlew runThe service runs on port 8888 by default. You can access the API at http://localhost:8888.