Skip to content

Commit a27cdd6

Browse files
Merge pull request #22 from appinlet/release/2.4.2
2021-06-15: v2.4.2
2 parents 07003ad + d8b83b1 commit a27cdd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2605
-1710
lines changed

Paygate/PayWeb/Block/Customer/CardRenderer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ class CardRenderer extends AbstractCardRenderer
1818
* Can render specified token
1919
*
2020
* @param PaymentTokenInterface $token
21+
*
2122
* @return boolean
2223
* @since 100.1.0
2324
*/
24-
public function canRender( PaymentTokenInterface $token )
25+
public function canRender(PaymentTokenInterface $token)
2526
{
2627
return $token->getPaymentMethodCode() === "paygate";
2728
}
@@ -50,7 +51,7 @@ public function getExpDate()
5051
*/
5152
public function getIconUrl()
5253
{
53-
return $this->getIconForType( $this->getTokenDetails()['type'] )['url'];
54+
return $this->getIconForType($this->getTokenDetails()['type'])['url'];
5455
}
5556

5657
/**
@@ -59,7 +60,7 @@ public function getIconUrl()
5960
*/
6061
public function getIconHeight()
6162
{
62-
return $this->getIconForType( $this->getTokenDetails()['type'] )['height'];
63+
return $this->getIconForType($this->getTokenDetails()['type'])['height'];
6364
}
6465

6566
/**
@@ -68,6 +69,6 @@ public function getIconHeight()
6869
*/
6970
public function getIconWidth()
7071
{
71-
return $this->getIconForType( $this->getTokenDetails()['type'] )['width'];
72+
return $this->getIconForType($this->getTokenDetails()['type'])['width'];
7273
}
7374
}

Paygate/PayWeb/Block/Form.php

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
*
77
* Released under the GNU General Public License
88
*/
9+
910
namespace PayGate\PayWeb\Block\PayGate;
1011

1112
use Magento\Customer\Helper\Session\CurrentCustomer;
1213
use Magento\Framework\Locale\ResolverInterface;
1314
use Magento\Framework\View\Element\Template;
1415
use Magento\Framework\View\Element\Template\Context;
16+
use PayGate\PayWeb\Helper\Data;
1517
use PayGate\PayWeb\Model\Config;
18+
use PayGate\PayWeb\Model\ConfigFactory;
1619

1720
class Form extends \Magento\Payment\Block\Form
1821
{
@@ -22,12 +25,12 @@ class Form extends \Magento\Payment\Block\Form
2225
protected $_methodCode = Config::METHOD_CODE;
2326

2427
/**
25-
* @var \PayGate\PayWeb\Helper\Data
28+
* @var Data
2629
*/
2730
protected $_paygateData;
2831

2932
/**
30-
* @var \PayGate\PayWeb\Model\ConfigFactory
33+
* @var ConfigFactory
3134
*/
3235
protected $paygateConfigFactory;
3336

@@ -37,7 +40,7 @@ class Form extends \Magento\Payment\Block\Form
3740
protected $_localeResolver;
3841

3942
/**
40-
* @var \PayGate\PayWeb\Model\Config
43+
* @var Config
4144
*/
4245
protected $_config;
4346

@@ -53,56 +56,56 @@ class Form extends \Magento\Payment\Block\Form
5356

5457
/**
5558
* @param Context $context
56-
* @param \PayGate\PayWeb\Model\ConfigFactory $paygateConfigFactory
59+
* @param ConfigFactory $paygateConfigFactory
5760
* @param ResolverInterface $localeResolver
58-
* @param \PayGate\PayWeb\Helper\Data $paygateData
61+
* @param Data $paygateData
5962
* @param CurrentCustomer $currentCustomer
6063
* @param array $data
6164
*/
6265
public function __construct(
6366
Context $context,
64-
\PayGate\PayWeb\Model\ConfigFactory $paygateConfigFactory,
67+
ConfigFactory $paygateConfigFactory,
6568
ResolverInterface $localeResolver,
66-
\PayGate\PayWeb\Helper\Data $paygateData,
69+
Data $paygateData,
6770
CurrentCustomer $currentCustomer,
6871
array $data = []
6972
) {
7073
$pre = __METHOD__ . " : ";
71-
$this->_logger->debug( $pre . 'bof' );
74+
$this->_logger->debug($pre . 'bof');
7275
$this->_paygateData = $paygateData;
7376
$this->paygateConfigFactory = $paygateConfigFactory;
7477
$this->_localeResolver = $localeResolver;
7578
$this->_config = null;
7679
$this->_isScopePrivate = true;
7780
$this->currentCustomer = $currentCustomer;
78-
parent::__construct( $context, $data );
79-
$this->_logger->debug( $pre . "eof" );
81+
parent::__construct($context, $data);
82+
$this->_logger->debug($pre . "eof");
8083
}
8184

8285
/**
83-
* Set template and redirect message
86+
* Payment method code getter
8487
*
85-
* @return null
88+
* @return string
8689
*/
87-
protected function _construct()
90+
public function getMethodCode()
8891
{
8992
$pre = __METHOD__ . " : ";
90-
$this->_logger->debug( $pre . 'bof' );
91-
$this->_config = $this->paygateConfigFactory->create()->setMethod( $this->getMethodCode() );
92-
parent::_construct();
93+
$this->_logger->debug($pre . 'bof');
94+
95+
return $this->_methodCode;
9396
}
9497

9598
/**
96-
* Payment method code getter
99+
* Set template and redirect message
97100
*
98-
* @return string
101+
* @return null
99102
*/
100-
public function getMethodCode()
103+
protected function _construct()
101104
{
102105
$pre = __METHOD__ . " : ";
103-
$this->_logger->debug( $pre . 'bof' );
104-
105-
return $this->_methodCode;
106+
$this->_logger->debug($pre . 'bof');
107+
$this->_config = $this->paygateConfigFactory->create()->setMethod($this->getMethodCode());
108+
parent::_construct();
106109
}
107110

108111
}

Paygate/PayWeb/Block/Payment/Info.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,39 @@
66
*
77
* Released under the GNU General Public License
88
*/
9+
910
namespace PayGate\PayWeb\Block\Payment;
1011

12+
use Magento\Framework\View\Element\Template\Context;
13+
use Magento\Payment\Model\Config;
14+
use PayGate\PayWeb\Model\InfoFactory;
15+
1116
/**
1217
* PayGate common payment info block
1318
* Uses default templates
1419
*/
1520
class Info extends \Magento\Payment\Block\Info
1621
{
1722
/**
18-
* @var \PayGate\PayWeb\Model\InfoFactory
23+
* @var InfoFactory
1924
*/
2025
protected $_PaygateInfoFactory;
2126

2227
/**
23-
* @param \Magento\Framework\View\Element\Template\Context $context
24-
* @param \Magento\Payment\Model\Config $paymentConfig
25-
* @param \PayGate\PayWeb\Model\InfoFactory $PaygateInfoFactory
28+
* @param Context $context
29+
* @param Config $paymentConfig
30+
* @param InfoFactory $PaygateInfoFactory
2631
* @param array $data
2732
*/
2833
public function __construct(
29-
\Magento\Framework\View\Element\Template\Context $context,
30-
\Magento\Payment\Model\Config $paymentConfig,
31-
\PayGate\PayWeb\Model\InfoFactory $PaygateInfoFactory,
34+
Context $context,
35+
Config $paymentConfig,
36+
InfoFactory $PaygateInfoFactory,
3237
array $data = []
3338
) {
3439
$this->_PaygateInfoFactory = $PaygateInfoFactory;
3540
$this->_paymentConfig = $paymentConfig;
36-
parent::__construct( $context, $data );
41+
parent::__construct($context, $data);
3742
}
3843

3944
}

Paygate/PayWeb/Block/Payment/Request.php

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,63 @@
99

1010
namespace PayGate\PayWeb\Block\Payment;
1111

