mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
* Add tour * Add instructions to set password for OAuth users * Tenant signup improvement * Fix bug on user soft delete * Slighlty darken background color * Add a stronger confirmation for board deletion
19 lines
462 B
Ruby
19 lines
462 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,
|
|
metadata: {
|
|
site_name: tenant.site_name,
|
|
subdomain: tenant.subdomain,
|
|
},
|
|
})
|
|
tb = TenantBilling.first_or_create
|
|
tb.update!(customer_id: customer.id)
|
|
end
|
|
end |