|
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\Adminhtml\Sales; |
|
10
|
|
|
|
|
11
|
|
|
use Moip\Magento2\Model\Ui\ConfigProviderBoleto; |
|
12
|
|
|
|
|
13
|
|
|
class Creditmemo extends \Magento\Backend\Block\Template |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
const BANK_NUMBER = 'moip_magento2_boleto_bank_number'; |
|
16
|
|
|
|
|
17
|
|
|
const AGENCY_NUMBER = 'moip_magento2_boleto_agency_number'; |
|
18
|
|
|
|
|
19
|
|
|
const AGENCY_CHECK_NUMBER = 'moip_magento2_boleto_agency_check_number'; |
|
20
|
|
|
|
|
21
|
|
|
const ACCOUNT_NUMBER = 'moip_magento2_boleto_account_number'; |
|
22
|
|
|
|
|
23
|
|
|
const ACCOUNT_CHECK_NUMBER = 'moip_magento2_boleto_account_check_number'; |
|
24
|
|
|
|
|
25
|
|
|
const HOLDER_FULLNAME = 'moip_magento2_boleto_account_holder_fullname'; |
|
26
|
|
|
|
|
27
|
|
|
const HOLDER_DOCUMENT_NUMBER = 'moip_magento2_boleto_account_holder_document_number'; |
|
28
|
|
|
|
|
29
|
|
|
const CREDITMEMO_COMMENT_TEXT = 'comment_text'; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var \Magento\Framework\Registry |
|
|
|
|
|
|
33
|
|
|
*/ |
|
34
|
|
|
private $coreRegistry; |
|
35
|
|
|
|
|
36
|
|
|
public function __construct( |
|
37
|
|
|
\Magento\Backend\Block\Template\Context $context, |
|
|
|
|
|
|
38
|
|
|
\Magento\Framework\Registry $registry, |
|
39
|
|
|
array $data = [] |
|
40
|
|
|
) { |
|
41
|
|
|
$this->coreRegistry = $registry; |
|
42
|
|
|
parent::__construct($context, $data); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @return \Magento\Sales\Model\Order\Creditmemo |
|
|
|
|
|
|
47
|
|
|
*/ |
|
48
|
|
|
public function getCreditmemo() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->coreRegistry->registry('current_creditmemo'); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @return \Magento\Sales\Model\Order |
|
|
|
|
|
|
55
|
|
|
*/ |
|
56
|
|
|
public function getOrder() |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->getCreditmemo()->getOrder(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Check whether can refund to payment by boleto. |
|
63
|
|
|
* |
|
64
|
|
|
* @return bool |
|
65
|
|
|
*/ |
|
66
|
|
|
public function canRefundBoleto() |
|
67
|
|
|
{ |
|
68
|
|
|
/** @var \Magento\Sales\Model\Order $order */ |
|
69
|
|
|
$order = $this->getCreditmemo()->getOrder(); |
|
70
|
|
|
|
|
71
|
|
|
if ($order->getPayment()->getMethodInstance()->getCode() === ConfigProviderBoleto::CODE) { |
|
72
|
|
|
return true; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
return false; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Json configuration for tooltip. |
|
80
|
|
|
* |
|
81
|
|
|
* @parms $field |
|
82
|
|
|
* |
|
83
|
|
|
* @return string json |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getTooltipConfig($field) |
|
86
|
|
|
{ |
|
87
|
|
|
$tooltipConfig = [ |
|
88
|
|
|
'tooltip' => [ |
|
89
|
|
|
'trigger' => '[data-tooltip-trigger=moip_magento2_tooltip_'.$field.']', |
|
90
|
|
|
'action' => 'click', |
|
91
|
|
|
'delay' => 0, |
|
92
|
|
|
'track' => false, |
|
93
|
|
|
'position' => 'top', |
|
94
|
|
|
], |
|
95
|
|
|
]; |
|
96
|
|
|
|
|
97
|
|
|
return str_replace('"', "'", \Zend_Json::encode($tooltipConfig)); |
|
|
|
|
|
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function getBankNumber() |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->getCreditmemo()->getData(self::BANK_NUMBER); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function getAgencyNumber() |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->getCreditmemo()->getData(self::AGENCY_NUMBER); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function getAgencyCheckNumber() |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->getCreditmemo()->getData(self::AGENCY_CHECK_NUMBER); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
public function getAccountNumber() |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->getCreditmemo()->getData(self::ACCOUNT_NUMBER); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function getAccountCheckNumber() |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->getCreditmemo()->getData(self::ACCOUNT_CHECK_NUMBER); |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths