Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid potential duplicate base url for redirect result route. (Fixes: #338) #339

Merged
merged 1 commit into from Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/Handlers/AbstractPaymentMethodHandler.php
Expand Up @@ -159,7 +159,7 @@ abstract class AbstractPaymentMethodHandler implements AsynchronousPaymentHandle
/**
* @var RouterInterface
*/
protected $router;
protected $symfonyRouter;

/**
* @var CsrfTokenManagerInterface
Expand Down Expand Up @@ -191,6 +191,7 @@ abstract class AbstractPaymentMethodHandler implements AsynchronousPaymentHandle

/**
* AbstractPaymentMethodHandler constructor.
*
* @param ConfigurationService $configurationService
* @param ClientService $clientService
* @param Browser $browserBuilder
Expand All @@ -205,7 +206,7 @@ abstract class AbstractPaymentMethodHandler implements AsynchronousPaymentHandle
* @param PaymentResponseHandler $paymentResponseHandler
* @param ResultHandler $resultHandler
* @param OrderTransactionStateHandler $orderTransactionStateHandler
* @param RouterInterface $router
* @param RouterInterface $symfonyRouter
* @param CsrfTokenManagerInterface $csrfTokenManager
* @param Session $session
* @param EntityRepositoryInterface $currencyRepository
Expand All @@ -227,7 +228,7 @@ public function __construct(
PaymentResponseHandler $paymentResponseHandler,
ResultHandler $resultHandler,
OrderTransactionStateHandler $orderTransactionStateHandler,
RouterInterface $router,
RouterInterface $symfonyRouter,
CsrfTokenManagerInterface $csrfTokenManager,
Session $session,
EntityRepositoryInterface $currencyRepository,
Expand All @@ -249,7 +250,7 @@ public function __construct(
$this->resultHandler = $resultHandler;
$this->logger = $logger;
$this->orderTransactionStateHandler = $orderTransactionStateHandler;
$this->router = $router;
$this->symfonyRouter = $symfonyRouter;
$this->csrfTokenManager = $csrfTokenManager;
$this->session = $session;
$this->currencyRepository = $currencyRepository;
Expand Down Expand Up @@ -682,7 +683,7 @@ private function getAdyenReturnUrl(AsyncPaymentTransactionStruct $transaction, S
$baseUrl = $this->salesChannelRepository->getCurrentDomainUrl($context);

// Generate the custom Adyen endpoint to receive the redirect from the issuer page
$adyenReturnPath = $this->router->generate(
$adyenReturnPath = $this->symfonyRouter->generate(
'payment.adyen.redirect_result',
[
RedirectResultController::CSRF_TOKEN => $this->csrfTokenManager->getToken(
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services/payment-handlers.xml
Expand Up @@ -20,7 +20,7 @@
<argument type="service" id="Adyen\Shopware\Handlers\ResultHandler"/>
<argument type="service"
id="Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStateHandler"/>
<argument type="service" id="Symfony\Component\Routing\RouterInterface"/>
<argument type="service" id="router.default"/>
<argument type="service" id="security.csrf.token_manager"/>
<argument type="service" id="session"/>
<argument type="service" id="currency.repository"/>
Expand Down