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 0a01254f authored by attilak's avatar attilak

Resolve comments during code review

parent a73e2010
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
namespace Adyen\Payment\Api; namespace Adyen\Payment\Api;
interface AdyenInitiateTerminalApiInterface interface AdyenInitiateTerminalApiInterface
{ {
/** /**
...@@ -32,4 +31,4 @@ interface AdyenInitiateTerminalApiInterface ...@@ -32,4 +31,4 @@ interface AdyenInitiateTerminalApiInterface
* @return mixed * @return mixed
*/ */
public function initiate(); public function initiate();
} }
\ No newline at end of file
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
namespace Adyen\Payment\Block\Form; namespace Adyen\Payment\Block\Form;
class PosCloud extends \Magento\Payment\Block\Form class PosCloud extends \Magento\Payment\Block\Form
{ {
/** /**
...@@ -32,4 +31,4 @@ class PosCloud extends \Magento\Payment\Block\Form ...@@ -32,4 +31,4 @@ class PosCloud extends \Magento\Payment\Block\Form
*/ */
protected $_template = 'Adyen_Payment::form/pos_cloud.phtml'; protected $_template = 'Adyen_Payment::form/pos_cloud.phtml';
} }
\ No newline at end of file
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
namespace Adyen\Payment\Block\Info; namespace Adyen\Payment\Block\Info;
class PosCloud extends AbstractInfo class PosCloud extends AbstractInfo
{ {
/** /**
......
...@@ -35,34 +35,43 @@ class TransactionPosCloudSync implements ClientInterface ...@@ -35,34 +35,43 @@ class TransactionPosCloudSync implements ClientInterface
*/ */
protected $storeId; protected $storeId;
/**
* @var \Adyen\Client
*/
protected $client;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $adyenHelper;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected $adyenLogger;
public function __construct( public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Model\RecurringType $recurringType,
\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\StoreManagerInterface $storeManager,
array $data = [] array $data = []
) { ) {
$this->_encryptor = $encryptor; $this->adyenHelper = $adyenHelper;
$this->_adyenHelper = $adyenHelper; $this->adyenLogger = $adyenLogger;
$this->_adyenLogger = $adyenLogger;
$this->_recurringType = $recurringType;
$this->_appState = $context->getAppState();
$this->storeId = $storeManager->getStore()->getId(); $this->storeId = $storeManager->getStore()->getId();
// initialize client // initialize client
$client = $this->_adyenHelper->initializeAdyenClient($this->storeId); $client = $this->adyenHelper->initializeAdyenClient($this->storeId);
$apiKey = $this->_adyenHelper->getPosApiKey($this->storeId); $apiKey = $this->adyenHelper->getPosApiKey($this->storeId);
$client->setXApiKey($apiKey); $client->setXApiKey($apiKey);
//Set configurable option in M2 //Set configurable option in M2
$posTimeout = $this->_adyenHelper->getAdyenPosCloudConfigData('pos_timeout', $this->storeId); $posTimeout = $this->adyenHelper->getAdyenPosCloudConfigData('pos_timeout', $this->storeId);
if (!empty($posTimeout)) { if (!empty($posTimeout)) {
$client->setTimeout($posTimeout); $client->setTimeout($posTimeout);
} }
$this->_client = $client; $this->client = $client;
} }
...@@ -82,15 +91,15 @@ class TransactionPosCloudSync implements ClientInterface ...@@ -82,15 +91,15 @@ class TransactionPosCloudSync implements ClientInterface
return $paymentResponse; return $paymentResponse;
} }
//always do status call and return the response of the status call //always do status call and return the response of the status call
$service = new \Adyen\Service\PosPayment($this->_client); $service = $this->adyenHelper->createAdyenPosPaymentService($this->client);
$poiId = $this->_adyenHelper->getPoiId($this->storeId); $poiId = $this->adyenHelper->getPoiId($this->storeId);
$newServiceID = date("dHis"); $newServiceID = date("dHis");
$statusDate = date("U"); $statusDate = date("U");
$timeDiff = (int)$statusDate - (int)$request['initiateDate']; $timeDiff = (int)$statusDate - (int)$request['initiateDate'];
$totalTimeout = $this->_adyenHelper->getAdyenPosCloudConfigData('total_timeout', $this->storeId); $totalTimeout = $this->adyenHelper->getAdyenPosCloudConfigData('total_timeout', $this->storeId);
if ($timeDiff > $totalTimeout) { if ($timeDiff > $totalTimeout) {
throw new \Magento\Framework\Exception\LocalizedException(__("Pos Timeout.")); throw new \Magento\Framework\Exception\LocalizedException(__("Pos Timeout."));
} }
......
...@@ -28,34 +28,6 @@ use Magento\Payment\Gateway\Request\BuilderInterface; ...@@ -28,34 +28,6 @@ use Magento\Payment\Gateway\Request\BuilderInterface;
class PosCloudBuilder implements BuilderInterface class PosCloudBuilder implements BuilderInterface
{ {
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
* @var
*/
private $_adyenLogger;
protected $_quoteRepository;
/**
* PaymentDataBuilder constructor.
*
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository
) {
$this->_adyenLogger = $adyenLogger;
$this->adyenHelper = $adyenHelper;
$this->_quoteRepository = $quoteRepository;
}
/** /**
* @param array $buildSubject * @param array $buildSubject
* @return array * @return array
...@@ -72,4 +44,4 @@ class PosCloudBuilder implements BuilderInterface ...@@ -72,4 +44,4 @@ class PosCloudBuilder implements BuilderInterface
"initiateDate" => $payment->getAdditionalInformation("initiateDate") "initiateDate" => $payment->getAdditionalInformation("initiateDate")
]; ];
} }
} }
\ No newline at end of file
...@@ -35,9 +35,9 @@ class PaymentPosCloudHandler implements HandlerInterface ...@@ -35,9 +35,9 @@ class PaymentPosCloudHandler implements HandlerInterface
*/ */
private $adyenHelper; private $adyenHelper;
/** /**
* @var * @var \Adyen\Payment\Logger\AdyenLogger
*/ */
private $adyenLogger; private $adyenLogger;
/** /**
...@@ -64,7 +64,7 @@ class PaymentPosCloudHandler implements HandlerInterface ...@@ -64,7 +64,7 @@ class PaymentPosCloudHandler implements HandlerInterface
*/ */
public function handle(array $handlingSubject, array $paymentResponse) public function handle(array $handlingSubject, array $paymentResponse)
{ {
$payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject); $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
/** @var OrderPaymentInterface $payment */ /** @var OrderPaymentInterface $payment */
$payment = $payment->getPayment(); $payment = $payment->getPayment();
...@@ -76,7 +76,7 @@ class PaymentPosCloudHandler implements HandlerInterface ...@@ -76,7 +76,7 @@ class PaymentPosCloudHandler implements HandlerInterface
$payment->getOrder()->setCanSendNewEmailFlag(false); $payment->getOrder()->setCanSendNewEmailFlag(false);
// set transaction(status) // set transaction(status)
if (!empty($paymentResponse) && !empty($paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID'])) { if (!empty($paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID'])) {
$pspReference = $paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID']; $pspReference = $paymentResponse['PaymentResult']['PaymentAcquirerData']['AcquirerTransactionID']['TransactionID'];
$payment->setTransactionId($pspReference); $payment->setTransactionId($pspReference);
// set transaction(payment) // set transaction(payment)
......
...@@ -40,11 +40,13 @@ class PosCloudResponseValidator extends AbstractValidator ...@@ -40,11 +40,13 @@ class PosCloudResponseValidator extends AbstractValidator
*/ */
private $adyenHelper; private $adyenHelper;
/** /**
* PosCloudResponseValidator constructor. * PosCloudResponseValidator constructor.
* @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory *
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory
*/ * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct( public function __construct(
\Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory, \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
......
...@@ -426,7 +426,7 @@ class Data extends AbstractHelper ...@@ -426,7 +426,7 @@ class Data extends AbstractHelper
/** /**
* @desc Gives back adyen_pos configuration values * @desc Gives back adyen_pos configuration values
* @param $field * @param $field
* @param null $storeId * @param int|null $storeId
* @return mixed * @return mixed
*/ */
public function getAdyenPosConfigData($field, $storeId = null) public function getAdyenPosConfigData($field, $storeId = null)
...@@ -437,7 +437,7 @@ class Data extends AbstractHelper ...@@ -437,7 +437,7 @@ class Data extends AbstractHelper
/** /**
* @desc Gives back adyen_pos configuration values as flag * @desc Gives back adyen_pos configuration values as flag
* @param $field * @param $field
* @param null $storeId * @param int|null $storeId
* @return mixed * @return mixed
*/ */
public function getAdyenPosConfigDataFlag($field, $storeId = null) public function getAdyenPosConfigDataFlag($field, $storeId = null)
...@@ -447,7 +447,7 @@ class Data extends AbstractHelper ...@@ -447,7 +447,7 @@ class Data extends AbstractHelper
/** /**
* @param $field * @param $field
* @param null $storeId * @param int|null $storeId
* @return bool|mixed * @return bool|mixed
*/ */
public function getAdyenPosCloudConfigData($field, $storeId = null) public function getAdyenPosCloudConfigData($field, $storeId = null)
...@@ -457,7 +457,7 @@ class Data extends AbstractHelper ...@@ -457,7 +457,7 @@ class Data extends AbstractHelper
/** /**
* @param $field * @param $field
* @param null $storeId * @param int|null $storeId
* @return bool|mixed * @return bool|mixed
*/ */
public function getAdyenPosCloudConfigDataFlag($field, $storeId = null) public function getAdyenPosCloudConfigDataFlag($field, $storeId = null)
...@@ -468,7 +468,7 @@ class Data extends AbstractHelper ...@@ -468,7 +468,7 @@ class Data extends AbstractHelper
/** /**
* @desc Gives back adyen_pay_by_mail configuration values * @desc Gives back adyen_pay_by_mail configuration values
* @param $field * @param $field
* @param null $storeId * @param int|null $storeId
* @return mixed * @return mixed
*/ */
public function getAdyenPayByMailConfigData($field, $storeId = null) public function getAdyenPayByMailConfigData($field, $storeId = null)
...@@ -479,7 +479,7 @@ class Data extends AbstractHelper ...@@ -479,7 +479,7 @@ class Data extends AbstractHelper
/** /**
* @desc Gives back adyen_pay_by_mail configuration values as flag * @desc Gives back adyen_pay_by_mail configuration values as flag
* @param $field * @param $field
* @param null $storeId * @param int|null $storeId
* @return mixed * @return mixed
*/ */
public function getAdyenPayByMailConfigDataFlag($field, $storeId = null) public function getAdyenPayByMailConfigDataFlag($field, $storeId = null)
...@@ -1185,7 +1185,7 @@ class Data extends AbstractHelper ...@@ -1185,7 +1185,7 @@ class Data extends AbstractHelper
} }
/** /**
* @param integer|null $storeId * @param int|null $storeId
* @return string the X API Key for the specified or current store * @return string the X API Key for the specified or current store
*/ */
public function getPosApiKey($storeId = null) public function getPosApiKey($storeId = null)
...@@ -1206,8 +1206,7 @@ class Data extends AbstractHelper ...@@ -1206,8 +1206,7 @@ class Data extends AbstractHelper
*/ */
public function getPoiId($storeId = null) public function getPoiId($storeId = null)
{ {
$poiId = $this->getAdyenPosCloudConfigData('pos_terminal_id', $storeId); return $this->getAdyenPosCloudConfigData('pos_terminal_id', $storeId);
return $poiId;
} }
/** /**
...@@ -1266,20 +1265,21 @@ class Data extends AbstractHelper ...@@ -1266,20 +1265,21 @@ class Data extends AbstractHelper
/** /**
* Initializes and returns Adyen Client and sets the required parameters of it * Initializes and returns Adyen Client and sets the required parameters of it
* *
* @param $storeId * @param int|null $storeId
* @param string|null $apiKey
* @return \Adyen\Client * @return \Adyen\Client
* @throws \Adyen\AdyenException * @throws \Adyen\AdyenException
*/ */
public function initializeAdyenClient($storeId = null) public function initializeAdyenClient($storeId = null, $apiKey = null)
{ {
// initialize client if (!$apiKey) {
$webserviceUsername = $this->getWsUsername($storeId); $apiKey = $this->getAPIKey($storeId);
$webservicePassword = $this->getWsPassword($storeId); }
$client = new \Adyen\Client(); // initialize client
$client = $this->createAdyenClient();
$client->setApplicationName("Magento 2 plugin"); $client->setApplicationName("Magento 2 plugin");
$client->setUsername($webserviceUsername); $client->setXApiKey($apiKey);
$client->setPassword($webservicePassword);
$client->setAdyenPaymentSource($this->getModuleName(), $this->getModuleVersion()); $client->setAdyenPaymentSource($this->getModuleName(), $this->getModuleVersion());
...@@ -1288,11 +1288,23 @@ class Data extends AbstractHelper ...@@ -1288,11 +1288,23 @@ class Data extends AbstractHelper
if ($this->isDemoMode($storeId)) { if ($this->isDemoMode($storeId)) {
$client->setEnvironment(\Adyen\Environment::TEST); $client->setEnvironment(\Adyen\Environment::TEST);
} else { } else {
$client->setEnvironment(\Adyen\Environment::LIVE); $client->setEnvironment(\Adyen\Environment::LIVE, $this->getLiveEndpointPrefix($storeId));
} }
$client->setLogger($this->adyenLogger); $client->setLogger($this->adyenLogger);
return $client; return $client;
} }
/**
* @param \Adyen\Clien $client
* @return \Adyen\Service\PosPayment
* @throws \Adyen\AdyenException
*/
public function createAdyenPosPaymentService($client)
{
return new \Adyen\Service\PosPayment($client);
}
} }
...@@ -30,12 +30,20 @@ use Adyen\Util\Util; ...@@ -30,12 +30,20 @@ use Adyen\Util\Util;
class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
{ {
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
private $_encryptor; /**
private $_adyenHelper; * @var \Adyen\Payment\Logger\AdyenLogger
private $_adyenLogger; */
private $_recurringType; private $adyenLogger;
private $_appState;
/**
* @var \Adyen\Client
*/
protected $client;
/** /**
* @var int * @var int
...@@ -45,7 +53,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -45,7 +53,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
/** /**
* @var \Magento\Checkout\Model\Session * @var \Magento\Checkout\Model\Session
*/ */
protected $_checkoutSession; protected $checkoutSession;
/** /**
* AdyenInitiateTerminalApi constructor. * AdyenInitiateTerminalApi constructor.
...@@ -57,23 +65,22 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -57,23 +65,22 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Checkout\Model\Session $_checkoutSession, \Magento\Checkout\Model\Session $checkoutSession,
\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\StoreManagerInterface $storeManager,
array $data = [] array $data = []
) )
{ {
$this->_adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger; $this->adyenLogger = $adyenLogger;
$this->_checkoutSession = $_checkoutSession; $this->checkoutSession = $checkoutSession;
$this->storeId = $storeManager->getStore()->getId(); $this->storeId = $storeManager->getStore()->getId();
// initialize client // initialize client
$client = $this->_adyenHelper->initializeAdyenClient($this->storeId); $apiKey = $this->adyenHelper->getPosApiKey($this->storeId);
$apiKey = $this->_adyenHelper->getPosApiKey($this->storeId); $client = $this->adyenHelper->initializeAdyenClient($this->storeId, $apiKey);
$client->setXApiKey($apiKey);
//Set configurable option in M2 //Set configurable option in M2
$posTimeout = $this->_adyenHelper->getAdyenPosCloudConfigData('pos_timeout', $this->storeId); $posTimeout = $this->adyenHelper->getAdyenPosCloudConfigData('pos_timeout', $this->storeId);
if (!empty($posTimeout)) { if (!empty($posTimeout)) {
$client->setTimeout($posTimeout); $client->setTimeout($posTimeout);
} }
...@@ -81,7 +88,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -81,7 +88,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
// assign magento log // assign magento log
$client->setLogger($adyenLogger); $client->setLogger($adyenLogger);
$this->_client = $client; $this->client = $client;
} }
/** /**
...@@ -91,14 +98,14 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -91,14 +98,14 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
*/ */
public function initiate() public function initiate()
{ {
$quote = $this->_checkoutSession->getQuote(); $quote = $this->checkoutSession->getQuote();
$payment = $quote->getPayment(); $payment = $quote->getPayment();
$payment->setMethod(AdyenPosCloudConfigProvider::CODE); $payment->setMethod(AdyenPosCloudConfigProvider::CODE);
$reference = $quote->reserveOrderId()->getReservedOrderId(); $reference = $quote->reserveOrderId()->getReservedOrderId();
$service = new \Adyen\Service\PosPayment($this->_client); $service = $this->adyenHelper->createAdyenPosPaymentService($this->client);
$transactionType = \Adyen\TransactionType::NORMAL; $transactionType = \Adyen\TransactionType::NORMAL;
$poiId = $this->_adyenHelper->getPoiId($this->storeId); $poiId = $this->adyenHelper->getPoiId($this->storeId);
$serviceID = date("dHis"); $serviceID = date("dHis");
$initiateDate = date("U"); $initiateDate = date("U");
$timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00"); $timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00");
...@@ -147,9 +154,9 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -147,9 +154,9 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
// If customer exists add it into the request to store request // If customer exists add it into the request to store request
if (!empty($customerId)) { if (!empty($customerId)) {
$shopperEmail = $quote->getCustomerEmail(); $shopperEmail = $quote->getCustomerEmail();
$recurringContract = $this->_adyenHelper->getAdyenPosCloudConfigData('recurring_type', $this->storeId); $recurringContract = $this->adyenHelper->getAdyenPosCloudConfigData('recurring_type', $this->storeId);
if (!empty($recurringContract) && !empty($shopperEmail) && !empty($customerId)) { if (!empty($recurringContract) && !empty($shopperEmail)) {
$recurringDetails = [ $recurringDetails = [
'shopperEmail' => $shopperEmail, 'shopperEmail' => $shopperEmail,
'shopperReference' => strval($customerId), 'shopperReference' => strval($customerId),
...@@ -168,7 +175,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -168,7 +175,7 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$response = $service->runTenderSync($request); $response = $service->runTenderSync($request);
} catch (\Adyen\AdyenException $e) { } catch (\Adyen\AdyenException $e) {
//Not able to perform a payment //Not able to perform a payment
$this->_adyenLogger->addAdyenDebug("adyenexception"); $this->adyenLogger->addAdyenDebug("adyenexception");
$response['error'] = $e->getMessage(); $response['error'] = $e->getMessage();
} catch (\Exception $e) { } catch (\Exception $e) {
//Probably timeout //Probably timeout
......
...@@ -22,10 +22,8 @@ ...@@ -22,10 +22,8 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Model; namespace Adyen\Payment\Model;
class AdyenPaymentInformationManagement extends \Magento\Checkout\Model\PaymentInformationManagement class AdyenPaymentInformationManagement extends \Magento\Checkout\Model\PaymentInformationManagement
{ {
...@@ -45,4 +43,4 @@ class AdyenPaymentInformationManagement extends \Magento\Checkout\Model\PaymentI ...@@ -45,4 +43,4 @@ class AdyenPaymentInformationManagement extends \Magento\Checkout\Model\PaymentI
} }
return $orderId; return $orderId;
} }
} }
\ No newline at end of file
...@@ -25,37 +25,23 @@ ...@@ -25,37 +25,23 @@
namespace Adyen\Payment\Model\Ui; namespace Adyen\Payment\Model\Ui;
use Magento\Checkout\Model\ConfigProviderInterface; use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Payment\Helper\Data as PaymentHelper;
use Magento\Directory\Helper\Data;
class AdyenPosCloudConfigProvider implements ConfigProviderInterface class AdyenPosCloudConfigProvider implements ConfigProviderInterface
{ {
const CODE = 'adyen_pos_cloud'; const CODE = 'adyen_pos_cloud';
protected $_adyenLogger;
/**
* @var PaymentHelper
*/
protected $_paymentHelper;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/** /**
* Request object * Request object
* *
* @var \Magento\Framework\App\RequestInterface * @var \Magento\Framework\App\RequestInterface
*/ */
protected $_request; protected $request;
/** /**
* @var \Magento\Framework\UrlInterface * @var \Magento\Framework\UrlInterface
*/ */
protected $_urlBuilder; protected $urlBuilder;
/** /**
* AdyenHppConfigProvider constructor. * AdyenHppConfigProvider constructor.
...@@ -64,18 +50,11 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface ...@@ -64,18 +50,11 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
*/ */
public function __construct( public function __construct(
PaymentHelper $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\UrlInterface $urlBuilder
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
) { ) {
$this->_paymentHelper = $paymentHelper; $this->request = $request;
$this->_adyenHelper = $adyenHelper; $this->urlBuilder = $urlBuilder;
$this->_request = $request;
$this->_urlBuilder = $urlBuilder;
$this->_adyenLogger = $adyenLogger;
} }
/** /**
...@@ -90,8 +69,8 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface ...@@ -90,8 +69,8 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface
'payment' => [ 'payment' => [
self::CODE => [ self::CODE => [
'isActive' => true, 'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl( 'redirectUrl' => $this->urlBuilder->getUrl(
'/checkout/onepage/success/', ['_secure' => $this->_getRequest()->isSecure()]) '/checkout/onepage/success/', ['_secure' => $this->getRequest()->isSecure()])
] ]
] ]
]; ];
...@@ -104,8 +83,8 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface ...@@ -104,8 +83,8 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface
* *
* @return \Magento\Framework\App\RequestInterface * @return \Magento\Framework\App\RequestInterface
*/ */
protected function _getRequest() protected function getRequest()
{ {
return $this->_request; return $this->request;
} }
} }
\ 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