_initTransaction(); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!$txn) { return $resultRedirect->setPath('sales/*/'); } try { $this->orderPaymentRepository ->get($txn->getPaymentId()) ->setOrder($txn->getOrder()) ->importTransactionInfo($txn); $txn->save(); $this->messageManager->addSuccessMessage(__('The transaction details have been updated.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addErrorMessage(__('We can\'t update the transaction details.')); $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); } return $resultRedirect->setPath('sales/transactions/view', ['_current' => true]); } }