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

27
config/initializers/stripe.rb Executable file
View File

@@ -0,0 +1,27 @@
Rails.application.configure do
# Try to get Stripe keys from environment variables first, then from credentials
stripe_publishable_key = ENV["STRIPE_PUBLISHABLE_KEY"]
stripe_secret_key = ENV["STRIPE_SECRET_KEY"]
stripe_webhook_secret = ENV["STRIPE_WEBHOOK_SECRET"]
# If not in environment variables, try to get from credentials
if Rails.application.respond_to?(:credentials) && Rails.application.credentials.respond_to?(:stripe)
stripe_credentials = Rails.application.credentials.stripe
if stripe_credentials
stripe_publishable_key ||= stripe_credentials[:publishable_key] if stripe_credentials.key?(:publishable_key)
stripe_secret_key ||= stripe_credentials[:secret_key] if stripe_credentials.key?(:secret_key)
stripe_webhook_secret ||= stripe_credentials[:webhook_secret] if stripe_credentials.key?(:webhook_secret)
end
end
config.stripe = {
publishable_key: stripe_publishable_key,
secret_key: stripe_secret_key,
signing_secret: stripe_webhook_secret
}
end
# Only set the API key if it exists
if Rails.application.config.stripe[:secret_key].present?
Stripe.api_key = Rails.application.config.stripe[:secret_key]
end

View File

@@ -16,9 +16,15 @@ Rails.application.routes.draw do
get "dashboard", to: "pages#dashboard", as: "dashboard"
# Events
get "events", to: "events#index", as: "events"
get "events/:slug.:id", to: "events#show", as: "event"
post "events/:slug.:id/checkout", to: "events#checkout", as: "event_checkout"
get "events", to: "events#index", as: "events"
get "events/:slug.:id", to: "events#show", as: "event"
post "events/:slug.:id/checkout", to: "events#checkout", as: "event_checkout"
# Payment success
get "payments/success", to: "events#payment_success", as: "payment_success"
# Tickets
get "tickets/:ticket_id/download", to: "events#download_ticket", as: "download_ticket"
# Routes for devise authentication Gem
# Bind devise to user