Exemplo n.º 1
0
 /**
  * Response action.
  * Action for Authorize.net SIM Relay Request.
  *
  * @param string $area
  * @return void
  */
 protected function _responseAction($area = 'frontend')
 {
     $helper = $this->dataFactory->create($area);
     $params = [];
     $data = $this->getRequest()->getPostValue();
     /* @var $paymentMethod \Magento\Authorizenet\Model\DirectPost */
     $paymentMethod = $this->_objectManager->create('Magento\\Authorizenet\\Model\\Directpost');
     $result = [];
     if (!empty($data['x_invoice_num'])) {
         $result['x_invoice_num'] = $data['x_invoice_num'];
         $params['order_success'] = $helper->getSuccessOrderUrl($result);
     }
     try {
         if (!empty($data['store_id'])) {
             $paymentMethod->setStore($data['store_id']);
         }
         $paymentMethod->process($data);
         $result['success'] = 1;
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
         $result['success'] = 0;
         $result['error_msg'] = $e->getMessage();
     } catch (\Exception $e) {
         $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
         $result['success'] = 0;
         $result['error_msg'] = __('We can\'t process your order right now. Please try again later.');
     }
     if (!empty($data['controller_action_name']) && strpos($data['controller_action_name'], 'sales_order_') === false) {
         if (!empty($data['key'])) {
             $result['key'] = $data['key'];
         }
         $result['controller_action_name'] = $data['controller_action_name'];
         $result['is_secure'] = isset($data['is_secure']) ? $data['is_secure'] : false;
         $params['redirect'] = $helper->getRedirectIframeUrl($result);
     }
     $this->_coreRegistry->register(Iframe::REGISTRY_KEY, $params);
     $this->_view->addPageLayoutHandles();
     $this->_view->loadLayout(false)->renderLayout();
 }
Exemplo n.º 2
0
 /**
  * Get helper data
  *
  * @param string $area
  * @return \Magento\Authorizenet\Helper\Backend\Data|\Magento\Authorizenet\Helper\Data
  */
 public function getHelper($area)
 {
     return $this->dataFactory->create($area);
 }