K-I-S / Virtual-Wallet

0 stars 3 forks source link

MyPyWallet: Virtual Wallet API

Description:

Back-end web application designed to help users manage their finances efficiently. It allows users to send and receive money, manage their cards, and perform various transactions seamlessly. The application supports user-to-user transactions.

Features

Installation

Prerequisites

Make sure you have the following software installed on your system:

Steps

Clone the Repository

Clone the project repository from GitHub to your local machine.

   git clone https://github.com/K-I-S/Virtual-Wallet.git
   cd Virtual-Wallet

Create and Activate a Virtual Environment

It's a good practice to use a virtual environment to manage your project dependencies.

python -m venv venv
source venv/bin/activate   # On Windows use `venv\Scripts\activate`

Install Dependencies

Install the necessary Python packages using the provided requirements.txt file.

pip install -r requirements.txt

Setup the Database

Ensure that your database is configured correctly. You may need to modify the config.py file under app/core/ with your database settings. After configuring, populate the database.

python app/core/db_population.py

Run the Application

Navigate to the main application directory and run the main.py file.

This should start the server, and the API will be available at http://localhost:8000.

Swagger documentation: http://127.0.0.1:8000/redoc

1. Register User

Registers a new user with the system.

Request

Request Body

Field Type Description
username string The username of the user (unique identifier).
email string The email address of the user (unique identifier).
password string The password for the user's account. (has to be atleast 8 and max 20 symbols and should contain capital letter, digit, and special symbol (+, -, *, &, ^, …)
phone_number string The phone number of the user.
fullname string The fullname of the user.

Response

2. User Login

Logs in a user to the system and generates an authentication token.

Request

Request Body

Field Type Description
username string The username of the user.
password string The password for the user's account.

Response

3. User Logout

Logs out a user and invalidates the current authentication token.

Request

Headers

Response

4. View User Profile

Retrieves the profile information of the current user.

Request

Headers

Response

5. Update User Profile

Updates the profile information of the current user.

Request

Headers

Request Body

Field Type Description
firstname string The new first name of the user.
lastname string The new last name of the user.
email string The new email address of the user.

Response

6. Search User

Searches for a user by username, email, or phone number.

Request

Headers

Query Parameters

Parameter Type Description
username string The username to search for.
email string The email to search for.
phone_number string The phone number to search for.

Response

7. Add Contact

Adds a new contact to the current user's contact list.

Request

Headers

Request Body

Field Type Description
username string The username of the contact to add.

Response

8. Delete Contact

Deletes a contact from the current user's contact list.

Request

Headers

Request Body

Field Type Description
username string The username of the contact to delete.

Response

9. View Contacts

Retrieves the contact list of the current user.

Request

Headers

Query Parameters

Parameter Type Description
page int The page number for pagination.
limit int The number of contacts per page.

Response

10. Admin: Search Users

Searches for users by username, email, or phone number with pagination support.

Request

Headers

Query Parameters

Parameter Type Description
username string The username to search for.
email string The email to search for.
phone_number string The phone number to search for.
page int The page number for pagination.
limit int The number of users per page.

Response

11. Admin: Change User Status

Changes the status of a user.

Request

Headers

Request Body

Field Type Description
username string The username of the user to change status.

Response

12. Admin: View Transactions

Retrieves transactions with optional filters for sender, receiver, status, flagged status, and sort order.

Request

Headers

Query Parameters

Parameter Type Description
sender string The username of the sender.
receiver string The username of the receiver.
status string The status of the transaction.
flagged string Flagged transactions (accepts 'yes' or 'no').
sort string The sort order of the transactions.
page int The page number for pagination.
limit int The number of transactions per page.

Response

13. Admin: Deny Transaction

Denies a transaction.

Request

Headers

Query Parameters

Parameter Type Description
transaction_id int The ID of the transaction.

Response

14. Admin: Confirm User

Confirms a user's access.

Request

Headers

Query Parameters

Parameter Type Description
user_id int The ID of the user.

Response

15. Deposit Money

Allows the user to deposit a specified amount into their account.

Request

Headers

Request Body

Field Type Description
deposit_amount decimal The amount of money to deposit.

Response

16. Withdraw Money

Allows the user to withdraw a specified amount from their account.

Request

Headers

Request Body

Field Type Description
withdrawal_amount decimal The amount of money to withdraw.

Response

17. Create Draft Transaction

Creates a draft transaction for the current user.

Request

Headers

Request Body

Field Type Description
transaction object The transaction details.

Response

18. Edit Draft Transaction

Edits an existing draft transaction for the current user.

Request

Headers

Request Body

Field Type Description
updated_transaction object The updated transaction details.

Response

19. Confirm Transaction

Confirms a draft transaction for the current user.

Request

Headers

Response

20. Delete Draft Transaction

Deletes a draft transaction for the current user.

Request

Headers

Response

21. Accept Transaction

Accepts an incoming transaction for the current user.

Request

Headers

Response

22. Decline Transaction

Declines an incoming transaction for the current user.

Request

Headers

Response

23. Create a Recurring Transaction

Creates a recurring transaction for the current user.

Request

Headers

Request Body

Field Type Description
recurring_transaction object The recurring transaction details.

Response

24. Display Recurring Transactions

Displays the list of recurring transactions for the current user.

Request

Headers

Response

25. Cancel Recurring Transaction

Cancels a recurring transaction for the current user.

Request

Headers

Query Parameters

Parameter Type Description
recurring_transaction_id int The ID of the recurring transaction to cancel.

Response

26. Create Card

Creates a new card for the current user.

Request

Headers

Response

27. View User's Cards

Retrieves the list of cards associated with the current user.

Request

Headers

Response

28. Delete Card

Deletes a specified card of the current user.

Request

Headers

Response

29. Create Category

Creates a new category for the current user.

Request

Headers

Request Body

Field Type Description
category object The category to create.

Response

30. View User's Categories

Retrieves the list of categories associated with the current user.

Request

Headers

Response

31. Create Expense Report

Generates a report of the user's expenses within a specified date range.

Request

Headers

Query Parameters

Parameter Type Description
from_date date The start date for the report.
to_date date The end date for the report.

Response

File Architecture

Screenshot_20240609_080751

Database Architecture

Screenshot_20240610_123502