- Java 8
- Maven
- Google Guice for dependency injection
- H2 in memory database
- Maven
- Javalin (with embedded Jetty Server)
- Hand-written in-memory data storage using concurrency utilities
- JUnit 4
- Apache HttpClient (for unit testing)
com.mybank.server.App
All the account related end points routing is done in the class as below path. com.mybank.account.AccountRouting
User API end points routing is done in class com.mybank.user.UserRouting
com.mybank.server.AppModule which is loading the main MyBankModule
mvn exec:java
Application is running in inbuilt light weight javalin server on localhost port 7000. H2 is a in memory database which has been initialized with some sample user and account data to view
- http://localhost:7000/api/user/test1
- http://localhost:7000/api/user/test2
- http://localhost:7000/api/account/1
- http://localhost:7000/api/account/2
HTTP METHOD | END POINT | USAGE |
---|---|---|
GET | /api/user/all | get all users |
POST | /api/user/create | create a new user |
PUT | /api/user/{userId} | update user |
GET | /api/user/{userId} | get user details by userId |
DELETE | /api/user/{userId} | delete user |
HTTP METHOD | END POINT | USAGE |
---|---|---|
GET | /api/account/{accountId} | get account details by accountId |
GET | /api/account/all | get all accounts |
GET | /api/account/{accountId}/balance | get account balance details by accountId |
POST | /api/account/create | create a new account |
DELETE | /api/account/{accountId} | remove account by accountId |
PUT | /api/account/{accountId}/withdraw/{amount} | withdraw money from account |
PUT | /api/account/changeStatus/{accountId}/{status} | disable/enable the account |
PUT | /api/account/{accountId}/deposit/{amount} | deposit money to account |
POST | /api/account/transaction | perform transaction between 2 user accounts |
- 200 OK: Request is ok and processed successfully.
- 400 Bad Request: Unknown parameter in a request which server doesn't know or accept.
- 404 Not Found: The requested resource is not found, or its not available in db.
- 500 Internal Server Error: The server encountered an unexpected condition or exception.
{
"userName":"Munish Bhardwaj",
"emailAddress":"munish@gmail.com"
}
{
"customerName":"test1",
"balance":1000.0000,
"currencyCode":"USD"
}
{
"accountId": 1,
"accountType": "PERSONAL",
"customerName": "munish",
"customerEmail": "munish@test.com",
"customerAddress": "India",
"customerMobile": "+918901901200",
"customerIdProof": "ZVXYZA",
"customerPassword": XVZA
"balance": 100.0000,
"currencyCode": "USD",
"accountStatus": true
}
{
"currencyCode":"INR",
"amount":800000.0000,
"fromAccountId":1,
"toAccountId":2
}