This is a simple payment gateway API that allows you to make payments and retrieve payment details.
Create a virtual environment and install the requirements using the following commands:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtCreate a .env file in the root directory and add the following environment variables:
DB_USER=
DB_PASSWORD=
DB_HOST=
DB_PORT=
DB_NAME=
SECRET_KEY=
ALGORITHM=To run the server, use the following command:
python main.py
The server will be running on http://127.0.0.1:8000/
Check the API documentation at http://12.0.0.1:8000/api/v1/docs
To run the tests, use the following command:
pytestTo run the server using docker, use the following commands:
docker build -t payment-gateway-api .
docker run --env-file .env p 8000:80 payment-gateway-apiOpen the file execute_sql.sh and replace the environment variables with the correct values for your database.
DB_NAME=
DB_USER=
DB_PASSWORD=
DB_HOST=For create the tables for the database, make it executable the file in folder script call execute_sql.sh with the following command in the terminal:
chmod +x execute_sql.shThen, execute the file with the following command:
./execute_sql.sh- FastAPI
- PostgreSQL
- Docker
- Pytest
- SQLAlchemy
