Skip to content

Akka-Kotlin-Koin-Ktor (AK^3) Bank API

License

Notifications You must be signed in to change notification settings

kpavlov/ak3-bank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AK3 Bank API

Akka-Kotlin-Koin-Ktor (AK3) Bank API

Build Status codecov

The project consists of an API to be used for opening customer bank accounts and saving transactions.

The API will expose an endpoint which accepts the user information (customerID, initialCredit).

Once the endpoint is called, a new account will be opened connected to the user whose ID is customerID.

Also, if initialCredit is not 0, a transaction will be sent to the new account.

Another Endpoint will output the user information showing Name, Surname, balance, and transactions of the accounts.

Assumptions

  • For simplicity, the data is saved in memory and not actually persisted, so that the solution could be easier tested.
  • All accounts are opened in the same currency (which is not always a case in real life)
  • Application security is skipped: no Authentication, Authorization and TLS. Full logging is enabled.
  • There are no restriction for the customer to open new account. The restriction could be maxActiveAccounts or max deposit amount. Now it's omitted.

Implementation notes

  • Swagger codegen is not mature enough to generate server interfaces for Ktor server. That's why only DTO classes are generated.

Build instructions

To build with maven and start:

./build-and-start.sh

REST API Commands

Create Customer

curl -v \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{"firstName": "Tirion", "lastName": "Lannister"}' \
    http://localhost:8080/v1/customers | jq

Create new current account with balance

curl -v \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{"initialCredit": 100500.42, "type": "CURRENT"}' \
    http://localhost:8080/v1/customers/1/accounts | jq 

Get customer info with account statements

curl -v \
    -H "Accept: application/json" \
    http://localhost:8080/v1/customers/1 | jq