feat: Add manual payout system for countries without Stripe Global Payouts

This commit is contained in:
kbe
2025-09-17 08:35:20 +02:00
parent 3c1e17c2af
commit c74140c431
12 changed files with 375 additions and 28 deletions

View File

@@ -82,6 +82,30 @@ class Payout < ApplicationRecord
service = PayoutService.new(self)
service.process!
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
event.earnings.where(status: 0).update_all(status: 1) # pending to paid
end
public
# === Instance Methods ===