clemens / spree_wirecard

MIT License
0 stars 4 forks source link

InvalidTransition #3

Open 23tux opened 11 years ago

23tux commented 11 years ago

Hi,

sorry for annoying, but I found another issue. Maybe it's related to a specific spree version. When I try to do a payment with wirecard, wirecard redirects to orders/R006323630/checkout/wirecard_success?payment_method_id=2&token=XXXXX. But then, it throws the following error:

StateMachine::InvalidTransition (Cannot transition state via :started_processing from "checkout" (Reason(s): Source ist nicht gültig)):
  state_machine (1.1.2) lib/state_machine/event.rb:241:in `block in add_actions'
  state_machine (1.1.2) lib/state_machine/machine.rb:753:in `call'
  state_machine (1.1.2) lib/state_machine/machine.rb:753:in `block (2 levels) in define_helper'
  /usr/local/rvm/gems/ruby-1.9.3-p392@global/bundler/gems/spree_wirecard-170f6beb1a46/app/controllers/spree/wirecard_qpay_helpers.rb:19:in `find_or_create_wirecard_qpay_payment'
  /usr/local/rvm/gems/ruby-1.9.3-p392@global/bundler/gems/spree_wirecard-170f6beb1a46/app/controllers/spree/checkout_controller_decorator.rb:17:in `wirecard_success'
  actionpack (3.2.9) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.9) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.9) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.9) lib/active_support/callbacks.rb:535:in `_run__1763504435731221959__process_action__3349004276534926503__callbacks'
  activesupport (3.2.9) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.9) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.9) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.9) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.9) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.9) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.9) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.9) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.9) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.9) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.9) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.9) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:601:in `call'
  /usr/local/rvm/gems/ruby-1.9.3-p392@global/bundler/gems/spree-0d81ee0a2265/core/lib/spree/core/middleware/redirect_legacy_product_url.rb:13:in `call'
  /usr/local/rvm/gems/ruby-1.9.3-p392@global/bundler/gems/spree-0d81ee0a2265/core/lib/spree/core/middleware/seo_assist.rb:27:in `call'

Inside the wirecard_success method, payment = find_or_create_wirecard_qpay_payment(@order, params) is called. When this method is called, the error is thrown. The strange thing is, that when I try to hook into that method, the error is thrown before the method is called. Are there some before hooks, that are called? I couldn't find any, and I wonder at what point this error occurs.

Nevertheless, the error says that the transition from "checkout" to :started_processing is not allowed. Why is the to transition a symbol and the the source a string? Maybe the problem is there, but I'm not sure.

You didn't change any transitions of the checkout process inside your gem, as far as I can see. So I'm wondering how to solve this problem. Maybe you can help me.

thx!

23tux commented 11 years ago

Ok, I'm a step further now. I was wrong, the error occurs, because the source has an invalid fingerprint, which is due to the fact, that I tried to use Wirecard with the 3D option. It seems, that when using this method, wirecard sends back a different response seed. But for now it works.

Maybe we could implement the 3D method.