Giter Site home page Giter Site logo

luishbeck / fastbank-backend Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 281 KB

RESTFUL API of a multiplatform digital bank using DRF

Python 98.62% Dockerfile 0.48% Shell 0.90%
api api-rest banking banking-applications django-rest-framework restfull-api docker

fastbank-backend's Introduction

FAST-BANK BACKEND

Project Description ๐ŸŒ

RESTFUL API for a digital bank, demonstrating knowledge in backend development, HTTP protocols, authentication and authorization, REST design, MVC architecture and application of business rules

Main Requirements

  • Endpoints protected by JWT authentication;
  • Creating new users and accounts (Natural and Legal);
  • Apply for card and loans upon approval;
  • Allow transfers between existing accounts;
  • Allow installments of purchases;
  • Allow installments payment;
  • Transaction history;

Used Technologies ๐Ÿ’ป๐Ÿ“š

  • Python ๐Ÿ
  • Django
    • Django REST Framework
    • Djoser
    • Jazzmin
  • Docker ๐Ÿณ
  • Insomnia

Executing the project

Setup the environment variables according to .env.example

IP = ''
PORT = ''

SECRET_KEY = ''

DEBUG = ''

ALLOWED_HOSTS = ''

DB_ENGINE = ''
POSTGRES_DB = ''
POSTGRES_USER = ''
POSTGRES_PASSWORD = ''
POSTGRES_HOST = ''
POSTGRES_PORT = ''

Run the command below to generate de Django Secret Key

python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

With Docker conatiners ๐Ÿณ

docker-compose build
docker-compose up

or with virtual environment

py -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

Run the server and populate

py client.py

This command does everything you need to prepare the django environment: - makemigrations - migrate - runserver - create superuser - database population

ENDPOINTS ๐Ÿ

If endpoint has authorization=True use {"Authorization": "Bearer <jwt.access>"}

USERS

authorization=False

/api/v1/auth/users/

POST METHOD

{
  "register_number": <int>,
  "picture": "<str>",
  "password": "<str>"
}

JWT

authorization=False

/api/v1/auth/jwt/create/

POST METHOD

{
  "register_number": <int>,
  "password": "<str>"
}

RETRUN EXAMPLE

{
  "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
  "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}

You need the {"access": "jwt"}

NATURAL PEOPLE

authorization=True

/api/v1/natural-people/

POST METHOD

{
  "user": <user_RN_fk>,
  "name": "<str>",
  "birth_date": "<yyyy-mm-dd>",
  "cpf": "<str>",
  "rg": "<str>",
  "social_name": "<str>"
}

LEGAL PEOPLE

authorization=True

/api/v1/legal-people/

POST METHOD

{
  "user": <user_RN_fk>,
  "fantasy_name": "<str>",
  "establishment_date": "<yyyy-mm-dd>",
  "cnpj": "<str>",
  "municipal_registration": "<str>",
  "state_registration": "<str>",
  "legal_nature": "<str>"
}

ADDRESSES

authorization=True

/api/v1/addresses/

POST METHOD

{
  "user": <user_RN_fk>,
  "street": "<str>",
  "number": "<str>",
  "neighborhood": "<str>",
  "city": "<str>",
  "state": "<str>",
  "cep": "<str>"
}

EMAILS

authorization=True

/api/v1/emails/

POST METHOD

{
  "user": <user_RN_fk>,
  "email": "<email>"
}

PHONES

authorization=True

/api/v1/phones/

POST METHOD

{
  "user": <user_RN_fk>,
  "area_code": "<str>",
  "prefix_number": "<str>",
  "phone_number": "<str>"
}

ACCOUNTS

authorization=True

/api/v1/accounts/

POST METHOD

{
  "type": "<str>"
}

The value for "type" needs to be "Savings" or "Current"

GET METHOD

{
    "user": [
      654321
    ],
    "agency": 1,
    "number": 1112,
    "type": "Current",
    "balance": "275.25",
    "credit_limit": "500.00",
    "is_active": true
}

INVESTMENTS

authorization=True

/api/v1/investments/

POST METHOD

{
  "type": "<str>",
  "contribution": <float>,
  "admin_fee": <float>,
  "period": "<yyyy-mm-dd>", 
  "risc_rate": <float>,
  "profitability": <float>,
  "is_active": <boolean>
}

GET METHOD

{
  "id": 1,
  "type": "LCA",
  "contribution": "135.25",
  "admin_fee": "1.50",
  "period": "2030-12-11",
  "risc_rate": "2.30",
  "profitability": "15.60",
  "is_active": true
}

ACCOUNTS INVESTMENTS

authorization=True

/api/v1/account-investments/

POST METHOD

{
  "id_account": <account_fk>,
  "id_investment": <investment_fk>
}

GET METHOD

For GET Method need to pass the query parameter "?account=<account_number>"

{
  "id_account": 1111,
  "id_investment": 1
}

INSTALLMENTS

authorization=True

GET METHOD

GET all installments

For GET Method need to pass the query parameter "?account=<account_number>"

{
  "id": 1,
  "id_account": 1111,
  "number": "1",
  "expiration_date": "2023-10-18",
  "payment_date": null,
  "payment_amount": "419.53",
  "paid": false
}

GET installment final amount

For GET Method need to pass the query parameter "?account=<account_number>&final=true"

{
  "Installment final amount": 927.45
}

CARDS

authorization=True

/api/v1/cards/

POST METHOD

{
  "id_account": <account_fk>
}

GET METHOD

For GET Method need to pass the query parameter "?account=<account_number>"

{
  "id_account": 1111,
  "number": "570054397143",
  "expiration_date": "2027-06-22",
  "flag": "Mastercard",
  "verification_code": "843",
  "is_active": true
}

CARDS TRANSACTIONS

authorization=True

/api/v1/card-transactions/

POST METHOD

{
  "id_account": <account_fk>,
  "id_card": <card_fk>,
  "amount": <float>
}

LOANS

authorization=True

/api/v1/loans/

POST METHOD

{
  "id_account": <account_fk>,
  "amount_request": <float>,
  "installment_amount": <int>,
  "observation": "<str>"
}

GET METHOD

For GET Method need to pass the query parameter "?account=<account_number>"

{
  "id_account": 1111,
  "request_date": "2023-10-11",
  "amount_request": "1459.25",
  "interest_rate": "15.00",
  "installment_amount": 4,
  "observation": "personal use"
}

PIX

authorization=True

/api/v1/pix/

POST METHOD

{
  "id_account": <account_fk>,
  "id_receiver_account": <account_fk>,
  "amount": <float> 
}

STATEMENT

authorization=True

/api/v1/statements/

GET METHOD

For GET Method need to pass the query parameter "?account=<account_number>"

{
  "id_account": <int>,
  "transaction_type": "<str>",
  "amount": <float>,
  "balance": <float>,
  "created_at" <yyyy-mm-dd>
}

fastbank-backend's People

Contributors

luishbeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  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.