38 lines
1.1 KiB
Ruby
Raw Normal View History

2017-02-24 12:42:59 +11:00
# name: discourse-donations
# about: Integrates Stripe into Discourse to allow forum visitors to make donations
# version: 1.11.1
# url: https://github.com/chrisbeach/discourse-donations
2018-06-25 18:14:50 +10:00
# authors: Rimian Perkins, Chris Beach, Angus McLeod
2017-01-31 13:28:41 +11:00
2017-05-01 10:48:40 +10:00
gem 'stripe', '2.8.0'
register_asset "stylesheets/discourse-donations.scss"
2017-02-28 13:36:41 +11:00
enabled_site_setting :discourse_donations_enabled
2017-11-12 11:16:47 +08:00
register_html_builder('server:before-head-close') do
"<script src='https://js.stripe.com/v3/'></script>"
end
after_initialize do
2018-06-25 18:14:50 +10:00
load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
load File.expand_path('../config/routes.rb', __FILE__)
load File.expand_path('../app/controllers/controllers.rb', __FILE__)
2017-05-04 17:23:41 +10:00
load File.expand_path('../app/jobs/jobs.rb', __FILE__)
2018-06-25 18:14:50 +10:00
load File.expand_path('../app/services/services.rb', __FILE__)
Discourse::Application.routes.append do
mount ::DiscourseDonations::Engine, at: 'donate'
end
class ::User
def stripe_customer_id
if custom_fields['stripe_customer_id']
2018-06-21 19:00:43 +10:00
custom_fields['stripe_customer_id'].to_s
else
nil
end
end
end
end