API to manage bank accounts.
- Start MySQL server
docker-compose up -d
. - Start spring boot application with
./mvnw spring-boot:run
Create a new user.
POST /user/ HTTP/1.1
Content-Type: application/json
{
"name":"Jon Doe",
"email":"[email protected]",
"phone":"5544332211"
}
{
"id": 1,
"name": "Jon Doe",
"email": "[email protected]",
"phone": "5544332211",
"bankAccounts": []
}
Get user and bank accounts by id
GET /user/1 HTTP/1.1
{
"id": 1,
"name": "Jon Doe",
"email": "[email protected]",
"phone": "5544332211",
"bankAccounts": [
{
"accountId": 1,
"accountNumber": "1123",
"bankName": "HDFC",
"balance": 1000.0,
"bankingServices": [
{
"serviceId": 1,
"active": true,
"activatedOn": "2022-06-27T05:50:04.773",
"serviceType": "MOBILE_BANKING"
}
]
},
{
"accountId": 2,
"accountNumber": "2123",
"bankName": "ICICI",
"balance": 2000.0,
"bankingServices": [
{
"serviceId": 2,
"active": true,
"activatedOn": "2022-06-27T05:50:04.773",
"serviceType": "MOBILE_BANKING"
}
]
}
]
}
Create a new bank account.
POST /bank-account/ HTTP/1.1
Content-Type: application/json
{
"userId": 1,
"accountNumber": "1123",
"bankName": "HDFC",
"balance": 1000.0,
"bankingServices": [
{
"serviceId": 1,
"active": true,
"activatedOn": "2022-06-27T05:50:04.773",
"serviceType": "MOBILE_BANKING"
}
]
}
{
"accountId": 1,
"accountNumber": "1123",
"bankName": "HDFC",
"balance": 1000.0,
"bankingServices": [
{
"serviceId": 1,
"active": true,
"activatedOn": "2022-06-27T05:50:04.773",
"serviceType": "MOBILE_BANKING"
}
]
}
Get bank account by id
GET /bank-account/1 HTTP/1.1
{
"accountId": 1,
"accountNumber": "1123",
"bankName": "HDFC",
"balance": 1000.0,
"bankingServices": [
{
"serviceId": 1,
"active": true,
"activatedOn": "2022-06-27T05:50:04.773",
"serviceType": "MOBILE_BANKING"
}
]
}
Get bank accounts with active service type
GET /bank-account/?SERVICE_TYPE=MOBILE_BANKING HTTP/1.1
[
{
"accountId": 1,
"accountNumber": "1123",
"bankName": "HDFC",
"balance": 1000.0,
"bankingServices": [
{
"serviceId": 1,
"active": true,
"activatedOn": "2022-06-27T05:50:04.773",
"serviceType": "MOBILE_BANKING"
}
]
},
{
"accountId": 2,
"accountNumber": "2123",
"bankName": "ICICI",
"balance": 2000.0,
"bankingServices": [
{
"serviceId": 2,
"active": true,
"activatedOn": "2022-06-27T05:50:04.773",
"serviceType": "MOBILE_BANKING"
}
]
}
]