Skip to content

Commit 92dec65

Browse files
authored
Merge pull request #7 from paghiper/php8
adiciona compatibilidade com versões mais novas do Magento
2 parents dff2266 + 0929b12 commit 92dec65

File tree

22 files changed

+635
-308
lines changed

22 files changed

+635
-308
lines changed

Block/Adminhtml/Order/View/Custom.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
class Custom extends \Magento\Backend\Block\Template
66
{
7+
/**
8+
* @param \Magento\Backend\Block\Template\Context $context
9+
* @param \Magento\Sales\Model\Order $order
10+
* @param array $data
11+
*/
712
public function __construct(
813
\Magento\Backend\Block\Template\Context $context,
914
\Magento\Sales\Model\Order $order,
@@ -13,6 +18,11 @@ public function __construct(
1318
parent::__construct($context, $data);
1419
}
1520

21+
/**
22+
* Get payment method
23+
*
24+
* @return string
25+
*/
1626
public function getPaymentMethod()
1727
{
1828
$order_id = $this->getRequest()->getParam('order_id');
@@ -21,6 +31,11 @@ public function getPaymentMethod()
2131
return $payment->getMethod();
2232
}
2333

34+
/**
35+
* Get payment info
36+
*
37+
* @return array|false
38+
*/
2439
public function getPaymentInfo()
2540
{
2641
$order_id = $this->getRequest()->getParam('order_id');

Block/Adminhtml/Sales/Order/Invoice/Totals.php

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,57 @@
88

99
class Totals extends Template
1010
{
11-
/**
12-
* Order invoice
13-
* @var Invoice
14-
*/
11+
/**
12+
* Order invoice
13+
* @var Invoice
14+
*/
1515
protected $_invoice;
1616

17-
/**
18-
* @var DataObject
19-
*/
17+
/**
18+
* @var DataObject
19+
*/
2020
protected $_source;
2121

22-
/**
23-
* Get data (totals) source model
24-
*
25-
* @return DataObject
26-
*/
22+
/**
23+
* Get data (totals) source model
24+
*
25+
* @return DataObject
26+
*/
2727
public function getSource(): DataObject
2828
{
2929
return $this->getParentBlock()->getSource();
3030
}
3131

32+
/**
33+
* Get invoice
34+
*
35+
* @return mixed
36+
*/
3237
public function getInvoice()
3338
{
3439
return $this->getParentBlock()->getInvoice();
3540
}
36-
37-
/**
38-
* Initialize payment fee totals
39-
*
40-
* @return $this
41-
*/
41+
42+
/**
43+
* Initialize payment fee totals
44+
*
45+
* @return $this
46+
*/
4247
public function initTotals(): Totals
4348
{
4449
$this->getParentBlock();
4550
$this->getInvoice();
4651
$this->getSource();
47-
52+
4853
if (!$this->getSource()->getDataByKey('paghiper_fee_amount')) {
4954
return $this;
5055
}
5156

5257
$total = new DataObject(
5358
[
54-
'code' => 'paghiper_fee',
55-
'value' => $this->getSource()->getDataByKey('paghiper_fee_amount'),
56-
'label' => __('Juros/Multa Paghiper')
59+
'code' => 'paghiper_fee',
60+
'value' => $this->getSource()->getDataByKey('paghiper_fee_amount'),
61+
'label' => __('Interest/Paghiper Fine')
5762
]
5863
);
5964

Block/Checkout/Success.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,27 @@
44

55
class Success extends \Magento\Sales\Block\Order\Totals
66
{
7+
/**
8+
* @var \Magento\Checkout\Model\Session
9+
*/
710
protected $checkoutSession;
11+
/**
12+
* @var \Magento\Customer\Model\Session
13+
*/
814
protected $customerSession;
15+
/**
16+
* @var \Magento\Sales\Model\OrderFactory
17+
*/
918
protected $_orderFactory;
1019

20+
/**
21+
* @param \Magento\Checkout\Model\Session $checkoutSession
22+
* @param \Magento\Customer\Model\Session $customerSession
23+
* @param \Magento\Sales\Model\OrderFactory $orderFactory
24+
* @param \Magento\Framework\View\Element\Template\Context $context
25+
* @param \Magento\Framework\Registry $registry
26+
* @param array $data
27+
*/
1128
public function __construct(
1229
\Magento\Checkout\Model\Session $checkoutSession,
1330
\Magento\Customer\Model\Session $customerSession,
@@ -22,18 +39,33 @@ public function __construct(
2239
$this->_orderFactory = $orderFactory;
2340
}
2441

42+
/**
43+
* Get pix code
44+
*
45+
* @return mixed
46+
*/
2547
public function getPixcode()
2648
{
2749
return $this->checkoutSession->getPixcode();
2850
}
2951

52+
/**
53+
* Get order
54+
*
55+
* @return \Magento\Sales\Model\Order|null
56+
*/
3057
public function getOrder()
3158
{
3259
return $this->_order = $this->_orderFactory->create()->loadByIncrementId(
3360
$this->checkoutSession->getLastRealOrderId()
3461
);
3562
}
3663

64+
/**
65+
* Get customer id
66+
*
67+
* @return mixed
68+
*/
3769
public function getCustomerId()
3870
{
3971
return $this->customerSession->getCustomer()->getId();

Block/Order/Payment/Info.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@
44

55
class Info extends \Magento\Framework\View\Element\Template
66
{
7+
/**
8+
* @var \Magento\Checkout\Model\Session
9+
*/
710
protected $_checkoutSession;
11+
/**
12+
* @var \Magento\Sales\Model\Order
13+
*/
814
protected $_orderFactory;
915

16+
/**
17+
* @param \Magento\Framework\View\Element\Template\Context $context
18+
* @param \Magento\Checkout\Model\Session $checkoutSession
19+
* @param \Magento\Sales\Model\Order $orderFactory
20+
* @param array $data
21+
*/
1022
public function __construct(
1123
\Magento\Framework\View\Element\Template\Context $context,
1224
\Magento\Checkout\Model\Session $checkoutSession,
@@ -18,6 +30,11 @@ public function __construct(
1830
$this->_orderFactory = $orderFactory;
1931
}
2032

33+
/**
34+
* Get payment method
35+
*
36+
* @return string
37+
*/
2138
public function getPaymentMethod()
2239
{
2340
$order_id = $this->getRequest()->getParam('order_id');
@@ -26,6 +43,11 @@ public function getPaymentMethod()
2643
return $payment->getMethod();
2744
}
2845

46+
/**
47+
* Get payment info
48+
*
49+
* @return array|false
50+
*/
2951
public function getPaymentInfo()
3052
{
3153
$order_id = $this->getRequest()->getParam('order_id');

0 commit comments

Comments
 (0)