Banking System is a simple web service for simulating simple operations including creating accounts, depositing, and transferring assets. To run the app, it is required to generate a CollectAPI access token, and Kafka must be up and running. To download and install Kafka, please refer to the official guide here, or here for setup with Docker.
The easiest way to run this application is via Docker. To install Docker, see here. Once you have Docker installed and working, you can easily pull and start the Docker image.
docker run -e collect.api.token="apikey <your-token-here>" -e kafka.bootstrap.address="localhost:9092" -p 8080:8080 eneskacan/banking-system
Clone the project
git clone https://github.com/eneskacan/banking-system.git
Update access token in the application.properties file
collect.api.token=apikey <your-token-here>
Go to the project directory
cd banking-system
Install and start
mvn spring-boot:run
POST /api/accounts
{
"name" : "Abdullah",
"surname" : "Yavuz",
"email" : "abdullah@bootcamp.com",
"idNumber" : "12121212121",
"type" : "TRY"
}
Parameter | Type | Description |
---|---|---|
body |
json |
Required. Account details |
If account is successfully created, returns a JSON response in the following format:
{
"message" : "Account successfully created",
"id" : "9758876081"
}
If account type is invalid, returns a JSON response in the following format:
{
"message" : "Invalid account type: Expected TRY, USD or XAU but got EUR"
}
GET /api/accounts/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Required. Account number |
If account number is valid, returns a JSON response in the following format:
{
"id" : "8793740856",
"name" : "Abdullah",
"surname" : "Yavuz",
"email" : "abdullah@bootcamp.com",
"idNumber" : "12121212121",
"accountType" : "TRY",
"balance" : 0.0,
"lastUpdated" : 1657928659221
}
PATCH /api/accounts/${id}/deposits
{
"amount" : 100
}
Parameter | Type | Description |
---|---|---|
body |
json |
Required. Deposit details |
id |
int |
Required. Account number |
PATCH /api/accounts/${id}/transfers
{
"receiverId" : "3006665471",
"amount" : 100
}
Parameter | Type | Description |
---|---|---|
body |
json |
Required. Transfer details |
receiverId |
int |
Required. Account number |
GET /api/logs
If request is successful, returns a JSON array in the following format:
[
{
"message": "Account 9758876081 deposited 100.000 XAU on 2022-07-16 02:26:50.065"
},
{
"message": "Account 8793740856 deposited 100.000 TRY on 2022-07-16 02:46:56.308"
}
]