Ensure that you have python3 correctly installed and configured in your Operating System
Ensure that you have PostgreSQL correctly installed and configured in your Operating System
Ensure that you have Postman installed in your Operating System
-
Clone the Repository into your local computer
-
Navigate to the root directory of the project using your Terminal
-
Create a .env file at the root directory of the project
The .env file should have the following attributes as shown in the image
DB_NAME= Name of your PostgreSQL database
DB_USER= database user
DB_PASSWORD= database user password
DB_HOST= database host
-
Create a virual environment using the command
python3 -m venv venv
-
Activate the Virtual environment using the commands below:
-
On Linux Operating system use the command
source ./venv/bin/activate
-
On Windows Operating System use the command
venv\Scripts\activate.bat
You will notice that venv appears before the beginnning of your Terminal. This indicates that the Virual environment is activated.
-
-
Install the dependencies for the project using the command
pip install -r requirements.txt
-
Run the the command
python3 manage.py makemigrations
in order to generate SQL commands -
Run the the command
python3 manage.py migrate
in order to execute those SQL commands in the database -
Run the app using the command
python3 manage.py runserver
Change the DEBUG
attribute to False
and change the DB_HOST
to point to the location of your database in the .env file and follow the installation guidelines provided by the production platform
The API has 3 main modules (directories):
-
src - Contains the API configurations
-
authentication - Module (app) responsible for handling authentication functions, User creation & login functionalities
-
transfers - Module (app) responsible for handling all the financial transactions
In order to access the API endpoints, users must register and login in order to obtain an auth Token (JWT).
The API schema can be accessed via this url http://localhost:8000/schema
The Schema view will appear as shown below:
- For user registration, access the andpoint via a POST request and pass the following attributes in the request body (full_name,phone_number,password) as shown below.
- For user Login, access the andpoint via a POST request and pass the following attributes in the request body (phone_number,password) as shown below.
- For Account creation, pass the access token on the Authorization section of the POST request headers as shown below:
After that pass the staring balance in the request body as shown below:
If an account has already been created: An error message will occur at the response body as shown below"
If starting balance is less than 0: An error message will be presented on the response body
Initial balance = 800
Transfer Amount = 200
Update Sender's starting Balance by subtracting 200 from the starting balance
Update Receiver's starting Balance by adding 200 to their starting balance
Save the Transaction in the Transfer (s) database Table
Relevent error messages will be dispalyed on the Response body incase the transfer amount is less than 0, transfer amount is greater than available balance or the receiver's account does not exist