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\Controller\Adminhtml\Order; |
||||
10 | |||||
11 | use Magento\Backend\App\Action\Context; |
||||
0 ignored issues
–
show
|
|||||
12 | use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; |
||||
0 ignored issues
–
show
The type
Magento\Framework\Model\...tion\AbstractCollection was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
13 | use Magento\Sales\Api\OrderManagementInterface; |
||||
0 ignored issues
–
show
The type
Magento\Sales\Api\OrderManagementInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
14 | use Magento\Sales\Model\Order; |
||||
0 ignored issues
–
show
The type
Magento\Sales\Model\Order was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
15 | use Magento\Sales\Model\ResourceModel\Order\CollectionFactory; |
||||
0 ignored issues
–
show
The type
Magento\Sales\Model\Reso...Order\CollectionFactory was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
16 | use Magento\Ui\Component\MassAction\Filter; |
||||
0 ignored issues
–
show
The type
Magento\Ui\Component\MassAction\Filter was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
17 | |||||
18 | /** |
||||
19 | * Class MassDelete. |
||||
20 | */ |
||||
21 | class MassUpdate extends \Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction |
||||
0 ignored issues
–
show
The type
Magento\Sales\Controller...rder\AbstractMassAction was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
22 | { |
||||
23 | /* |
||||
24 | * @var Order Management |
||||
25 | */ |
||||
26 | protected $orderManagement; |
||||
27 | |||||
28 | /* |
||||
29 | * @param Context |
||||
30 | * @param Filter |
||||
31 | * @param CollectionFactory |
||||
32 | * @param OrderManagementInterface |
||||
33 | */ |
||||
34 | public function __construct( |
||||
35 | Context $context, |
||||
36 | Filter $filter, |
||||
37 | CollectionFactory $collectionFactory, |
||||
38 | OrderManagementInterface $orderManagement, |
||||
39 | Order $order |
||||
40 | ) { |
||||
41 | parent::__construct($context, $filter); |
||||
42 | $this->collectionFactory = $collectionFactory; |
||||
0 ignored issues
–
show
|
|||||
43 | $this->orderManagement = $orderManagement; |
||||
44 | $this->order = $order; |
||||
0 ignored issues
–
show
|
|||||
45 | } |
||||
46 | |||||
47 | /* |
||||
48 | * Mass Action |
||||
49 | * |
||||
50 | * @param collection |
||||
51 | * |
||||
52 | * @return Url |
||||
0 ignored issues
–
show
The type
Moip\Magento2\Controller\Adminhtml\Order\Url was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
53 | */ |
||||
54 | protected function massAction(AbstractCollection $collection) |
||||
55 | { |
||||
56 | $countUpdate = 0; |
||||
57 | $countNotUpdate = 0; |
||||
58 | |||||
59 | foreach ($collection->getItems() as $order) { |
||||
60 | if (!$order->getEntityId()) { |
||||
61 | continue; |
||||
62 | } |
||||
63 | |||||
64 | $loadedOrder = $this->order->load($order->getEntityId()); |
||||
65 | |||||
66 | if ($loadedOrder->canFetchPaymentReviewUpdate()) { |
||||
67 | $payment = $loadedOrder->getPayment(); |
||||
68 | $transactionId = $payment->getLastTransId(); |
||||
69 | $method = $payment->getMethodInstance(); |
||||
70 | |||||
71 | try { |
||||
72 | $method->fetchTransactionInfo($payment, $transactionId); |
||||
73 | $payment->getOrder()->save(); |
||||
74 | $state = $payment->getOrder()->getState(); |
||||
75 | if ($state === 'processing') { |
||||
76 | $countUpdate++; |
||||
77 | } |
||||
78 | $countNotUpdate++; |
||||
79 | } catch (\Exception $exc) { |
||||
80 | $countNotUpdate++; |
||||
81 | } |
||||
82 | } elseif (!$loadedOrder->canFetchPaymentReviewUpdate()) { |
||||
83 | $countNotUpdate++; |
||||
84 | } |
||||
85 | |||||
86 | continue; |
||||
87 | } |
||||
88 | |||||
89 | if ($countUpdate) { |
||||
90 | $this->messageManager->addSuccess(__('%1 payments have been updated.', $countUpdate)); |
||||
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
91 | } |
||||
92 | if ($countNotUpdate) { |
||||
93 | $this->messageManager->addWarning(__('%1 payments have not yet been updated.', $countNotUpdate)); |
||||
94 | } |
||||
95 | |||||
96 | $resultRedirect = $this->resultRedirectFactory->create(); |
||||
97 | $resultRedirect->setPath($this->getComponentRefererUrl()); |
||||
98 | |||||
99 | return $resultRedirect; |
||||
100 | } |
||||
101 | } |
||||
102 |
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