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\Observer; |
10
|
|
|
|
11
|
|
|
use Magento\Framework\Event\Observer; |
|
|
|
|
12
|
|
|
use Magento\Payment\Observer\AbstractDataAssignObserver; |
|
|
|
|
13
|
|
|
use Magento\Quote\Api\Data\PaymentInterface; |
|
|
|
|
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class DataAssignBoletoObserver - Captures payment information by boleto. |
17
|
|
|
*/ |
18
|
|
|
class DataAssignBoletoObserver extends AbstractDataAssignObserver |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @const Method Name Block |
22
|
|
|
*/ |
23
|
|
|
const METHOD_NAME = 'method_name'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @const Method Name |
27
|
|
|
*/ |
28
|
|
|
const METHOD_NAME_TYPE = 'Boleto Bancário'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @const Holder Full Nane |
32
|
|
|
*/ |
33
|
|
|
const PAYER_FULLNAME = 'boleto_payer_fullname'; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @const Holder Tax Document |
37
|
|
|
*/ |
38
|
|
|
const PAYER_TAX_DOCUMENT = 'boleto_payer_tax_document'; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var array |
42
|
|
|
*/ |
43
|
|
|
protected $addInformationList = [ |
44
|
|
|
self::PAYER_FULLNAME, |
45
|
|
|
self::PAYER_TAX_DOCUMENT, |
46
|
|
|
]; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param Observer $observer |
50
|
|
|
* |
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
|
|
public function execute(Observer $observer) |
54
|
|
|
{ |
55
|
|
|
$data = $this->readDataArgument($observer); |
56
|
|
|
|
57
|
|
|
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); |
58
|
|
|
|
59
|
|
|
if (!is_array($additionalData)) { |
60
|
|
|
return; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
$paymentInfo = $this->readPaymentModelArgument($observer); |
64
|
|
|
|
65
|
|
|
$paymentInfo->setAdditionalInformation( |
66
|
|
|
self::METHOD_NAME, |
67
|
|
|
self::METHOD_NAME_TYPE |
68
|
|
|
); |
69
|
|
|
|
70
|
|
|
foreach ($this->addInformationList as $addInformationKey) { |
71
|
|
|
if (isset($additionalData[$addInformationKey])) { |
72
|
|
|
if ($additionalData[$addInformationKey]) { |
73
|
|
|
$paymentInfo->setAdditionalInformation( |
74
|
|
|
$addInformationKey, |
75
|
|
|
$additionalData[$addInformationKey] |
76
|
|
|
); |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
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