develop #3

Merged
kbe merged 227 commits from develop into main 2025-09-16 14:35:23 +00:00
2 changed files with 7 additions and 15 deletions
Showing only changes of commit d5326c7dc6 - Show all commits

View File

@@ -188,15 +188,8 @@ class OrdersController < ApplicationController
# Don't fail the payment process due to job scheduling issues
end
# Send confirmation emails
@order.tickets.each do |ticket|
begin
TicketMailer.purchase_confirmation(ticket).deliver_now
rescue => e
Rails.logger.error "Failed to send confirmation email for ticket #{ticket.id}: #{e.message}"
# Don't fail the entire payment process due to email/PDF generation issues
end
end
# Email confirmation is handled by the order model's mark_as_paid! method
# to avoid duplicate emails
# Clear session data
session.delete(:pending_cart)

View File

@@ -25,15 +25,14 @@ class OrderEmailTest < ActiveSupport::TestCase
assert @order.tickets.all? { |ticket| ticket.status == "active" }
end
test "email sending is part of the transaction" do
test "email sending failure does not prevent order completion" do
# Mock mailer to raise an error
TicketMailer.stubs(:purchase_confirmation_order).raises(StandardError.new("Email error"))
assert_raises(StandardError) do
# Should not raise error - email failure is logged but doesn't fail the payment
@order.mark_as_paid!
end
# Order should not be marked as paid if email fails
assert_equal "draft", @order.reload.status
# Order should still be marked as paid even if email fails
assert_equal "paid", @order.reload.status
end
end