Drupal 10: Payment Submission fails with a 500 service unavailable
Noticed this while executing Stripe test for Drupal 10.
To replicate -
- Install Stripe extension on Drupal 10
- Configure it on a webform (Also replicates on civi forms)
- Submit the webform with Stripe chosen as the payment processor.
Log displays the following error -
The website encountered an unexpected error. Please try again later.
<em class="placeholder">Error</em>: Class "Symfony\Component\EventDispatcher\Event" not found in <em class="placeholder">include()</em> (line <em class="placeholder">27</em> of <em class="placeholder">sites/default/files/civicrm/ext/com.drastikbydesign.stripe/Civi/Stripe/Event/AuthorizeEvent.php</em>).
<pre class="backtrace">Composer\Autoload\includeFile('/Users/jitendra/www/drupal10/web/sites/default/files/civicrm/ext/com.drastikbydesign.stripe/Civi/Stripe/Event/AuthorizeEvent.php') (Line: 428)
Composer\Autoload\ClassLoader->loadClass('Civi\Stripe\Event\AuthorizeEvent') (Line: 165)
civicrm_api3_stripe_paymentintent_process(Array) (Line: 89)
Civi\API\Provider\MagicFunctionProvider->invoke(Array) (Line: 158)
Civi\API\Kernel->runRequest(Array) (Line: 81)
Civi\API\Kernel->runSafe('StripePaymentintent', 'process', Array) (Line: 22)
civicrm_api('StripePaymentintent', 'process', Array) (Line: 289)
CRM_Utils_REST::process(Array, Array) (Line: 534)
CRM_Utils_REST::ajax() (Line: 285)
CRM_Core_Invoke::runItem(Array) (Line: 69)
CRM_Core_Invoke::_invoke(Array) (Line: 36)
CRM_Core_Invoke::invoke(Array) (Line: 88)
Drupal\civicrm\Civicrm->invoke(Array) (Line: 80)
Drupal\civicrm\Controller\CivicrmController->main(Array, '')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 681)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
</pre>
Seems like this is due to Symfony\Component\EventDispatcher\Event
being replaced by Symfony\Contracts\EventDispatcher\Event
- https://www.drupal.org/node/3159012
So I think we just need to replace the usage of the above with the following?
use Drupal\Component\EventDispatcher\Event;