Issues (570)

Block/Success.php (1 issue)

1
<?php
2
/**
3
 * Copyright © Wirecard Brasil. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See COPYING.txt for license details.
7
 */
8
9
namespace Moip\Magento2\Block;
10
11
/**
12
 * Class Success - Success page information.
13
 */
14
class Success extends \Magento\Framework\View\Element\Template
15
{
16
    /**
17
     * @var \Magento\Checkout\Model\Session
18
     */
19
    protected $_checkoutSession;
20
21
    /**
22
     * @var \Magento\Sales\Model\Order\Config
23
     */
24
    protected $_orderConfig;
25
26
    /**
27
     * @var \Magento\Framework\App\Http\Context
28
     */
29
    protected $httpContext;
30
31
    /**
32
     * @param \Magento\Framework\View\Element\Template\Context $context
33
     * @param \Magento\Checkout\Model\Session                  $checkoutSession
34
     * @param \Magento\Sales\Model\Order\Config                $orderConfig
35
     * @param \Magento\Framework\App\Http\Context              $httpContext
36
     * @param array                                            $data
37
     */
38
    public function __construct(
39
        \Magento\Framework\View\Element\Template\Context $context,
40
        \Magento\Checkout\Model\Session $checkoutSession,
41
        \Magento\Sales\Model\Order\Config $orderConfig,
42
        \Magento\Framework\App\Http\Context $httpContext,
43
        array $data = []
44
    ) {
45
        parent::__construct($context, $data);
46
        $this->_checkoutSession = $checkoutSession;
47
        $this->_orderConfig = $orderConfig;
48
        $this->_isScopePrivate = true;
0 ignored issues
show
Bug Best Practice introduced by
The property _isScopePrivate does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
49
        $this->httpContext = $httpContext;
50
    }
51
52
    /**
53
     * getPayment.
54
     *
55
     * @return MethodInstance
56
     */
57
    public function getPayment()
58
    {
59
        $order = $this->_checkoutSession->getLastRealOrder();
60
61
        return $order->getPayment()->getMethodInstance();
62
    }
63
64
    /**
65
     * Method Code.
66
     *
67
     * @return string
68
     */
69
    public function getMethodCode()
70
    {
71
        return $this->getPayment()->getCode();
72
    }
73
74
    /**
75
     * Info payment.
76
     *
77
     * @param  $info
78
     *
79
     * @return string
80
     */
81
    public function getInfo($info)
82
    {
83
        return  $this->getPayment()->getInfoInstance()->getAdditionalInformation($info);
84
    }
85
}
86