From 4b0a5b11257342c0a54c59312846face826325ce Mon Sep 17 00:00:00 2001 From: Rishabh Saxena Date: Mon, 8 Aug 2016 23:36:16 +0530 Subject: [PATCH] move params merge to private method --- app/controllers/payments_controller.rb | 10 +++++----- app/views/payments/new.html.haml | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb index 39f6df58..a86c5f66 100644 --- a/app/controllers/payments_controller.rb +++ b/app/controllers/payments_controller.rb @@ -14,10 +14,7 @@ class PaymentsController < ApplicationController end def create - @payment = Payment.new payment_params.merge(stripe_customer_email: params[:stripeEmail], - stripe_customer_token: params[:stripeToken], - user: current_user, - conference: @conference) + @payment = Payment.new payment_params if @payment.purchase && @payment.save update_purchased_ticket_purchases @@ -33,7 +30,10 @@ class PaymentsController < ApplicationController private def payment_params - params.permit :stripe_customer_email, :stripe_customer_token + params.permit(:stripe_customer_email, :stripe_customer_token) + .merge(stripe_customer_email: params[:stripeEmail], + stripe_customer_token: params[:stripeToken], + user: current_user, conference: @conference) end def update_purchased_ticket_purchases diff --git a/app/views/payments/new.html.haml b/app/views/payments/new.html.haml index 1817f32c..0f12bf34 100644 --- a/app/views/payments/new.html.haml +++ b/app/views/payments/new.html.haml @@ -15,4 +15,5 @@ .col-md-13 %p.text-muted.text-center %small - The payment is totally secure. Your credit card details will be sent directly to our payment processor. + All payments are handled securely by our payment processor, + = link_to 'Stripe', 'https://stripe.com', target: '_blank'