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
|
|
|
use Moip\Magento2\Gateway\Config\Config; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class DataAssignObserverCc - Capture credit card payment information. |
18
|
|
|
*/ |
19
|
|
|
class DataAssignObserverCcVault extends AbstractDataAssignObserver |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @const Method Name Block |
23
|
|
|
*/ |
24
|
|
|
const METHOD_NAME = 'method_name'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @const Method Name |
28
|
|
|
*/ |
29
|
|
|
const METHOD_NAME_TYPE = 'Cartão de Crédito - Cofre'; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @const Credit Card - CVV |
33
|
|
|
*/ |
34
|
|
|
const PAYER_CC_CVV = 'cc_cvv'; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @const Installment |
38
|
|
|
*/ |
39
|
|
|
const PAYER_CC_INSTALLMENTS = 'cc_installments'; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var array |
43
|
|
|
*/ |
44
|
|
|
protected $addInformationList = [ |
45
|
|
|
self::PAYER_CC_CVV, |
46
|
|
|
self::PAYER_CC_INSTALLMENTS, |
47
|
|
|
]; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var |
51
|
|
|
*/ |
52
|
|
|
protected $config; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param Config $config |
56
|
|
|
*/ |
57
|
|
|
public function __construct( |
58
|
|
|
Config $config |
59
|
|
|
) { |
60
|
|
|
$this->config = $config; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param Observer $observer |
65
|
|
|
*/ |
66
|
|
|
public function execute(Observer $observer) |
67
|
|
|
{ |
68
|
|
|
$data = $this->readDataArgument($observer); |
69
|
|
|
|
70
|
|
|
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); |
71
|
|
|
|
72
|
|
|
if (!is_array($additionalData)) { |
73
|
|
|
return; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
$paymentInfo = $this->readPaymentModelArgument($observer); |
77
|
|
|
|
78
|
|
|
$paymentInfo->setAdditionalInformation( |
79
|
|
|
self::METHOD_NAME, |
80
|
|
|
self::METHOD_NAME_TYPE |
81
|
|
|
); |
82
|
|
|
|
83
|
|
|
foreach ($this->addInformationList as $addInformationKey) { |
84
|
|
|
if (isset($additionalData[$addInformationKey])) { |
85
|
|
|
if ($additionalData[$addInformationKey]) { |
86
|
|
|
$paymentInfo->setAdditionalInformation( |
87
|
|
|
$addInformationKey, |
88
|
|
|
$additionalData[$addInformationKey] |
89
|
|
|
); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
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