Skip to content

kafir-coder/baking-maya-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Maya Banking Challenge

Project Overview

The Basic Banking API is a simple API that allows users to perform basic banking operations such as creating accounts, depositing and withdrawing money, checking balances, and transferring funds between accounts. This project is built using Python and the Flask framework, providing a RESTful interface to interact with bank accounts.

Features

  • Create a new account: Users can create a new account with an initial deposit.
  • Deposit money: Users can deposit money into their account.
  • Withdraw money: Users can withdraw money from their account (subject to balance).
  • Check balance: Users can check the balance of their account.
  • Transfer money: Users can transfer funds between two accounts.

Setup Instructions

Prerequisites

Make sure you have Python 3.x installed. You will also need pip to install dependencies.

  1. Install Python (if not already installed):

  2. Install dependencies:

    • Flask is required for creating the API.
    • You can install Flask using pip:
    pip install flask
    
    

Clone the repository Clone the project repository to your local machine.

bash Copy code git clone https://github.com/your-username/banking-api.git cd banking-api Run the Application To start the API, navigate to the project directory and run the Flask application.

API Endpoints

The following endpoints are available:

  1. Create Account (POST /accounts) Request Body:
{
  "name": "John Doe",
  "initial_deposit": 1000
}

Response:

{
  "account_number": "123456789",
  "name": "John Doe",
  "balance": 1000
}
  1. Deposit Money (POST /accounts/{account_number}/deposit) Request Body:
{
  "amount": 500
}

Response:

{
  "message": "Deposit successful.",
  "new_balance": 1500
}
  1. Withdraw Money (POST /accounts/{account_number}/withdraw) Request Body:
{
  "amount": 200
}

Response:

{
  "message": "Withdrawal successful.",
  "new_balance": 1300
}
  1. Check Balance (GET /accounts/{account_number}/balance) Response:
{
  "balance": 1300
}
  1. Transfer Money (POST /accounts/{sender_account_number}/transfer) Request Body:
{
  "receiver_account_number": "987654321",
  "amount": 300
}

Response:

{
  "message": "Transfer successful.",
  "sender_balance": 1000,
  "receiver_balance": 1200
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published