- Add 30-minute expiry window for draft tickets with automatic cleanup - Implement 3-attempt payment retry mechanism with tracking - Create background job for cleaning expired draft tickets every 10 minutes - Add comprehensive UI warnings for expiring tickets and retry attempts - Enhance dashboard to display pending draft tickets with retry options - Add payment cancellation handling with smart retry redirections - Include rake tasks for manual cleanup and statistics - Add database fields: expires_at, payment_attempts, last_payment_attempt_at, stripe_session_id - Fix payment attempt counter display to show correct attempt number (1/3, 2/3, 3/3)
15 lines
404 B
Ruby
15 lines
404 B
Ruby
class CleanupExpiredDraftsJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform
|
|
expired_count = 0
|
|
|
|
Ticket.expired_drafts.find_each do |ticket|
|
|
Rails.logger.info "Expiring draft ticket #{ticket.id} for user #{ticket.user_id}"
|
|
ticket.expire_if_overdue!
|
|
expired_count += 1
|
|
end
|
|
|
|
Rails.logger.info "Expired #{expired_count} draft tickets" if expired_count > 0
|
|
end
|
|
end |