We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 57cb7dc3 authored by rikterbeek's avatar rikterbeek

add retrieve version from url

parent e6676afa
......@@ -30,12 +30,9 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* Contains list of modules
*
* @var \Magento\Framework\Module\ModuleListInterface
* @var \Adyen\Payment\Helper\Data
*/
protected $_moduleList;
protected $_adyenHelper;
/**
* Version constructor.
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
......@@ -43,12 +40,12 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
* @param array $data
*/
public function __construct(
\Magento\Framework\Module\ModuleListInterface $moduleList,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Backend\Block\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
$this->_moduleList = $moduleList;
$this->_adyenHelper = $adyenHelper;
}
/**
......@@ -59,6 +56,6 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
*/
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
return (string) $this->_moduleList->getOne("Adyen_Payment")['setup_version'];
return $this->_adyenHelper->getModuleVersion();
}
}
\ No newline at end of file
......@@ -75,6 +75,19 @@ class Json extends \Magento\Framework\App\Action\Action
*/
public function execute()
{
// if version is in the notification string show the module version
$response = $this->getRequest()->getParams();
if (isset($response['version'])) {
$this->getResponse()
->clearHeader('Content-Type')
->setHeader('Content-Type', 'text/html')
->setBody($this->_adyenHelper->getModuleVersion());
return;
}
try {
$notificationItems = json_decode(file_get_contents('php://input'), true);
......
......@@ -46,6 +46,11 @@ class Data extends AbstractHelper
*/
protected $_country;
/**
* @var \Magento\Framework\Module\ModuleListInterface
*/
protected $_moduleList;
/**
* Data constructor.
*
......@@ -57,12 +62,14 @@ class Data extends AbstractHelper
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Magento\Framework\Config\DataInterface $dataStorage,
\Magento\Directory\Model\Config\Source\Country $country
\Magento\Directory\Model\Config\Source\Country $country,
\Magento\Framework\Module\ModuleListInterface $moduleList
) {
parent::__construct($context);
$this->_encryptor = $encryptor;
$this->_dataStorage = $dataStorage;
$this->_country = $country;
$this->_moduleList = $moduleList;
}
/**
......@@ -573,4 +580,9 @@ class Data extends AbstractHelper
}
return $sepaCountries;
}
public function getModuleVersion()
{
return (string) $this->_moduleList->getOne("Adyen_Payment")['setup_version'];
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment