RefundPlugin::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 7
rs 10
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\CrefoPay\Communication\Plugin\Oms\Command;
9
10
use Orm\Zed\Sales\Persistence\SpySalesOrder;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Sales\Persistence\SpySalesOrder 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
12
use Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject;
13
use Spryker\Zed\Oms\Dependency\Plugin\Command\CommandByOrderInterface;
14
15
/**
16
 * @method \SprykerEco\Zed\CrefoPay\CrefoPayConfig getConfig()
17
 * @method \SprykerEco\Zed\CrefoPay\Business\CrefoPayFacadeInterface getFacade()
18
 * @method \SprykerEco\Zed\CrefoPay\Communication\CrefoPayCommunicationFactory getFactory()
19
 *
20
 * @SuppressWarnings(PHPMD.NewPluginExtensionModuleRule)
21
 */
22
class RefundPlugin extends AbstractPlugin implements CommandByOrderInterface
23
{
24
    /**
25
     * {@inheritDoc}
26
     * - Makes refund request to CrefoPay API. All order items combined in one payment transaction.
27
     * - Updates order items status.
28
     *
29
     * @api
30
     *
31
     * @param array<\Orm\Zed\Sales\Persistence\SpySalesOrderItem> $orderItems
32
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity
33
     * @param \Spryker\Zed\Oms\Business\Util\ReadOnlyArrayObject $data
34
     *
35
     * @return array
36
     */
37
    public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data): array
38
    {
39
        $this->getFactory()
40
            ->createRefundOmsCommand()
41
            ->execute($orderItems, $orderEntity, $data);
42
43
        return [];
44
    }
45
}
46