refactor(pricing): implement hybrid fee model (€0.50 + 1.5%) deducted from promoter payout

- Remove 1€ fixed fee from orders and Stripe invoices
- Add platform_fee_cents, promoter_payout_cents methods to Order model
- Update views to show clean ticket totals without added fees
- Update tests for new fee calculation logic
- Update pricing docs with implemented model
This commit is contained in:
kbe
2025-09-15 20:07:51 +02:00
parent d6184b6c84
commit 049e5505ef
9 changed files with 205 additions and 108 deletions

View File

@@ -88,11 +88,32 @@ class Order < ApplicationRecord
end
end
# Calculate total from tickets plus 1€ service fee
# Calculate total from ticket prices only (platform fee deducted from promoter payout)
def calculate_total!
ticket_total = tickets.sum(:price_cents)
fee_cents = 100 # 1€ in cents
update!(total_amount_cents: ticket_total + fee_cents)
update!(total_amount_cents: ticket_total)
end
# Platform fee: €0.50 fixed + 1.5% of ticket price, per ticket
def platform_fee_cents
tickets.sum do |ticket|
fixed_fee = 50 # €0.50 in cents
percentage_fee = (ticket.price_cents * 0.015).to_i
fixed_fee + percentage_fee
end
end
# Promoter payout amount after platform fee deduction
def promoter_payout_cents
total_amount_cents - platform_fee_cents
end
def platform_fee_euros
platform_fee_cents / 100.0
end
def promoter_payout_euros
promoter_payout_cents / 100.0
end
# Create Stripe invoice for accounting records