Skip to content

Commit

Permalink
1.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Aug 12, 2024
1 parent b6b31b5 commit bd93811
Show file tree
Hide file tree
Showing 70 changed files with 2,972 additions and 1,713 deletions.
53 changes: 35 additions & 18 deletions Block/Adminhtml/System/Config/Fieldset/Base/Payment.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,55 @@

namespace EMerchantPay\Genesis\Block\Adminhtml\System\Config\Fieldset\Base;

use Magento\Backend\Block\Context;
use Magento\Backend\Model\Auth\Session;
use Magento\Config\Block\System\Config\Form\Fieldset;
use Magento\Config\Model\Config;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\View\Helper\Js;

/**
* Base Renderer for EMerchantPay Checkout & Direct Panel in System Configuration
*
* Class Payment
* @package EMerchantPay\Genesis\Block\Adminhtml\System\Config\Fieldset\Base
*/
abstract class Payment extends \Magento\Config\Block\System\Config\Form\Fieldset
abstract class Payment extends Fieldset
{
/**
* @var \Magento\Config\Model\Config
* @var Config
*/
protected $_backendConfig;

/**
* @param \Magento\Backend\Block\Context $context
* @param \Magento\Backend\Model\Auth\Session $authSession
* @param \Magento\Framework\View\Helper\Js $jsHelper
* @param \Magento\Config\Model\Config $backendConfig
* @param array $data
* @param Context $context
* @param Session $authSession
* @param Js $jsHelper
* @param Config $backendConfig
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Context $context,
\Magento\Backend\Model\Auth\Session $authSession,
\Magento\Framework\View\Helper\Js $jsHelper,
\Magento\Config\Model\Config $backendConfig,
array $data = []
Context $context,
Session $authSession,
Js $jsHelper,
Config $backendConfig,
array $data = []
) {
$this->_backendConfig = $backendConfig;
parent::__construct($context, $authSession, $jsHelper, $data);
}

/**
* Retrieves the Module Panel Css Class
*
* @return string
*/
abstract protected function getBlockHeadCssClass();

/**
* Add custom css class
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @param AbstractElement $element
*
* @return string
*/
protected function _getFrontendClass($element)
Expand All @@ -70,8 +78,10 @@ protected function _getFrontendClass($element)
/**
* Return header title part of html for payment solution
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @param AbstractElement $element
*
* @return string
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _getHeaderTitleHtml($element)
Expand Down Expand Up @@ -106,8 +116,10 @@ protected function _getHeaderTitleHtml($element)
/**
* Return header comment part of html for payment solution
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @param AbstractElement $element
*
* @return string
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _getHeaderCommentHtml($element)
Expand All @@ -118,8 +130,10 @@ protected function _getHeaderCommentHtml($element)
/**
* Get collapsed state on-load
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @param AbstractElement $element
*
* @return bool
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _isCollapseState($element)
Expand All @@ -128,7 +142,10 @@ protected function _isCollapseState($element)
}

/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* Add jQuery to the payment page
*
* @param AbstractElement $element
*
* @return string
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/System/Config/Fieldset/CheckoutPayment.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
* Renderer for EMerchantPay Checkout Panel in System Configuration
*
* Class CheckoutPayment
* @package EMerchantPay\Genesis\Block\Adminhtml\System\Config\Fieldset
*/
class CheckoutPayment extends \EMerchantPay\Genesis\Block\Adminhtml\System\Config\Fieldset\Base\Payment
{
/**
* Retrieves the Module Panel Css Class
*
* @return string
*/
protected function getBlockHeadCssClass()
Expand Down
11 changes: 7 additions & 4 deletions Block/Adminhtml/System/Config/Fieldset/Init.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@

namespace EMerchantPay\Genesis\Block\Adminhtml\System\Config\Fieldset;

use Magento\Backend\Block\Template;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Data\Form\Element\Renderer\RendererInterface;

/**
* Renderer for EMerchantPay banner in System Configuration
*/
class Init extends \Magento\Backend\Block\Template implements
\Magento\Framework\Data\Form\Element\Renderer\RendererInterface
class Init extends Template implements RendererInterface
{
/**
* @var string
Expand All @@ -33,13 +36,13 @@ class Init extends \Magento\Backend\Block\Template implements
/**
* Render fieldset html
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @param AbstractElement $element
* @return string
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
// @codingStandardsIgnoreStart
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
public function render(AbstractElement $element)
{
return $this->toHtml();
}
Expand Down
8 changes: 4 additions & 4 deletions Block/Frontend/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace EMerchantPay\Genesis\Block\Frontend;

use EMerchantPay\Genesis\Model\Config as BackendConfig;
use EMerchantPay\Genesis\Model\Method\Checkout;
use EMerchantPay\Genesis\Model\Method\Checkout as MethodCheckout;
use Magento\Framework\View\Element\Template;

/**
Expand All @@ -37,8 +37,8 @@ class Config extends Template

/**
* @param Template\Context $context
* @param BackendConfig $backendConfig
* @param array $data
* @param BackendConfig $backendConfig
* @param array $data
*/
public function __construct(
Template\Context $context,
Expand All @@ -56,7 +56,7 @@ public function __construct(
*/
public function isIframeProcessingEnabled(): bool
{
$this->_backendConfig->setMethodCode(Checkout::CODE);
$this->_backendConfig->setMethodCode(MethodCheckout::CODE);

return $this->_backendConfig->isIframeProcessingEnabled();
}
Expand Down
40 changes: 27 additions & 13 deletions Controller/AbstractAction.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,46 @@

namespace EMerchantPay\Genesis\Controller;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Message\ManagerInterface;
use Magento\Framework\ObjectManagerInterface;
use Psr\Log\LoggerInterface;

/**
* Base Controller Class
*
* Class AbstractAction
* @package EMerchantPay\Genesis\Controller
*/
abstract class AbstractAction extends \Magento\Framework\App\Action\Action
abstract class AbstractAction extends Action
{
/**
* @var \Magento\Framework\App\Action\Context
* @var Context
*/
protected $_context;

/**
* @var \Psr\Log\LoggerInterface
* @var LoggerInterface
*/
protected $_logger;

/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Psr\Log\LoggerInterface $logger
* @param Context $context
* @param LoggerInterface $logger
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Psr\Log\LoggerInterface $logger
Context $context,
LoggerInterface $logger
) {
parent::__construct($context);
$this->_context = $context;
$this->_logger = $logger;
$this->_logger = $logger;
}

/**
* Get Instance of Magento Controller Action
* @return \Magento\Framework\App\Action\Context
*
* @return Context
*/
protected function getContext()
{
Expand All @@ -60,7 +67,8 @@ protected function getContext()

/**
* Get Instance of Magento Object Manager
* @return \Magento\Framework\ObjectManagerInterface
*
* @return ObjectManagerInterface
*/
protected function getObjectManager()
{
Expand All @@ -69,7 +77,8 @@ protected function getObjectManager()

/**
* Get Instance of Magento global Message Manager
* @return \Magento\Framework\Message\ManagerInterface
*
* @return ManagerInterface
*/
protected function getMessageManager()
{
Expand All @@ -78,7 +87,8 @@ protected function getMessageManager()

/**
* Get Instance of Magento global Logger
* @return \Psr\Log\LoggerInterface
*
* @return LoggerInterface
*/
protected function getLogger()
{
Expand All @@ -87,7 +97,9 @@ protected function getLogger()

/**
* Check if param exists in the post request
*
* @param string $key
*
* @return bool
*/
protected function isPostRequestExists($key)
Expand All @@ -99,7 +111,9 @@ protected function isPostRequestExists($key)

/**
* Get an array of the Submitted Post Request
*
* @param string|null $key
*
* @return null|array
*/
protected function getPostRequest($key = null)
Expand Down
29 changes: 16 additions & 13 deletions Controller/AbstractCheckoutAction.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,28 @@
use Magento\Checkout\Model\Session;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Controller\Result\Raw;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\Result\Raw;
use Magento\Framework\UrlInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\OrderFactory;
use Psr\Log\LoggerInterface;
use Magento\Framework\UrlInterface;

/**
* Base Checkout Controller Class
*
* Class AbstractCheckoutAction
* @package EMerchantPay\Genesis\Controller
*/
abstract class AbstractCheckoutAction extends \EMerchantPay\Genesis\Controller\AbstractAction
abstract class AbstractCheckoutAction extends AbstractAction
{
const ROUTE_PATTERN_CHECKOUT_ONEPAGE_SUCCESS_PATH = 'checkout/onepage/success';
const ROUTE_PATTERN_CHECKOUT_ONEPAGE_SUCCESS_ARGS = [];
public const ROUTE_PATTERN_CHECKOUT_ONEPAGE_SUCCESS_PATH = 'checkout/onepage/success';
public const ROUTE_PATTERN_CHECKOUT_ONEPAGE_SUCCESS_ARGS = [];

const ROUTE_PATTERN_CHECKOUT_CART_PATH = 'checkout/cart';
const ROUTE_PATTERN_CHECKOUT_CART_ARGS = [];
public const ROUTE_PATTERN_CHECKOUT_CART_PATH = 'checkout/cart';
public const ROUTE_PATTERN_CHECKOUT_CART_ARGS = [];

const ROUTE_PATTERN_CHECKOUT_FRAGMENT_PAYMENT_PATH = 'checkout';
const ROUTE_PATTERN_CHECKOUT_FRAGMENT_PAYMENT_ARGS = ['_fragment' => 'payment'];
public const ROUTE_PATTERN_CHECKOUT_FRAGMENT_PAYMENT_PATH = 'checkout';
public const ROUTE_PATTERN_CHECKOUT_FRAGMENT_PAYMENT_ARGS = ['_fragment' => 'payment'];

/**
* @var Session
Expand Down Expand Up @@ -112,7 +113,8 @@ protected function getOrderFactory()

/**
* Get an Instance of the current Checkout Order Object
* @return \Magento\Sales\Model\Order
*
* @return Order
*/
protected function getOrder()
{
Expand All @@ -135,6 +137,7 @@ protected function getOrder()

/**
* Does a redirect to the Checkout Payment Page
*
* @return void
*/
protected function redirectToCheckoutFragmentPayment()
Expand Down Expand Up @@ -185,7 +188,7 @@ protected function redirectToCheckoutCart(bool $iframeRedirect)
* Return html code with embedded js in <script> tag to break the iframe jail
*
* @param string $redirectPath
* @param array $params
* @param array $params
*
* @return Raw
*/
Expand Down Expand Up @@ -214,7 +217,7 @@ private function breakIframeAndRedirect(string $redirectPath, array $params)
/**
* Return response based on if iframe payment processing is used or not
*
* @param bool $iframeRedirect
* @param bool $iframeRedirect
* @param array $returnUrl
*
* @return ResponseInterface|Raw
Expand Down
Loading

0 comments on commit bd93811

Please sign in to comment.