$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',
['orderId' =>
$orderId, 'changedPayment' => true, 'paymentFailed' => true
] );
} return $response ??
$this->
redirectToRoute( 'frontend.checkout.finish.page',
['orderId' =>
$orderId, 'changedPayment' => true
] );
}