feat: Implement complete event ticketing system with Stripe integration and email confirmations

- Enhanced events index page with improved visual design and better information display
- Completely redesigned event show page with modern layout, ticket selection, and checkout functionality
- Implemented Stripe payment processing for ticket purchases
- Created ticket generation system with PDF tickets and QR codes
- Added email confirmation system with ticket attachments
- Updated database configuration to use SQLite for easier development setup
- Fixed gem dependencies and resolved conflicts
- Improved error handling throughout the checkout process
- Enhanced Stimulus controller for ticket cart management
- Added proper redirect handling for successful and cancelled payments
This commit is contained in:
kbe
2025-08-28 18:03:48 +02:00
parent 49ad935855
commit 4e2445198f
23 changed files with 1376 additions and 279 deletions

205
README.md
View File

@@ -4,76 +4,209 @@
## 🌃 Overview
**Aperonight** is a two-sided marketplace connecting event-goers with nightlife promoters in Paris. The platform allows:
- **Customers** to discover/book tickets for upcoming events
- **Promoters** to create/manage events and validate tickets at venue entrances
**Aperonight** is a comprehensive ticket selling system that connects event-goers with event organizers. The platform provides a complete solution for event booking, payment processing, and ticket management.
## 🎯 Key Features
### For Event-Goers
✔ Browse upcoming events with filters (date, location, music genre)
✔ Book tickets with multiple bundle options (VIP, group passes, etc.)
Secure payment processing (credit cards, Apple/Google Pay)
✔ Mobile-friendly e-tickets with QR codes
**User Dashboard** - Personalized metrics showing booked events, upcoming events, and event statistics
**Event Discovery** - Browse upcoming events with detailed information and venue details
**Secure Booking** - Multiple ticket types per event with quantity selection
**Stripe Integration** - Secure payment processing with credit/debit cards
**PDF Tickets** - Automatically generated tickets with unique QR codes for each purchase
**Download System** - Instant PDF ticket downloads after successful payment
### For Promoters
Event creation dashboard with ticket type customization
✔ Real-time ticket validation via mobile scanning
Sales analytics and attendee tracking
✔ Automatic aggregation of events from partner platforms
### For Event Organizers
**Event Management** - Create and manage events with detailed information
**Ticket Type Configuration** - Set up multiple ticket types with different pricing
**Sales Tracking** - Monitor ticket sales and availability
**User Authentication** - Secure user registration and login system
### Technical Implementation
**Payment Processing** - Full Stripe Checkout integration with session management
**PDF Generation** - Custom PDF tickets with QR codes using Prawn library
**Responsive Design** - Mobile-friendly interface with Tailwind CSS
**Database Relations** - Proper user-event-ticket relationships
## 🛠 Technical Stack
### Backend
- **Ruby on Rails 7** (API mode)
- **MariaDB** database
<!--- **Redis** for caching/background jobs-->
- **ActiveJob** for background processing
- **Ruby on Rails 8.0+** with Hotwire for reactive UI
- **MySQL** database with comprehensive migrations
- **Devise** for user authentication and session management
- **Kaminari** for pagination
### Frontend
- **Hotwire (Turbo + Stimulus)** for reactive UI
- **Tailwind CSS** for styling
- **React Native** for promoter mobile app (ticket scanning)
- **Hotwire (Turbo + Stimulus)** for interactive JavaScript behavior
- **Tailwind CSS** for responsive styling and modern UI
- **JavaScript Controllers** for cart management and checkout flow
### Key Integrations
- **Stripe Connect** for payments & promoter payouts
- **Shogun/Bizouk/Weezevent APIs** for event aggregation
<!--- **Twilio** for SMS ticket delivery-->
<!--- **AWS S3** for media storage-->
- **Stripe** for secure payment processing and checkout sessions
- **Prawn & Prawn-QRCode** for PDF ticket generation
- **RQRCode** for unique QR code generation per ticket
## 📊 Database Schema (Simplified)
## 📊 Database Schema
```mermaid
erDiagram
USER ||--o{ BOOKING : makes
USER ||--o{ EVENT : creates
USER ||--o{ TICKET : purchases
USER {
integer id
string email
string encrypted_password
}
PROMOTER ||--o{ EVENT : creates
PROMOTER {
integer id
string stripe_account_id
string first_name
string last_name
}
EVENT ||--o{ TICKET_TYPE : has
EVENT {
integer id
integer user_id
string name
string slug
text description
string venue_name
string venue_address
decimal latitude
decimal longitude
datetime start_time
}
BOOKING ||--o{ TICKET : generates
BOOKING {
integer id
decimal total_price
datetime end_time
string state
boolean featured
string image
}
TICKET_TYPE ||--o{ TICKET : defines
TICKET_TYPE {
integer id
integer event_id
string name
text description
integer price_cents
integer quantity
datetime sale_start_at
datetime sale_end_at
boolean requires_id
integer minimum_age
}
TICKET {
integer id
integer user_id
integer ticket_type_id
string qr_code
integer price_cents
string status
}
```
## 🚀 Getting Started
### Prerequisites
- Ruby 3.4+
- Rails 8.0+
- MySQL/MariaDB
- Node.js 18+ (for asset compilation)
- Stripe account (for payment processing)
### Installation
1. **Clone the repository**
```bash
git clone https://github.com/yourusername/aperonight.git
cd aperonight
```
2. **Install dependencies**
```bash
bundle install
npm install
```
3. **Database setup**
```bash
rails db:create
rails db:migrate
rails db:seed
```
4. **Configure environment variables**
Create a `.env` file or configure Rails credentials:
```bash
# Stripe configuration
STRIPE_PUBLISHABLE_KEY=pk_test_your_key_here
STRIPE_SECRET_KEY=sk_test_your_key_here
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
# Database configuration (if not using defaults)
DATABASE_URL=mysql2://username:password@localhost/aperonight_development
```
5. **Start the development server**
```bash
rails server
```
Visit `http://localhost:3000` to see the application running.
## 💳 Payment Configuration
### Setting up Stripe
1. Create a Stripe account at [stripe.com](https://stripe.com)
2. Get your API keys from the Stripe Dashboard
3. Add your keys to the Rails credentials or environment variables
4. Configure webhook endpoints for payment confirmations:
- Endpoint URL: `your-domain.com/stripe/webhooks`
- Events: `checkout.session.completed`, `payment_intent.succeeded`
## 🎫 Core Functionality
### User Flow
1. **Registration/Login** - Users create accounts or sign in
2. **Event Discovery** - Browse events from the homepage or events page
3. **Ticket Selection** - Choose ticket types and quantities
4. **Checkout** - Secure payment through Stripe Checkout
5. **Ticket Generation** - Automatic PDF ticket generation with QR codes
6. **Download** - Instant ticket download after payment
### Event Management
1. **Event Creation** - Create events with full details and images
2. **Ticket Types** - Configure multiple ticket types with pricing
3. **Sales Tracking** - Monitor ticket sales through the dashboard
### Dashboard Features
- **Personal Metrics** - View booked events and upcoming events
- **Event Sections** - Today's events, tomorrow's events, and upcoming events
- **Quick Actions** - Easy navigation to event discovery and booking
## 🔧 Development
### Key Files Structure
```
app/
├── controllers/
│ ├── events_controller.rb # Event listing, booking, checkout
│ └── pages_controller.rb # Dashboard and static pages
├── models/
│ ├── user.rb # User authentication with Devise
│ ├── event.rb # Event management and states
│ ├── ticket_type.rb # Ticket configuration
│ └── ticket.rb # Ticket generation with QR codes
├── services/
│ └── ticket_pdf_generator.rb # PDF ticket generation service
└── views/
├── events/
│ ├── show.html.erb # Event details and booking
│ └── payment_success.html.erb # Post-purchase confirmation
└── pages/
└── dashboard.html.erb # User dashboard with metrics
```
### Key Routes
- `GET /` - Homepage
- `GET /dashboard` - User dashboard (authenticated)
- `GET /events` - Event listings
- `GET /events/:slug.:id` - Event details and booking
- `POST /events/:slug.:id/checkout` - Stripe checkout initiation
- `GET /payment/success` - Payment confirmation
- `GET /tickets/:ticket_id/download` - PDF ticket download