Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: compatibilization with magento 2.4.6 and PHP 8.2 #214

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Block/Payment/Info/TwoCreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ public function getTransactionInfo()
return [];
}

$chargeOne = current($orderObject->getCharges());
$chargeTwo = next($chargeOne);
$charges = $orderObject->getCharges();
$chargeOne = current($charges);
$chargeTwo = next($charges);

return [
'card1' => array_merge(
Expand Down
15 changes: 13 additions & 2 deletions Concrete/Magento2DatabaseDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

namespace Pagarme\Pagarme\Concrete;

use Magento\Framework\App\ResourceConnection;
use Pagarme\Core\Kernel\Abstractions\AbstractDatabaseDecorator;

final class Magento2DatabaseDecorator extends AbstractDatabaseDecorator
{
/**
* @var ResourceConnection
*/
protected $db;

/**
* @var mixed
*/
private $lastInsertId;

protected function setTableArray()
{
$this->tableArray = [
Expand Down Expand Up @@ -87,7 +98,7 @@ protected function doFetch($query)

public function getLastId()
{
return $this->db->lastInsertId;
return $this->lastInsertId;
}

protected function setTablePrefix()
Expand All @@ -98,6 +109,6 @@ protected function setTablePrefix()

protected function setLastInsertId($lastInsertId)
{
$this->db->lastInsertId = $lastInsertId;
$this->lastInsertId = $lastInsertId;
}
}
5 changes: 5 additions & 0 deletions Console/Command/MigrateExecute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
class MigrateExecute extends Command
{

/**
* @var MigrateData
*/
private $migrateData;

public function __construct(MigrateData $migrateData)
{
$this->migrateData = $migrateData;
Expand Down
5 changes: 5 additions & 0 deletions Console/Command/MigrateList.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
class MigrateList extends Command
{

/**
* @var MigrateData
*/
private $migrateData;

public function __construct(MigrateData $migrateData)
{
$this->migrateData = $migrateData;
Expand Down
27 changes: 26 additions & 1 deletion Console/MigrateData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,40 @@
use Magento\Framework\App\Helper\Context;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Monolog\Logger;

class MigrateData extends AbstractHelper
{
/**
* @var Logger
*/
protected $logger;

/**
* @var AdapterInterface
*/
protected $connection;

/**
* @var mixed
*/
protected $start;

/**
* @var array|null
*/
protected $options;

/**
* @var array|null
*/
protected $log;

public function __construct(Context $context, ResourceConnection $resourceConnection)
{
parent::__construct($context);
$this->logger = new \Monolog\Logger('migration');
$this->logger = new Logger('migration');
$this->logger->pushHandler(new \Monolog\Handler\StreamHandler(BP .'/var/log/pagarme_migration.log'));
$this->connection = $resourceConnection->getConnection();
$this->start = microtime(true);
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Charges/Cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Cancel extends ChargeAction
public function execute()
{
parent::execute();
$params = $this->request->getParams();
$params = $this->getRequest()->getParams();
$logService = new LogService(
'ChargeService',
true
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Charges/Capture.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Capture extends ChargeAction
public function execute()
{
parent::execute();
$params = $this->request->getParams();
$params = $this->getRequest()->getParams();

$logService = new LogService(
'Capture on module',
Expand Down
18 changes: 12 additions & 6 deletions Controller/Adminhtml/Charges/ChargeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,29 @@

class ChargeAction extends \Magento\Backend\App\Action
{
protected $resultPageFactory;
/**
* @var JsonFactory
*/
private $resultJsonFactory;

/**
* @var StoreManagerInterface
*/
private $storeManager;

/**
* Constructor
*
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
* @param Context $context
* @param JsonFactory $resultJsonFactory
* @param StoreManagerInterface $storeManager
*/
public function __construct(
Context $context,
JsonFactory $resultJsonFactory,
Http $request,
StoreManagerInterface $storeManager
) {
Magento2CoreSetup::bootstrap();

$this->request = $request;
$this->resultJsonFactory = $resultJsonFactory;
$this->storeManager = $storeManager;
parent::__construct($context);
Expand Down
14 changes: 13 additions & 1 deletion Controller/Adminhtml/Plans/PlanAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,41 @@

class PlanAction extends Action
{

/**
* @var bool|PageFactory
*/
protected $resultPageFactory = false;

/**
* @var CollectionFactory
*/
protected $productCollectionFactory;

/**
* @var JsonFactory
*/
protected $resultJsonFactory;

/**
* @var ProductHelper
*/
protected $productHelper;

/**
* @var Registry
*/
protected $coreRegistry;

/**
* @var Factory
*/
protected $messageFactory;

/**
* @var StoreManagerInterface
*/
protected $storeManager;


/**
* Constructor
Expand Down
24 changes: 14 additions & 10 deletions Controller/Adminhtml/Recipients/RecipientAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@

namespace Pagarme\Pagarme\Controller\Adminhtml\Recipients;

use Exception;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
use Magento\Framework\View\Result\PageFactory;
use Pagarme\Pagarme\Concrete\Magento2CoreSetup;
use Webkul\Marketplace\Model\SellerFactory;
use Webkul\Marketplace\Model\SellerFactory;
use Magento\Framework\Message\Factory as MagentoMessageFactory;
use Magento\Framework\Module\Manager as ModuleManager;


class RecipientAction extends Action
{
protected $resultPageFactory = false;
/**
* @var WebkulHelper
*/
protected $webkulHelper;

/**
* @var Registry
Expand All @@ -29,18 +26,25 @@ class RecipientAction extends Action
* @var SellerFactory
*/
protected $sellerFactory;

/**
* @var MagentoMessageFactory
*/
protected $messageFactory;

/**
* Constructor
*
* @var ModuleManager
*/
private $moduleManager;

/**
* @param Context $context
* @param Registry $coreRegistry
* @param PageFactory $resultPageFactory
* @param MagentoMessageFactory $messageFactory
* @param ModuleManager $moduleManager
* @throws Exception
*/

public function __construct(
Context $context,
Registry $coreRegistry,
Expand All @@ -50,11 +54,11 @@ public function __construct(
) {

parent::__construct($context);

$this->resultPageFactory = $resultPageFactory;
$this->coreRegistry = $coreRegistry;
$this->messageFactory = $messageFactory;
$this->moduleManager = $moduleManager;
$this->moduleManager = $moduleManager;
$this->__init();
Magento2CoreSetup::bootstrap();
}
Expand Down
30 changes: 20 additions & 10 deletions Controller/Adminhtml/RecurrenceProducts/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Message\Factory;
use Magento\Framework\Registry;
use Magento\Framework\View\Result\PageFactory;
Expand All @@ -21,16 +22,27 @@ class Delete extends Action
*/
protected $coreRegistry;

/**
* @var Factory
*/
protected $messageFactory;

/**
* @var ProductSubscriptionHelper
*/
protected $productSubscriptionHelper;

/**
* Constructor
*
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
* @throws \Exception
* @param Context $context
* @param PageFactory $resultPageFactory
* @param Registry $coreRegistry
* @param Factory $messageFactory
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
Context $context,
PageFactory $resultPageFactory,
Registry $coreRegistry,
Factory $messageFactory
)
Expand All @@ -48,7 +60,7 @@ public function __construct(
/**
* Index action
*
* @return \Magento\Framework\Controller\ResultInterface
* @return ResponseInterface
*/
public function execute()
{
Expand All @@ -61,8 +73,7 @@ public function execute()
if (!$productData || !$productData->getId()) {
$message = $this->messageFactory->create('error', __('Product subscription not exist.'));
$this->messageManager->addErrorMessage($message);
$this->_redirect('pagarme_pagarme/recurrenceproducts/index');
return;
return $this->_redirect('pagarme_pagarme/recurrenceproducts/index');
}
}

Expand All @@ -73,7 +84,6 @@ public function execute()
$message = $this->messageFactory->create('success', __("Product subscription deleted."));
$this->messageManager->addMessage($message);

$this->_redirect('pagarme_pagarme/recurrenceproducts/index');
return;
return $this->_redirect('pagarme_pagarme/recurrenceproducts/index');
}
}
18 changes: 14 additions & 4 deletions Helper/CustomerUpdatePagarmeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@

class CustomerUpdatePagarmeHelper
{

protected $updateCustomerRequest;

/**
* @var Config
*/
protected $config;

/**
* @var CustomerRepositoryInterface
*/
protected $customerRepositoryInterface;

/**
* AdminCustomerSaveAfter constructor.
* @var CustomerService
*/
protected $customerService;

/**
* @param Config $config
* @param CustomerRepositoryInterface $customerRepositoryInterface
* @param CustomerService $customerService
*/
public function __construct(
Config $config,
Expand Down
Loading