Closed AndreasA closed 3 years ago
Thanks for opening this issue @AndreasA,
Can you point where in the plugin is the change payment method route being replaced? Just to have all the information here.
Ángel
it conflicts with: https://github.com/shopware/platform/blob/d56b11d76c23c7133e062807c68b01128fa69185/src/Storefront/Controller/AccountOrderController.php#L194
you use the same route name as the default storefront controller and therefore one of those wins and as plugins are loaded after the core, yours wins.
If you use the controller event, you would not event need to annotate your controller with route or similar as you would rewrite the controller on the fly (which is a callable at that point).
Thanks for the info @AndreasA
Is your feature request related to a problem? Please describe. Currently you replace the Storefront change payment method route to ensure you can set the adyen data there.
However, this is can be problematic, if e.g. other plugins would do this too, e.g. multiple payment plugins.
Describe the solution you'd like These are not the only solutions but some possibilities:
KernelEvents::REQUEST
: https://symfony.com/doc/current/reference/events.html#kernel-request, checks$request->attributes->get('_route')
to determine it isfrontend.account.edit-order.change-payment-method
. If it is, check if the adyen payment data is provided and then call your custom logic andsetResponse
to the correspondingRedirectResponse
.setController
to have it use your controller instead. See also https://symfony.com/doc/current/components/http_kernel.html#component-http-kernel-kernel-controller and https://symfony.com/doc/current/event_dispatcher/before_after_filters.html#creating-an-event-subscriber