mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 03:07:52 +01:00
15 lines
361 B
Ruby
15 lines
361 B
Ruby
|
|
require 'stripe'
|
||
|
|
|
||
|
|
class CreateStripeCustomer
|
||
|
|
def run
|
||
|
|
tenant = Current.tenant_or_raise! # check that Current Tenant is set
|
||
|
|
owner = User.find_by(role: 'owner')
|
||
|
|
|
||
|
|
customer = Stripe::Customer.create({
|
||
|
|
email: owner.email,
|
||
|
|
name: owner.full_name,
|
||
|
|
})
|
||
|
|
tb = TenantBilling.first_or_create
|
||
|
|
tb.update!(customer_id: customer.id)
|
||
|
|
end
|
||
|
|
end
|