Hi,

I've followed the documentation to install module and create a sandbox credential on my PayPal account, but Drupal shows this 500 error when I save a new payment gateway with Paypal Checkout.

PHP Fatal error: Class 'Sainsburys\Guzzle\Oauth2\GrantType\ClientCredentials' not found in /xxx/public_html/modules/commerce_paypal/src/ClientCredentials.php on line 10

Drupal Commerce 8.x-2.12 installed with Ludwig
Commerce Paypal 8.x-1.0-beta4

Thanks for the support.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ConradFlashback created an issue. See original summary.

jsacksick’s picture

Status: Active » Needs review
FileSize
0 bytes

Could you try with the attached patch? It looks like you haven't installed the library required by the module.

jsacksick’s picture

FileSize
321 bytes

With the correct patch :).

  • jsacksick committed a9984ee on 8.x-1.x
    Issue #3046124 by jsacksick: Provide a ludwig.json.
    
jsacksick’s picture

Status: Needs review » Fixed

Committed the patch.

ConradFlashback’s picture

FileSize
17.66 KB

Thanks jsacksick for the fast support.
I've installed dev version and the library in Ludwig panel (see attachment).
But when I create a new payment gateway I now have this error:

TypeError: Argument 1 passed to Drupal\Core\Form\FormState::setError() must be of the type array, null given, called in xxx/public_html/modules/commerce_paypal/src/Plugin/Commerce/PaymentGateway/Checkout.php on line 339 in xxx/public_html/core/lib/Drupal/Core/Form/FormState.php on line 1093 #0 xxx/public_html/modules/commerce_paypal/src/Plugin/Commerce/PaymentGateway/Checkout.php(339): Drupal\Core\Form\FormState->setError(NULL)
#1 xxx/public_html/modules/commerce/src/Element/PluginConfiguration.php(123): Drupal\commerce_paypal\Plugin\Commerce\PaymentGateway\Checkout->validateConfigurationForm(Array, Object(Drupal\Core\Form\FormState))
#2 [internal function]: Drupal\commerce\Element\PluginConfiguration::validatePluginConfiguration(Array, Object(Drupal\Core\Form\FormState), Array)
#3 xxx/public_html/core/lib/Drupal/Core/Form/FormValidator.php(282): call_user_func_array(Array, Array)
#4 xxx/public_html/core/lib/Drupal/Core/Form/FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState))
#5 xxx/public_html/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'commerce_paymen...')
#6 xxx/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(575): Drupal\Core\Form\FormValidator->validateForm('commerce_paymen...', Array, Object(Drupal\Core\Form\FormState))
#7 xxx/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('commerce_paymen...', Array, Object(Drupal\Core\Form\FormState))
#8 xxx/public_html/core/lib/Drupal/Core/Controller/FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('commerce_paymen...', Object(Drupal\Core\Form\FormState))
#9 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#10 xxx/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#11 xxx/public_html/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 xxx/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#13 xxx/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#14 xxx/public_html/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 xxx/public_html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#16 xxx/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 xxx/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 xxx/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 xxx/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 xxx/public_html/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 xxx/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 xxx/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 xxx/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 xxx/public_html/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 xxx/public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
ConradFlashback’s picture

Status: Fixed » Active
jsacksick’s picture

Status: Active » Fixed

The issue you're reporting now is completely unrelated, it looks like you're providing wrong credentials that aren't being validated...

See #3047382: Issues with the credentials validation.

I'm closing this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mediameriquat’s picture

I have the exact same error message :

PHP Fatal error: Class 'Sainsburys\Guzzle\Oauth2\GrantType\ClientCredentials' not found in /xxx/public_html/modules/commerce_paypal/src/ClientCredentials.php on line 10

Commerce Paypal 8.x-1.0-beta5
Drupal Commerce 8.x-2.14 with Ludwig
sainsburys/guzzle-oauth2-plugin properly installed
Client ID and Secret provided

I tried both the beta5 and dev version, and I am still unable to activate a PayPal Gateway. Any hints?

jsacksick’s picture

You're obviously missing the library... I personally don't use Ludwig but somebody confirmed the patch was working..

soezkan’s picture

Still got this "PHP Fatal error: Class 'Sainsburys\Guzzle\Oauth2\GrantType\ClientCredentials' ..."

You say, "You're obviously missing the library..."
What library you referring to?

Vinoth M’s picture

Is there any solution for this? I am also facing the same problem. I am using shared hosting. So I don't have ssh and couldn't install the commerce PayPal via composer. So I used Ludwig for adding libraries. But this issue coming while add payment gateway. Please help me to fix this issue.

Thanks.

pcrex’s picture

composer require gregurco/guzzle-bundle-oauth2-plugin