feat: complete promoter payout system with Stripe Connect onboarding

This commit is contained in:
kbe
2025-09-16 23:53:04 +02:00
parent d922d7304d
commit bc09feafc1
5 changed files with 155 additions and 5 deletions

View File

@@ -1,10 +1,32 @@
class Promoter::PayoutsController < ApplicationController
before_action :authenticate_user!
before_action :ensure_promoter
def index
@events = current_user.events.includes(:earnings).order(start_time: :desc)
end
def show
@event = current_user.events.find(params[:id])
@earnings = @event.earnings
end
def create
@event = current_user.events.find(params[:event_id] || params[:id])
if @event.can_request_payout?
PayoutService.new.process_event_payout(@event)
redirect_to promoter_payout_path(@event), notice: "Payout requested successfully. It will be processed shortly."
else
redirect_to promoter_payouts_path, alert: "Cannot request payout: #{@event.can_request_payout? ? '' : 'Event not eligible for payout.'}"
end
end
private
def ensure_promoter
unless current_user.promoter?
redirect_to dashboard_path, alert: "Access denied. Promoter account required."
end
end
end