Add 1€ service fee to all order-related pages and Stripe integration

- Added 1€ service fee to order total calculation in Order model
- Updated checkout page to display fee breakdown (subtotal + 1€ fee = total)
- Updated payment success page to show fee breakdown
- Updated order show page to display fee breakdown
- Updated payment cancel page to show fee breakdown
- Modified Stripe session creation to include service fee as separate line item
- Updated order model tests to account for the 1€ service fee
- Enhanced overall pricing transparency for users

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
kbe
2025-09-07 01:29:24 +02:00
parent cc03bfad49
commit 0ede98efa4
7 changed files with 79 additions and 24 deletions

View File

@@ -88,9 +88,11 @@ class Order < ApplicationRecord
end
end
# Calculate total from tickets
# Calculate total from tickets plus 1€ service fee
def calculate_total!
update!(total_amount_cents: tickets.sum(:price_cents))
ticket_total = tickets.sum(:price_cents)
fee_cents = 100 # 1€ in cents
update!(total_amount_cents: ticket_total + fee_cents)
end
# Create Stripe invoice for accounting records