refactor: prepare for free ticket
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user