GithubHelp home page GithubHelp logo

meow-bank-api's Introduction

meow-bank-api

This is a simple Flask application that provides various endpoints to manage customers and their accounts, including functionalities for creating bank accounts, transferring amounts, and retrieving balances and transfer histories.

Prerequisites

  • Python 3.6 or higher
  • pip (Python package installer)

Setting Up the Project

  1. Clone the repository:

    git clone https://github.com/PaulAlek/meow-bank-api cd your-repo-name

Create a virtual environment:

python -m venv venv

Activate the virtual environment:

On macOS/Linux:

source venv/bin/activate

On Windows:

.\venv\Scripts\activate

####Install the dependencies:

pip install -r requirements.txt

Usage

Running the Flask Application

Ensure the virtual environment is activated:

source venv/bin/activate # On macOS/Linux .\venv\Scripts\activate # On Windows

Run the application:

python app.py Access the application:

Consider using Postman or CURL.

Base URL http://127.0.0.1:8000.

Endpoints /allCustomers (GET) Retrieve a list of all customers.

/allAccounts (GET) Retrieve a list of all accounts.

/createBankAccount (POST) Create a new bank account for an existing customer.

Request Body:

json Copy code { "customerId": "string", "amount": "float" }

Responses:

200 OK: Successfully created the bank account. 400 Bad Request: Invalid input. 404 Not Found: Customer does not exist. /transfer (PATCH) Transfer an amount between two accounts.

Request Body:

json Copy code { "fromAccountId": "string", "toAccountId": "string", "transferAmount": "float" } Responses:

200 OK: Successfully completed the transfer. 400 Bad Request: Invalid input or insufficient funds. 404 Not Found: One or both accounts do not exist. /getBalanceGivenAccount (GET) Retrieve the balance for a given account.

Query Parameters:

accountId: The ID of the account. Responses:

200 OK: Successfully retrieved the balance. 404 Not Found: Invalid account ID. /getAllAccountBalancesForCustomer (GET) Retrieve the balances of all accounts for a given customer.

Query Parameters:

customerId: The ID of the customer. Responses:

200 OK: Successfully retrieved all balances. 404 Not Found: Invalid customer ID.

/transferHistory (GET) Retrieve the transfer history for a given account.

Query Parameters:

accountId: The ID of the account. Responses:

200 OK: Successfully retrieved the transfer history. 404 Not Found: Invalid account ID.

meow-bank-api's People

Contributors

paulalek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.