feat: Add manual payout system for countries without Stripe Global Payouts
This commit is contained in:
@@ -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 ===
|
||||
|
||||
Reference in New Issue
Block a user