Skip to content

Rewards users with gift cards when they consistently pay their credit card bills on time

Notifications You must be signed in to change notification settings

codedtt/Rewarding-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BON Rewards Simulation 🎁

This project simulates a reward system where users receive gift cards for paying their last 3 credit card bills on time.


πŸš€ Features

  • Create Users, Bills, and Rewards
  • Record bill payments with payment date
  • Track each bill’s due date and payment date
  • Reward users with a mock gift card if their last 3 bills are paid on or before the due date
  • Homepage endpoint displaying a welcome message
  • RESTful API built with FastAPI + SQLite or PostgreSQL

πŸ›  Tech Stack

  • Python 3.10+
  • FastAPI (API framework)
  • SQLAlchemy (ORM)
  • SQLite (for local dev) / PostgreSQL (for persistent cloud deployment)
  • Uvicorn (server)

πŸ“¦ Setup Instructions

1. Clone repo

git clone https://github.com/codedtt/Rewarding-System.git
cd bon-rewards

2. Create virtual environment

python -m venv venv

Activate it:
Windows (PowerShell):
.\venv\Scripts\activate

Linux / Mac:
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Run the server

API (Hosted on Render): πŸ‘‰ (https://rewarding-system.onrender.com/)  

Running Locally: 
uvicorn app:app --reload
API will be available at πŸ‘‰ (http://127.0.0.1:8000)

Docs: (http://127.0.0.1:8000/docs)

🏠 Homepage

The root endpoint displays a welcome message:

{
  "message": "πŸŽ‰ Welcome to the BON Rewards App! Pay your bills on time and earn rewards!"
}

πŸ“Š API Endpoints πŸ‘€ Users

  • POST /users/ β†’ Create a user

  • GET /users/ β†’ List all users

🧾 Bills

  • POST /bills/ β†’ Create a bill (define due_date)

  • GET /bills/ β†’ List all bills

πŸ’³ Payments

  • POST /payments/ β†’ Pay a bill

  • Requires bill_id, user_id, payment_date

🎁 Rewards

  • GET /rewards/ β†’ List all rewards

Reward automatically generated when last 3 bills are paid on/before due date.

πŸ§ͺ Example Test Flow

  1. Create User

  2. Create 3+ Bills

  3. Pay Bills on time

  4. Check Rewards endpoint

πŸ“Œ Notes

  • Rewards are mocked ($10 Amazon Gift Card).

  • Bills are evaluated based on due_date, not bill IDs.

  • Only the last 3 consecutive bills determine reward eligibility.

  • Use PostgreSQL for persistent cloud deployment; SQLite is suitable for local development only.

About

Rewards users with gift cards when they consistently pay their credit card bills on time

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages