/**
  * Redirect to romview after validating that correct information has actually been answered
  */
 public function viewAction()
 {
     Mage::unregister('rom_order');
     /** @var Zend_Controller_Request_Http */
     $request = $this->getRequest();
     $orderId = $request->getPost('oar_order_id');
     $orderEmail = $request->getPost('oar_email');
     $orderZip = $request->getPost('oar_zip');
     $orderLastname = $request->getPost('oar_billing_lastname');
     /** @var Mage_Core_Model_Session */
     $session = $this->_orderFactory->getCoreSessionModel();
     // Clearing out messages
     $session->getMessages(true);
     /** @var EbayEnterprise_Order_Model_Detail */
     $detailApi = $this->_orderFactory->getNewRomOrderDetailModel($orderId);
     try {
         /** @var EbayEnterprise_Order_Model_Detail_Order $romOrderObject */
         $romOrderObject = $detailApi->process();
     } catch (EbayEnterprise_Order_Exception_Order_Detail_Notfound_Exception $e) {
         $session->addError($e->getMessage());
         $this->_redirect('sales/guest/form');
         return;
     }
     if ($this->_hasValidOrderResult($romOrderObject, $orderEmail, $orderZip, $orderLastname)) {
         $this->_redirect('sales/order/romguestview', ['order_id' => $orderId]);
     } else {
         $session->addError($this->_orderHelper->__('Order not found.'));
         $this->_redirect('sales/guest/form');
     }
     return;
 }
 /**
  * Unhandled exceptions cause the entire order not to get saved.
  * This is by design, so we don't report a false success or try
  * to keep sending an order that has no hope for success.
  *
  * @param Exception|null The exception to log or null for the default.
  * @return Exception The same (or default) exception after logging
  */
 protected function _logUnhandledException(Exception $e = null)
 {
     if (!$e) {
         $errorMessage = $this->_helper->__(self::ORDER_CREATE_FAIL_MESSAGE);
         // Mage::exception adds '_Exception' to the end.
         $exceptionClassName = Mage::getConfig()->getModelClassName('ebayenterprise_order/create');
         $e = Mage::exception($exceptionClassName, $errorMessage);
     }
     $this->_logger->warning('Encountered a fatal error attempting to send order create. See the exception log.', $this->_logContext->getMetaData(__CLASS__, [], $e));
     return $e;
 }
 /**
  * Get the shipping method.
  *
  * @return string | null
  */
 public function getShippingDescription()
 {
     /** @var string */
     $carrier = $this->getCarrier();
     /** @var string */
     $mode = $this->getCarrierMode();
     /** @var array */
     $shipmap = is_array($this->coreConfig->shippingMethodMap) ? array_flip($this->coreConfig->shippingMethodMap) : [];
     /** @var string */
     $romKey = sprintf('%s_%s', $carrier, $mode);
     return isset($shipmap[$romKey]) ? $this->getShippingMethod($shipmap[$romKey]) : $this->orderHelper->__('%s %s', $carrier, $mode);
 }
 /**
  * Redirect and notify the customer of an order could not be canceled.
  *
  * @param  Exception
  * @param  Mage_Core_Model_Session
  * @param  string
  * @return self
  */
 protected function _handleRomCancelException(Exception $e, Mage_Core_Model_Session $session, $redirectUrl)
 {
     $session->addError($this->_orderHelper->__($e->getMessage()));
     $this->_redirectUrl($redirectUrl);
     return $this;
 }
 /**
  * Get options in "key-value" format
  *
  * @return array
  */
 public function toArray()
 {
     return ['eb2c' => $this->_orderHelper->__('eBay Enterprise Email'), 'mage' => $this->_orderHelper->__('Magento')];
 }
 /**
  * Constructing the cancel reason select box form field
  *
  * @return string
  */
 public function getCancelReasonHtmlSelect($defValue = null, $name = 'cancel_reason', $id = 'cancel_reason', $title = 'Reason')
 {
     return $this->getLayout()->createBlock('core/html_select')->setName($name)->setId($id)->setTitle($this->_orderHelper->__($title))->setClass('validate-select')->setValue($defValue)->setOptions($this->_orderHelper->getCancelReasonOptionArray())->getHtml();
 }