Shopping Cart Exception at checkout with TestPaymentProcessor

Alexander Sinishin 16.Dec.2011 6:29am
Hi Pascal,

I configured shopping cart to use TestPaymentProcessor and getting an exception at checkout:


Processing PageController#index (for 95.158.0.245 at 2011-12-16 06:09:47) [POST]
  Parameters: {"commit"=>"Continue", “action”=>"index", “authenticity_token”=>"1zf3uR2En1QHTPNEQj0BA264yQ8b3k0FUSLNV/PeMH
E=", “shipping_address”=>{"city"=>"North", “address”=>"B2 str", “zip”=>"27295", “country”=>"United States", “phone”=>"",
“address_2”=>"", “last_name”=>"Linkoln", “state”=>"NC", “first_name”=>"Abram"}, “path”=>[“shop”, “checkout”], “same_addre
ss”=>"1", “billing_address”=>{"country"=>"United States"}, “controller”=>"page"}
Redirected to http://www.maricel.us/shop/checkout/payment
Filter chain halted as [:handle_page] rendered_or_redirected.
Completed in 349ms (DB: 0) | 301 Moved Permanently [http://www.maricel.us/shop/checkout?authenticity_token=1zf3uR2En1QHTP
NEQj0BA264yQ8b3k0FUSLNV%2FPeMHE%3D]


Processing PageController#index (for 95.158.0.245 at 2011-12-16 06:09:47) [GET]
  Parameters: {"action"=>"index", “path”=>[“shop”, “checkout”, “payment”], “controller”=>"page"}

ActionView::TemplateError (undefined method `transaction_partial’ for Shop::TestPaymentProcessor:Class) on line #17 of ve
ndor/modules/shop/app/views/shop/processor/_payment_processors.rhtml:
14: <tr>
15: <td class='field'>
16: <% cms_unstyled_fields_for “payment[#{processor.id}]”, processor.get_instance(user).get_transaction_options(payment[p
rocessor.id.to_s], :admin => admin) do |p| -%>
17: <%= render :partial => processor.processor_handler_class.transaction_partial, :locals => {:f => p, :processor => pr
ocessor, :admin => admin } >
18: <br/>
19: <
end -%>
20: </td>

    vendor/modules/shop/app/views/shop/processor/_payment_processors.rhtml:17:in `_run_rhtml_vendor47modules47shop47app47
views47shop47processor47_payment_processors46rhtml_locals_admin_object_payment_payment_processors_user’
    lib/styled_form_builder_generator.rb:115:in `cms_unstyled_fields_for’

=====

BTW: I cannot find TestProcessor in the source code. Please give me a clue what actions should i take.

Thanks,
Alexander.
Pascal Rettig 16.Dec.2011 8:25am
Not sure what’s going on there – Shop::TestPaymentProcessor should be in vendor/modules/shop/app/models/shop/ it inherits from Shop::ActiveMerchantCreditCardProcessor which defines the transaction_partial class method.

Can you trying jumping into console and seeing what running:

     Shop::TestPaymentProcessor.transaction_partial

gets you?

-Pascal
Alexander Sinishin 16.Dec.2011 12:16pm
Thanks Pascal, I used console and found work around. I put in active_merchant_credit_card_processor.rb the line:

require ‘active_merchant’

Now it works!

===
Here FYI an error trace in console was:

[ruby@maricel Webiva]$ bundle exec script/console production
Loading production environment (Rails 2.3.5)
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
>> Shop::TestPaymentProcessor.transaction_partial
NameError: uninitialized constant Shop::ActiveMerchantCreditCardProcessor::ActiveMerchant
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing’
from /var/www/Webiva/vendor/modules/shop/app/models/shop/active_merchant_credit_card_processor.rb:2
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `polyglot_original_require’
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in `load_missing_constant’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `rails_official_const_missing’
from /var/www/Webiva/lib/webiva_monkey_patches.rb:113:in `const_missing’
from /var/www/Webiva/vendor/modules/shop/app/models/shop/test_payment_processor.rb:1
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `polyglot_original_require’
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in `load_missing_constant’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `rails_official_const_missing’
from /var/www/Webiva/lib/webiva_monkey_patches.rb:113:in `const_missing’
from (irb):1>> require ‘activemerchant’
MissingSourceFile: no such file to load — activemerchant
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `polyglot_original_require’
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require’
from (irb):2

===
And a patched case is:

[ruby@maricel Webiva]$ bundle exec script/console production
Loading production environment (Rails 2.3.5)
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
>> require ‘active_merchant’
=> true
>> Shop::TestPaymentProcessor.transaction_partial
=> “/shop/config/credit_card_form”
>> exit