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

@@ -0,0 +1,35 @@
class StripeConnectService
def self.create_account(user)
return if user.stripe_connected_account_id.present?
account = Stripe::Account.create(
type: 'express',
country: 'FR',
email: user.email,
capabilities: {
card_payments: {requested: true},
transfers: {requested: true}
}
)
user.update!(stripe_connected_account_id: account.id)
account
end
def self.onboarding_link(user)
return unless user.stripe_connected_account_id.present?
account_link = Stripe::AccountLink.create(
account: user.stripe_connected_account_id,
refresh_url: Rails.application.routes.url_helpers.promoter_stripe_refresh_url,
return_url: Rails.application.routes.url_helpers.promoter_stripe_return_url,
type: 'account_onboarding'
)
account_link.url
end
def self.get_account_details(account_id)
Stripe::Account.retrieve(account_id)
end
end