Coder Social home page Coder Social logo

gibson-gichuru / e-wallet Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 1.49 MB

This project is a simple E-Wallet application accessible via USSD interface. It allows users to create an account, top up their wallet, make withdrawals, and request for balance and statements. The application was built using Python, Flask, PostgreSQL, Redis, and Africa's Talking API. The development process was test-driven, and the application is

Shell 0.28% Python 99.15% Mako 0.57%
flask africastalking-api ussd-applications

e-wallet's Introduction

E-Wallet

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.

Table of Contents

Technologies

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

Features

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.

Installation

To install and run the application, follow these steps:

Clone-The-Application

Clone the repository to your local machine.

  git clone https://github.com/Gibson-Gichuru/E-wallet

Install-App-Dependencies

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

Run-App

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

Testing

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.

Deployment

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

How It Works

Account-Creation

When a user dials the USSD code, they are prompted to create an account by entering their username.

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.

Reactivate-Account

Users can request for account reactivation

Deactivate-Account

Users can request for account deactivation at will

Application-Design

Database-Design

User-Registration-Sequence

Account-Activation-Sequence

Account-Deactivation-Sequence

Account-Topup-Sequence

Account-withdraw-Sequence

Account-Balance-Request-Sequence

Account-Statement-Request-Sequence

User-Initiated-C2B-Topup-Sequence

License

This project is licensed under the MIT License. See the LICENSE file for details.

e-wallet's People

Contributors

gibson-gichuru avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

sudoevans

e-wallet's Issues

Documentation

I like the way you are documenting your code, This is a great skill to have.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.