From e26b73a57db0b0b5a877eecd19249cbc45583128 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Tue, 21 Mar 2017 12:49:31 +1100 Subject: [PATCH] fix tests, active user --- .../discourse_donations/charges_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/discourse_donations/charges_controller.rb b/app/controllers/discourse_donations/charges_controller.rb index 9de96ff..fc2b1c6 100644 --- a/app/controllers/discourse_donations/charges_controller.rb +++ b/app/controllers/discourse_donations/charges_controller.rb @@ -10,10 +10,8 @@ module DiscourseDonations Stripe.api_key = SiteSetting.discourse_donations_secret_key currency = SiteSetting.discourse_donations_currency - current_user = create_user(params) if current_user.nil? - customer = Stripe::Customer.create( - :email => current_user.email, + :email => params[:email] || current_user.email, :source => params[:stripeToken] ) @@ -24,6 +22,8 @@ module DiscourseDonations :currency => currency ) + create_user(params) if current_user.nil? + render :json => charge end @@ -34,7 +34,8 @@ private email: options[:email], username: options[:username], name: options[:name], - password: options[:password] + password: options[:password], + active: true ) end end