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:
27
config/initializers/stripe.rb
Executable file
27
config/initializers/stripe.rb
Executable 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user