Skip to content

KovvalVeetil/credit-card-rewards-management

Repository files navigation

WIP - CREDIT CARD REWARDS MANAGEMENT SYSTEM

Key Features:

User Registration and Authentication: Users can sign up, log in, and manage their account. Role-based access (e.g., Admin, Customer Support, Customer).

Card Management: Users can register their credit cards. Card details are securely stored and validated.

Transaction Logging: Users can upload or log transactions manually. Transactions are associated with a specific credit card.

Reward Points Calculation: Based on transaction categories (e.g., travel, dining, etc.). Configurable reward rules for admins.

Points Redemption: Users can redeem points for rewards (e.g., cashback, vouchers).

DB MODEL

  1. Users
Column Type Constraints
id integer primary key
email string unique, indexed, not null
encrypted_password string not null, handled by Devise
role string values: customer, admin
created_at datetime
updated_at datetime
  1. CreditCards
Column Type Constraints
id integer primary key
user_id integer foreign key, indexed, not null
card_number string encrypted, not null
card_type string values: visa, mastercard, amex, etc.
expiry_date date not null
cardholder_name string not null
created_at datetime
updated_at datetime
  1. Transactions
Column Type Constraints
id integer primary key
credit_card_id integer foreign key, indexed, not null
amount decimal(10, 2) not null
category string values: travel, dining, shopping, etc.
transaction_date date not null
created_at datetime
updated_at datetime
  1. RewardRules
Column Type Constraints
id integer primary key
category string unique, not null
points_per_dollar decimal(5, 2) not null
created_at datetime
updated_at datetime
  1. Rewards
Column Type Constraints
id integer primary key
user_id integer foreign key, indexed, not null
points_balance integer default: 0, not null
created_at datetime
updated_at datetime
  1. Redemptions
Column Type Constraints
id integer primary key
user_id integer foreign key, indexed, not null
reward_item string not null
points_redeemed integer not null
created_at datetime
updated_at datetime

FLOW

  1. User Registration and Credit Card Setup User Sign-Up: A new user registers via the API with basic information (email, password, role). The user can log in, and their session is authenticated using Devise.

Credit Card Registration: A registered user adds a credit card by providing card details (card number, expiry date, name). The card details are encrypted and securely stored. The user can register multiple cards, each associated with the user.

  1. Transaction Logging Transaction Entry: A user logs a transaction through the system (either manually or via batch upload). Each transaction has the following:

Associated credit card. Amount spent. Category (e.g., travel, dining, etc.). Date of the transaction.

Transaction Validation: The system ensures the transaction is valid (e.g., positive amount, existing credit card). Transactions are linked to the correct credit card in the database.

  1. Rewards Calculation Fetching Reward Rules: The system fetches reward rules based on the transaction category. Reward rules specify how many points a user earns per dollar spent in each category.

Calculating Points: For each logged transaction, points are calculated using the rule for the transaction’s category. Formula: points = amount_spent * points_per_dollar Example: For dining with points_per_dollar = 1.5, a $100 dining transaction would earn 100 * 1.5 = 150 points.

Updating User Points: The calculated points are added to the user’s total points balance in the Rewards table. The points are cumulative, increasing with each new transaction.

  1. Points Redemption User Request for Redemption: A user requests to redeem points (e.g., for cashback or a voucher). The system checks the user’s current points balance in the Rewards table.

Validation: The system ensures the user has enough points to redeem. Example: If a user wants to redeem 500 points, they must have at least 500 points in their balance.

Reward Catalog: The system provides a catalog of available rewards (cashback, gift cards, etc.). Each reward option has a required number of points for redemption (e.g., 500 points = $5 cashback, 1000 points = $10 voucher).

Redemption Process: The system deducts the redeemed points from the user’s balance. A record of the redemption is logged in the Redemptions table, storing: User ID Reward item (e.g., cashback, voucher) Points redeemed

  1. Admin Control Reward Rules Management: Admins can modify reward rules (e.g., adjust points per dollar for certain categories). Admins can set new reward items in the catalog (e.g., add more reward tiers or update cashback offers).

Analytics: Admins can access analytics to track system usage: Total points redeemed by all users. Points balance per user. Popular reward categories.

About

It's a credit card rewards program management system

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages