From c091676cb5a47462029c8f8cd800a03beb6f82bd Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Thu, 18 May 2017 10:46:11 +1000 Subject: [PATCH] permit stripe token and amount --- app/controllers/discourse_donations/charges_controller.rb | 2 +- assets/javascripts/discourse/components/stripe-card.js.es6 | 3 +-- .../controllers/discourse_donations/charges_controller_spec.rb | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/discourse_donations/charges_controller.rb b/app/controllers/discourse_donations/charges_controller.rb index 3cafd36..66e0624 100644 --- a/app/controllers/discourse_donations/charges_controller.rb +++ b/app/controllers/discourse_donations/charges_controller.rb @@ -7,7 +7,7 @@ module DiscourseDonations skip_before_filter :verify_authenticity_token, only: [:create] def create - params.permit(:name, :username, :email, :password) + params.permit(:name, :username, :email, :password, :stripeToken, :amount) output = { 'messages' => [], 'rewards' => [] } diff --git a/assets/javascripts/discourse/components/stripe-card.js.es6 b/assets/javascripts/discourse/components/stripe-card.js.es6 index da0737f..5563a74 100644 --- a/assets/javascripts/discourse/components/stripe-card.js.es6 +++ b/assets/javascripts/discourse/components/stripe-card.js.es6 @@ -66,8 +66,7 @@ export default Ember.Component.extend({ stripeToken: data.token.id, amount: self.get('amount') * 100, email: self.get('email'), - username: self.get('username'), - create_account: this.get('create_accounts') + username: self.get('username') }; if(!self.get('paymentSuccess')) { diff --git a/spec/controllers/discourse_donations/charges_controller_spec.rb b/spec/controllers/discourse_donations/charges_controller_spec.rb index a0a86a1..766a99e 100644 --- a/spec/controllers/discourse_donations/charges_controller_spec.rb +++ b/spec/controllers/discourse_donations/charges_controller_spec.rb @@ -24,7 +24,7 @@ module DiscourseDonations end it 'whitelists the params' do - params = { email: 'email@example.com', password: 'secret', username: 'mr-pink', name: 'kirsten' } + params = { email: 'email@example.com', password: 'secret', username: 'mr-pink', name: 'kirsten', amount: 100, stripeToken: 'rrurrrurrrrr' } should permit(:name, :username, :email, :password).for(:create, params: params) end