public function __construct(private readonly AbstractPaymentMethodRoute
$paymentMethodRoute) { } public function switch(ErrorCollection
$errors, SalesChannelContext
$salesChannelContext): PaymentMethodEntity
{ $originalPaymentMethod =
$salesChannelContext->
getPaymentMethod();
if (!
$this->
paymentMethodBlocked($errors)) { return $originalPaymentMethod;
} $paymentMethod =
$this->
getPaymentMethodToChangeTo($errors,
$salesChannelContext);
if ($paymentMethod === null
) { return $originalPaymentMethod;
} $this->
addNoticeToCart($errors,
$paymentMethod);
return $paymentMethod;
} private function paymentMethodBlocked(ErrorCollection
$errors): bool
{