Skip to content

ruanjoppert/simplest-banking

Repository files navigation

Simplest banking (🚧 WIP)

Simplest banking service I could think of using some good practices.

Installation

  1. Clone this project
  2. Install dependencies using yarn or npm install

image

git clone git@github.com
cd simplest-banking
yarn

Roadmap

This application is still under development, some details are still missing

API Reference

Reset state

Use this route to reset the service state

Request

POST /reset

Response

Status: 200 OK

Get balance

Returns the balance from account

Request

GET /balance?account_id=1234
Parameter Type Description
account_id string Required. Id of item to fetch

Response - existing account

Status: 200 OK

20

Response - non-existing account

Status: 404 Not Found

0

Make transaction

Make an account transaction

Request

POST /event
Event Description
deposit deposit fund to account
transfer transfer from origin account to destination account
withdraw withdraw fund from account

Response - Create account with initial balance

Status: 201 Created

{"destination": {"id":"100", "balance":10}}

Response - Deposit into existing account

Status: 201 Created

{"destination": {"id":"100", "balance":20}}

Response - Withdraw from non-existing account

Status: 404 Not found

0

Response - Withdraw from existing account

Status: 201 Created

{"origin": {"id":"100", "balance":15}}

Response - Transfer from existing account

Status: 201 Created

{"origin": {"id":"100", "balance":0}, "destination": {"id":"300", "balance":15}}

Response - Transfer from non-existing account

Status: 404 Not found

0

Events

Deposit

Parameter Type Description Required
type string deposit yes
destination number account id where it will be deposited yes
amount number amount to be to be transacted yes

Sample

{"type":"deposit", "destination":"100", "amount":10}

Withdraw

Parameter Type Description Required
type string withdraw yes
origin number account id where it will be withdrawn yes
amount number amount to be to be transacted yes

Sample

{"type":"withdraw", "origin":"100", "amount":5}

Transfer

Parameter Type Description Required
type string transfer yes
origin number account id where it will be withdrawn yes
destination number account id where it will be deposited yes
amount number amount to be to be transacted yes

Sample

{"type":"transfer", "origin":"200", "amount":15, "destination":"300"}

Build and run

The service uses typescript, so it is necessary to build

yarn build
yarn start

Running Tests

To run tests, run the following command

yarn test

modules/account domain entities events exceptions

application commands queries exceptions event-handlers

infrastructure database

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors