Skip to content

Commit

Permalink
Use Laminas library instead of Zend (#21)
Browse files Browse the repository at this point in the history
* Use Laminas library instead of Zend
* Linter changes

---------

Co-authored-by: Piotr Matras <piotr.matras@creativestyle.pl>
Co-authored-by: Šaltanovas Aivaras <aivaras.saltanovas@kevin.eu>
  • Loading branch information
3 people authored Mar 4, 2024
1 parent e9dc015 commit 75badc4
Show file tree
Hide file tree
Showing 16 changed files with 340 additions and 798 deletions.
17 changes: 1 addition & 16 deletions Api/Kevin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getConnection($clientId = null, $clientSecret = null)

$options = array_merge($options, $this->config->getSystemData());

return new \Kevin\Client($clientId, $clientSecret, $options);
return new Client($clientId, $clientSecret, $options);
}

/**
Expand Down Expand Up @@ -158,25 +158,16 @@ public function getBank($bankId)
}
}

/**
* @return mixed
*/
public function initPayment($params)
{
return $this->getClient()->payment()->initPayment($params);
}

/**
* @return mixed
*/
public function getPaymentStatus($paymentId, $attr)
{
return $this->getClient()->payment()->getPaymentStatus($paymentId, $attr);
}

/**
* @return mixed
*/
public function getPayment($paymentId, $attr)
{
return $this->getClient()->payment()->getPayment($paymentId, $attr);
Expand All @@ -199,9 +190,6 @@ public function getAvailableCountries()
}
}

/**
* @return mixed
*/
public function initRefund($paymentId, $attr)
{
return $this->getClient()->payment()->initiatePaymentRefund($paymentId, $attr);
Expand All @@ -218,9 +206,6 @@ public function getRefunds($paymentId)
}
}

/**
* @return mixed
*/
public function verifySignature($endpointSecret, $requestBody, $headers, $webhookUrl)
{
$timestampTimeout = self::SIGNATURE_VERIFY_TIMEOUT;
Expand Down
2 changes: 0 additions & 2 deletions Block/Adminhtml/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class Info extends \Magento\Payment\Block\Info
{
/**
* @param null $transport
*
* @return mixed
*/
protected function _prepareSpecificInformation($transport = null)
{
Expand Down
5 changes: 1 addition & 4 deletions Controller/Payment/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Callback extends \Magento\Framework\App\Action\Action
protected $api;

/**
* @var \Kevin\Payment\Model\Adapter
* @var KevinAdapter
*/
protected $adapter;

Expand Down Expand Up @@ -65,9 +65,6 @@ public function __construct(
parent::__construct($context);
}

/**
* @return mixed
*/
protected function _getCheckout()
{
return $this->_objectManager->get('Magento\Checkout\Model\Session');
Expand Down
5 changes: 1 addition & 4 deletions Controller/Payment/Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Kevin\Payment\Controller\Payment;

use Zend\Json\Json;
use Laminas\Json\Json;

/**
* Class Notify.
Expand Down Expand Up @@ -114,9 +114,6 @@ public function __construct(
parent::__construct($context);
}

/**
* @return mixed
*/
public function execute()
{
$body = $this->getRequest()->getContent();
Expand Down
6 changes: 0 additions & 6 deletions Controller/Payment/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ public function __construct(
parent::__construct($context);
}

/**
* @return mixed
*/
protected function _getCheckout()
{
return $this->_objectManager->get('Magento\Checkout\Model\Session');
Expand Down Expand Up @@ -176,9 +173,6 @@ protected function getCustomerDeviceId()
return $this->getUUID();
}

/**
* @return mixed
*/
protected function getCustomerIpAddress()
{
return $this->remoteAddress->getRemoteAddress();
Expand Down
33 changes: 0 additions & 33 deletions Gateway/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,49 +72,31 @@ public function __construct(
parent::__construct($scopeConfig, $methodCode, $pathPattern);
}

/**
* @return mixed
*/
public function getStatus()
{
return $this->getValue('status');
}

/**
* @return mixed
*/
public function getActive()
{
return $this->getValue('active');
}

/**
* @return mixed
*/
public function getClientId()
{
return $this->getValue('client_id');
}

/**
* @return mixed
*/
public function getClientSecret()
{
return $this->getValue('client_secret');
}

/**
* @return mixed
*/
public function getSignature()
{
return $this->getValue('signature');
}

/**
* @return mixed
*/
public function getRedirectPreferred()
{
return (int) $this->getValue('extra_settings/redirect_preferred');
Expand Down Expand Up @@ -144,43 +126,28 @@ public function getPaymentSearch()
return (int) $this->getValue('extra_settings/show_search');
}

/**
* @return mixed
*/
public function getPaymentList()
{
return (int) $this->getValue('extra_settings/payment_list');
}

/**
* @return mixed
*/
public function getCompanyName()
{
return $this->getValue('default_bank/company_name');
}

/**
* @return mixed
*/
public function getCompanyBankAccount()
{
return $this->getValue('default_bank/company_bank_account');
}

/**
* @return mixed
*/
public function getAdditionalBankAccounts()
{
$value = $this->getValue('additional_bank/additional_bank_list');

return $value ? $this->serialize->unserialize($value) : '';
}

/**
* @return mixed
*/
public function getKevinCountryList()
{
return $this->getValue('country_list');
Expand Down
7 changes: 0 additions & 7 deletions Model/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ public function initPayment($order)
}

/**
* @param $payment
*
* @return array
*/
public function initRefund($transactionId, $amount)
Expand All @@ -151,8 +149,6 @@ public function initRefund($transactionId, $amount)
/**
* @param null $order
* @param array $paymentData
*
* @return mixed
*/
public function createTransaction($order = null, $paymentData = [])
{
Expand Down Expand Up @@ -192,9 +188,6 @@ public function createTransaction($order = null, $paymentData = [])
}
}

/**
* @return mixed
*/
public function getTransaction($transactionId)
{
$transaction = $this->transactions->create()
Expand Down
3 changes: 0 additions & 3 deletions Model/Config/Source/ModuleStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ public function __construct(
$this->_config = $config;
}

/**
* {@inheritDoc}
*/
public function getCommentText($elementValue)
{
if (!$this->_config->getStatus()) {
Expand Down
16 changes: 8 additions & 8 deletions Model/Creditmemo/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Delete
protected $_authSession;

/**
* @var \Magento\Framework\Registry
* @var Registry
*/
protected $registry;

Expand All @@ -58,7 +58,7 @@ public function __construct(
}

/**
* @return \Magento\Sales\Model\Order
* @return Order
*
* @throws \Exception
*/
Expand Down Expand Up @@ -174,16 +174,16 @@ protected function setTotalandBaseTotal($creditmemo, $order)
protected function saveOrder($order)
{
if ($order->hasShipments() || $order->hasInvoices() || $order->hasCreditmemos()) {
$order->setState(\Magento\Sales\Model\Order::STATE_PROCESSING)
->setStatus($order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_PROCESSING))
$order->setState(Order::STATE_PROCESSING)
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_PROCESSING))
->save();
} elseif (!$order->canInvoice() && !$order->canShip() && !$order->hasCreditmemos()) {
$order->setState(\Magento\Sales\Model\Order::STATE_COMPLETE)
->setStatus($order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_COMPLETE))
$order->setState(Order::STATE_COMPLETE)
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_COMPLETE))
->save();
} else {
$order->setState(\Magento\Sales\Model\Order::STATE_NEW)
->setStatus($order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_NEW))
$order->setState(Order::STATE_NEW)
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_NEW))
->save();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Model/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PaymentMethods extends \Magento\Framework\Model\AbstractModel
public function _construct()
{
$this->_init(
\Kevin\Payment\Model\ResourceModel\PaymentMethods::class
ResourceModel\PaymentMethods::class
);
}
}
3 changes: 0 additions & 3 deletions Model/ResourceModel/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

