wip: order checkout

This commit is contained in:
kbe
2025-09-02 02:56:23 +02:00
parent afe074c8a1
commit ca81d2360c
18 changed files with 893 additions and 292 deletions

View File

@@ -0,0 +1,23 @@
class ExpiredOrdersCleanupJob < ApplicationJob
queue_as :default
def perform
# Find and expire all draft orders that have passed their expiry time
expired_orders = Order.expired_drafts
Rails.logger.info "Found #{expired_orders.count} expired orders to process"
expired_orders.find_each do |order|
begin
order.expire_if_overdue!
Rails.logger.info "Expired order ##{order.id} for user ##{order.user_id}"
rescue => e
Rails.logger.error "Failed to expire order ##{order.id}: #{e.message}"
# Continue processing other orders even if one fails
next
end
end
Rails.logger.info "Completed expired orders cleanup job"
end
end