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 0d06f645 authored by attilak's avatar attilak Committed by Rik ter Beek

Changes based on code review

parent 14b4cb63
...@@ -36,11 +36,6 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface ...@@ -36,11 +36,6 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
*/ */
protected $_inboxFactory; protected $_inboxFactory;
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $scopeConfigInterface;
/** /**
* @var \Magento\Store\Model\StoreManagerInterface * @var \Magento\Store\Model\StoreManagerInterface
*/ */
...@@ -58,18 +53,15 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface ...@@ -58,18 +53,15 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface
*/ */
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\AdminNotification\Model\InboxFactory $inboxFactory, \Magento\AdminNotification\Model\InboxFactory $inboxFactory,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface,
\Magento\Store\Model\StoreManagerInterface $storeManagerInterface, \Magento\Store\Model\StoreManagerInterface $storeManagerInterface,
\Magento\Backend\Model\Auth\Session $authSession \Magento\Backend\Model\Auth\Session $authSession
) { ) {
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_inboxFactory = $inboxFactory; $this->_inboxFactory = $inboxFactory;
$this->scopeConfigInterface = $scopeConfigInterface;
$this->storeManagerInterface = $storeManagerInterface; $this->storeManagerInterface = $storeManagerInterface;
$this->authSession = $authSession; $this->authSession = $authSession;
} }
...@@ -95,17 +87,12 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface ...@@ -95,17 +87,12 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
if ($this->authSession->isFirstPageAfterLogin() && empty($this->_adyenHelper->getAPIKey())) { if ($this->authSession->isFirstPageAfterLogin() && empty($this->_adyenHelper->getAPIKey())) {
try { try {
$title = "Adyen extension requires the API KEY!"; $title = "Adyen extension requires the API KEY!";
if (!empty($this->_adyenHelper->getWsUsername())) {
$description = "Please provide API-KEY for the webservice user " . $this->_adyenHelper->getWsUsername() . " for default/store " . $this->storeManagerInterface->getStore()->getName();
}else{
$description = "Please provide API-KEY for default/store " . $this->storeManagerInterface->getStore()->getName();
}
$messageData[] = array( $messageData[] = array(
'severity' => $this->getSeverity(), 'severity' => $this->getSeverity(),
'date_added' => date("Y-m-d"), 'date_added' => date("Y-m-d"),
'title' => $title, 'title' => $title,
'description' => $description, 'description' => $this->getText(),
'url' => "https://docs.adyen.com/developers/plug-ins-and-partners/magento-2/set-up-the-plugin-in-magento#step3configuretheplugininmagento", 'url' => "https://docs.adyen.com/developers/plug-ins-and-partners/magento-2/set-up-the-plugin-in-magento#step3configuretheplugininmagento",
); );
...@@ -131,8 +118,13 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface ...@@ -131,8 +118,13 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
*/ */
public function getText() public function getText()
{ {
$message = __("Please provide API-KEY for the webserver user " . $this->_adyenHelper->getWsUsername() . " for default/store" . $this->storeManagerInterface->getStore()->getName()); if (!empty($this->_adyenHelper->getWsUsername())) {
return __($message); $message = "Please provide API-KEY for the webservice user " . $this->_adyenHelper->getWsUsername() . " for default/store " . $this->storeManagerInterface->getStore()->getName();
}else{
$message = "Please provide API-KEY for default/store " . $this->storeManagerInterface->getStore()->getName();
}
return $message;
} }
/** /**
......
...@@ -36,7 +36,6 @@ class TransactionPayment implements ClientInterface ...@@ -36,7 +36,6 @@ class TransactionPayment implements ClientInterface
* @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Model\RecurringType $recurringType * @param \Adyen\Payment\Model\RecurringType $recurringType
* @param array $data * @param array $data
*/ */
...@@ -44,13 +43,11 @@ class TransactionPayment implements ClientInterface ...@@ -44,13 +43,11 @@ class TransactionPayment implements ClientInterface
\Magento\Framework\Model\Context $context, \Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType, \Adyen\Payment\Model\RecurringType $recurringType,
array $data = [] array $data = []
) { ) {
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType; $this->_recurringType = $recurringType;
$this->_appState = $context->getAppState(); $this->_appState = $context->getAppState();
} }
......
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