Skip to content

A basic bank service based on Amazon Quantum ledger database (QLDB)

Notifications You must be signed in to change notification settings

samfatoks/bank-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bank Service

Setup

On the QLDB page on AWS management console, perform the following operation:

  1. Create a ledger with name bank or any other name. Ensure to use the correct ledger name in the config file (Config.toml)
  2. Create table
CREATE TABLE accounts
  1. Create index on table
CREATE INDEX ON accounts (account_number)
  1. Create .env file at the root of the project with the following details.
RUST_LOG=info,actix_web=info
SERVER_PORT=8080
LEDGER_NAME=bank

Run

In the project root directory, type the command below to run

cargo run

Change the http_port and ledger_name in the configuration file (Config.toml) as you see fit. Default Base URL: http://locathost:8080

Rest Endpoints

  1. GET /account - get all accounts
  2. GET /account/{account_number} - get account details by account_number
  3. POST /account - Create new account. This returns a JSON response including the account_number and default balance of 0.
  4. DELETE /account/{account_number} - delete account by account_number
  5. POST /transaction - Process transaction based on JSON payload.

New account payload (/account)

{
	"name": "Sam James",
	"phone": "2347038657970"
}

Debit Payload for Transaction endpoint (/transaction)

{
	"amount": "50",
	"recipient_account_number": "565656565",
	"transaction_type": "DEBIT"
}

Credit Payload for Transaction endpoint (/transaction)

{
	"amount": "100",
	"recipient_account_number": "565656565",
	"transaction_type": "CREDIT"
}

Transfer Payload for Transaction endpoint (/transaction)

{
	"amount": "50",
	"recipient_account_number": "565656565",
	"sender_account_number": "3971240165",
	"transaction_type": "TRANSFER"
}

About

A basic bank service based on Amazon Quantum ledger database (QLDB)

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages