spree-contrib / better_spree_paypal_express

A better Spree PayPal Express Extension.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
110 stars 269 forks source link

PaypalController cannot handle redirect due to incorrect number of arguments #29

Closed charandas closed 10 years ago

charandas commented 10 years ago

On being redirected from sandbox payment on Paypal using Paypal balance, like the following:

http://jewelify.us/paypal/confirm?payment_method_id=1&token=EC-2XE09284H1460651V&PayerID=PRABSRTRSY2CS

My rails app is returning the following:

I, [2013-10-01T16:11:26.988184 #27761]  INFO -- : Processing by Spree::CheckoutController#update as HTML
I, [2013-10-01T16:11:26.988275 #27761]  INFO -- :   Parameters: {"utf8"=>"✓", "authenticity_token"=>"FT8v7vOtpYb8ONDJ4FVob2rCe/frKeoCdfDYQrI/0QM=", "order"=>{"shipments_attributes"=>{"0"=>{"selected_shipping_rate_id"=>"6", "id"=>"9"}}}, "commit"=>"Save and Continue", "state"=>"delivery"}
I, [2013-10-01T16:11:27.287181 #27761]  INFO -- : Redirected to http://jewelify.us/checkout/payment
I, [2013-10-01T16:11:27.287529 #27761]  INFO -- : Completed 302 Found in 299ms (ActiveRecord: 18.5ms)
I, [2013-10-01T16:11:27.424877 #27761]  INFO -- : Started GET "/checkout/payment" for 108.185.71.133 at 2013-10-01 16:11:27 +0000
I, [2013-10-01T16:11:27.426684 #27761]  INFO -- : Processing by Spree::CheckoutController#edit as HTML
I, [2013-10-01T16:11:27.426756 #27761]  INFO -- :   Parameters: {"state"=>"payment"}
I, [2013-10-01T16:11:27.459959 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_core-2.1.1/app/views/spree/shared/_error_messages.html.erb (0.2ms)
I, [2013-10-01T16:11:27.568390 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/bundler/gems/better_spree_paypal_express-d62aed547d6c/app/views/spree/checkout/payment/_paypal.html.erb (1.5ms)
I, [2013-10-01T16:11:27.570119 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/checkout/_payment.html.erb (100.6ms)
I, [2013-10-01T16:11:27.580291 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/checkout/_summary.html.erb (9.5ms)
I, [2013-10-01T16:11:27.580500 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/checkout/edit.html.erb within spree/layouts/spree_application (121.2ms)
I, [2013-10-01T16:11:27.583868 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_core-2.1.1/app/views/spree/shared/_routes.html.erb (0.4ms)
I, [2013-10-01T16:11:27.584014 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/shared/_head.html.erb (3.0ms)
I, [2013-10-01T16:11:27.587423 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/shared/_search.html.erb (1.6ms)
I, [2013-10-01T16:11:27.587534 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/shared/_nav_bar.html.erb (2.5ms)
I, [2013-10-01T16:11:27.589649 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/shared/_main_nav_bar.html.erb (1.9ms)
I, [2013-10-01T16:11:27.589755 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/shared/_header.html.erb (5.5ms)
I, [2013-10-01T16:11:27.590305 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/shared/_footer.html.erb (0.2ms)
I, [2013-10-01T16:11:27.591441 #27761]  INFO -- :   Rendered /var/www/jewelify/shared/bundle/ruby/2.0.0/gems/spree_frontend-2.1.1/app/views/spree/shared/_google_analytics.html.erb (0.9ms)
I, [2013-10-01T16:11:27.591880 #27761]  INFO -- : Completed 200 OK in 165ms (Views: 130.6ms | ActiveRecord: 6.9ms)
I, [2013-10-01T16:11:27.677255 #27761]  INFO -- : Started GET "/assets/store/cart.png" for 108.185.71.133 at 2013-10-01 16:11:27 +0000
F, [2013-10-01T16:11:27.678777 #27761] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/assets/store/cart.png"):
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

I, [2013-10-01T16:11:30.420110 #27761]  INFO -- : Started POST "/paypal?payment_method_id=1" for 108.185.71.133 at 2013-10-01 16:11:30 +0000
I, [2013-10-01T16:11:30.426454 #27761]  INFO -- : Processing by Spree::PaypalController#express as HTML
I, [2013-10-01T16:11:30.426550 #27761]  INFO -- :   Parameters: {"authenticity_token"=>"FT8v7vOtpYb8ONDJ4FVob2rCe/frKeoCdfDYQrI/0QM=", "payment_method_id"=>"1"}
I, [2013-10-01T16:11:31.881664 #27761]  INFO -- : Redirected to https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=EC-2XE09284H1460651V
I, [2013-10-01T16:11:31.881936 #27761]  INFO -- : Completed 302 Found in 1455ms (ActiveRecord: 5.7ms)
I, [2013-10-01T16:12:01.972008 #27761]  INFO -- : Started GET "/paypal/confirm?payment_method_id=1&token=EC-2XE09284H1460651V&PayerID=PRABSRTRSY2CS" for 108.185.71.133 at 2013-10-01 16:12:01 +0000
I, [2013-10-01T16:12:01.981601 #27761]  INFO -- : Processing by Spree::PaypalController#confirm as HTML
I, [2013-10-01T16:12:01.981780 #27761]  INFO -- :   Parameters: {"payment_method_id"=>"1", "token"=>"EC-2XE09284H1460651V", "PayerID"=>"PRABSRTRSY2CS"}
I, [2013-10-01T16:12:02.117161 #27761]  INFO -- : Completed 500 Internal Server Error in 135ms
F, [2013-10-01T16:12:02.120692 #27761] FATAL -- : 
ArgumentError (wrong number of arguments (2 for 0..1)):
  activerecord (4.0.0) lib/active_record/persistence.rb:32:in `create'
  /var/www/jewelify/shared/bundle/ruby/2.0.0/bundler/gems/better_spree_paypal_express-d62aed547d6c/app/controllers/spree/paypal_controller.rb:63:in `confirm'
  actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (4.0.0) lib/active_support/callbacks.rb:453:in `_run__941592807079783878__process_action__callbacks'
  activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
  activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
  actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
  activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
  actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
  actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
  actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/railtie/configurable.rb:30:in `method_missing'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `catch'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  rack (1.5.2) lib/rack/etag.rb:23:in `call'
  rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
  activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__1457700310619317659__call__callbacks'
  activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
  /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

Any clues - could it be a setup issue - I have my test account registered right on Paypal Developer with some balance. I don't think this better gem has any much configuration either apart from API access setup through Spree admin?

I am using everything stable-2-1.

jhawthorn commented 10 years ago

The extra argument is :without_protection => true. I suspect this is fixed by #28

radar commented 10 years ago

This has been fixed now.

Thanks for letting us know about it!

charandas commented 10 years ago

When will it be backported to stable-2-1? Or alternatively, enlighten me on your workflow, please?

radar commented 10 years ago

This commit is already on 2-1-stable. c28493eb0ab7bbd4d386d05e357de7799fb9cec2.