/**
  * Process an incoming Genesis Notification
  * If it appears valid, do a reconcile and
  * use the reconcile data to save details
  * about the transaction
  *
  * @see Genesis_API_Documentation \ notification_url
  *
  * @return void
  */
 public function notifyAction()
 {
     // Notifications are only POST, deny everything else
     if (!$this->getRequest()->isPost()) {
         return;
     }
     try {
         $this->helper->initClient($this->checkout->getCode());
         $notification = new \Genesis\API\Notification($this->getRequest()->getPost());
         if ($notification->isAuthentic()) {
             $notification->initReconciliation();
             $reconcile = $notification->getReconciliationObject();
             if (isset($reconcile->unique_id)) {
                 $this->checkout->processNotification($reconcile);
                 $this->getResponse()->setHeader('Content-type', 'application/xml');
                 $this->getResponse()->setBody($notification->generateResponse());
             }
         }
     } catch (Exception $exception) {
         Mage::logException($exception);
     }
 }
 /**
  *
  * @return null|string (null => failed; responseText => success)
  * @throws \Exception
  * @throws \Genesis\Exceptions\InvalidArgument
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function handleGenesisNotification()
 {
     $this->_configHelper->initGatewayClient();
     $notification = new \Genesis\API\Notification($this->getIpnRequestData());
     if ($notification->isAuthentic()) {
         $notification->initReconciliation();
     }
     $responseObject = $notification->getReconciliationObject();
     if (!isset($responseObject->unique_id)) {
         return null;
     } else {
         $this->setOrderByReconcile($responseObject);
         try {
             $this->processNotification($responseObject);
         } catch (\Magento\Framework\Exception\LocalizedException $e) {
             $comment = $this->createIpnComment(__('Note: %1', $e->getMessage()), true);
             $comment->save();
             throw $e;
         }
         return $notification->generateResponse();
     }
 }