public function testGetCorrelationIdInbound() { $this->_object->resetHeaders(); $this->_object->setHeaders(array('x-xc-result-correlation-id' => 'test2')); $correlationId = $this->_object->getCorrelationId(); $this->assertEquals('test2', $correlationId); }
/** * Process data on message received * @return Xcom_Chronicle_Model_Message_Saleschannel_Sites_Inbound */ public function process() { parent::process(); $data = $this->getBody(); if (!isset($data)) { $data = array(); } if (!isset($data['webStoreId'])) { $data['webStoreId'] = ''; } $webStoreId = $data['webStoreId']; try { if ($this->_validateSchema()) { $resultSet = $this->_processSearchCategories($webStoreId); if (!empty($resultSet['results'])) { $response = $this->_generateSuccessMessage($webStoreId, $resultSet['results']); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreMetadataProvision/GetAllCategorySucceeded', $response); } else { $response = $this->_generateFailureMessage($webStoreId, $resultSet['error']); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreMetadataProvision/GetAllCategoryFailed', $response); } } } catch (Exception $ex) { Mage::logException($ex); $response = $this->_generateFailureMessage($webStoreId, $ex->getMessage()); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreMetadataProvision/GetAllCategoryFailed', $response); } return $this; }
/** * Builds the Get success and/or failure outbound messages. * @return Xcom_Chronicle_Model_Message_Inventory_Stock_Get_Inbound this message */ public function process() { parent::process(); $data = $this->getBody(); if (!isset($data)) { $data = array(); } try { if ($this->_validateSchema()) { $resultSet = $this->_processLookup($data); $customer = $resultSet['customer']; if (!is_null($customer)) { $response = array('customer' => $customer, 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); $this->_sendSuccess($response); } if (sizeof($resultSet['errors']) > 0) { $response = array('errors' => $resultSet['errors'], 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); $this->_sendFailure($response); } } } catch (Exception $ex) { Mage::logException($ex); $errorResponse = array('id' => $data['id'], 'errors' => array(array('code' => empty($code) ? '-1' : '' . $code, 'message' => $ex->getMessage(), 'parameters' => null)), 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); $this->_sendFailure($errorResponse); } return $this; }
/** * Process data on message received * @return Xcom_Chronicle_Model_Message_Saleschannel_Search_Inbound */ public function process() { parent::process(); $data = $this->getBody(); if (!isset($data)) { $data = array(); } if (!isset($data['query'])) { $data['query'] = null; } try { if ($this->_validateSchema()) { $results = $this->_processSearchQuery($data); $response = array('offers' => $results, 'query' => $data['query'], 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); Mage::helper('xcom_xfabric')->send('salesChannel/offer/searchSucceeded', $response); } } catch (Xcom_Xfabric_Exception $ex) { Mage::logException($ex); $errorResponse = $this->_generate_failure_data($data['query'], $ex, $ex->getCode()); Mage::helper('xcom_xfabric')->send('salesChannel/offer/searchFailed', $errorResponse); Mage::helper("Sent failure"); } catch (Exception $ex) { Mage::logException($ex); if (!is_null($ex)) { $message = $ex->getMessage(); } $errorResponse = $this->_generate_failure_data($data['query'], $ex); Mage::helper('xcom_xfabric')->send('salesChannel/offer/searchFailed', $errorResponse); } return $this; }
/** * Process data on message received * @return array */ public function process() { parent::process(); $data = $this->getBody(); Mage::log($data, null, 'messageFailed.log'); return $this; }
/** * Process data on message received * @return Xcom_Chronicle_Model_Message_Order_Search_Inbound */ public function process() { parent::process(); $data = $this->getBody(); if (!isset($data)) { $data = array(); } try { if ($this->_validateSchema()) { $results = $this->_processSearchQuery($data); $response = array('orders' => $results, 'query' => $data['query'], 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); Mage::helper('xcom_xfabric')->send('com.x.ordermanagement.v2/OrderSearch.NonSensitive/SearchNonSensitiveOrderSucceeded', $response); } } catch (Xcom_Xfabric_Exception $ex) { Mage::logException($ex); $errorResponse = $this->_generateFailureData($data['query'], $ex, $ex->getCode()); Mage::helper('xcom_xfabric')->send('com.x.ordermanagement.v2/OrderSearch.NonSensitive/SearchOrderFailed', $errorResponse); Mage::helper("Sent failure"); } catch (Exception $ex) { Mage::logException($ex); $errorResponse = $this->_generateFailureData($data['query'], $ex); Mage::helper('xcom_xfabric')->send('com.x.ordermanagement.v2/OrderSearch.NonSensitive/SearchOrderFailed', $errorResponse); } return $this; }
/** * Builds the Get success and/or failure outbound messages. * @return Xcom_Chronicle_Model_Message_Inventory_Stock_Get_Inbound this message */ public function process() { parent::process(); $data = $this->getBody(); if (!isset($data)) { $data = array(); } try { if ($this->_validateSchema()) { $resultSet = $this->_processLookup($data); if (sizeof($resultSet['results']) > 0) { $response = array('stockItems' => $resultSet['results'], 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); Mage::helper('xcom_xfabric')->send('com.x.inventory.v1/StockItemLookup/LookupStockItemSucceeded', $response); } if (sizeof($resultSet['errors']) > 0) { $response = array('errors' => $resultSet['errors'], 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); Mage::helper('xcom_xfabric')->send('com.x.inventory.v1/StockItemLookup/LookupStockItemFailed', $response); } } } catch (Exception $ex) { Mage::logException($ex); $errors = array(); foreach ($data['stockItemIds'] as $id) { $errors[] = array('sku' => $id, 'errors' => array(array('code' => '-1', 'message' => 'Exception raised while processing lookup for inventory.', 'parameters' => null))); } $response = array('errors' => $errors, 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); Mage::helper('xcom_xfabric')->send('com.x.inventory.v1/StockItemLookup/LookupStockItemFailed', $response); } return $this; }
/** * Save product types. * * @return Xcom_Mapping_Model_Message_ProductTaxonomy_ProductType_Abstract_Response */ public function process() { //since this process is delayed event prefix has to be set here $this->_eventPrefix = 'response_message'; parent::process(); $data = $this->getBody(); if (isset($data['productTypes'])) { $this->saveProductTypes($data['productTypes']); } return $this; }
public function process() { parent::process(); $data = $this->getBody(); try { $this->_processStartSale($data); } catch (Exception $e) { Mage::logException($e); } return $this; }
/** * Process data on message received * @return array */ public function process() { parent::process(); $data = $this->getBody(); $dataObject = array(); $dataObject['destination_id'] = $this->getPublisherPseudonym(); if (isset($data['payload'])) { $dataObject['payload'] = $data['payload']; } Mage::helper('xcom_xfabric')->send('message/pong', $dataObject); return $this; }
/** * Process data on message received * @return Xcom_Chronicle_Model_Message_Webstore_Provider_Get_Inbound */ public function process() { parent::process(); try { if ($this->_validateSchema()) { $providerName = Mage::getBaseUrl(); $response = $this->_generateSuccessMessage($providerName); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreMetadataProvision/GetAllWebStoreProviderSucceeded', $response); } } catch (Exception $ex) { //will just log the exception and just drop the request on the floor, because there is no //error message for this particular request Mage::logException($ex); } return $this; }
/** * Process message body and store result in database * @return Xcom_Mapping_Model_Message_ProductTaxonomy_Get_Succeeded */ public function process() { parent::process(); $data = $this->getBody(); $localeCode = 'en_US'; if (!is_null($data['locale'])) { $localeCode = $data['locale']['language'] . '_' . $data['locale']['country']; } $this->setLocaleCode($localeCode); $this->_deleteProductClasses($data); foreach ($data['productTaxonomy']['productClasses'] as $productClass) { $this->saveProductClass($productClass); } $this->setLoadedFlagConfig(); return $this; }
/** * Process data on message received * @return Xcom_Chronicle_Model_Message_Order_Search_Inbound */ public function process() { parent::process(); $data = $this->getBody(); try { $this->_processSearchQuery($data['ids']); if (count($this->_foundProducts) > 0) { $this->_sendFoundProducts(); } if (count($this->_errors) > 0) { $this->_sendErrors(); } } catch (Exception $e) { Mage::logException($e); $this->_notFoundProducts = $data['ids']; $this->_addSearchError($e->getMessage()); $this->_sendErrors(); } return $this; }
/** * Process data on message received * @return Xcom_Chronicle_Model_Message_Customer_Search_Inbound */ public function process() { parent::process(); $data = $this->getBody(); if (!isset($data)) { $data = array(); } if (!isset($data['modifiedSince'])) { $data['modifiedSince'] = null; } if (!isset($data['itemsRequested'])) { $data['itemsRequested'] = null; } if (!isset($data['startItemIndex'])) { $data['startItemIndex'] = null; } if (!isset($data['webStoreId'])) { $data['webStoreId'] = null; } try { if ($this->_validateSchema()) { $searchResults = $this->_processSearchQuery($data); $response = array('webStoreOffers' => $searchResults['results'], 'totalItemsFound' => $searchResults['totalItemsFound'], 'request' => array('webStoreId' => $data['webStoreId'], 'modifiedSince' => $data['modifiedSince'], 'itemsRequested' => $data['itemsRequested'], 'startItemIndex' => $data['startItemIndex']), 'destination_id' => $this->getPublisherPseudonym(), 'correlation_id' => $this->getCorrelationId()); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreOfferSearch/SearchWebStoreOfferSucceeded', $response); } } catch (Xcom_Xfabric_Exception $ex) { Mage::logException($ex); $errorResponse = $this->_generate_failure_data($data['modifiedSince'], $data['itemsRequested'], $data['startItemIndex'], $data['webStoreId'], $ex, $ex->getCode()); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreOfferSearch/SearchWebStoreOfferFailed', $errorResponse); } catch (Exception $ex) { if (!is_null($ex)) { $message = $ex->getMessage(); } Mage::logException($ex); $errorResponse = $this->_generate_failure_data($data['modifiedSince'], $data['itemsRequested'], $data['startItemIndex'], $data['webStoreId'], $ex, $ex->getCode()); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreOfferSearch/SearchWebStoreOfferFailed', $errorResponse); } return $this; }
/** * Process data on message received * @return Xcom_Chronicle_Model_Message_Webstore_Get_Inbound */ public function process() { parent::process(); $providerName = Mage::getBaseUrl(); try { if ($this->_validateSchema()) { $resultSet = $this->_processGetStores(); if (!empty($resultSet['results'])) { $response = $this->_generateSuccessMessage($providerName, $resultSet['results']); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreMetadataProvision/GetAllWebStoreSucceeded', $response); } else { $response = $this->_generateFailureMessage($providerName, $resultSet['error']); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreMetadataProvision/GetAllWebStoreFailed', $response); } } } catch (Exception $ex) { Mage::logException($ex); $response = $this->_generateFailureMessage($providerName, $ex->getMessage()); Mage::helper('xcom_xfabric')->send('com.x.webstore.v1/WebStoreMetadataProvision/GetAllWebStoreFailed', $response); } return $this; }
protected function _construct() { $this->_topic = 'productTaxonomy/getFailed'; $this->_schemaRecordName = 'GetProductTaxonomyFailed'; parent::_construct(); }
/** * Initialization of class */ protected function _construct() { parent::_construct(); $this->_topic = 'message/pong'; }
protected function _construct() { $this->_topic = 'productTaxonomy/productType/searchFailed'; $this->_schemaRecordName = 'SearchProductTypeFailed'; parent::_construct(); }
/** * Initialization of class */ protected function _construct() { parent::_construct(); $this->_topic = 'productTaxonomy/updated'; }