solidusio / solidus_paypal_commerce_platform

💳 Integrate Solidus with Paypal Commerce Platform
https://developer.paypal.com/docs/platforms/
BSD 3-Clause "New" or "Revised" License
17 stars 24 forks source link

Order Discount Breakdown #193

Closed jakemumu closed 1 year ago

jakemumu commented 1 year ago

Summary

Patches an erroneous order breakdown

More info: https://github.com/solidusio/solidus_paypal_commerce_platform/issues/191

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

jakemumu commented 1 year ago

Hey @kennyadsl -- Re-opened this PR on a new repo where I could write the tests locally, but I am indeed having trouble.

I followed the steps in the readme and ran bin/rake from the root of the extension directory -- this created the dummy-app for me.

When I run bin/rake again from the root I get 0 tests to run. If I cd into the dummy app and run rspec same issue, I tried something like rspec ../spec from within the dummy app and appears to pick up the tests but doesn't run them / they fail.

Apologies but -- how do I run the tests on a Solidus extension I would absolutely love to know so I can be of better help to the project : )

kennyadsl commented 1 year ago

I can run specs with bin/rspec spec from the root. Sorry for the confusion in the README, I'm going to update it.

kennyadsl commented 1 year ago

BTW, bin/rake also works for me from the root. It executes all specs correctly after creating the dummy app. Can you please post the full output of the command? Better if you remove the dummy-app folder before trying again to have the full logs. Thanks!

jakemumu commented 1 year ago

Hmm -- that's so weird, here are my results:

➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) ✗ bin/rspec spec
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
No examples found.

Finished in 0.00079 seconds (files took 0.05221 seconds to load)
0 examples, 0 failures

/Users/jacobpenn/jacobpenn/Development/Minimal/solidus_extensions/solidus_paypal_commerce_platform

Here's my bin/rake output:

➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) ✗ bin/rake
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
bin/rspec
Creating the dummy-app app...
      create
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  Gemfile
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_0.rb
      create  config/initializers/permissions_policy.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/assets
      create  log
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  tmp
      create  tmp/pids
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  storage
      create  tmp/storage
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_0.rb
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies....
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using minitest 5.18.0
Using thor 1.2.1
Using zeitwerk 2.6.7
Using sqlite3 1.6.1 (x86_64-darwin)
Using i18n 1.12.0
Using tzinfo 2.0.6
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.2
Using date 3.3.3
Using timeout 0.3.2
Using bindex 0.8.1
Using net-protocol 0.2.1
Using io-console 0.6.0
Using net-imap 0.3.4
Using reline 0.3.2
Using builder 3.2.4
Using irb 1.6.3
Using crass 1.0.6
Using debug 1.7.1
Using activesupport 7.0.4.3
Using websocket-driver 0.7.5
Using puma 5.6.5
Using bundler 2.2.27
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using method_source 1.0.0
Using mail 2.8.1
Using erubi 1.12.0
Using rack 2.2.6.4
Using globalid 1.1.0
Using rack-test 2.1.0
Using activejob 7.0.4.3
Using sprockets 4.2.0
Using activemodel 7.0.4.3
Using racc 1.6.2
Using activerecord 7.0.4.3
Using nokogiri 1.14.2 (x86_64-darwin)
Using rails-dom-testing 2.0.3
Using loofah 2.19.1
Using rails-html-sanitizer 1.5.0
Using actionview 7.0.4.3
Using actionpack 7.0.4.3
Using jbuilder 2.11.5
Using actioncable 7.0.4.3
Using activestorage 7.0.4.3
Using actionmailer 7.0.4.3
Using actionmailbox 7.0.4.3
Using sprockets-rails 3.4.2
Using actiontext 7.0.4.3
Using railties 7.0.4.3
Using importmap-rails 1.1.5
Using rails 7.0.4.3
Using stimulus-rails 1.2.1
Using turbo-rails 1.4.0
Using web-console 4.2.0
Bundle complete! 11 Gemfile dependencies, 59 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle binstubs bundler
       rails  importmap:install
Add Importmap include tags in application layout
      insert  app/views/layouts/application.html.erb
Create application.js module as entrypoint
      create  app/javascript/application.js
Use vendor/javascript for downloaded pins
      create  vendor/javascript
      create  vendor/javascript/.keep
Ensure JavaScript files are in the Sprocket manifest
      append  app/assets/config/manifest.js
Configure importmap paths in config/importmap.rb
      create  config/importmap.rb
Copying binstub
      create  bin/importmap
       rails  turbo:install stimulus:install
Import Turbo
      append  app/javascript/application.js
Pin Turbo
      append  config/importmap.rb
Enable redis in bundle
        gsub  Gemfile
         run  bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using minitest 5.18.0
