Merge newer features and remove legacy code
This commit is contained in:
@@ -60,22 +60,6 @@ class Admin::PayoutsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# Mark a payout as manually processed (for SEPA transfers, etc.)
|
||||
def mark_as_manually_processed
|
||||
@payout = Payout.find(params[:id])
|
||||
|
||||
if @payout.pending? || @payout.processing?
|
||||
begin
|
||||
@payout.mark_as_manually_processed!
|
||||
redirect_to admin_payouts_path, notice: "Payout marked as manually processed. Please complete the bank transfer."
|
||||
rescue => e
|
||||
redirect_to admin_payouts_path, alert: "Failed to mark payout as manually processed: #{e.message}"
|
||||
end
|
||||
else
|
||||
redirect_to admin_payouts_path, alert: "Cannot mark this payout as manually processed."
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_payout
|
||||
|
||||
@@ -141,23 +141,6 @@ class Payout < ApplicationRecord
|
||||
)
|
||||
end
|
||||
|
||||
# Mark payout as manually processed (for countries where Stripe payouts are not available)
|
||||
def mark_as_manually_processed!
|
||||
return unless pending? || processing?
|
||||
|
||||
update!(
|
||||
status: :completed,
|
||||
stripe_payout_id: "MANUAL_#{SecureRandom.hex(10)}" # Generate a unique ID for manual payouts
|
||||
)
|
||||
|
||||
update_earnings_status
|
||||
end
|
||||
|
||||
# Check if this is a manual payout (not processed through Stripe)
|
||||
def manual_payout?
|
||||
stripe_payout_id.present? && stripe_payout_id.start_with?("MANUAL_")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_earnings_status
|
||||
|
||||
@@ -3,12 +3,6 @@ class PayoutService
|
||||
@payout = payout
|
||||
end
|
||||
|
||||
# Legacy method for backward compatibility - now redirects to manual workflow
|
||||
def process!
|
||||
Rails.logger.warn "PayoutService#process! called - manual processing required for payout #{@payout.id}"
|
||||
raise "Automatic payout processing is disabled. Use manual workflow in admin interface."
|
||||
end
|
||||
|
||||
# Check if user is in France or doesn't have a Stripe account (manual processing)
|
||||
def process_with_stripe_or_manual
|
||||
if should_process_manually?
|
||||
@@ -64,7 +58,7 @@ class PayoutService
|
||||
begin
|
||||
# For manual processing, we just mark it as completed
|
||||
# In a real implementation, this would trigger notifications to admin
|
||||
@payout.mark_as_manually_processed!
|
||||
@payout.mark_completed!(User.admin.first || User.first, "Manual processing completed")
|
||||
|
||||
Rails.logger.info "Manual payout processed for payout #{@payout.id} for event #{@payout.event.name}"
|
||||
rescue => e
|
||||
|
||||
Reference in New Issue
Block a user