This is a simple E-Wallet application that can be accessed via USSD interface. The application allows users to create an account, top up their wallet, make withdrawals, and request for balance and statements. The main notification channel for the application is via SMS.
The application is built using the following technologies:
- Python: Programming language used to build the application
- Flask: Web framework used to create the USSD application
- Sqlite: Relational database used to store user information and transaction details
- Redis: Used for efficient scheduling of tasks
- Africa's Talking API: Used for payment handling and SMS notifications to users
The application offers the following features:
- Account Creation: Users can create an account by entering their name and phone number.
- Top Up: Users can top up their wallet by entering the amount they wish to add.
- Withdraw: Users can withdraw money from their wallet by entering the amount they wish to withdraw.
- Check Balance: Users can check their wallet balance by selecting the balance option from the menu.
- Request Statement: Users can request for their transaction statement by selecting the statement option from the menu.
To install and run the application, follow these steps:
Clone the repository to your local machine.
git clone https://github.com/Gibson-Gichuru/E-wallet
The application requires redis to be installed and running.
Redis can be installed by following the instructions
here, also you need to have Poetry dependency manager installed
use the steps to install Poetry.
Once redis and Poetry are installed, navigate to the application root directory and run the command below.
poetry install
Create a .env file and update the appropriate as described in the env.txt file
To install pre-commit and pre-push scripts run.
# make sure the hook script have the appropriate permissions
sudo chmod +x hooks.py
# install the hooks
./hooks.py -i
# to uninstall the hooks
./hooks.py -u
To run the application simply run
poetry run flask run
# or you can activate the virtual environment then run the application
poetry shell
flask run
To work with africastalking api you'll need to tunnell the application so that the callback endpoints can be reached remotely
The application offers a custom commmand to tunnel the http address it's running on using ngrock
. To activate tunnelling launch a new terminal session and run
# the command should install ngrock
poerty run flask tunnel
# or
poetry shell
flask tunnel
The tunnell command will update the application .env file to include full url routes to all the callbacks used in the application
The application was developed using a test-driven approach, and tests are included in the tests
folder. To run the tests, execute poetry run flask test
from the command line.
The application is deployed to an AWS EC2 instance using a CI/CD pipeline with GitHub Actions. The pipeline automatically tests and deploys the application whenever code is pushed to the main
branch. The configuration for the pipeline can be found in the .github/workflows/deploy.yml
file.
The application offers a custom script To install the application on a server.
To deploy the application nginx (other web servers can be used) should be installed. to install the application simply run.
sudo chmod +x Setup.py
./Setup.py
The command installs the application as a systemd service and enabling it to launch on boot. (the assumption is that the application would be installed on a unix based operating system which uses systemd
)
The script also updates the database schema to feature the latest schema (any sqlbased database server can be used. By default the application uses sqlite
as the main database )
Also the script builds nginx config file and installs it.
Nginx is used as a reverse proxy in this case, thus if any other webserver is used make sure it supports reverse proxying to a socket file. as the application on a production environment interfaces with the reverse proxy via a unix socket file
When a user dials the USSD code, they are prompted to create an account by entering their username.
Users can top up their wallet by entering the amount they wish to add.
Users can withdraw money from their wallet by entering the amount they wish to withdraw.
Users can check their wallet balance by selecting the balance option from the menu.
Users can request for their transaction statement by selecting the statement option from the menu.
Users can request for account reactivation
Users can request for account deactivation at will
This project is licensed under the MIT License. See the LICENSE file for details.