Exemplo n.º 1
0
 /**
  * Return Google Content Service Instance
  *
  * @param int $storeId
  * @return \Magento\Framework\Gdata\Gshopping\Content
  */
 public function getService($storeId = null)
 {
     if (!$this->_service) {
         $this->_service = $this->_connect($storeId);
         if ($this->getConfig()->getIsDebug($storeId)) {
             $this->_service->setLogAdapter($this->_logAdapterFactory->create(array('fileName' => 'googleshopping.log')), 'log')->setDebug(true);
         }
     }
     return $this->_service;
 }
Exemplo n.º 2
0
 /**
  * Log debug data to file.
  * Log file dir: var/log/import_export/%Y/%m/%d/%time%_%operation_type%_%entity_type%.log
  *
  * @param mixed $debugData
  * @return $this
  */
 public function addLogComment($debugData)
 {
     if (is_array($debugData)) {
         $this->_logTrace = array_merge($this->_logTrace, $debugData);
     } else {
         $this->_logTrace[] = $debugData;
     }
     if (!$this->_debugMode) {
         return $this;
     }
     if (!$this->_logInstance) {
         $dirName = date('Y/m/d/');
         $fileName = join('_', array(str_replace(':', '-', $this->getRunAt()), $this->getScheduledOperationId(), $this->getOperationType(), $this->getEntity()));
         $path = 'import_export/' . $dirName;
         $this->_varDirectory->create($path);
         $fileName = $path . $fileName . '.log';
         $this->_logInstance = $this->_adapterFactory->create(array('fileName' => $this->_varDirectory->getAbsolutePath($fileName)))->setFilterDataKeys($this->_debugReplacePrivateDataKeys);
     }
     $this->_logInstance->log($debugData);
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Return callback response with shipping options
  *
  * @param array $request
  * @return string
  * @throws \Exception
  */
 public function getShippingOptionsCallbackResponse(array $request)
 {
     // prepare debug data
     $logger = $this->_logFactory->create(array('fileName' => 'payment_' . $this->_methodType . '.log'));
     $debugData = array('request' => $request, 'response' => array());
     try {
         // obtain addresses
         $this->_getApi();
         $address = $this->_api->prepareShippingOptionsCallbackAddress($request);
         $quoteAddress = $this->_quote->getShippingAddress();
         // compare addresses, calculate shipping rates and prepare response
         $options = array();
         if ($address && $quoteAddress && !$this->_quote->getIsVirtual()) {
             foreach ($address->getExportedKeys() as $key) {
                 $quoteAddress->setDataUsingMethod($key, $address->getData($key));
             }
             $quoteAddress->setCollectShippingRates(true)->collectTotals();
             $options = $this->_prepareShippingOptions($quoteAddress, false, true);
         }
         $response = $this->_api->setShippingOptions($options)->formatShippingOptionsCallback();
         // log request and response
         $debugData['response'] = $response;
         $logger->log($debugData);
         return $response;
     } catch (\Exception $e) {
         $logger->log($debugData);
         throw $e;
     }
 }
Exemplo n.º 4
0
 /**
  * Log debug data to file
  *
  * @param array $debugData
  * @return void
  */
 protected function _debug($debugData)
 {
     if ($this->getDebugFlag()) {
         $this->_logFactory->create(array('fileName' => 'card_validation_3d_secure.log'))->setFilterDataKeys($this->_debugReplacePrivateDataKeys)->log($debugData);
     }
 }
Exemplo n.º 5
0
 /**
  * Log debug data to file
  *
  * @param mixed $debugData
  * @return void
  */
 protected function _debug($debugData)
 {
     if ($this->getDebugFlag()) {
         $this->_logAdapterFactory->create(array('fileName' => 'payment_' . $this->_config->getMethodCode() . '.log'))->setFilterDataKeys($this->_debugReplacePrivateDataKeys)->log($debugData);
     }
 }