Skip to content

Latest commit

 

History

History
115 lines (94 loc) · 3.44 KB

README.md

File metadata and controls

115 lines (94 loc) · 3.44 KB

Rest API's for Money Transfer between two accounts, implemented in Javalin.

Technology stack

Main Class

com.mybank.server.App

API URL Routings

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

Guice Module

com.mybank.server.AppModule which is loading the main MyBankModule

How to run

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

Available Rest API's for Users

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

Available Rest API's for Accounts

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

Http Status

  • 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.

Dummy JSON for User and Account

User :
{  
  "userName":"Munish Bhardwaj",
  "emailAddress":"munish@gmail.com"
} 
User Account: :
{  
   "customerName":"test1",
   "balance":1000.0000,
   "currencyCode":"USD"
} 
Account: :
{  
  	"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
} 

User Transaction:

{  
   "currencyCode":"INR",
   "amount":800000.0000,
   "fromAccountId":1,
   "toAccountId":2
}