neerajkumar / solidus-razorpay

Razorpay integration into solidus application.
MIT License
0 stars 2 forks source link

`<module:Spree>': superclass must be a Class (Module given) (TypeError) #1

Closed PlrEx closed 3 years ago

PlrEx commented 3 years ago

Followed Guide for Solidus : https://guides.solidus.io/developers/getting-started/first-time-installation.html

I get the following error with this step "rails g solidus_razorpay:install"

OS : Ubuntu 20.10

Gemfile

source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.1' gem 'rails', '~> 6.1.4' gem 'sqlite3', '~> 1.4' gem 'puma', '~> 5.0' gem 'sass-rails', '>= 6' gem 'jbuilder', '~> 2.7' gem 'bootsnap', '>= 1.4.4', require: false

group :development, :test do end

group :development do gem 'web-console', '>= 4.1.0' gem 'rack-mini-profiler', '~> 2.0' gem 'listen', '~> 3.3' gem 'spring' end

group :test do gem 'capybara', '>= 3.26' gem 'selenium-webdriver' gem 'webdrivers' end

gem "solidus", "~> 3.0" gem 'solidus_auth_devise' gem 'solidus_auth_devise'

gem 'solidus_razorpay'

plr@ecomtest:~/test/sld3$ /var/lib/gems/2.7.0/gems/solidus_razorpay-0.1.0/app/models/spree/gateway/razorpay_gateway.rb:2:in <module:Spree>': superclass must be a Class (Module given) (TypeError) from /var/lib/gems/2.7.0/gems/solidus_razorpay-0.1.0/app/models/spree/gateway/razorpay_gateway.rb:1:in

' from /var/lib/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in load' from /var/lib/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:inload' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:523:in block in load_file' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:715:innew_constants_in' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:522:in load_file' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:419:inblock in require_or_load' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:39:in block in load_interlock' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies/interlock.rb:14:inblock in loading' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/concurrency/share_lock.rb:151:in exclusive' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies/interlock.rb:13:inloading' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:39:in load_interlock' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:402:inrequire_or_load' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:558:in load_missing_constant' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:213:inconst_missing' from /var/lib/gems/2.7.0/gems/solidus_razorpay-0.1.0/lib/solidus_razorpay/engine.rb:21:in block in <class:Engine>' from /var/lib/gems/2.7.0/gems/railties-6.1.4/lib/rails/initializable.rb:32:ininstance_exec' from /var/lib/gems/2.7.0/gems/railties-6.1.4/lib/rails/initializable.rb:32:in run' from /var/lib/gems/2.7.0/gems/railties-6.1.4/lib/rails/initializable.rb:61:inblock in run_initializers' from /usr/lib/ruby/2.7.0/tsort.rb:228:in block in tsort_each' from /usr/lib/ruby/2.7.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component' from /usr/lib/ruby/2.7.0/tsort.rb:431:in each_strongly_connected_component_from' from /usr/lib/ruby/2.7.0/tsort.rb:349:inblock in each_strongly_connected_component' from /usr/lib/ruby/2.7.0/tsort.rb:347:in each' from /usr/lib/ruby/2.7.0/tsort.rb:347:incall' from /usr/lib/ruby/2.7.0/tsort.rb:347:in each_strongly_connected_component' from /usr/lib/ruby/2.7.0/tsort.rb:226:intsort_each' from /usr/lib/ruby/2.7.0/tsort.rb:205:in tsort_each' from /var/lib/gems/2.7.0/gems/railties-6.1.4/lib/rails/initializable.rb:60:inrun_initializers' from /var/lib/gems/2.7.0/gems/railties-6.1.4/lib/rails/application.rb:391:in initialize!' from /home/plr/test/sld3/config/environment.rb:5:in
' from /var/lib/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /var/lib/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inblock in require_with_bootsnap_lfi' from /var/lib/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /var/lib/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:inrequire_with_bootsnap_lfi' from /var/lib/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /var/lib/gems/2.7.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:inrequire' from /var/lib/gems/2.7.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in require' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:332:inblock in require' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:299:in load_dependency' from /var/lib/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:332:inrequire' from /var/lib/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:106:in preload' from /var/lib/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:157:inserve' from /var/lib/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:145:in block in run' from /var/lib/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:inloop' from /var/lib/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in run' from /var/lib/gems/2.7.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in<top (required)>' from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in require' from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:inrequire' from -e:1:in `
'

