1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pagantis\Pagantis\Model\Ui; |
4
|
|
|
|
5
|
|
|
use Magento\Checkout\Model\ConfigProviderInterface; |
6
|
|
|
use Magento\Checkout\Model\Session; |
7
|
|
|
use Pagantis\Pagantis\Helper\ExtraConfig; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class ConfigProvider |
11
|
|
|
* @package Pagantis\Pagantis\Model\Ui |
12
|
|
|
*/ |
13
|
|
|
final class ConfigProvider implements ConfigProviderInterface |
14
|
|
|
{ |
15
|
|
|
const CODE = 'pagantis'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var \Magento\Payment\Model\MethodInterface |
19
|
|
|
*/ |
20
|
|
|
protected $method; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var Session |
24
|
|
|
*/ |
25
|
|
|
protected $checkoutSession; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var String |
29
|
|
|
*/ |
30
|
|
|
protected $extraConfig; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var String |
34
|
|
|
*/ |
35
|
|
|
protected $assetRepository; |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
public function __construct( |
39
|
|
|
\Magento\Payment\Helper\Data $paymentHelper, |
40
|
|
|
Session $checkoutSession, |
41
|
|
|
ExtraConfig $extraConfig, |
42
|
|
|
\Magento\Framework\View\Asset\Repository $assetRepository |
43
|
|
|
) { |
44
|
|
|
$this->method = $paymentHelper->getMethodInstance(self::CODE); |
45
|
|
|
$this->checkoutSession = $checkoutSession; |
46
|
|
|
$this->extraConfig = $extraConfig->getExtraConfig(); |
|
|
|
|
47
|
|
|
$this->assetRepository = $assetRepository; |
|
|
|
|
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Retrieve assoc array of checkout configuration |
52
|
|
|
* |
53
|
|
|
* @return array |
54
|
|
|
*/ |
55
|
|
|
public function getConfig() |
56
|
|
|
{ |
57
|
|
|
$quote = $this->checkoutSession->getQuote(); |
58
|
|
|
|
59
|
|
|
return [ |
60
|
|
|
'payment' => [ |
61
|
|
|
self::CODE => [ |
62
|
|
|
'total' => $quote->getGrandTotal(), |
63
|
|
|
'displayMode' => $this->method->getConfigData('display_mode'), |
64
|
|
|
'title' => __($this->extraConfig['PAGANTIS_TITLE']), |
65
|
|
|
'subtitle' => __($this->extraConfig['PAGANTIS_TITLE_EXTRA']), |
66
|
|
|
'image' => $this->assetRepository->getUrl('Pagantis_Pagantis::logopagantis.png') |
67
|
|
|
], |
68
|
|
|
], |
69
|
|
|
]; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..