Skip to content

Commit

Permalink
Merge pull request #56 from paynl/feature/instorefix
Browse files Browse the repository at this point in the history
Fix instore redirect
  • Loading branch information
woutse authored Aug 17, 2022
2 parents e69d213 + 2722f61 commit 6adb99e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Controller/Order/Instore.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Instore extends PayAction implements CsrfAwareActionInterface
private $orderRepository;
private $quoteRepository;
private $paymentHelper;
protected $resultFactory;

public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
{
Expand All @@ -40,11 +41,13 @@ public function __construct(
\Magento\Framework\App\Action\Context $context,
OrderRepository $orderRepository,
PaymentHelper $paymentHelper,
QuoteRepository $quoteRepository
QuoteRepository $quoteRepository,
\Magento\Framework\Controller\ResultFactory $resultFactory
) {
$this->orderRepository = $orderRepository;
$this->paymentHelper = $paymentHelper;
$this->quoteRepository = $quoteRepository;
$this->resultFactory = $resultFactory;

parent::__construct($context);
}
Expand Down Expand Up @@ -75,11 +78,13 @@ public function execute()
PayHelper::setCookie('pinError', $e->getMessage());
}

$redirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT);

if (!empty($redirectUrl)) {
header("Location: " . $redirectUrl);
$redirect->setUrl($redirectUrl);
} else {
header("Location: " . $returnUrl);
$redirect->setUrl($returnUrl);
}
exit;
return $redirect;
}
}

0 comments on commit 6adb99e

Please sign in to comment.