Skip to content

eneskacan/banking-system

Repository files navigation

Banking System

Publish Docker Image

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.

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

Installation

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

API Reference

Create account

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 account

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
}

Make deposit

PATCH /api/accounts/${id}/deposits
{
  "amount" : 100
}
Parameter Type Description
body json Required. Deposit details
id int Required. Account number

Make transfer

PATCH /api/accounts/${id}/transfers
{
  "receiverId" : "3006665471",
  "amount" : 100
}
Parameter Type Description
body json Required. Transfer details
receiverId int Required. Account number

Get logs

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"
  }
]

Acknowledgements

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published