1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\FirstData\Communication\Plugin\Oms\Command; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\FirstDataOmsCommandRequestTransfer; |
|
|
|
|
11
|
|
|
use Orm\Zed\Sales\Persistence\SpySalesOrder; |
|
|
|
|
12
|
|
|
use Spryker\Zed\Kernel\Communication\AbstractPlugin; |
13
|
|
|
use Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject; |
14
|
|
|
use Spryker\Zed\Oms\Dependency\Plugin\Command\CommandByOrderInterface; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @method \SprykerEco\Zed\FirstData\Business\FirstDataFacadeInterface getFacade() |
18
|
|
|
* @method \SprykerEco\Zed\FirstData\FirstDataConfig getConfig() |
19
|
|
|
* @method \SprykerEco\Zed\FirstData\Communication\FirstDataCommunicationFactory getFactory() |
20
|
|
|
*/ |
21
|
|
|
class FirstDataCaptureCommandByOrderPlugin extends AbstractPlugin implements CommandByOrderInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* {@inheritDoc} |
25
|
|
|
* - Makes PostAuthTransaction request to FirstData API and charges applicable items. |
26
|
|
|
* - Returns an error if the operation couldn't be executed successfully. |
27
|
|
|
* - Logs request's details to DB. |
28
|
|
|
* - Updates order items status into DB. |
29
|
|
|
* |
30
|
|
|
* @api |
31
|
|
|
* |
32
|
|
|
* @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $orderItems |
33
|
|
|
* @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity |
34
|
|
|
* @param \Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject $data |
35
|
|
|
* |
36
|
|
|
* @return array |
37
|
|
|
*/ |
38
|
|
|
public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data): array |
39
|
|
|
{ |
40
|
|
|
$salesOrderItemIds = []; |
41
|
|
|
foreach ($orderItems as $salesOrderItemEntity) { |
42
|
|
|
$salesOrderItemIds[] = $salesOrderItemEntity->getIdSalesOrderItem(); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
$orderTransfer = $this->getFactory() |
46
|
|
|
->getSalesFacade() |
47
|
|
|
->getOrderByIdSalesOrder($orderEntity->getIdSalesOrder()); |
48
|
|
|
|
49
|
|
|
$this->getFacade()->executeCaptureOmsCommand( |
50
|
|
|
(new FirstDataOmsCommandRequestTransfer()) |
51
|
|
|
->setOrder($orderTransfer) |
52
|
|
|
->setSalesOrderItemIds($salesOrderItemIds) |
53
|
|
|
); |
54
|
|
|
|
55
|
|
|
return []; |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
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