plr@ecomtest:~/test/sld3$

Did I miss something ?

neerajkumar commented 3 years ago

OK. Thanks.I am checking

neerajkumar commented 3 years ago

@PlrEx I have fixed the issue and created a new version 0.2.0 https://rubygems.org/gems/solidus_razorpay/versions/0.2.0. Please upgrade and test with solidus_razorpay-0.2.0, and let me know if it is still failing.

PlrEx commented 3 years ago

wg@ecombase:~/sld3$ bin/rails s -b 0.0.0.0 => Booting Puma => Rails 6.1.4 application starting in development => Run bin/rails server --help for more startup options Exiting Traceback (most recent call last): 69: from bin/rails:2:in <main>' 68: from bin/rails:2:inload' 67: from /home/wg/sld3/bin/spring:7:in <top (required)>' 66: from /home/wg/sld3/bin/spring:7:intap' 65: from /home/wg/sld3/bin/spring:10:in block in <top (required)>' 64: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:inrequire' 63: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in require' 62: from /home/wg/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in<top (required)>' 61: from /home/wg/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in load' 60: from /home/wg/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/bin/spring:49:in<top (required)>' 59: from /home/wg/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/client.rb:30:in run' 58: from /home/wg/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/client/command.rb:7:incall' 57: from /home/wg/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in call' 56: from /home/wg/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/client/rails.rb:28:inload' 55: from /home/wg/sld3/bin/rails:5:in <top (required)>' 54: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:inrequire' 53: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi' 52: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:inregister' 51: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi' 50: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inrequire' 49: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/commands.rb:18:in <main>' 48: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/command.rb:48:ininvoke' 47: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/command/base.rb:69:in perform' 46: from /home/wg/.rvm/gems/ruby-2.7.1/gems/thor-1.1.0/lib/thor.rb:392:indispatch' 45: from /home/wg/.rvm/gems/ruby-2.7.1/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command' 44: from /home/wg/.rvm/gems/ruby-2.7.1/gems/thor-1.1.0/lib/thor/command.rb:27:inrun' 43: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:135:in perform' 42: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:135:intap' 41: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:144:in block in perform' 40: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:37:instart' 39: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/commands/server/server_command.rb:77:in log_to_stdout' 38: from /home/wg/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/server.rb:422:inwrapped_app' 37: from /home/wg/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/server.rb:249:in app' 36: from /home/wg/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/server.rb:349:inbuild_app_and_options_from_config' 35: from /home/wg/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:66:in parse_file' 34: from /home/wg/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:105:inload_file' 33: from /home/wg/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:116:in new_from_string' 32: from /home/wg/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/builder.rb:116:ineval' 31: from config.ru:3:in block in <main>' 30: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:inrequire_relative' 29: from /home/wg/.rvm/gems/ruby-2.7.1/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in require' 28: from /home/wg/.rvm/gems/ruby-2.7.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:inrequire' 27: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' 26: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:inrequire_with_bootsnap_lfi' 25: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' 24: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inblock in require_with_bootsnap_lfi' 23: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' 22: from /home/wg/sld3/config/environment.rb:5:in

