Add billing (#329)

This commit is contained in:
Riccardo Graziosi
2024-05-03 18:11:07 +02:00
committed by GitHub
parent fc36c967af
commit bea146e612
63 changed files with 1354 additions and 27 deletions

View File

@@ -0,0 +1,15 @@
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