本文整理汇总了PHP中EbayEnterprise_MageLog_Helper_Context::getMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP EbayEnterprise_MageLog_Helper_Context::getMetaData方法的具体用法?PHP EbayEnterprise_MageLog_Helper_Context::getMetaData怎么用?PHP EbayEnterprise_MageLog_Helper_Context::getMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EbayEnterprise_MageLog_Helper_Context
的用法示例。
在下文中一共展示了EbayEnterprise_MageLog_Helper_Context::getMetaData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: 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));
}
}
示例3: 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;
}
示例4: 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));
}
}
示例5: 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);
}
}
示例6: 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;
}
示例7: __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);
}
示例8: 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'];
}
示例9: _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;
}
示例10: 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;
}
示例11: _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;
}
示例12: _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;
}
示例13: 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;
}
示例14: _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;
}
示例15: 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;
}