' 21: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/application.rb:391:in initialize!' 20: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/initializable.rb:60:inrun_initializers' 19: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:205:in tsort_each' 18: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:226:intsort_each' 17: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:347:in each_strongly_connected_component' 16: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:347:incall' 15: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:347:in each' 14: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:349:inblock in each_strongly_connected_component' 13: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:431:in each_strongly_connected_component_from' 12: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component' 11: from /home/wg/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/tsort.rb:228:in block in tsort_each' 10: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/initializable.rb:61:inblock in run_initializers' 9: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/initializable.rb:32:in run' 8: from /home/wg/.rvm/gems/ruby-2.7.1/gems/railties-6.1.4/lib/rails/initializable.rb:32:ininstance_exec' 7: from /home/wg/.rvm/gems/ruby-2.7.1/gems/solidus_razorpay-0.2.0/lib/solidus_razorpay/engine.rb:21:in block in <class:Engine>' 6: from /home/wg/.rvm/gems/ruby-2.7.1/gems/activesupport-6.1.4/lib/active_support/dependencies/interlock.rb:13:inloading' 5: from /home/wg/.rvm/gems/ruby-2.7.1/gems/activesupport-6.1.4/lib/active_support/concurrency/share_lock.rb:151:in exclusive' 4: from /home/wg/.rvm/gems/ruby-2.7.1/gems/activesupport-6.1.4/lib/active_support/dependencies/interlock.rb:14:inblock in loading' 3: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in load' 2: from /home/wg/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:inload' 1: from /home/wg/.rvm/gems/ruby-2.7.1/gems/solidus_razorpay-0.2.0/app/models/solidus_razorpay/razorpay_gateway.rb:1:in <main>' /home/wg/.rvm/gems/ruby-2.7.1/gems/solidus_razorpay-0.2.0/app/models/solidus_razorpay/razorpay_gateway.rb:2:in': uninitialized constant Spree::Gateway (NameError) wg@ecombase:~/sld3$

I get different error now

neerajkumar commented 3 years ago

@PlrEx You will need to do the fresh start. Remove everything first.

bundle exec rails db:rollback
bundle exec rails d solidus_razorpay:install

then remove solidus_razorpay gem from Gemfile, followed by run

bundle install

Then after, you add the latest version of solidus_razorpay and follow all given instructions. Or, It's better to use it in a new solidus application.

PlrEx commented 3 years ago

Thanks for replay. I tried with fresh install not sure what I did wrong still get the error I have recorded the steps to produce the error please watch and let me where I went wrong. Link : https://www.youtube.com/watch?v=itlAcdVuLS8

neerajkumar commented 3 years ago

@PlrEx Its not your fault. I am doing something wrong. I can remember that I had replace ::Spree::Gateway by ::Spree::PaymentMethod. But, somehow I reverted my change in local changes and pushed old code. Please give me sometime, I will fix and get back to you. Meanwhile, I just remove the gem for now.

neerajkumar commented 3 years ago

@PlrEx Just released a new version 1.0.0. Please try with this new version. Again, do a fresh start. Remove previously installed solidus_razorpay gem.

bundle exec rails db:rollback
bundle exec rails d solidus_razorpay:install

I tried, but I am not getting any error. Please let me know if you still getting the error.

PlrEx commented 3 years ago

I got few template errors once I renamed the templates it is working now. Thank you for the efforts. I have renamed template and created the pull request.

solidus_view_template_error gatway_admin_template_error solidus_razorpay_working

neerajkumar commented 3 years ago

Your changes are breaking the application.

Screenshot 2021-07-24 at 9 41 54 PM

I am using it in https://github.com/solidusio/solidus-demo.

Which application are you using?

PlrEx commented 3 years ago

Based on this guide https://guides.solidus.io/developers/getting-started/first-time-installation.html

Below is the procedure I followed.

First Solidus install

rails new mmm --skip-javascript cd mmm bundle add solidus bin/rails generate solidus:install

solidus razorpay

gem 'solidus_razorpay' # Adding this to Gemfile bundle rails g solidus_razorpay:install

neerajkumar commented 3 years ago

OK. I fixed your issue and release a new version 1.1.0. Just try with this version now. Hopefully, everything will work now. Thanks for your testing.

neerajkumar commented 3 years ago

Closing the issue as it has been resolved and no more response by creator.