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
Make sure you have the following software installed on your system:
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.
Registers a new user with the system.
POST
/users/register
application/json
Field | Type | Description |
---|---|---|
username | string | The username of the user (unique identifier). |
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. |
201 Created
Logs in a user to the system and generates an authentication token.
POST
/users/login
application/json
Field | Type | Description |
---|---|---|
username | string | The username of the user. |
password | string | The password for the user's account. |
200 OK
Logs out a user and invalidates the current authentication token.
GET
/users/logout
Bearer <token>
200 OK
Retrieves the profile information of the current user.
GET
/users/view
Bearer <token>
200 OK
Updates the profile information of the current user.
PUT
/users/update
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
firstname | string | The new first name of the user. |
lastname | string | The new last name of the user. |
string | The new email address of the user. |
200 OK
Searches for a user by username, email, or phone number.
GET
/users/search
Bearer <token>
Parameter | Type | Description |
---|---|---|
username | string | The username to search for. |
string | The email to search for. | |
phone_number | string | The phone number to search for. |
200 OK
Adds a new contact to the current user's contact list.
POST
/users/contacts
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
username | string | The username of the contact to add. |
200 OK
Deletes a contact from the current user's contact list.
DELETE
/users/contacts
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
username | string | The username of the contact to delete. |
204 No Content
Retrieves the contact list of the current user.
GET
/users/view/contacts
Bearer <token>
Parameter | Type | Description |
---|---|---|
page | int | The page number for pagination. |
limit | int | The number of contacts per page. |
200 OK
Searches for users by username, email, or phone number with pagination support.
GET
/admin/search/users
Bearer <token>
Parameter | Type | Description |
---|---|---|
username | string | The username to search for. |
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. |
200 OK
Changes the status of a user.
PUT
/admin/status
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
username | string | The username of the user to change status. |
200 OK
Retrieves transactions with optional filters for sender, receiver, status, flagged status, and sort order.
GET
/admin/view/transactions
Bearer <token>
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. |
200 OK
Denies a transaction.
PUT
/admin/deny/transactions
Bearer <token>
Parameter | Type | Description |
---|---|---|
transaction_id | int | The ID of the transaction. |
204 No Content
Confirms a user's access.
PUT
/admin/confirm/users
Bearer <token>
Parameter | Type | Description |
---|---|---|
user_id | int | The ID of the user. |
200 OK
Allows the user to deposit a specified amount into their account.
POST
/deposit
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
deposit_amount | decimal | The amount of money to deposit. |
201 Created
Allows the user to withdraw a specified amount from their account.
POST
/withdrawal
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
withdrawal_amount | decimal | The amount of money to withdraw. |
201 Created
Creates a draft transaction for the current user.
POST
/draft
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
transaction | object | The transaction details. |
201 Created
Edits an existing draft transaction for the current user.
PUT
/{transaction_id}
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
updated_transaction | object | The updated transaction details. |
200 OK
Confirms a draft transaction for the current user.
POST
/{transaction_id}/confirm
Bearer <token>
200 OK
Deletes a draft transaction for the current user.
DELETE
/{transaction_id}
Bearer <token>
204 No Content
Accepts an incoming transaction for the current user.
POST
/{transaction_id}/accept
Bearer <token>
200 OK
Declines an incoming transaction for the current user.
POST
/{transaction_id}/decline
Bearer <token>
204 No Content
Creates a recurring transaction for the current user.
POST
/recurring_transactions/
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
recurring_transaction | object | The recurring transaction details. |
201 Created
Displays the list of recurring transactions for the current user.
GET
/recurring_transactions/
Bearer <token>
200 OK
Cancels a recurring transaction for the current user.
DELETE
/recurring_transactions/
Bearer <token>
Parameter | Type | Description |
---|---|---|
recurring_transaction_id | int | The ID of the recurring transaction to cancel. |
204 No Content
Creates a new card for the current user.
POST
/
Bearer <token>
201 Created
Retrieves the list of cards associated with the current user.
GET
/
Bearer <token>
200 OK
Deletes a specified card of the current user.
DELETE
/{id}
Bearer <token>
200 OK
(if deletion is successful), 400 Bad Request
(if the card does not belong to the user)Creates a new category for the current user.
POST
/
Bearer <token>
application/json
Field | Type | Description |
---|---|---|
category | object | The category to create. |
201 Created
Retrieves the list of categories associated with the current user.
GET
/list
Bearer <token>
200 OK
Generates a report of the user's expenses within a specified date range.
GET
/report
Bearer <token>
Parameter | Type | Description |
---|---|---|
from_date | date | The start date for the report. |
to_date | date | The end date for the report. |
201 Created
(if the report is successfully generated), 204 No Content
(if the report could not be generated)