We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) 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 ...@@ -30,12 +30,9 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
{ {
/** /**
* Contains list of modules * @var \Adyen\Payment\Helper\Data
*
* @var \Magento\Framework\Module\ModuleListInterface
*/ */
protected $_moduleList; protected $_adyenHelper;
/** /**
* Version constructor. * Version constructor.
* @param \Magento\Framework\Module\ModuleListInterface $moduleList * @param \Magento\Framework\Module\ModuleListInterface $moduleList
...@@ -43,12 +40,12 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field ...@@ -43,12 +40,12 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
* @param array $data * @param array $data
*/ */
public function __construct( public function __construct(
\Magento\Framework\Module\ModuleListInterface $moduleList, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Block\Template\Context $context,
array $data = [] array $data = []
) { ) {
parent::__construct($context, $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 ...@@ -59,6 +56,6 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
*/ */
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) 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 ...@@ -75,6 +75,19 @@ class Json extends \Magento\Framework\App\Action\Action
*/ */
public function execute() 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 { try {
$notificationItems = json_decode(file_get_contents('php://input'), true); $notificationItems = json_decode(file_get_contents('php://input'), true);
......
...@@ -46,6 +46,11 @@ class Data extends AbstractHelper ...@@ -46,6 +46,11 @@ class Data extends AbstractHelper
*/ */
protected $_country; protected $_country;
/**
* @var \Magento\Framework\Module\ModuleListInterface
*/
protected $_moduleList;
/** /**
* Data constructor. * Data constructor.
* *
...@@ -57,12 +62,14 @@ class Data extends AbstractHelper ...@@ -57,12 +62,14 @@ class Data extends AbstractHelper
\Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Helper\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Magento\Framework\Config\DataInterface $dataStorage, \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); parent::__construct($context);
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
$this->_dataStorage = $dataStorage; $this->_dataStorage = $dataStorage;
$this->_country = $country; $this->_country = $country;
$this->_moduleList = $moduleList;
} }
/** /**
...@@ -573,4 +580,9 @@ class Data extends AbstractHelper ...@@ -573,4 +580,9 @@ class Data extends AbstractHelper
} }
return $sepaCountries; 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