diff --git a/Controller/Redirect/Process.php b/Controller/Redirect/Process.php index 5af38827a..1f7619410 100755 --- a/Controller/Redirect/Process.php +++ b/Controller/Redirect/Process.php @@ -658,6 +658,9 @@ protected function redirectFailure() { $store = $this->order->getStore(); $this->logger->addDebug('start redirectFailure'); + if ($this->hasPostData('add_service_action_from_magento', 'payfastcheckout')) { + return $this->handleProcessedResponse('checkout/cart'); + } if ($this->accountConfig->getFailureRedirectToCheckout($store)) { $this->logger->addDebug('getFailureRedirectToCheckout'); if (!$this->customerSession->isLoggedIn() && ($this->order->getCustomerId() > 0)) { @@ -666,7 +669,6 @@ protected function redirectFailure() try { $customer = $this->customerRepository->getById($this->order->getCustomerId()); $this->customerSession->setCustomerDataAsLoggedIn($customer); - if (!$this->checkoutSession->getLastRealOrderId() && $this->order->getIncrementId()) { $this->checkoutSession->setLastRealOrderId($this->order->getIncrementId()); $this->logger->addDebug(__METHOD__ . '|setLastRealOrderId|'); @@ -683,15 +685,7 @@ protected function redirectFailure() $this->logger->addDebug('ready for redirect'); return $this->handleProcessedResponse('checkout', ['_fragment' => 'payment', '_query' => ['bk_e' => 1]]); } - - /** - * @noinspection PhpUndefinedMethodInspection - */ - if($this->hasPostData('add_service_action_from_magento', 'payfastcheckout')) { - $url = 'checkout/cart'; - } else { - $url = $this->accountConfig->getFailureRedirect($store); - } + $url = $this->accountConfig->getFailureRedirect($store); return $this->handleProcessedResponse($url); }