本文整理汇总了PHP中EbayEnterprise_MageLog_Helper_Context类的典型用法代码示例。如果您正苦于以下问题:PHP EbayEnterprise_MageLog_Helper_Context类的具体用法?PHP EbayEnterprise_MageLog_Helper_Context怎么用?PHP EbayEnterprise_MageLog_Helper_Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EbayEnterprise_MageLog_Helper_Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$this->logger = $this->getHelperMockBuilder('ebayenterprise_magelog/data')->disableOriginalConstructor()->getMock();
$this->logContext = $this->getHelperMockBuilder('ebayenterprise_magelog/context')->disableOriginalConstructor()->getMock();
$this->logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
}
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:7,代码来源:AllocationTest.php
示例2: _extractTaxData
/**
* Extract tax data from the tax response payload and store tax records,
* duties and fees.
*
* Extracts all three sets of tax data as each set of data can be retrieved
* from the same address parser. Extracting all three sets at once prevents
* nearly identical steps from being repeated for each ship group for each
* type of tax data.
*
* @return self
*/
protected function _extractTaxData()
{
// Each of these will hold an array of arrays of data extracted from each
// ship group - e.g. $taxRecords = [[$recordA, $recordB], [$recordC, $recordD]].
$taxRecords = [];
$duties = [];
$fees = [];
foreach ($this->_taxResponse->getShipGroups() as $shipGroup) {
$address = $this->_getQuoteAddressForShipGroup($shipGroup);
if ($address) {
$addressParser = $this->_taxFactory->createResponseAddressParser($shipGroup, $address);
$taxRecords[] = $addressParser->getTaxRecords();
$duties[] = $addressParser->getTaxDuties();
$fees[] = $addressParser->getTaxFees();
} else {
$this->_logger->warn('Tax response ship group does not relate to any known address.', $this->_logContext->getMetaData(__CLASS__, ['rom_response_body' => $shipGroup->serialize()]));
}
}
// Flatten each nested array of tax data - allows for a single array_merge
// instead of iteratively calling array_merge on each pass when extracting
// tax data for each ship group.
$this->_taxRecords = $this->_flattenArray($taxRecords);
$this->_taxDuties = $this->_flattenArray($duties);
$this->_taxFees = $this->_flattenArray($fees);
return $this;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:37,代码来源:Quote.php
示例3: copyShipFromAddressTo
protected function copyShipFromAddressTo(Mage_Customer_Model_Address_Abstract $address, EbayEnterprise_Inventory_Model_Details_Item $detail)
{
if ($detail->isAvailable()) {
$meta = ['sku' => $detail->getSku(), 'item_id' => $detail->getItemId()];
$this->logger->debug('applying details for item "{sku}" [{item_id}]', $this->logContext->getMetaData(__CLASS__, $meta));
$address->addData($this->exportShipFromAddress($detail));
}
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:8,代码来源:Origin.php
示例4: handleBeforeCollectTotals
/**
* Before collecting item totals, check that all items
* in the quote are available to be fulfilled.
*
* @param Varien_Event_Observer
* @return self
*/
public function handleBeforeCollectTotals(Varien_Event_Observer $observer)
{
try {
$quote = $observer->getEvent()->getQuote();
$this->quantityService->checkQuoteInventory($quote);
} catch (EbayEnterprise_Inventory_Exception_Quantity_Collector_Exception $e) {
$this->logger->warning($e->getMessage(), $this->logContext->getMetaData(__CLASS__, [], $e));
}
return $this;
}
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:17,代码来源:Observer.php
示例5: lookupTenderType
/**
* Lookup the tender type for given gift card.
* @param string
* @param string
* @param bool
* @return string
* @throws EbayEnterprise_GiftCard_Exception_InvalidCardNumber_Exception If card number cannot be retrieved.
*/
public function lookupTenderType($cardNumber, $currencyCode, $panIsToken = false)
{
try {
$api = $this->getTenderTypeLookupApi();
return $this->createTenderTypeLookup($cardNumber, $currencyCode, $api, $panIsToken)->getTenderType();
} catch (EbayEnterprise_GiftCard_Exception_TenderTypeLookupFailed_Exception $e) {
$this->logger->error('Unable to lookup tender type', $this->logContext->getMetaData(__CLASS__, [], $e));
throw Mage::exception('EbayEnterprise_GiftCard_Exception_InvalidCardNumber', $this->helper->__(self::INVLIAD_CARD_NUMBER_MESSAGE, $cardNumber));
}
}
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:18,代码来源:Tendertype.php
示例6: testGetMetaData
/**
* @param string $className
* @param array $data
* @param Exception $e
* @param string $case the test case
* @dataProvider providerGetMetaData
* @loadFixture
*/
public function testGetMetaData($className, $data, $exception, $case)
{
$context = $this->_context->getMetaData($className, $data, $exception);
if (!$exception) {
$this->assertSame($this->expected($case)->getData(), $context);
} else {
$this->assertArrayHasKey('exception_class', $context);
$this->assertArrayHasKey('exception_message', $context);
$this->assertArrayHasKey('exception_stacktrace', $context);
}
}
开发者ID:kojiromike,项目名称:magento-log,代码行数:19,代码来源:ContextTest.php
示例7: setUp
public function setUp()
{
$this->helper = $this->getHelperMock('ebayenterprise_giftcard/data', ['__', 'getConfigData']);
$this->coreHelper = $this->getHelperMock('eb2ccore/data', ['getSdkApi']);
$this->logger = $this->getHelperMock('ebayenterprise_magelog/data');
$this->logContext = $this->getHelperMock('ebayenterprise_magelog/context');
$this->logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
$this->apiLogger = $this->getMock('\\Psr\\Log\\NullLogger');
$this->config = $this->buildCoreConfigRegistry(['apiService' => 'payments', 'apiOperationTenderTypeLookup' => 'tendertype/lookup']);
$this->constructorArgs = ['core_helper' => $this->coreHelper, 'helper' => $this->helper, 'logger' => $this->logger, 'log_context' => $this->logContext, 'api_logger' => $this->apiLogger, 'config' => $this->config];
}
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:11,代码来源:TendertypeTest.php
示例8: makeRequest
/**
* Make a request to the token validation service using the token set in
* "magic" data. Should return the response message from the service.
* @return string
*/
public function makeRequest()
{
// if there's no token, don't attempt to validate it
if (!$this->getToken()) {
$logMessage = 'No token to make request for';
$this->_logger->info($logMessage, $this->_context->getMetaData(__CLASS__));
return '';
}
$response = Mage::getModel('eb2ccore/api')->setStatusHandlerPath(static::API_STATUS_HANDLER)->request($this->_buildRequest(), Mage::helper('eb2ccsr')->getConfigModel()->xsdFileTokenValidation, $this->_getApiUri());
return $response;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:16,代码来源:Request.php
示例9: __construct
/**
* @link http://www.php.net/manual/en/class.exception.php
*/
public function __construct($message = "", $code = 0, Exception $previous = null)
{
$this->_logger = Mage::helper('ebayenterprise_magelog');
$this->_context = Mage::helper('ebayenterprise_magelog/context');
/**
* @note This runs counter to our styleguide because it is
* itself an exception. Furthermore we want to be both
* inescapable and verbose with critical exceptions.
*/
$this->_logger->critical($message, $this->_context->getMetaData(__CLASS__, [], $previous));
parent::__construct($message, $code, $previous);
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:15,代码来源:Critical.php
示例10: getMethodSdkId
/**
* get the ROM identifier for the given magento shipping method code
* return null if $shippingMethod evaluates to false
*
* @param string
* @return string|null
*/
public function getMethodSdkId($shippingMethod)
{
$this->fetchAvailableShippingMethods();
if (!$shippingMethod) {
return '';
}
if (!isset($this->methods[$shippingMethod]['sdk_id'])) {
$this->logger->error('Unable to get the SDK identifier for shipping method {shipping_method}', $this->logContext->getMetaData(__CLASS__, ['shipping_method' => $shippingMethod]));
throw Mage::exception('EbayEnterprise_Eb2cCore', 'Unable to find a valid shipping method');
}
return $this->methods[$shippingMethod]['sdk_id'];
}
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:19,代码来源:Shipping.php
示例11: setUp
public function setUp()
{
parent::setUp();
$this->logger = $this->getHelperMockBuilder('ebayenterprise_magelog/data')->disableOriginalConstructor()->getMock();
$this->logContext = $this->getHelperMockBuilder('ebayenterprise_magelog/context')->disableOriginalConstructor()->getMock();
$this->logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
$this->request = $this->getMockForAbstractClass('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Inventory\\IAllocationRollbackRequest');
$this->reply = $this->getMockForAbstractClass('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Inventory\\IAllocationRollbackReply');
$this->httpApi = $this->getMockBuilder('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi')->disableOriginalConstructor()->setMethods(['send', 'getRequestBody', 'getResponseBody', 'setRequestBody'])->getMock();
$this->httpApi->expects($this->any())->method('setRequestBody')->with($this->isInstanceOf('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Inventory\\IAllocationRollbackRequest'))->will($this->returnSelf());
$this->httpApi->expects($this->any())->method('getRequestBody')->will($this->returnValue($this->request));
$this->httpApi->expects($this->any())->method('getResponseBody')->will($this->returnValue($this->reply));
}
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:13,代码来源:ServiceTest.php
示例12: _buildBatches
/**
* Build the given batches into feed files.
* @param array of EbayEnterprise_Catalog_Model_Pim_Batch $batches
* @return self
*/
protected function _buildBatches(array $batches)
{
try {
foreach ($batches as $batch) {
Mage::getModel('ebayenterprise_catalog/pim', array('batch' => $batch))->buildFeed();
}
$this->_updateCutoffDate();
} catch (EbayEnterprise_Eb2cCore_Exception_InvalidXml $e) {
$logMessage = 'Error building export feeds';
$this->_logger->critical($logMessage, $this->_context->getMetaData(__CLASS__, [], $e));
}
return $this;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:18,代码来源:Exporter.php
示例13: setUp
public function setUp()
{
parent::setUp();
// Prevent log context from needing session while gather context data for logging.
$this->logContext = $this->getHelperMock('ebayenterprise_magelog/context', ['getMetaData']);
$this->logContext->method('getMetaData')->will($this->returnValue([]));
$this->api = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi');
$this->configModel = $this->buildCoreConfigRegistry(['apiService' => 'inventory', 'apiOperation' => 'allocate']);
$this->helper = $this->getHelperMock('ebayenterprise_inventory');
$this->helper->method('getConfigModel')->will($this->returnValue($this->configModel));
$this->coreHelper = $this->getHelperMock('eb2ccore', ['getSdkApi']);
$this->coreHelper->method('getSdkApi')->will($this->returnValue($this->api));
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:13,代码来源:DeallocatorTest.php
示例14: void
/**
* @param Mage_Sales_Model_Order
* @return self
*/
public function void(Mage_Sales_Model_Order $order)
{
if ($this->_canVoid($order)) {
try {
$this->_getVoidApi()->doVoidOrder($order);
} catch (EbayEnterprise_PayPal_Exception $e) {
$logMessage = 'Void request failed. See exception log for details.';
$this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__));
$this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e));
}
}
return $this;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:17,代码来源:Void.php
示例15: _getLastTimestamp
/**
* Get the last timestamp captured from a test message and return a new DateTime
* object for the timestamp. If no last test message exists or is not a parseable
* date time, will return null.
* @return DateTime|null
*/
protected function _getLastTimestamp()
{
$lastTimestamp = $this->getValue();
$timestamp = null;
try {
// If the value isn't set, don't create a new DateTime. new DateTime(null)
// gives a DateTime for the current time, which is not desirable here.
$timestamp = $lastTimestamp ? $this->_coreHelper->getNewDateTime($lastTimestamp) : null;
} catch (Exception $e) {
$logData = ['last_timestamp' => $lastTimestamp];
$logMessage = 'Invalid timestamp for last AMQP test message timestamp: {last_timestamp}.';
$this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__, $logData, $e));
}
return $timestamp;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:21,代码来源:Lasttestmessage.php
示例16: tryOperation
/**
* attempt to do an inventory detail operation
*
* @param Mage_Sales_Model_Quote
* @return EbayEnterprise_Inventory_Model_Details_Result
*/
protected function tryOperation(Mage_Sales_Model_Quote $quote)
{
$logger = $this->logger;
$logContext = $this->logContext;
try {
$api = $this->prepareApi();
$request = $this->prepareRequest($api, $quote);
if (count($request->getItems())) {
$this->logger->debug('Trying inventory details operation', $this->logContext->getMetaData(__CLASS__));
$api->send();
}
return $this->prepareResult($api);
} catch (InvalidPayload $e) {
$logger->warning('Invalid payload for inventory details. See exception log for more details.', $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
$logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e));
} catch (NetworkError $e) {
$logger->warning('Caught a network error sending the inventory details request. See exception log for more details.', $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
$logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e));
} catch (UnsupportedOperation $e) {
$logger->critical('The inventory details operation is unsupported in current configuration. See exception log for more details.', $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
$logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e));
} catch (UnsupportedHttpAction $e) {
$logger->critical('The inventory details operation is configured with an unsupported HTTP action. See exception log for more details.', $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
$logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e));
}
// if we got here there was a problem
throw Mage::exception('EbayEnterprise_Inventory_Exception_Details_Operation', 'Failed to fetch inventory details');
}
开发者ID:rgabruel,项目名称:magento-retail-order-management,代码行数:34,代码来源:Details.php
示例17: saveCollectionStubIndexer
/**
* Save an EAV collection, disabling the indexer if the collection is
* larger than a configured size.
*
* @param Mage_Eav_Model_Entity_Collection_Abstract
* @return self
*/
public function saveCollectionStubIndexer(Mage_Eav_Model_Entity_Collection_Abstract $collection)
{
$config = $this->getConfigModel();
$stubIndexer = $config->maxPartialReindexSkus < $collection->getSize();
if ($stubIndexer) {
// Stub the indexer so no indexing can take place during massive saves.
$indexerKey = '_singleton/index/indexer';
$oldIndexer = $this->reregister($indexerKey, $this->indexerStub);
}
$failureCount = 0;
$logData = ['product_count' => $collection->getSize()];
$logMessage = 'Saving {product_count} products with stubbed indexer.';
$this->logger->info($logMessage, $this->context->getMetaData(__CLASS__, $logData));
$failMessage = 'Failed to save product with sku {sku}.';
foreach ($collection as $item) {
try {
$item->save();
} catch (Exception $e) {
$failureCount++;
$failLogData = ['sku' => $item->getSku(), 'exception' => $e];
$this->logger->logException($e, $this->context->getMetaData(__CLASS__, $failLogData))->error($failMessage, $this->context->getMetaData(__CLASS__, $failLogData));
}
}
$logMessage = 'Finished saving {product_count} products with {failure_count} failures.';
$logData['failure_count'] = $failureCount;
$this->logger->info($logMessage, $this->context->getMetaData(__CLASS__, $logData));
if ($stubIndexer) {
$this->reregister($indexerKey, $oldIndexer);
}
return $this;
}
开发者ID:rgabruel,项目名称:magento-retail-order-management,代码行数:38,代码来源:Data.php
示例18: _extractTaxData
/**
* Extract tax data from the ship group.
*
* Extracts all three sets of tax data as each set of data can be retrieved
* from the same item parser. Extracting all three sets at once prevents
* nearly identical steps from being repeated for each item for each type of
* tax data.
*
* @return EbayEnterprise_Tax_Model_Record[]
*/
protected function _extractTaxData()
{
// Each of these will hold an array of arrays of data extracted from each
// ship group - e.g. $taxRecords = [[$recordA, $recordB], [$recordC, $recordD]].
// Prepopulate tax records with data extracted for the address for gifting
// so it will get merged together with item taxes.
$taxRecords = [$this->_extractGiftingTaxRecords()];
$duties = [];
$fees = [];
/** @var ITaxedOrderItem $orderItem */
foreach ($this->_shipGroup->getItems() as $orderItem) {
/** @var Mage_Sales_Model_Quote_Item $item */
$item = $this->_getItemForItemPayload($orderItem);
if ($item) {
$itemParser = $this->_taxFactory->createResponseItemParser($orderItem, $item, $this->_addressId, $this->_quoteId);
$taxRecords[] = $itemParser->getTaxRecords();
$duties[] = $itemParser->getTaxDuties();
$fees[] = $itemParser->getTaxFees();
} else {
$this->_logger->warning('Tax response item does not relate to any known quote item.', $this->_logContext->getMetaData(__CLASS__, ['rom_response_body' => $orderItem->serialize()]));
}
}
// Flatten each nested array of tax data - allows for a single array_merge
// instead of iteratively calling array_merge on each pass when extracting
// tax data for each item.
$this->_taxRecords = $this->_flattenArray($taxRecords);
$this->_taxDuties = $this->_flattenArray($duties);
$this->_taxFees = $this->_flattenArray($fees);
return $this;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:40,代码来源:Address.php
示例19: _processProductCollection
/**
* Process all of the products within a given store.
*
* @param Mage_Catalog_Model_Resource_Product_Collection $products products for a specific store
* @param EbayEnterprise_Catalog_Model_Pim_Product_Collection $pimProducts collection of PIM Product instances
* @param string $key
* @param array $productIds
* @return EbayEnterprise_Catalog_Model_Pim_Product_Collection $pimProducts collection of PIM Product instances
*/
protected function _processProductCollection(Mage_Catalog_Model_Resource_Product_Collection $products, EbayEnterprise_Catalog_Model_Pim_Product_Collection $pimProducts, array &$productIds = null)
{
$excludedProductIds = array();
$currentStoreId = $products->getStoreId();
$config = Mage::helper('eb2ccore')->getConfigModel($currentStoreId);
$clientId = $config->clientId;
$catalogId = $config->catalogId;
foreach ($products->getItems() as $product) {
$product->setStoreId($currentStoreId);
$pimProduct = $pimProducts->getItemForProduct($product);
if (!$pimProduct) {
$pimProduct = Mage::getModel('ebayenterprise_catalog/pim_product', array('client_id' => $clientId, 'catalog_id' => $catalogId, 'sku' => $product->getSku()));
$pimProducts->addItem($pimProduct);
}
try {
$pimProduct->loadPimAttributesByProduct($product, $this->_doc, $this->_getFeedConfig(), $this->_getFeedAttributes($currentStoreId));
} catch (EbayEnterprise_Catalog_Model_Pim_Product_Validation_Exception $e) {
$logData = ['sku' => $pimProduct->getSku()];
$logMessage = 'Product "{sku}" excluded from export.';
$this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
$this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e));
$excludedProductIds[] = $product->getId();
$pimProducts->deleteItem($pimProduct);
}
}
if ($productIds) {
$productIds = array_diff($productIds, $excludedProductIds);
}
return $pimProducts;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:39,代码来源:Pim.php
示例20: updateWithQuote
/**
* Update session data with a new quote object. Method should get a diff of the
* current/old quote data and diff it with the new quote data. This data should
* then be used to update flags as needed. Finally, the new data should replace
* existing data.
* @param Mage_Sales_Model_Quote $quote New quote object
* @return self
*/
public function updateWithQuote(Mage_Sales_Model_Quote $quote)
{
$oldData = $this->getCurrentQuoteData();
$newData = $this->_extractQuoteData($quote);
// Copy over the last_updated timestamp from the old quote data. This will
// persist the timestamp from one set of data to the next preventing
// the new data from auto expiring.
$newData['last_updated'] = $oldData['last_updated'];
$this->_logger->debug('Comparing quote data', $this->_context->getMetaData(__CLASS__, ['old' => json_encode($oldData), 'new' => json_encode($newData)]));
$quoteDiff = $this->_diffQuoteData($oldData, $newData);
// if nothing has changed in the quote, no need to update flags, or
// quote data as none of them will change
if (!empty($quoteDiff)) {
$changes = implode(', ', array_keys($quoteDiff));
$logData = ['changes' => $changes, 'diff' => json_encode($quoteDiff)];
$logMessage = 'Changes found in quote for: {changes}';
$this->_logger->debug($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
$this->setTaxUpdateRequiredFlag($this->_changeRequiresTaxUpdate($newData, $quoteDiff))->setDetailsUpdateRequiredFlag($this->_changeRequiresDetailsUpdate($newData, $quoteDiff))->setCurrentQuoteData($newData);
} else {
$this->_logger->debug('No changes in quote.', $this->_context->getMetaData(__CLASS__));
}
// always update the changes - could go from having changes to no changes
$this->setQuoteChanges($quoteDiff);
return $this;
}
开发者ID:danlins,项目名称:magento-retail-order-management,代码行数:33,代码来源:Session.php
注:本文中的EbayEnterprise_MageLog_Helper_Context类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论