Skip to content

ShenoudaGergis/Sprints-Bank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sprints online bank

An online bank system built with node.js & express.js

API endpoints

  1. User
Endpoint Method Body
/user/register POST
 {
    "ssn"        : [number] ,
    "first_name" : [string] , 
    "last_name"  : [string] ,
    "email"      : [string] ,
    "password"   : [string] ,
    "address"    : [string] ,
    "phone"      : [number] 
 }
/user/auth POST
 {
    "email"      : [string] ,
    "password"   : [string] ,
 }
/user/update PUT
 {
    "first_name" : [string] , 
    "last_name"  : [string] ,
    "email"      : [string] ,
    "password"   : [string] ,
    "address"    : [string] ,
    "phone"      : [number] 
 }
/user/delete DELETE

    
  1. Account
Endpoint Method Body
/account/open POST
 {
    "balance"    : [number] ,
    "type"       : [string] ,
    "pin"        : [number]
 }
/account/close DELETE
 {
    "account_no"    : [number]
 }
/account/transaction/:account_no GET

/account/balance/:account_no GET

/account/withdraw POST
 {
    "account_no"    : [number] ,
    "amount"        : [number] ,
 }
/account/deposite POST
 {
    "account_no"    : [number] ,
    "amount"        : [number] ,
 }
/account/deposite/card POST
 {
    "number"     : [number] ,
    "cvv"        : [number] ,
    "pin"        : [number] ,
    "amount"     : [number] ,
 }
/account/withdraw/card POST
 {
    "number"     : [number] ,
    "cvv"        : [number] ,
    "pin"        : [number] ,
    "amount"     : [number] ,
 }
/account/transfer POST
{
  "source" : {
    "number"     : [number] ,
    "cvv"        : [number] ,
    "pin"        : [number] ,
  } ,
  "destination: : {
    "number"     : [number] ,
    "cvv"        : [number] ,
    "pin"        : [number] ,    
  } 
  "amount"     : [number] ,
}

Authentication

The application uses Bearer authentication. The token is generated by /user/auth call and will last for 30 mins by default. The protocol used is https for a secure data transmission.

Response

Each response for the listed API calls above will have error key, if its value is 0 that means the operation succeeded otherwise which is 1 means it's failed

How to use

For now, you can use the application locally by cloning the project in your local machine then
run : npm install to install the required packages
run : npm start to initialize database tables and run server

Customer should first create a profile providing his personal info, then using a valid token he can then open an account with any amount of money. The account generated will be attached with a debit card, the card will have number , CVV and PIN. User can make any transactions using this info or with his account number and a valid authentication token.

The application is hosted on : https://sprints-bank-system.herokuapp.com/

Configurations

You can change the default configurations found in config.js file such as the session_timeout for each token generated in minutes