zain cash test API that is created as a clone for test.zaincash.iq
Zain cash test API is very limited and I can't really have any account that have enough money to give me success message so I decided to create this clone to test with it.
See documentation about the zain cash API here:
https://docs.zaincash.iq/
Before starting, you should have the following installed on your system:
- Python (version 3.10.8 or above)
- pip (Python package installer)
- Create a new directory for your project.
- Open a terminal or command prompt and navigate to the new directory.
- Create a new virtual environment by running the following command:
This will create a new folder called
python -m venv envenvin your project directory, which will contain all the necessary packages for your project. - Activate the virtual environment by running the following command:
- On Windows:
env\Scripts\activate- On Linux or macOS:
source env/bin/activate
- With the virtual environment activated, run the following command to install all the necessary packages & libraries for python:
pip install -r requirements.txt
The .env file contains all the sensitive information about the project
-
Create a new file in your project directory called
.env. -
Add your sensitive information as environment variables in the following format:
SECRET_KEY=this is my SECRET_KEY DEBUG=1hint: The information are all development information and credentials.
Django credentials:
- SECRET_KEY: django secret key.
- DEBUG: set to
1asTruein development enviroment.
Migrate the database changes using this command in the directory of the project
python manage.py migrate
and this will create a new file called db.sqlite3 that is the database for development enviroment.
Run the project using this command in the directory of the project.
python manage.py runserver 8001
hint: running on port 8001 to avoid conflicts with other projects
open the terminal in the project directory and run this command
python manage.py createsuperuser
fill the username, email, password and confirm password
After running the project go this url http://127.0.0.1:8001/admin.
Enter the username and password of the superuser that you have created
You will see few DataBase tables in Base section:
- Accounts: the users accounts (as they are zain cash wallet)
- Merchants: the merchants
- Transaction: the transactions
you can easly add new Accounts, Merchants
the Transaction will be created by using the API by following the zain cash documentation.