public function setUp()
 {
     parent::setUp();
     $this->_payload = new OrderEvents\OrderRejected(new Payload\ValidatorIterator([$this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\IValidator')]), $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\ISchemaValidator'), $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\IPayloadMap'), new NullLogger());
     $this->_payload->setCustomerOrderId(static::PAYLOAD_CUSTOMER_ORDER_ID)->setStoreId(static::PAYLOAD_STORE_ID)->setOrderCreateTimestamp(new DateTime(static::PAYLOAD_ORDER_CREATE_TIMESTAMP))->setReason(static::PAYLOAD_REASON)->setCode(static::PAYLOAD_CODE);
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
     $this->_eventHelper = $this->getHelperMock('ebayenterprise_order/event', ['attemptCancelOrder']);
     $this->_orderrejected = Mage::getModel('ebayenterprise_order/orderrejected', ['payload' => $this->_payload, 'order_event_helper' => $this->_eventHelper]);
 }
 /**
  * Processing order rejected event by loading the order using the customer order id
  * from the payload, if we have a valid order in Magento we proceed to attempt
  * to cancel the order.
  * @return self
  */
 public function process()
 {
     $incrementId = trim($this->_payload->getCustomerOrderId());
     if ($incrementId === '') {
         $logMessage = 'Received empty customer order id.';
         $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__));
         return $this;
     }
     $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
     if (!$order->getId()) {
         $logData = ['increment_Id' => $incrementId];
         $logMessage = 'Customer order id {increment_id} was not found.';
         $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
         return $this;
     }
     // canceling the order
     $this->_orderEventHelper->attemptCancelOrder($order, $this->_payload->getEventType());
     return $this;
 }