Skip to content

About

Streamlit hotel booking flow: browse rooms, validate payment cards, add upgrades, and generate a PDF reservation ticket.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

36 Commits

Folders and files

Repository files navigation

🏨 Luxury Booking Engine

A full-featured hotel booking application built with Python and Streamlit.
Browse hotels, validate payment cards, add spa upgrades, and receive a generated PDF reservation ticket — all in one polished dark UI.

Python Streamlit pandas fpdf2 OOP



✨ Features

  • 🏩 Hotel Cards: Each hotel displays name, city, rating, price per night, amenities, and availability status in a glassmorphism card.
  • 💳 Card Validation: Credit card details (number, expiry, holder, CVC) are validated against a CSV dataset before any booking is confirmed.
  • 🔐 2-Step Authentication: SecureCreditCard adds a password check on top of standard validation — no booking without both passing.
  • 🧖 Spa Upgrade: Eligible hotels offer an optional VIP Spa add-on, handled via the SpaHotel subclass.
  • 📄 PDF Ticket Generation: A formatted A4 reservation statement is generated with fpdf2 and offered as a download after booking.
  • 🎨 Premium Dark UI: Animated gradient background, glassmorphism cards, hover effects — all injected via styles.py.

🧠 Architecture

The app is split into focused classes, keeping business logic separate from the UI layer.

Hotel & SpaHotel — Inheritance

SpaHotel extends Hotel with spa booking functionality — demonstrating OOP inheritance cleanly:

class SpaHotel(Hotel):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.spa_included = False

    def book_spa(self):
        self.spa_included = True

CreditCard & SecureCreditCard — Two-Layer Validation

Standard card data is validated against cards.csv. The secure subclass adds a password layer checked against card-security.csv:

class SecureCreditCard(CreditCard):
    def authenticate(self, given_password, df_security_dict):
        if self.number in df_security_dict:
            return df_security_dict[self.number] == given_password
        return False

BaseTicket & ReservationTicket — Abstract Base Class

BaseTicket is an ABC that handles all PDF layout logic. ReservationTicket only needs to implement generate_text() — keeping the PDF generation reusable:

class BaseTicket(ABC):
    @abstractmethod
    def generate_text(self) -> str:
        pass

    def generate_pdf(self, filename="ticket.pdf"):
        # Full A4 PDF layout with header, table, totals, footer...

📁 Project Structure

Hotel-Booking/
├── data/
│   ├── hotels.csv          # Hotel data — name, city, price, rating, amenities
│   ├── cards.csv           # Valid card data for payment validation
│   └── card-security.csv   # Card passwords for 2-step authentication
├── modules/
│   ├── __init__.py
│   ├── hotel.py            # Hotel & SpaHotel classes
│   ├── payment.py          # CreditCard & SecureCreditCard classes
│   └── ticket.py           # BaseTicket (ABC) & ReservationTicket
├── utils/
│   ├── __init__.py
│   └── styles.py           # Injected CSS — dark theme & glassmorphism
├── main.py                 # Streamlit UI & booking flow
├── requirements.txt
└── README.md

🚀 Getting Started

  1. Clone the repository:

    git clone https://github.com/AndrewTechTips/Luxury-Booking-Engine.git
    cd Luxury-Booking-Engine
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the app:

    streamlit run main.py

📬 Contact

"Thank you for choosing absolute excellence. Enjoy your travels." 🌍

About

Streamlit hotel booking flow: browse rooms, validate payment cards, add upgrades, and generate a PDF reservation ticket.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages