MoneyTransfer is REST API application for transfer money between accounts.
Compile the project and run tests:
mvn clean package
Run the application on port 4567
java -jar target/MoneyTransfer.jar
API call
GET localhost:4567/accounts/
Example response
[
{
"id": 1,
"customer": {
"id": 1,
"name": "Mike",
"surname": "Barskiy",
"phoneNumber": "+79818403837",
"email": "[email protected]"
},
"balance": 10000,
"currency": "AUD"
},
{
"id": 2,
"customer": {
"id": 2,
"name": "Ekaterina",
"surname": "Khodosova",
"phoneNumber": "+79818257940",
"email": "[email protected]"
},
"balance": 25000,
"currency": "USD"
}
]
API call
Parameters:
- senderId - sender account identifier
- receiverId - receiver account identifier
- amount - amount of money to transfer
POST localhost:4567/transfers/create
{
"senderId":4,
"receiverId":1,
"amount":1000
}
Example response
{
"id": 2,
"senderId": 4,
"receiverId": 1,
"amount": 1000
}
API call
GET localhost:4567/transfers/
Example response
[
{
"id": 1,
"senderId": 1,
"receiverId": 2,
"amount": 500
},
{
"id": 2,
"senderId": 4,
"receiverId": 1,
"amount": 1000
}
]
API call
GET localhost:4567/transfers/1
Example response
{
"id": 1,
"senderId": 1,
"receiverId": 2,
"amount": 500
}
API call
POST localhost:4567/transfers/create
{
"senderId":4,
"receiverId":4,
"amount":2000
}
Example response
{
"status": "ERROR",
"message": "Can't send money to the same account!"
}
API call
GET localhost:4567/unused/1
Example response
{
"status": "ERROR",
"code": 404,
"message": "Not Found"
}
- Spark Framework - Web application framework, runs on an embedded Jetty web server
- Google Guice - Dependency injection
- OrmLite - Persisting Java objects to SQL
- H2 - Database
- JUnit - Framework to write tests
- Maven - Dependency Management
- SLF4J - Simple logging facade