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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user