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

@@ -33,5 +33,33 @@ module App
def posts_per_page
15
end
def trial_period_days
ENV.key?("TRIAL_PERIOD_DAYS") ? ENV["TRIAL_PERIOD_DAYS"].to_i.days : 7.days
end
def stripe_secret_key
ENV["STRIPE_SECRET_KEY"]
end
def stripe_public_key
ENV["STRIPE_PUBLIC_KEY"]
end
def stripe_endpoint_secret
ENV["STRIPE_ENDPOINT_SECRET"]
end
def stripe_manage_subscription_url
ENV["STRIPE_MANAGE_SUBSCRIPTION_URL"]
end
def stripe_monthly_lookup_key
ENV["STRIPE_MONTHLY_LOOKUP_KEY"]
end
def stripe_yearly_lookup_key
ENV["STRIPE_YEARLY_LOOKUP_KEY"]
end
end
end

View File

@@ -58,8 +58,7 @@ Rails.application.configure do
end
config.action_mailer.default_options = {
from: ENV.fetch("EMAIL_MAIL_FROM", "Astuto <notifications@astuto.io>"),
reply_to: ENV.fetch("EMAIL_MAIL_REPLY_TO", ENV.fetch("EMAIL_MAIL_FROM", "Astuto <notifications@astuto.io>"))
reply_to: "noreply@astuto.io"
}
# Store uploaded files on the local file system (see config/storage.yml for options).

View File

@@ -82,8 +82,7 @@ Rails.application.configure do
end
config.action_mailer.default_options = {
from: ENV.fetch("EMAIL_MAIL_FROM", "Astuto <notifications@astuto.io>"),
reply_to: ENV.fetch("EMAIL_MAIL_REPLY_TO", ENV.fetch("EMAIL_MAIL_FROM", "Astuto <notifications@astuto.io>"))
reply_to: "noreply@astuto.io"
}
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to

View File

@@ -11,5 +11,6 @@ RESERVED_SUBDOMAINS = [
'dashboard',
'analytics',
'cname',
'whatever'
'whatever',
'billing'
]

View File

@@ -0,0 +1,3 @@
require 'stripe'
Stripe.api_key = Rails.application.stripe_secret_key

View File

@@ -79,6 +79,8 @@ en:
log_in: 'Log in / Sign up'
roadmap:
title: 'Roadmap'
billing:
title: 'Billing'
blocked_tenant:
title: 'This feedback space has been blocked'
board:

View File

@@ -10,6 +10,14 @@ Rails.application.routes.draw do
resource :tenants, only: [:create]
end
constraints subdomain: 'billing' do
get '/billing', to: 'billing#index'
get '/billing/return', to: 'billing#return'
post '/create_checkout_session', to: 'billing#create_checkout_session'
get '/session_status', to: 'billing#session_status'
post '/webhook', to: 'billing#webhook'
end
end
constraints subdomain: /.*/ do
@@ -19,6 +27,8 @@ Rails.application.routes.draw do
get '/pending-tenant', to: 'static_pages#pending_tenant'
get '/blocked-tenant', to: 'static_pages#blocked_tenant'
get '/request_billing_page', to: 'billing#request_billing_page'
devise_for :users, :controllers => {
:registrations => 'registrations',
:sessions => 'sessions'