/** * @param InputInterface $input * @param OutputInterface $output * * @return int|void */ protected function execute(InputInterface $input, OutputInterface $output) { $initialized = false; try { $this->detectMagento($output); $initialized = $this->initMagento(); } catch (Exception $e) { // do nothing } $parser = new Parser(new Lexer()); $cleaner = new CodeCleaner($parser); $consoleOutput = new ShellOutput(); $config = new Configuration(); $config->setCodeCleaner($cleaner); $shell = new Shell($config); $shell->setScopeVariables(['di' => $this->getObjectManager()]); if ($initialized) { $ok = Charset::convertInteger(Charset::UNICODE_CHECKMARK_CHAR); $edition = $this->productMeta->getEdition(); $magentoVersion = $this->productMeta->getVersion(); $consoleOutput->writeln('<fg=black;bg=green>Magento ' . $magentoVersion . ' ' . $edition . ' initialized.</fg=black;bg=green> ' . $ok); } else { $consoleOutput->writeln('<fg=black;bg=yellow>Magento is not initialized.</fg=black;bg=yellow>'); } $help = <<<'help' At the prompt, type <comment>help</comment> for some help. To exit the shell, type <comment>^D</comment>. help; $consoleOutput->writeln($help); $shell->run($input, $consoleOutput); }
/** * Sets the response body to ProductName/Major.MinorVersion (Edition). E.g.: Magento/0.42 (Community). Omits patch * version from response * * @return void */ public function execute() { $versionParts = explode('.', $this->productMetadata->getVersion()); if (!isset($versionParts[0]) || !isset($versionParts[1])) { return; // Major and minor version are not set - return empty response } $majorMinorVersion = $versionParts[0] . '.' . $versionParts[1]; $this->getResponse()->setBody($this->productMetadata->getName() . '/' . $majorMinorVersion . ' (' . $this->productMetadata->getEdition() . ')'); }
/** * Retrieve feed data as XML element * * @return \SimpleXMLElement */ public function getFeedData() { $curl = $this->curlFactory->create(); $curl->setConfig( [ 'timeout' => 2, 'useragent' => $this->productMetadata->getName() . '/' . $this->productMetadata->getVersion() . ' (' . $this->productMetadata->getEdition() . ')', 'referer' => $this->urlBuilder->getUrl('*/*/*') ] ); $curl->write(\Zend_Http_Client::GET, $this->getFeedUrl(), '1.0'); $data = $curl->read(); if ($data === false) { return false; } $data = preg_split('/^\r?$/m', $data, 2); $data = trim($data[1]); $curl->close(); try { $xml = new \SimpleXMLElement($data); } catch (\Exception $e) { return false; } return $xml; }
public function getPxParams() { $v = $this->getVersion(); $extension = "Mandrill;{$v}"; $mageEdition = $this->_metaData->getEdition(); switch ($mageEdition) { case 'Community': $mageEdition = 'CE'; break; case 'Enterprise': $mageEdition = 'EE'; break; } $mageVersion = $this->_metaData->getVersion(); $mage = "Magento {$mageEdition};{$mageVersion}"; $hash = md5($extension . '_' . $mage . '_' . $extension); return "ext={$extension}&mage={$mage}&ctrl={$hash}"; }
/** * Get the 'Info' section data * * @return string[] */ protected function getGeneralInfo() { $versionParts = explode('.', $this->productMetadata->getVersion()); if (!isset($versionParts[0]) || !isset($versionParts[1])) { return []; // Major and minor version are not set - return empty response } $majorMinorVersion = $versionParts[0] . '.' . $versionParts[1]; return ['version' => $majorMinorVersion, 'title' => $this->productMetadata->getName() . ' ' . $this->productMetadata->getEdition()]; }
/** * Returns the version number of the platform the e-commerce installation * * @return string the platforms's version */ public function getPlatformVersion() { $version = 'unknown'; if ($this->_productMetaData->getVersion()) { $version = $this->_productMetaData->getVersion(); } elseif (defined(AppInterface::VERSION)) { $version = AppInterface::VERSION; } return $version; }
/** * create an order in ComproPago * * @return array */ private function createOrder() { $order = $this->checSession->getLastRealOrder(); $dataorder = new PlaceOrderInfo($order->getRealOrderId(), $order->getRealOrderId(), $order->getData('total_due'), $order->getCustomerFirstname() . " " . $order->getCustomerLastname(), $order->getCustomerEmail(), $_COOKIE['provider'], null, 'magento2', $this->metada->getVersion()); if (isset($_COOKIE['payment_method']) && $_COOKIE['payment_method'] == 'compropago') { try { $client = new Client($this->instance->getPublicKey(), $this->instance->getPrivateKey(), $this->instance->getLiveMode()); $response = $client->api->placeOrder($dataorder); $_COOKIE['provider'] = null; $_COOKIE['payment_method'] = null; unset($_COOKIE['provider']); unset($_COOKIE['payment_method']); return ["type" => "success", "value" => base64_encode($response->getId())]; } catch (\Exception $e) { return ["type" => "error", "value" => $e->getMessage()]; } } else { return ["type" => "error", "value" => "Metodo no reconocido"]; } }
public function getPxParams() { $modules = $this->_loader->load(); $v = ""; if (isset($modules['Ebizmarts_MageMonkey'])) { $v = $modules['Ebizmarts_MageMonkey']['setup_version']; } $extension = "MageMonkey;{$v}"; $mageEdition = $this->_metaData->getEdition(); switch ($mageEdition) { case 'Community': $mageEdition = 'CE'; break; case 'Enterprise': $mageEdition = 'EE'; break; } $mageVersion = $this->_metaData->getVersion(); $mage = "Magento {$mageEdition};{$mageVersion}"; $hash = md5($extension . '_' . $mage . '_' . $extension); return "ext={$extension}&mage={$mage}&ctrl={$hash}"; }
public function getExpectedCommonData() { $versionParts = explode('.', $this->productMetadata->getVersion()); if (!isset($versionParts[0]) || !isset($versionParts[1])) { return []; // Major and minor version are not set - return empty response } $majorMinorVersion = $versionParts[0] . '.' . $versionParts[1]; $url = str_replace('://', '', strstr($this->baseUrl, '://')); $host = strpos($url, '/') ? strstr($url, '/', true) : $url; $basePath = strstr(rtrim($url, '/'), '/'); $basePath = $basePath ? trim($basePath, '/') . '/' : ''; $basePath = '/' . $basePath . 'rest/' . $this->storeCode; return ['swagger' => '2.0', 'info' => ['version' => $majorMinorVersion, 'title' => $this->productMetadata->getName() . ' ' . $this->productMetadata->getEdition()], 'host' => $host, 'basePath' => $basePath]; }
/** * Retrieve environment information of magento * And installed extensions provided by CedCommerce * * @return array */ public function getEnvironmentInformation() { $info = array(); $info['plateform'] = 'Magento2.x'; $info['domain_name'] = $this->urlBuilder->getBaseUrl(); $info['magento_edition'] = 'default'; if (method_exists('Mage', 'getEdition')) { $info['magento_edition'] = $this->productMetadata->getEdition(); } $info['magento_version'] = $this->productMetadata->getVersion(); $info['php_version'] = phpversion(); $info['feed_types'] = $this->_backendConfig->getValue(\Ced\DevTool\Model\Feed::XML_FEED_TYPES); $info['admin_name'] = $this->_backendConfig->getValue('trans_email/ident_general/name'); if (strlen($info['admin_name']) == 0) { $info['admin_name'] = $this->_backendConfig->getValue('trans_email/ident_sales/name'); } $info['admin_email'] = $this->_backendConfig->getValue('trans_email/ident_general/email'); if (strlen($info['admin_email']) == 0) { $info['admin_email'] = $this->_backendConfig->getValue('trans_email/ident_sales/email'); } $info['installed_extensions_by_cedcommerce'] = $this->getCedCommerceExtensions(true); return $info; }
/** * Get product version * * @return string */ public function getMagentoVersion() { return $this->productMetadata->getVersion(); }
/** * Generate AvaTax Client Name from a combination of Magento version number and AvaTax module version number * Format: Magento 2.x Community - AvaTax 1.0.0 * Limited to 50 characters to comply with API requirements * * @return string */ protected function getClientName() { return substr($this->magentoProductMetadata->getName(), 0, 7) . ' ' . substr($this->magentoProductMetadata->getVersion(), 0, 14) . ' ' . substr($this->magentoProductMetadata->getEdition(), 0, 10) . ' - ' . 'AvaTax ' . substr(AvaTaxAppInterface::APP_VERSION, 0, 7); // "AvaTax " & 1.x.x - 14 chars }
/** * Format param "channel" for transaction * * @return string */ protected function getChannel() { $edition = $this->productMetaData->getEdition(); $version = $this->productMetaData->getVersion(); return self::CHANNEL_NAME . ' ' . $edition . ' ' . $version; }
protected function addVersionInfo() { $this->infos['Name'] = $this->productMetadata->getName(); $this->infos['Version'] = $this->productMetadata->getVersion(); $this->infos['Edition'] = $this->productMetadata->getEdition(); }
/** * Sets the response body with ProductName/Version (Edition). E.g.: Magento/0.42.0-beta3 (Community) * * @return void */ public function execute() { $this->getResponse()->setBody($this->productMetadata->getName() . '/' . $this->productMetadata->getVersion() . ' (' . $this->productMetadata->getEdition() . ')'); }