/** * will log a warning when the result code is * for an error or is unknown * @dataProvider provideFailureResultCodes */ public function testLogResultCodeWithError($code) { $response = $this->getModelMockBuilder('ebayenterprise_address/validation_response')->setConstructorArgs([['api' => $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi'), 'logger' => $this->logger, 'context' => $this->context]])->setMethods(['extractResponseData'])->getMock(); $response->setResultCode($code); $this->logger->expects($this->once())->method('warning'); EcomDev_Utils_Reflection::invokeRestrictedMethod($response, 'logResultCode'); }
/** * 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; }
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)); } }
/** * 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)); } }
/** * 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; }
/** * 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; }
/** * @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); }
/** * 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']; }
/** * 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; }
/** * @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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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'); }
/** * Return an instance of `sales/order` when the payload have a valid customer increment id, * the order increment id correspond to a sales order in the Magento store, and the order in the Magento * store is shippable. However, if any of these conditions are not met a null value will be returned. * @return Mage_Sales_Model_Order | null */ protected function _getOrder() { $incrementId = $this->_payload->getCustomerOrderId(); $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId); if (!$order->getId()) { $logMsgOrderNotFound = "The shipment could not be added. The order (id: {$incrementId}) was not found in this Magento store."; $this->_logger->warning($logMsgOrderNotFound, $this->_context->getMetaData(__CLASS__)); return null; } if (!$order->canShip()) { $logMsgOrderNotShippable = "Order ({$incrementId}) can not be shipped."; $this->_logger->warning($logMsgOrderNotShippable, $this->_context->getMetaData(__CLASS__)); return null; } return $order; }
/** * 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; }
/** * 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; }
/** * Test the method EbayEnterprise_MageLog_Helper_Data::logException when invoked * will call the EbayEnterprise_MageLog_Model_Logger::logException passing the proper * parameters. * @param Exception $exception * @param array $context * @dataProvider providerLogException */ public function testLogException(Exception $exception, array $context) { $logger = $this->getModelMock('ebayenterprise_magelog/logger', ['logException']); $logger->expects($this->once())->method('logException')->with($this->identicalTo($exception), $this->identicalTo($context))->will($this->returnSelf()); $this->replaceByMock('model', 'ebayenterprise_magelog/logger', $logger); EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->_helper, '_logger', null); $this->assertSame($this->_helper, $this->_helper->logException($exception, $context)); }
/** * attempt to undo an allocation * * @param EbayEnterprise_Inventory_Model_Allocation_Reservation */ public function rollback(EbayEnterprise_Inventory_Model_Allocation_Reservation $reservation) { $api = $this->prepareApi(); try { $this->prepareRequest($api, $reservation); $api->send(); return; } catch (InvalidPayload $e) { $this->logger->warning('The allocation rollback response payload is invalid.', $this->logContext->getMetaData(__CLASS__, [], $e)); } catch (NetworkError $e) { $this->logger->warning('Failed sending the allocation rollback request.', $this->logContext->getMetaData(__CLASS__, [], $e)); } catch (UnsupportedOperation $e) { $this->logger->critical('Allocation rollback is unsupported in the currently configured SDK.', $this->logContext->getMetaData(__CLASS__, [], $e)); } catch (UnsupportedHttpAction $e) { $this->logger->critical('Allocation rollback configured to use unsupported HTTP action.', $this->logContext->getMetaData(__CLASS__, [], $e)); } }
/** * add the shipping method to the the list if it is a * valid ROM shipping method * * @param string * @param string */ protected function storeShippingMethodInfo($shippingMethod, $displayString) { $sdkId = $this->lookupShipMethod($shippingMethod); if (!$sdkId) { $this->logger->warning('Encountered active shipping method with no ROM mapping.', $this->logContext->getMetaData(__CLASS__, ['shipping_method' => $shippingMethod, 'display_string' => $displayString])); return; } $this->methods[$shippingMethod] = ['sdk_id' => $sdkId, 'display_text' => $displayString]; }
/** * Redeem the gift card for the requested amount and return the amount that * was actually redeemed for the card. * @param EbayEnterprise_GiftCard_Model_IGiftcard $card * @param float $amount * @return self */ protected function _redeemVoidCard(EbayEnterprise_GiftCard_Model_IGiftcard $card) { try { $card->void(); } catch (EbayEnterprise_GiftCard_Exception $e) { $this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e)); } return $card; }
/** * Dispacth an event in Magento with the payload and store scope it was received in. * @param IOrderEvent $payload * @param Mage_Core_Model_Store $store * @return self */ protected function _dispatchPayload(IOrderEvent $payload, Mage_Core_Model_Store $store) { $eventName = $this->_eventPrefix . '_' . $this->_coreHelper->underscoreWords($payload->getEventType()); $logData = ['event_name' => $eventName]; $logMessage = 'Dispatching event "{event_name}" for payload.'; $this->_logger->info($logMessage, $this->_context->getMetaData(__CLASS__, $logData)); Mage::dispatchEvent($eventName, array('payload' => $payload, 'store' => $store)); return $this; }
/** * Return an array of CSV row data. * @param Mage_Catalog_Model_Product $product * @param int $storeId * @return array returns an empty array if the image is not valid */ protected function _getDataRow(Mage_Catalog_Model_Product $product, $storeId) { // if we don't have an image URL return an empty array so we can skip this product in the feed $resized = $this->_getResizedImage($product, $storeId); if (empty($resized)) { return array(); } return array($product->getSku(), $this->_helper->cleanString($product->getName()), $this->_helper->cleanStringForFeed($product->getShortDescription()), $product->getPrice(), $this->_getValidSpecialPrice($product, $storeId), $resized, $product->getProductUrl(), $product->getAvailableInventory()); }
/** * Resubmit an order. * * @param Mage_Sales_Model_Order * @return void */ protected function resubmit(Mage_Sales_Model_Order $order) { if (!$order->hasEb2cOrderCreateRequest()) { $this->logger->warning('Unable to resubmit "{order_id}". Please see documentation for possible solutions.', $this->logContext->getMetaData(['order_id' => $order->getIncrementId()])); return; } $api = $this->coreHelper->getSdkApi($this->orderCfg->apiService, $this->orderCfg->apiCreateOperation); $createArgs = ['api' => $api, 'config' => $this->orderCfg, 'is_payload_prebuilt' => true, 'order' => $order, 'payload' => $api->getRequestBody()]; $this->getOrderCreateModel($createArgs)->send(); }
/** * Sets configurable_attributes_data * @param string $productTypeId ('configurable', 'simple' etc). * @param Varien_Object $source the source data field * @param Mage_Catalog_Model_Product $product the product we are setting * @return array of configurable_attributes_data */ public function getConfigurableAttributesData($productTypeId, Varien_Object $source, Mage_Catalog_Model_Product $product) { if ($product->getId() && $product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && $productTypeId === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE && $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product)) { $logData = ['sku' => $product->getSku()]; $logMessage = 'Cannot change existing configurable attributes; update discarded for SKU "{sku}"'; $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__, $logData)); return null; } return $source->getData('configurable_attributes_data'); }
/** * 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; }
/** * Verify that the passed in track number is in the collections of Magento shipment tracks, otherwise logs warning message. * @param Varien_Data_Collection $tracks * @param OrderEvents\ITrackingNumber $trackingNumber * @return self */ protected function _verifyTrack(Varien_Data_Collection $tracks, OrderEvents\ITrackingNumber $trackingNumber) { $number = $trackingNumber->getTrackingNumber(); $track = $tracks->getItemByColumnValue('track_number', $number); if (is_null($track)) { $logMessage = "Magento did not add an expected-to-be-shipped Track number ({$number}) to the shipment."; $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__)); } return $this; }
/** * resubmit the order * @param Mage_Sales_Model_Order * @param array */ protected function resubmit(Mage_Sales_Model_Order $order, array $createArgs) { $raw = $order->getEb2cOrderCreateRequest(); if ($raw) { $createArgs['order'] = $order; $this->getOrderCreateModel($createArgs)->send(); } else { $this->logger->warning('Unable to resubmit "{order_id}". Please see documentation for possible solutions.', $this->logContext->getMetaData(['order_id' => $order->getIncrementId()])); } }
/** * If a new email can be sent for the order, queue it to be sent. * * @param Mage_Sales_Model_Order * @return self */ protected function _queueNewOrderEmail(Mage_Sales_Model_Order $order) { if ($order->getCanSendNewEmailFlag()) { try { $order->queueNewOrderEmail(); } catch (Exception $e) { $this->_logger->warning('Unable to queue new order email.', $this->_logContext->getMetaData(__CLASS__, [], $e)); } } return $this; }
/** * undo the the allocation * * @return self */ public function undoAllocation() { $result = $this->getInventorySession()->getAllocationResult(); if ($result) { $reservation = $result->getReservation(); $this->logger->info('Undo item allocation "{reservation_id}"', $this->logContext->getMetaData(__CLASS__, ['reservation_id' => $reservation->getId()])); $this->createDeallocator()->rollback($reservation); } $this->getInventorySession()->unsAllocationResult(); return $this; }