Using builder 3.2.4
Using erubi 1.12.0
Using racc 1.6.2
Using crass 1.0.6
Using rack 2.2.6.4
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.2
Using date 3.3.3
Using timeout 0.3.2
Using bindex 0.8.1
Using bundler 2.2.27
Using io-console 0.6.0
Using method_source 1.0.0
Using reline 0.3.2
Using zeitwerk 2.6.7
Using irb 1.6.3
Using sqlite3 1.6.1 (x86_64-darwin)
Using debug 1.7.1
Using tzinfo 2.0.6
Using nokogiri 1.14.2 (x86_64-darwin)
Using rack-test 2.1.0
Using loofah 2.19.1
Using net-protocol 0.2.1
Using rails-html-sanitizer 1.5.0
Using net-imap 0.3.4
Using sprockets 4.2.0
Using redis 4.8.1
Using i18n 1.12.0
Using websocket-driver 0.7.5
Using activesupport 7.0.4.3
Using net-pop 0.1.2
Using rails-dom-testing 2.0.3
Using thor 1.2.1
Using actionview 7.0.4.3
Using globalid 1.1.0
Using actionpack 7.0.4.3
Using activejob 7.0.4.3
Using actioncable 7.0.4.3
Using railties 7.0.4.3
Using activemodel 7.0.4.3
Using importmap-rails 1.1.5
Using activerecord 7.0.4.3
Using puma 5.6.5
Using activestorage 7.0.4.3
Using stimulus-rails 1.2.1
Using actiontext 7.0.4.3
Using net-smtp 0.3.3
Using web-console 4.2.0
Using mail 2.8.1
Using jbuilder 2.11.5
Using actionmailbox 7.0.4.3
Using sprockets-rails 3.4.2
Using actionmailer 7.0.4.3
Using turbo-rails 1.4.0
Using rails 7.0.4.3
Bundle complete! 12 Gemfile dependencies, 60 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Switch development cable to use redis
        gsub  config/cable.yml
Create controllers directory
      create  app/javascript/controllers
      create  app/javascript/controllers/index.js
      create  app/javascript/controllers/application.js
      create  app/javascript/controllers/hello_controller.js
Import Stimulus controllers
      append  app/javascript/application.js
Pin Stimulus
Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true"
      append  config/importmap.rb
Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
      append  config/importmap.rb
Pin all controllers
Appending: pin_all_from "app/javascript/controllers", under: "controllers"
      append  config/importmap.rb
Unknown switches "--github"
Did you mean?  "--git"
Dropped database 'db/development.sqlite3'
Database 'db/test.sqlite3' does not exist
Created database 'db/development.sqlite3'
Created database 'db/test.sqlite3'
Could not find generator 'solidus:install'.
Run `bin/rails generate --help` for more options.
Unknown switches "--path"
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
No examples found.

Finished in 0.00087 seconds (files took 0.05113 seconds to load)
0 examples, 0 failures

/Users/jacobpenn/jacobpenn/Development/Minimal/solidus_extensions/solidus_paypal_commerce_platform

Still results in:

➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) ✗ bin/rspec spec
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
No examples found.

Finished in 0.0008 seconds (files took 0.0507 seconds to load)
0 examples, 0 failures

/Users/jacobpenn/jacobpenn/Development/Minimal/solidus_extensions/solidus_paypal_commerce_platform
kennyadsl commented 1 year ago

That's so weird... Just to be sure, is bug/order_discount_breakdown based against the latest code in master?

waiting-for-dev commented 1 year ago

What are which bin/rspec & which bin/rake return? Maybe you have those aliased to bundle exec ...?

jakemumu commented 1 year ago

Yeah... I'm still stumped, I rebased this off of master and then deleted and redid the process locally, bin/rake still resulted in 0 tests being run.

➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) which bin/rake
bin/rake
➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) which bin/rspec
bin/rspec

I know I'm a bit slow here but when I get another chance I'm down to put some binds in places and step through to find the issue, I just don't really know much about how rspec boots.

jakemumu commented 1 year ago

I'd still love to get this merged.. :/

waiting-for-dev commented 1 year ago

@jakemumu did you try debugging with https://github.com/solidusio/solidus_paypal_commerce_platform/pull/193#issuecomment-1469983907?

jakemumu commented 1 year ago

@waiting-for-dev thanks yeah I tried it here: https://github.com/solidusio/solidus_paypal_commerce_platform/pull/193#issuecomment-1518886635 - whichever combination with bundle or not wasn't pulling the tests for some reason -- I'll give it another try when I get a chance but I'm surprised others aren't having this issue -- it's a pretty critical patch for us.

--

If I can't get them running though perhaps someone else would be willing to assist with a test?

kennyadsl commented 1 year ago

@jakemumu I'm looking to see if I can move this forward.

kennyadsl commented 1 year ago

@jakemumu I rebased this PR against a branch that allows specs to pass (locally only, we are still waiting for selenium/capybara to fix their problem) and added a commit with a test for the fix.

I will rebase and squash everything in a single commit once we have the spec green, then I'll craft a release for this. Thanks for your help!

jakemumu commented 1 year ago

🥳 🥳 🥳 🥳 -- thanks so much @kennyadsl -- apologies I wasn't able to fully push that one over the finish line, really appreciate you helping get it there!

kennyadsl commented 1 year ago

@jakemumu no problem, I'm here to help!