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 7f6ae398 authored by marcoss's avatar marcoss

Fix code style issues

parent d8743168
...@@ -52,23 +52,31 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -52,23 +52,31 @@ class Json extends \Magento\Framework\App\Action\Action
*/ */
protected $_adyenLogger; protected $_adyenLogger;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* Json constructor. * Json constructor.
* *
* @param \Magento\Framework\App\Action\Context $context * @param \Magento\Framework\App\Action\Context $context
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Action\Context $context, \Magento\Framework\App\Action\Context $context,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Framework\Serialize\SerializerInterface $serializer
) { ) {
parent::__construct($context); parent::__construct($context);
$this->_objectManager = $context->getObjectManager(); $this->_objectManager = $context->getObjectManager();
$this->_resultFactory = $context->getResultFactory(); $this->_resultFactory = $context->getResultFactory();
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
$this->serializer = $serializer;
// Fix for Magento2.3 adding isAjax to the request params // Fix for Magento2.3 adding isAjax to the request params
if(interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) { if(interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) {
...@@ -214,7 +222,7 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -214,7 +222,7 @@ class Json extends \Magento\Framework\App\Action\Action
$notification->setLive($notificationMode); $notification->setLive($notificationMode);
if (isset($response['additionalData'])) { if (isset($response['additionalData'])) {
$notification->setAddtionalData(serialize($response['additionalData'])); $notification->setAddtionalData($this->serializer->serialize($response['additionalData']));
} }
if (isset($response['done'])) { if (isset($response['done'])) {
$notification->setDone($response['done']); $notification->setDone($response['done']);
......
...@@ -77,15 +77,22 @@ class Redirect extends \Magento\Framework\App\Action\Action ...@@ -77,15 +77,22 @@ class Redirect extends \Magento\Framework\App\Action\Action
* @var PaymentTokenFactoryInterface * @var PaymentTokenFactoryInterface
*/ */
private $paymentTokenFactory; private $paymentTokenFactory;
/** /**
* @var OrderPaymentExtensionInterfaceFactory * @var OrderPaymentExtensionInterfaceFactory
*/ */
private $paymentExtensionFactory; private $paymentExtensionFactory;
/** /**
* @var OrderPaymentResource * @var OrderPaymentResource
*/ */
private $orderPaymentResource; private $orderPaymentResource;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* Redirect constructor. * Redirect constructor.
* *
...@@ -94,6 +101,10 @@ class Redirect extends \Magento\Framework\App\Action\Action ...@@ -94,6 +101,10 @@ class Redirect extends \Magento\Framework\App\Action\Action
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest * @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository * @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository
* @param PaymentTokenFactoryInterface $paymentTokenFactory
* @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory
* @param OrderPaymentResource $orderPaymentResource
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Action\Context $context, \Magento\Framework\App\Action\Context $context,
...@@ -103,7 +114,8 @@ class Redirect extends \Magento\Framework\App\Action\Action ...@@ -103,7 +114,8 @@ class Redirect extends \Magento\Framework\App\Action\Action
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository, \Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
PaymentTokenFactoryInterface $paymentTokenFactory, PaymentTokenFactoryInterface $paymentTokenFactory,
OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory, OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory,
OrderPaymentResource $orderPaymentResource OrderPaymentResource $orderPaymentResource,
\Magento\Framework\Serialize\SerializerInterface $serializer
) { ) {
parent::__construct($context); parent::__construct($context);
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
...@@ -113,6 +125,7 @@ class Redirect extends \Magento\Framework\App\Action\Action ...@@ -113,6 +125,7 @@ class Redirect extends \Magento\Framework\App\Action\Action
$this->paymentTokenFactory = $paymentTokenFactory; $this->paymentTokenFactory = $paymentTokenFactory;
$this->paymentExtensionFactory = $paymentExtensionFactory; $this->paymentExtensionFactory = $paymentExtensionFactory;
$this->orderPaymentResource = $orderPaymentResource; $this->orderPaymentResource = $orderPaymentResource;
$this->serializer = $serializer;
if (interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) { if (interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) {
$request = $this->getRequest(); $request = $this->getRequest();
if ($request instanceof Http && $request->isPost()) { if ($request instanceof Http && $request->isPost()) {
...@@ -198,9 +211,9 @@ class Redirect extends \Magento\Framework\App\Action\Action ...@@ -198,9 +211,9 @@ class Redirect extends \Magento\Framework\App\Action\Action
$extensionAttributes = $this->getExtensionAttributes($order->getPayment()); $extensionAttributes = $this->getExtensionAttributes($order->getPayment());
$extensionAttributes->setVaultPaymentToken($paymentToken); $extensionAttributes->setVaultPaymentToken($paymentToken);
$orderPayment = $order->getPayment()->setExtensionAttributes($extensionAttributes); $orderPayment = $order->getPayment()->setExtensionAttributes($extensionAttributes);
$add = unserialize($orderPayment->getAdditionalData()); $add = $this->serializer->unserialize($orderPayment->getAdditionalData());
$add['force_save'] = true; $add['force_save'] = true;
$orderPayment->setAdditionalData(serialize($add)); $orderPayment->setAdditionalData($this->serializer->serialize($add));
$this->orderPaymentResource->save($orderPayment); $this->orderPaymentResource->save($orderPayment);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->_adyenLogger->error((string)$e->getMessage()); $this->_adyenLogger->error((string)$e->getMessage());
......
...@@ -44,22 +44,30 @@ class InstallmentValidator extends AbstractValidator ...@@ -44,22 +44,30 @@ class InstallmentValidator extends AbstractValidator
*/ */
private $session; private $session;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* InstallmentValidator constructor. * InstallmentValidator constructor.
* @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory * @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\App\ObjectManager $objectManager * @param \Magento\Checkout\Model\Session $session
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/ */
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,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Checkout\Model\Session $session \Magento\Checkout\Model\Session $session,
\Magento\Framework\Serialize\SerializerInterface $serializer
) { ) {
$this->adyenLogger = $adyenLogger; $this->adyenLogger = $adyenLogger;
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->session = $session; $this->session = $session;
$this->serializer = $serializer;
parent::__construct($resultFactory); parent::__construct($resultFactory);
} }
...@@ -77,7 +85,7 @@ class InstallmentValidator extends AbstractValidator ...@@ -77,7 +85,7 @@ class InstallmentValidator extends AbstractValidator
$installmentSelected = $payment->getAdditionalInformation('number_of_installments'); $installmentSelected = $payment->getAdditionalInformation('number_of_installments');
$ccType = $payment->getAdditionalInformation('cc_type'); $ccType = $payment->getAdditionalInformation('cc_type');
if ($installmentsAvailable) { if ($installmentsAvailable) {
$installments = unserialize($installmentsAvailable); $installments = $this->serializer->unserialize($installmentsAvailable);
} }
if ($installmentSelected && $installmentsAvailable) { if ($installmentSelected && $installmentsAvailable) {
$isValid = false; $isValid = false;
......
...@@ -131,6 +131,10 @@ class Data extends AbstractHelper ...@@ -131,6 +131,10 @@ class Data extends AbstractHelper
*/ */
private $helperBackend; private $helperBackend;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* Data constructor. * Data constructor.
...@@ -154,6 +158,7 @@ class Data extends AbstractHelper ...@@ -154,6 +158,7 @@ class Data extends AbstractHelper
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param \Magento\Framework\Locale\ResolverInterface $localeResolver
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Backend\Helper\Data $helperBackend * @param \Magento\Backend\Helper\Data $helperBackend
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Helper\Context $context,
...@@ -175,7 +180,8 @@ class Data extends AbstractHelper ...@@ -175,7 +180,8 @@ class Data extends AbstractHelper
\Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel, \Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel,
\Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\Locale\ResolverInterface $localeResolver,
\Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Backend\Helper\Data $helperBackend \Magento\Backend\Helper\Data $helperBackend,
\Magento\Framework\Serialize\SerializerInterface $serializer
) { ) {
parent::__construct($context); parent::__construct($context);
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
...@@ -197,6 +203,7 @@ class Data extends AbstractHelper ...@@ -197,6 +203,7 @@ class Data extends AbstractHelper
$this->localeResolver = $localeResolver; $this->localeResolver = $localeResolver;
$this->config = $config; $this->config = $config;
$this->helperBackend = $helperBackend; $this->helperBackend = $helperBackend;
$this->serializer = $serializer;
} }
/** /**
...@@ -955,7 +962,7 @@ class Data extends AbstractHelper ...@@ -955,7 +962,7 @@ class Data extends AbstractHelper
$installments = null; $installments = null;
$installmentsValue = $this->getAdyenCcConfigData('installments'); $installmentsValue = $this->getAdyenCcConfigData('installments');
if ($installmentsValue) { if ($installmentsValue) {
$installments = unserialize($installmentsValue); $installments = $this->serializer->unserialize($installmentsValue);
} }
if ($installments) { if ($installments) {
......
...@@ -30,6 +30,11 @@ class Installments extends \Magento\Framework\App\Config\Value ...@@ -30,6 +30,11 @@ class Installments extends \Magento\Framework\App\Config\Value
*/ */
protected $mathRandom; protected $mathRandom;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Registry $registry
...@@ -46,11 +51,13 @@ class Installments extends \Magento\Framework\App\Config\Value ...@@ -46,11 +51,13 @@ class Installments extends \Magento\Framework\App\Config\Value
\Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Magento\Framework\Math\Random $mathRandom, \Magento\Framework\Math\Random $mathRandom,
\Magento\Framework\Serialize\SerializerInterface $serializer,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [] array $data = []
) { ) {
$this->mathRandom = $mathRandom; $this->mathRandom = $mathRandom;
$this->serializer = $serializer;
parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data);
} }
...@@ -62,8 +69,7 @@ class Installments extends \Magento\Framework\App\Config\Value ...@@ -62,8 +69,7 @@ class Installments extends \Magento\Framework\App\Config\Value
public function beforeSave() public function beforeSave()
{ {
$value = $this->getValue(); $value = $this->getValue();
$unserialized = @unserialize($value); if (!is_array($value)) {
if ($unserialized !== false) {
return $this; return $this;
} }
$result = []; $result = [];
...@@ -94,7 +100,7 @@ class Installments extends \Magento\Framework\App\Config\Value ...@@ -94,7 +100,7 @@ class Installments extends \Magento\Framework\App\Config\Value
$finalResult[$key] = $installments; $finalResult[$key] = $installments;
} }
$this->setValue(serialize($finalResult)); $this->setValue($this->serializer->serialize($finalResult));
return $this; return $this;
} }
...@@ -106,7 +112,7 @@ class Installments extends \Magento\Framework\App\Config\Value ...@@ -106,7 +112,7 @@ class Installments extends \Magento\Framework\App\Config\Value
protected function _afterLoad() protected function _afterLoad()
{ {
$value = $this->getValue(); $value = $this->getValue();
$value = unserialize($value); $value = $this->serializer->unserialize($value);
if (is_array($value)) { if (is_array($value)) {
$value = $this->encodeArrayFieldValue($value); $value = $this->encodeArrayFieldValue($value);
$this->setValue($value); $this->setValue($value);
......
...@@ -30,12 +30,18 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value ...@@ -30,12 +30,18 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value
*/ */
protected $mathRandom; protected $mathRandom;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
* @param \Magento\Framework\Math\Random $mathRandom * @param \Magento\Framework\Math\Random $mathRandom
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data * @param array $data
...@@ -46,11 +52,13 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value ...@@ -46,11 +52,13 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value
\Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Magento\Framework\Math\Random $mathRandom, \Magento\Framework\Math\Random $mathRandom,
\Magento\Framework\Serialize\SerializerInterface $serializer,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [] array $data = []
) { ) {
$this->mathRandom = $mathRandom; $this->mathRandom = $mathRandom;
$this->serializer = $serializer;
parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data);
} }
...@@ -62,9 +70,7 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value ...@@ -62,9 +70,7 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value
public function beforeSave() public function beforeSave()
{ {
$value = $this->getValue(); $value = $this->getValue();
if (!is_array($value)) {
$unserialized = @unserialize($value);
if ($unserialized !== false) {
return $this; return $this;
} }
$result = []; $result = [];
...@@ -87,7 +93,7 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value ...@@ -87,7 +93,7 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value
asort($result); asort($result);
$this->setValue(serialize($result)); $this->setValue($this->serializer->serialize($result));
return $this; return $this;
} }
...@@ -100,7 +106,7 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value ...@@ -100,7 +106,7 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value
protected function _afterLoad() protected function _afterLoad()
{ {
$value = $this->getValue(); $value = $this->getValue();
$value = unserialize($value); $value = $this->serializer->unserialize($value);
if (is_array($value)) { if (is_array($value)) {
$value = $this->encodeArrayFieldValue($value); $value = $this->encodeArrayFieldValue($value);
......
...@@ -69,6 +69,10 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -69,6 +69,10 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
*/ */
private $storeManager; private $storeManager;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* AdyenCcConfigProvider constructor. * AdyenCcConfigProvider constructor.
...@@ -80,6 +84,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -80,6 +84,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
* @param \Magento\Framework\View\Asset\Source $assetSource * @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Payment\Model\CcConfig $ccConfig * @param \Magento\Payment\Model\CcConfig $ccConfig
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/ */
public function __construct( public function __construct(
\Magento\Payment\Helper\Data $paymentHelper, \Magento\Payment\Helper\Data $paymentHelper,
...@@ -88,7 +93,8 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -88,7 +93,8 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
\Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\UrlInterface $urlBuilder,
\Magento\Framework\View\Asset\Source $assetSource, \Magento\Framework\View\Asset\Source $assetSource,
\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Payment\Model\CcConfig $ccConfig \Magento\Payment\Model\CcConfig $ccConfig,
\Magento\Framework\Serialize\SerializerInterface $serializer
) { ) {
$this->_paymentHelper = $paymentHelper; $this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
...@@ -97,6 +103,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -97,6 +103,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$this->_assetSource = $assetSource; $this->_assetSource = $assetSource;
$this->ccConfig = $ccConfig; $this->ccConfig = $ccConfig;
$this->storeManager = $storeManager; $this->storeManager = $storeManager;
$this->serializer = $serializer;
} }
/** /**
...@@ -156,7 +163,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -156,7 +163,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$installments = $this->_adyenHelper->getAdyenCcConfigData('installments'); $installments = $this->_adyenHelper->getAdyenCcConfigData('installments');
if ($installmentsEnabled && $installments) { if ($installmentsEnabled && $installments) {
$config['payment']['adyenCc']['installments'] = unserialize($installments); $config['payment']['adyenCc']['installments'] = $this->serializer->unserialize($installments);
$config['payment']['adyenCc']['hasInstallments'] = true; $config['payment']['adyenCc']['hasInstallments'] = true;
} else { } else {
$config['payment']['adyenCc']['installments'] = []; $config['payment']['adyenCc']['installments'] = [];
......
...@@ -144,6 +144,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface ...@@ -144,6 +144,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
$config['payment'] ['adyenHpp']['genderTypes'] = \Adyen\Payment\Model\Gender::getGenderTypes(); $config['payment'] ['adyenHpp']['genderTypes'] = \Adyen\Payment\Model\Gender::getGenderTypes();
$config['payment'] ['adyenHpp']['ratePayId'] = $this->adyenHelper->getRatePayId(); $config['payment'] ['adyenHpp']['ratePayId'] = $this->adyenHelper->getRatePayId();
// TODO: change the algorithm
$config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->session->getQuoteId() . date('c')); $config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->session->getQuoteId() . date('c'));
$config['payment'] ['adyenHpp']['nordicCountries'] = ['SE', 'NO', 'DK', 'FI']; $config['payment'] ['adyenHpp']['nordicCountries'] = ['SE', 'NO', 'DK', 'FI'];
......
...@@ -53,22 +53,32 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface ...@@ -53,22 +53,32 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface
*/ */
protected $adyenHelper; protected $adyenHelper;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/** /**
* AdyenHppConfigProvider constructor. * AdyenHppConfigProvider constructor.
* *
* @param PaymentHelper $paymentHelper * @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Adyen\Payment\Helper\PaymentMethods $paymentMethodsHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\UrlInterface $urlBuilder,
\Adyen\Payment\Helper\PaymentMethods $paymentMethodsHelper, \Adyen\Payment\Helper\PaymentMethods $paymentMethodsHelper,
\Adyen\Payment\Helper\Data $adyenHelper \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\Serialize\SerializerInterface $serializer
) { ) {
$this->request = $request; $this->request = $request;
$this->urlBuilder = $urlBuilder; $this->urlBuilder = $urlBuilder;
$this->paymentMethodsHelper = $paymentMethodsHelper; $this->paymentMethodsHelper = $paymentMethodsHelper;
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->serializer = $serializer;
} }
/** /**
...@@ -101,7 +111,7 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface ...@@ -101,7 +111,7 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface
$installments = $this->adyenHelper->getAdyenPosCloudConfigData('installments'); $installments = $this->adyenHelper->getAdyenPosCloudConfigData('installments');
if ($installmentsEnabled && $installments) { if ($installmentsEnabled && $installments) {
$config['payment']['adyenPos']['installments'] = unserialize($installments); $config['payment']['adyenPos']['installments'] = $this->serializer->unserialize($installments);
$config['payment']['adyenPos']['hasInstallments'] = true; $config['payment']['adyenPos']['hasInstallments'] = true;
} else { } else {
$config['payment']['adyenPos']['installments'] = []; $config['payment']['adyenPos']['installments'] = [];
......
...@@ -960,6 +960,26 @@ ...@@ -960,6 +960,26 @@
<argument name="dataStorage" xsi:type="object">adyenPaymentConfigDataStorage</argument> <argument name="dataStorage" xsi:type="object">adyenPaymentConfigDataStorage</argument>
</arguments> </arguments>
</type> </type>
<type name="Adyen\Payment\Model\Config\Backend\Installments">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<type name="Adyen\Payment\Model\Config\Backend\InstallmentsPosCloud">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<type name="Adyen\Payment\Gateway\Validator\InstallmentValidator">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<type name="Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<preference for="Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface" <preference for="Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface"
type="Adyen\Payment\Model\GuestAdyenPaymentMethodManagement"/> type="Adyen\Payment\Model\GuestAdyenPaymentMethodManagement"/>
<preference for="Adyen\Payment\Api\AdyenPaymentMethodManagementInterface" <preference for="Adyen\Payment\Api\AdyenPaymentMethodManagementInterface"
......
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