refactor: prepare for free ticket

This commit is contained in:
kbe
2025-09-16 16:36:39 +02:00
parent b228d5a174
commit 9c56b2e1e5
15 changed files with 96 additions and 17 deletions

View File

@@ -126,6 +126,15 @@ class OrdersController < ApplicationController
@total_amount = @order.total_amount_cents
@expiring_soon = @order.expiring_soon?
# For free orders, automatically mark as paid and redirect to success
if @order.free?
@order.mark_as_paid!
session.delete(:pending_cart)
session.delete(:ticket_names)
session.delete(:draft_order_id)
return redirect_to order_path(@order), notice: "Vos billets gratuits ont été confirmés !"
end
# Create Stripe checkout session if Stripe is configured
if Rails.application.config.stripe[:secret_key].present?
begin