class PaymentMethods extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
/**
* {@inheritDoc}
*/
protected function _construct()
{
$this->_init('kevin_payment_list', 'id');
Expand Down
2 changes: 1 addition & 1 deletion Plugin/Config/SaveConfigPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function beforeSave(
}

if ($clientId && $clientSecret) {
if (strpos($clientSecret, '***') !== false) {
if (str_contains($clientSecret, '***')) {
$clientSecret = $this->config->getClientSecret();
}

Expand Down
3 changes: 0 additions & 3 deletions Plugin/Sales/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ public function __construct(
$this->config = $config;
}

/**
* @return mixed
*/
public function afterGetCanSendNewEmailFlag(
\Magento\Sales\Model\Order $subject,
$result
Expand Down
8 changes: 4 additions & 4 deletions Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public function upgrade(
'Logo'
)
->addColumn(
'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, 100,
['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
'created_at', Table::TYPE_TIMESTAMP, 100,
['nullable' => false, 'default' => Table::TIMESTAMP_INIT],
'Created At'
)
->addColumn(
'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, 100,
['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
'updated_at', Table::TYPE_TIMESTAMP, 100,
['nullable' => false, 'default' => Table::TIMESTAMP_INIT],
'Updated At'
)->addIndex(
$setup->getIdxName('kevin_payment_list', ['country_id']),
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
},
"scripts": {
"fix-style": [
"wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.19.0/php-cs-fixer.phar -O php-cs-fixer",
"wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.51.0/php-cs-fixer.phar -O php-cs-fixer",
"chmod a+x php-cs-fixer",
"./php-cs-fixer fix --config=./.php.cs.fixer.php -v --allow-risky=yes"
],
"check-style": [
"wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.19.0/php-cs-fixer.phar -O php-cs-fixer",
"wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.51.0/php-cs-fixer.phar -O php-cs-fixer",
"chmod a+x php-cs-fixer",
"./php-cs-fixer fix --config=./.php.cs.fixer.php -v --allow-risky=yes --dry-run"
]
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19"
"friendsofphp/php-cs-fixer": "^v3.51.0"
},
"extra": {
"exclude-from-files": [
Expand Down
Loading

0 comments on commit 75badc4

Please sign in to comment.