API ENDPOINTS

POST - /accounts

GET - /accounts/{accountCode}

POST - /money-transfer

GET - /money-transfer/{transferId}


Documentation

POST - /accounts

request body

{
  "accountCode": "<accountCode>",
  "balance": 0.00
}

201 - Account created successfully

response body

{
  "accountCode": "<accountCode>",
  "balance": 0.00
}

422 - Account code already in use

response body

{}

GET - /accounts/{accountCode}

200 - Account data retrieved successfully

response body

{
  "accountCode": "<accountCode>",
  "balance": 0.00
}

POST - /money-transfer

request body

{
  "sourceAccount": "<sourceAccountCode>",
  "destinationAccount": "<destinationAccountCode>",
  "amount": 0.00
}

202 - Transfer has been received and will be processed, the Location header on response will be filled with the URI to check the transfer status.

response header

"Location": "/money-transfer/{transferId}"

GET - /money-transfer/{transferId}

200 - Money transfer status retrieved successfully

response body

{
  "transferId": "<transferId>",
  "status": "[PENDING or COMPLETED or CANCELED]"
}

404 - Transfer not found

response body

{}

422 - Transfer id has invalid format

response body

{}

HOW TO EXECUTE

On root project folder for linux machines type

gradlew run

On windows machines type

gradlew.bat run