2 Commits

Author SHA1 Message Date
kbe
b5c1846f2c fix(mailers): Include TicketsHelper in TicketMailer to make format_ticket_price available
- Add helper :tickets to TicketMailer to make format_ticket_price method available in mailer templates
- Fixes undefined method 'format_ticket_price' error in purchase confirmation emails
- Required after recent changes to support free tickets
2025-09-16 17:25:14 +02:00
kbe
04393add14 fix(tests): Remove service fee expectation from Stripe invoice test and fix duplicated keys in event view
- Update StripeInvoiceServiceTest to match the implementation that no longer adds service fees to customer invoices
- Remove duplicated Stimulus data attributes in events/show.html.erb that were causing warnings
- Align tests with the hybrid fee model where fees are deducted from promoter payouts
2025-09-16 17:22:00 +02:00
3 changed files with 6 additions and 19 deletions

View File

@@ -1,4 +1,6 @@
class TicketMailer < ApplicationMailer
helper :tickets
def purchase_confirmation_order(order)
@order = order
@user = order.user

View File

@@ -135,11 +135,9 @@
controller: "ticket-selection",
ticket_selection_target: "form",
ticket_selection_event_slug_value: @event.slug,
ticket_selection_event_id_value: @event.id,
ticket_selection_order_new_url_value: event_order_new_path(@event.slug, @event.id),
ticket_selection_store_cart_url_value: api_v1_store_cart_path,
ticket_selection_order_new_url_value: event_order_new_path(@event.slug, @event.id),
ticket_selection_store_cart_url_value: api_v1_store_cart_path
ticket_selection_event_id_value: @event.id,
ticket_selection_order_new_url_value: event_order_new_path(@event.slug, @event.id),
ticket_selection_store_cart_url_value: api_v1_store_cart_path
} do |form| %>
<div class="bg-gradient-to-br from-purple-50 to-indigo-50 rounded-2xl border border-purple-100 p-6 shadow-sm">

View File

@@ -210,25 +210,12 @@ class StripeInvoiceServiceTest < ActiveSupport::TestCase
}
}
expected_service_fee_line_item = {
customer: "cus_test123",
invoice: "in_test123",
amount: 100,
currency: "eur",
description: "Frais de service - Frais de traitement de la commande",
metadata: {
item_type: "service_fee",
amount_cents: 100
}
}
mock_invoice = mock("invoice")
mock_invoice.stubs(:id).returns("in_test123")
mock_invoice.stubs(:finalize_invoice).returns(mock_invoice)
mock_invoice.expects(:pay)
Stripe::Invoice.expects(:create).returns(mock_invoice)
Stripe::InvoiceItem.expects(:create).with(expected_ticket_line_item)
Stripe::InvoiceItem.expects(:create).with(expected_service_fee_line_item)
Stripe::InvoiceItem.expects(:create).with(expected_ticket_line_item) # Only for tickets, no service fee
result = @service.create_post_payment_invoice
assert_not_nil result