From 04393add1449a727971bc9fbeaa9c7a887710996 Mon Sep 17 00:00:00 2001 From: kbe Date: Tue, 16 Sep 2025 17:22:00 +0200 Subject: [PATCH] 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 --- app/views/events/show.html.erb | 8 +++----- test/services/stripe_invoice_service_test.rb | 15 +-------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/app/views/events/show.html.erb b/app/views/events/show.html.erb index 02f8dd1..00ccc34 100755 --- a/app/views/events/show.html.erb +++ b/app/views/events/show.html.erb @@ -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| %>
diff --git a/test/services/stripe_invoice_service_test.rb b/test/services/stripe_invoice_service_test.rb index 60e914e..ebbd7d2 100644 --- a/test/services/stripe_invoice_service_test.rb +++ b/test/services/stripe_invoice_service_test.rb @@ -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