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

@@ -469,7 +469,7 @@ class OrderTest < ActiveSupport::TestCase
assert_equal "active", ticket2.status
end
test "calculate_total! should sum ticket prices" do
test "calculate_total! should sum ticket prices plus 1€ service fee" do
order = Order.create!(
user: @user, event: @event, total_amount_cents: 0,
status: "draft", payment_attempts: 0
@@ -506,7 +506,7 @@ class OrderTest < ActiveSupport::TestCase
order.calculate_total!
order.reload
assert_equal 3000, order.total_amount_cents # 2 tickets * 1500 cents
assert_equal 3100, order.total_amount_cents # 2 tickets * 1500 cents + 100 cents (1€ fee)
end
# === Stripe Integration Tests (Mock) ===