2019-09-11 05:55:35 -04:00
|
|
|
# frozen_string_literal: true
|
2019-09-11 05:27:24 -04:00
|
|
|
|
2019-09-11 19:25:06 -04:00
|
|
|
# name: discourse-patrons
|
2019-09-23 03:53:05 -04:00
|
|
|
# about: Integrates Stripe into Discourse to allow visitors to make payments and Subscribe
|
2019-10-16 21:08:48 -04:00
|
|
|
# version: 1.3.0
|
2019-09-11 05:18:30 -04:00
|
|
|
# url: https://github.com/rimian/discourse-patrons
|
2019-09-11 05:11:02 -04:00
|
|
|
# authors: Rimian Perkins
|
2017-01-30 21:28:41 -05:00
|
|
|
|
2019-09-10 23:19:07 -04:00
|
|
|
enabled_site_setting :discourse_patrons_enabled
|
2017-01-31 19:35:21 -05:00
|
|
|
|
2019-10-15 23:15:01 -04:00
|
|
|
gem 'stripe', '5.7.1'
|
2019-09-11 05:18:30 -04:00
|
|
|
|
2019-09-11 07:14:48 -04:00
|
|
|
register_asset "stylesheets/common/discourse-patrons.scss"
|
|
|
|
register_asset "stylesheets/mobile/discourse-patrons.scss"
|
|
|
|
|
2019-09-11 05:18:30 -04:00
|
|
|
register_html_builder('server:before-head-close') do
|
|
|
|
"<script src='https://js.stripe.com/v3/'></script>"
|
|
|
|
end
|
|
|
|
|
|
|
|
extend_content_security_policy(
|
|
|
|
script_src: ['https://js.stripe.com/v3/']
|
|
|
|
)
|
|
|
|
|
2019-10-08 06:59:20 -04:00
|
|
|
add_admin_route 'discourse_patrons.title', 'discourse-patrons.dashboard'
|
2019-09-13 22:56:28 -04:00
|
|
|
|
|
|
|
Discourse::Application.routes.append do
|
2019-10-17 20:54:49 -04:00
|
|
|
get '/admin/plugins/discourse-patrons' => 'admin/plugins#index'
|
2019-10-08 06:59:20 -04:00
|
|
|
get '/admin/plugins/discourse-patrons/dashboard' => 'admin/plugins#index'
|
2019-10-14 00:39:24 -04:00
|
|
|
get '/admin/plugins/discourse-patrons/products' => 'admin/plugins#index'
|
|
|
|
get '/admin/plugins/discourse-patrons/products/:product_id' => 'admin/plugins#index'
|
2019-09-23 01:01:03 -04:00
|
|
|
get '/admin/plugins/discourse-patrons/subscriptions' => 'admin/plugins#index'
|
2019-09-24 01:18:58 -04:00
|
|
|
get '/admin/plugins/discourse-patrons/plans' => 'admin/plugins#index'
|
|
|
|
get '/admin/plugins/discourse-patrons/plans/:plan_id' => 'admin/plugins#index'
|
2019-09-13 22:56:28 -04:00
|
|
|
end
|
|
|
|
|
2019-09-11 03:13:12 -04:00
|
|
|
after_initialize do
|
2019-10-15 08:14:04 -04:00
|
|
|
::Stripe.api_version = "2019-10-08"
|
2019-10-16 21:08:48 -04:00
|
|
|
::Stripe.set_app_info('Discourse Patrons', version: '1.3.0', url: 'https://github.com/rimian/discourse-patrons')
|
2019-09-11 07:14:48 -04:00
|
|
|
|
2019-09-12 23:52:41 -04:00
|
|
|
[
|
|
|
|
"../lib/discourse_patrons/engine",
|
|
|
|
"../config/routes",
|
2019-09-24 06:44:51 -04:00
|
|
|
"../app/controllers/concerns/stripe",
|
2019-09-13 22:56:28 -04:00
|
|
|
"../app/controllers/admin_controller",
|
2019-09-24 02:04:42 -04:00
|
|
|
"../app/controllers/admin/plans_controller",
|
2019-10-14 22:18:25 -04:00
|
|
|
"../app/controllers/admin/products_controller",
|
2019-09-23 03:53:05 -04:00
|
|
|
"../app/controllers/admin/subscriptions_controller",
|
2019-10-10 21:26:01 -04:00
|
|
|
"../app/controllers/customers_controller",
|
2019-09-12 23:52:41 -04:00
|
|
|
"../app/controllers/patrons_controller",
|
2019-10-09 22:52:55 -04:00
|
|
|
"../app/controllers/plans_controller",
|
2019-10-13 18:52:43 -04:00
|
|
|
"../app/controllers/subscriptions_controller",
|
2019-09-12 23:52:41 -04:00
|
|
|
"../app/models/payment",
|
2019-09-13 22:56:28 -04:00
|
|
|
"../app/serializers/payment_serializer",
|
2019-09-12 23:52:41 -04:00
|
|
|
].each { |path| require File.expand_path(path, __FILE__) }
|
|
|
|
|
2019-09-11 04:32:09 -04:00
|
|
|
Discourse::Application.routes.append do
|
|
|
|
mount ::DiscoursePatrons::Engine, at: 'patrons'
|
|
|
|
end
|
2017-02-16 21:15:32 -05:00
|
|
|
end
|