From 5ff0bbe4e018898b2db56070ef5c8503f96601cd Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Sat, 17 Dec 2011 10:32:00 +1100 Subject: [PATCH] Shorten ppx_auth_response inside paypal_finish --- app/controllers/spree/checkout_controller_decorator.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index 4cd2564..1cd0808 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -116,11 +116,8 @@ module Spree opts = { :token => params[:token], :payer_id => params[:PayerID] }.merge all_opts(@order, params[:payment_method_id], 'payment' ) gateway = paypal_gateway - if Spree::Config[:auto_capture] - ppx_auth_response = gateway.purchase((@order.total*100).to_i, opts) - else - ppx_auth_response = gateway.authorize((@order.total*100).to_i, opts) - end + method = Spree::Config[:auto_capture] ? :purchase : :authorize + ppx_auth_response = gateway.send(method, (@order.total*100).to_i, opts) paypal_account = Spree::PaypalAccount.find_by_payer_id(params[:PayerID])