Files
astuto/app/workflows/create_stripe_customer.rb
Riccardo Graziosi bea146e612 Add billing (#329)
2024-05-03 18:11:07 +02:00

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