directpostFactory = $directpostFactory ?: $this->_objectManager->create(DirectpostFactory::class); $this->logger = $logger ?: $this->_objectManager->get(LoggerInterface::class); } /** * @inheritDoc */ public function createCsrfValidationException( RequestInterface $request ): ?InvalidRequestException { return null; } /** * @inheritDoc */ public function validateForCsrf(RequestInterface $request): ?bool { return true; } /** * Response action. * * Action for Authorize.net SIM Relay Request. * * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { $data = $this->getRequest()->getParams(); /** @var Directpost $paymentMethod */ $paymentMethod = $this->directpostFactory->create(); if (!empty($data['store_id'])) { $paymentMethod->setStore($data['store_id']); } $paymentMethod->setResponseData($data); try { $paymentMethod->validateResponse(); } catch (LocalizedException $e) { $this->logger->critical($e->getMessage()); return $this->_redirect('noroute'); } $this->_responseAction('adminhtml'); return $this->resultFactory->create(ResultFactory::TYPE_PAGE); } }