1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright © Getnet. All rights reserved. |
4
|
|
|
* |
5
|
|
|
* @author Bruno Elisei <[email protected]> |
6
|
|
|
* See LICENSE for license details. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Getnet\PaymentMagento\Block\Order; |
10
|
|
|
|
11
|
|
|
use Magento\Checkout\Model\Session; |
12
|
|
|
use Magento\Framework\App\Http\Context as HttpContext; |
13
|
|
|
use Magento\Framework\View\Element\Template; |
14
|
|
|
use Magento\Framework\View\Element\Template\Context; |
15
|
|
|
use Magento\Sales\Model\Order\Config; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class Success - Success page information. |
19
|
|
|
*/ |
20
|
|
|
class Success extends Template |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var Session |
24
|
|
|
*/ |
25
|
|
|
protected $checkoutSession; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var Config |
29
|
|
|
*/ |
30
|
|
|
protected $orderConfig; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var HttpContext |
34
|
|
|
*/ |
35
|
|
|
protected $httpContext; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param Context $context |
39
|
|
|
* @param Session $checkoutSession |
40
|
|
|
* @param Config $orderConfig |
41
|
|
|
* @param HttpContext $httpContext |
42
|
|
|
* @param array $data |
43
|
|
|
*/ |
44
|
|
|
public function __construct( |
45
|
|
|
Context $context, |
46
|
|
|
Session $checkoutSession, |
47
|
|
|
Config $orderConfig, |
48
|
|
|
HttpContext $httpContext, |
49
|
|
|
array $data = [] |
50
|
|
|
) { |
51
|
|
|
parent::__construct($context, $data); |
52
|
|
|
$this->checkoutSession = $checkoutSession; |
53
|
|
|
$this->orderConfig = $orderConfig; |
54
|
|
|
$this->httpContext = $httpContext; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Get Payment. |
59
|
|
|
* |
60
|
|
|
* @return \Magento\Payment\Model\MethodInterface |
61
|
|
|
*/ |
62
|
|
|
public function getPayment() |
63
|
|
|
{ |
64
|
|
|
$order = $this->checkoutSession->getLastRealOrder(); |
65
|
|
|
|
66
|
|
|
return $order->getPayment()->getMethodInstance(); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Method Code. |
71
|
|
|
* |
72
|
|
|
* @return string |
73
|
|
|
*/ |
74
|
|
|
public function getMethodCode() |
75
|
|
|
{ |
76
|
|
|
return $this->getPayment()->getCode(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Info payment. |
81
|
|
|
* |
82
|
|
|
* @param string $info |
83
|
|
|
* |
84
|
|
|
* @return string |
85
|
|
|
*/ |
86
|
|
|
public function getInfo(string $info) |
87
|
|
|
{ |
88
|
|
|
return $this->getPayment()->getInfoInstance()->getAdditionalInformation($info); |
|
|
|
|
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Get Url to Image Qr Code. |
93
|
|
|
* |
94
|
|
|
* @param string $qrCode |
95
|
|
|
* |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
|
|
public function getImageQrCode($qrCode) |
99
|
|
|
{ |
100
|
|
|
return $this->_urlBuilder->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]).$qrCode; |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.