12-
class Request extends \Magento\Framework\View\Element\Template
12+
use Magento\Checkout\Model\Session;
13+
use Magento\Framework\Filesystem\Directory\ReadFactory;
14+
use Magento\Framework\Module\Dir\Reader;
15+
use Magento\Framework\View\Element\Template;
16+
use Magento\Framework\View\Element\Template\Context;
17+
use Magento\Sales\Model\OrderFactory;
18+
use PayGate\PayWeb\Model\PayGate;
19+
20+
class Request extends Template
1321
{
1422

1523
/**
16-
* @var \PayGate\PayWeb\Model\PayGate $_paymentMethod
24+
* @var PayGate $_paymentMethod
1725
*/
1826
protected $_paymentMethod;
1927

2028
/**
21-
* @var \Magento\Sales\Model\OrderFactory
29+
* @var OrderFactory
2230
*/
2331
protected $_orderFactory;
2432

2533
/**
26-
* @var \Magento\Checkout\Model\Session
34+
* @var Session
2735
*/
2836
protected $_checkoutSession;
2937

3038
/**
31-
* @var \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory
39+
* @var ReadFactory $readFactory
3240
*/
3341
protected $readFactory;
3442

3543
/**
36-
* @var \Magento\Framework\Module\Dir\Reader $reader
44+
* @var Reader $reader
3745
*/
3846
protected $reader;
3947

4048
/**
41-
* @param \Magento\Framework\View\Element\Template\Context $context
42-
* @param \Magento\Sales\Model\OrderFactory $orderFactory
43-
* @param \Magento\Checkout\Model\Session $checkoutSession
44-
* @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory
45-
* @param \Magento\Framework\Module\Dir\Reader $reader
46-
* @param \PayGate\PayWeb\Model\PayGate $paymentMethod
49+
* @param Context $context
50+
* @param OrderFactory $orderFactory
51+
* @param Session $checkoutSession
52+
* @param ReadFactory $readFactory
53+
* @param Reader $reader
54+
* @param PayGate $paymentMethod
4755
* @param array $data
4856
*/
4957
public function __construct(
50-
\Magento\Framework\View\Element\Template\Context $context,
51-
\Magento\Sales\Model\OrderFactory $orderFactory,
52-
\Magento\Checkout\Model\Session $checkoutSession,
53-
\Magento\Framework\Filesystem\Directory\ReadFactory $readFactory,
54-
\Magento\Framework\Module\Dir\Reader $reader,
55-
\PayGate\PayWeb\Model\PayGate $paymentMethod,
58+
Context $context,
59+
OrderFactory $orderFactory,
60+
Session $checkoutSession,
61+
ReadFactory $readFactory,
62+
Reader $reader,
63+
PayGate $paymentMethod,
5664
array $data = []
5765
) {
5866
$this->_orderFactory = $orderFactory;
5967
$this->_checkoutSession = $checkoutSession;
60-
parent::__construct( $context, $data );
68+
parent::__construct($context, $data);
6169
$this->_isScopePrivate = true;
6270
$this->readFactory = $readFactory;
6371
$this->reader = $reader;
@@ -66,13 +74,15 @@ public function __construct(
6674

6775
public function _prepareLayout()
6876
{
69-
$this->setMessage( 'Redirecting to PayGate' )
70-
->setId( 'paygate_checkout' )
71-
->setName( 'paygate_checkout' )
72-
->setFormMethod( 'POST' )
73-
->setFormAction( 'https://secure.paygate.co.za/payweb3/process.trans' )
74-
->setFormData( $this->_paymentMethod->getStandardCheckoutFormFields() )
75-
->setSubmitForm( '<script type="text/javascript">document.getElementById( "paygate_checkout" ).submit();</script>' );
77+
$this->setMessage('Redirecting to PayGate')
78+
->setId('paygate_checkout')
79+
->setName('paygate_checkout')
80+
->setFormMethod('POST')
81+
->setFormAction('https://secure.paygate.co.za/payweb3/process.trans')
82+
->setFormData($this->_paymentMethod->getStandardCheckoutFormFields())
83+
->setSubmitForm(
84+
'<script type="text/javascript">document.getElementById( "paygate_checkout" ).submit();</script>'
85+
);
7686

7787
return parent::_prepareLayout();
7888
}

Paygate/PayWeb/Controller/AbstractPaygate.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
namespace PayGate\PayWeb\Controller;
1111

12-
if ( interface_exists( "Magento\Framework\App\CsrfAwareActionInterface" ) ) {
13-
class_alias( 'PayGate\PayWeb\Controller\AbstractPaygatem230', 'PayGate\PayWeb\Controller\AbstractPaygate' );
12+
if (interface_exists("Magento\Framework\App\CsrfAwareActionInterface")) {
13+
class_alias('PayGate\PayWeb\Controller\AbstractPaygatem230', 'PayGate\PayWeb\Controller\AbstractPaygate');
1414
} else {
15-
class_alias( 'PayGate\PayWeb\Controller\AbstractPaygatem220', 'PayGate\PayWeb\Controller\AbstractPaygate' );
15+
class_alias('PayGate\PayWeb\Controller\AbstractPaygatem220', 'PayGate\PayWeb\Controller\AbstractPaygate');
1616
}

0 commit comments

Comments
 (0)