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

"Something went wrong" after clicking the Accept and Integrate button on PayPal integration wizard page #132

Open ahmadoji01 opened 3 years ago

ahmadoji01 commented 3 years ago

The environment I used: Rails 6.1.3 @ Local Development Environment MacOS BigSur 11.2.3 Terminal Ruby 3.0.1

What I have done:

  1. Run the rails generate solidus_paypal_commerce_platform:install command
  2. Configuring the Solidus PayPal API credentials on config/initializers/spree.rb with these lines
    config.static_model_preferences.add(
    SolidusPaypalCommercePlatform::PaymentMethod,
    'paypal_commerce_platform_credentials', {
      test_mode: !Rails.env.production?,
      client_id: 'credential goes here',
      client_secret: 'credential goes here',
      display_on_product_page: true,
      display_on_cart: true,
    }
    )

How I reproduce the errors:

  1. Login to Admin Panel
  2. Go to Settings > Payment Page
  3. Click the "Setup PayPal Commerce Platform" button
  4. Fill in the email and password on PayPal Commerce Platform integration wizard popup from PayPal
  5. Click the "Accept and Integrate" button
  6. Popup closed and the admin panel says "Something went wrong"

Messages from Rails Console:

Started POST "/solidus_paypal_commerce_platform/wizard" for ::1 at 2021-06-09 22:33:18 +0700
Processing by SolidusPaypalCommercePlatform::WizardController#create as */*
  Parameters: {"authCode"=>"C21AAIERkUIiMjzR2HUuKm6BV53--PNPuN-RdzCTvDsXOEJT9_m7n5yN0gxiqNgIRaOFe5Tj1fkwAdfg9PjY2JEMcx6ZmXrYQ", "sharedId"=>"AWZG0SyysxSuqGnm4HZHKIYt2QLaNP2E4CwARJo5RSbnurdSVtQ6FavjIww7OusNGR24MqAKtc_x8jjO", "nonce"=>"xBRMZHxqyfpM2hNRD5tGhtDFRVtuI1Z5xhftE1KwiZB477UYkliUY5Kov4ioQd9qM151DbLmBIPOVrKMdqOVGnXrtQHpIhYVyNIJzS2Z8VYHHOdbnpeADI7khFxe60b5"}
  Spree::User Load (0.4ms)  SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."spree_api_key" = ? LIMIT ?  [["spree_api_key", "ca56066af735e67b192d66544ade6e9e09b46034c5be283e"], ["LIMIT", 1]]
   (0.1ms)  SELECT "spree_roles"."name" FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = ?  [["user_id", 1]]
  Spree::Role Load (0.1ms)  SELECT "spree_roles".* FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = ?  [["user_id", 1]]
Completed 500 Internal Server Error in 38ms (ActiveRecord: 0.6ms | Allocations: 7474)

NoMethodError (undefined method `escape' for URI:Module):

paypalhttp (1.0.0) lib/paypalhttp/serializers/form_encoded.rb:8:in `block in encode'
paypalhttp (1.0.0) lib/paypalhttp/serializers/form_encoded.rb:7:in `each'
paypalhttp (1.0.0) lib/paypalhttp/serializers/form_encoded.rb:7:in `encode'
paypalhttp (1.0.0) lib/paypalhttp/encoder.rb:23:in `serialize_request'
paypalhttp (1.0.0) lib/paypalhttp/http_client.rb:72:in `execute'
solidus_paypal_commerce_platform (0.3.2) lib/solidus_paypal_commerce_platform/client.rb:29:in `execute'
solidus_paypal_commerce_platform (0.3.2) lib/solidus_paypal_commerce_platform/client.rb:51:in `fetch_api_credentials'
solidus_paypal_commerce_platform (0.3.2) app/controllers/solidus_paypal_commerce_platform/wizard_controller.rb:40:in `api_credentials'
solidus_paypal_commerce_platform (0.3.2) app/controllers/solidus_paypal_commerce_platform/wizard_controller.rb:32:in `payment_method_params'
solidus_paypal_commerce_platform (0.3.2) app/controllers/solidus_paypal_commerce_platform/wizard_controller.rb:10:in `create'
ahmadoji01 commented 3 years ago

Solved by downgrading the Ruby version from 3.0.1 to 2.7.3.

I will keep this open until the developers notice

mtylty commented 3 years ago

@uzzybotak thanks for opening and issue. This is definitely worth checking out.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions.

RyanofWoods commented 2 years ago

Hi there @ahmadoji01 👋 Thank you for the issue, but apologies for the delay.

I looked into this deeper and it turns out the the dependency paypal-checkout-sdk does not support Ruby 3.0 yet.

Thank you for bringing it to our attention. I will update the gemspec and we will make this gem support Ruby 3.0 as soon as the paypal dependencies support it 👍


ps. I just want to note, if you setup the PaymentMethod/Gateway by static_model_preferences, then you should not need to use the wizard. As the wizard is for setting up the PaymentMethod when you do not have credentials. But regardless, the Ruby 3.0 incompatibility affects the whole gem and not just the wizard.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions.