set some env vars and create some stripe account stuff
This commit is contained in:
parent
ad44f38d69
commit
853c94a72e
|
@ -1,7 +1,30 @@
|
|||
module Choice
|
||||
class ChoiceController < Choice::ApplicationController
|
||||
def create
|
||||
head 200
|
||||
@badge = consumer_defender_badge
|
||||
@user = @discourse_api.client.user
|
||||
|
||||
customer = Stripe::Customer.create(
|
||||
:email => params[:stripeEmail],
|
||||
:source => params[:stripeToken]
|
||||
)
|
||||
|
||||
charge = Stripe::Charge.create(
|
||||
:customer => customer.id,
|
||||
:amount => params[:amount],
|
||||
:description => 'Consumer Defender',
|
||||
:currency => 'aud'
|
||||
)
|
||||
|
||||
|
||||
|
||||
head :created
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def consumer_defender_badge
|
||||
Discourse.badges['badges'].select { |b| b['name'] == 'Consumer Defender' }.first
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
11
plugin.rb
11
plugin.rb
|
@ -1,10 +1,17 @@
|
|||
# name: choice-plugin
|
||||
# about: Integrating CHOICE with Discourse
|
||||
# version: 0.0.2
|
||||
# about: Integrating Discourse with Stripe
|
||||
# version: 0.0.3
|
||||
# authors: Rimian Perkins
|
||||
|
||||
gem 'stripe', '1.58.0'
|
||||
|
||||
Rails.configuration.stripe = {
|
||||
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
|
||||
:secret_key => ENV['STRIPE_SECRET_KEY']
|
||||
}
|
||||
|
||||
Stripe.api_key = Rails.configuration.stripe[:secret_key]
|
||||
|
||||
module ::Choice
|
||||
class Engine < ::Rails::Engine
|
||||
engine_name 'choice'
|
||||
|
|
Loading…
Reference in New Issue