$setPaymentOrderRouteRequestEvent =
new SetPaymentOrderRouteRequestEvent($request,
$setPaymentRequest,
$context);
$this->eventDispatcher->
dispatch($setPaymentOrderRouteRequestEvent);
$this->setPaymentOrderRoute->
setPayment($setPaymentOrderRouteRequestEvent->
getStoreApiRequest(),
$context);
$handlePaymentRequest =
new Request();
$handlePaymentRequest->request->
set('orderId',
$orderId);
$handlePaymentRequest->request->
set('finishUrl',
$finishUrl);
$handlePaymentRequest->request->
set('errorUrl',
$errorUrl);
$handlePaymentRequest->request->
add($request->request->
all());
$handlePaymentMethodRouteRequestEvent =
new HandlePaymentMethodRouteRequestEvent($request,
$handlePaymentRequest,
$context);
$this->eventDispatcher->
dispatch($handlePaymentMethodRouteRequestEvent);
try { $routeResponse =
$this->handlePaymentMethodRoute->
load( $handlePaymentMethodRouteRequestEvent->
getStoreApiRequest(),
$context );
$response =
$routeResponse->
getRedirectResponse();
} catch (PaymentProcessException
) { return $this->
forwardToRoute( 'frontend.checkout.finish.page',
[