mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
Add billing (#329)
This commit is contained in:
committed by
GitHub
parent
fc36c967af
commit
bea146e612
15
app/workflows/create_stripe_customer.rb
Normal file
15
app/workflows/create_stripe_customer.rb
Normal 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
|
||||
Reference in New Issue
Block a user