/** * 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; }
public function testGetOrderHistoryUrl() { $expectedPath = parse_url(Mage::getBaseUrl() . 'sales/guest/view/')['path']; $expectedParams = ['oar_billing_lastname' => 'Sibelius', 'oar_email' => '*****@*****.**', 'oar_order_id' => '908123987143079814', 'oar_type' => 'email']; $order = $this->getModelMockBuilder('sales/order')->setMethods(['getCustomerEmail', 'getCustomerLastname', 'getIncrementId'])->getMock(); $order->expects($this->any())->method('getCustomerEmail')->will($this->returnValue($expectedParams['oar_email'])); $order->expects($this->any())->method('getCustomerLastname')->will($this->returnValue($expectedParams['oar_billing_lastname'])); $order->expects($this->any())->method('getIncrementId')->will($this->returnValue($expectedParams['oar_order_id'])); $url = parse_url($this->_helper->getOrderHistoryUrl($order)); $path = $url['path']; $query = []; parse_str($url['query'], $query); $this->assertSame($expectedPath, $path); $this->assertSame($expectedParams, $query); }
/** * Get the next increment id by incrementing the last id * @return string */ public function getNextId() { // remove any order prefixes from the last increment id $last = $this->_orderHelper->removeOrderIncrementPrefix($this->getLastId()); // Using bcmath to avoid float/integer overflow. return $this->format(bcadd($last, 1)); }
/** * get an id for the customer * @return string */ protected function _getCustomerId() { /** bool $isGuest */ $isGuest = !$this->_order->getCustomerId(); /** @var int $customerId */ $customerId = $this->_order->getCustomerId() ?: $this->_getGuestCustomerId(); /** @var mixed $store */ $store = $this->_order->getStore(); return $this->_helper->prefixCustomerId($customerId, $store, $isGuest); }
/** * 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(); }
/** * Responsible for extracting order increment ids from a passed in DOM document * and then load a collection of sales/order instances for any increment ids in * the document. * * @param string * @return Varien_Data_Collection */ protected function loadOrdersFromXml($xml) { return $this->orderHelper->getOrderCollectionByIncrementIds($this->orderHelper->extractOrderEventIncrementIds($xml)); }
/** * Get the cancel reason description from the order cancel description map * on on the order cancel code in the sales/order object. * * @return string | null */ protected function _getReasonDescription() { $reasonCode = $this->_order->getCancelReasonCode(); return $reasonCode ? $this->_orderHelper->getCancelReasonDescription($reasonCode) : null; }