Passed
Pull Request — master (#4)
by Aleksey
15:10 queued 11:37
created

findPaymentCrefoPayOrderItemsByCrefoPayToSalesOrderItemsCollection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 11
rs 10
c 0
b 0
f 0
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\Business\Reader;
9
10
use Generated\Shared\Transfer\CrefoPayToSalesOrderItemsCollectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ItemsCollectionTransfer 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 Generated\Shared\Transfer\CrefoPayToSalesOrderItemTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...oSalesOrderItemTransfer 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...
12
use Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rItemCollectionTransfer 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...
13
use Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...oCrefoPayApiLogTransfer 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...
14
use Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PayNotificationTransfer 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...
15
use Generated\Shared\Transfer\PaymentCrefoPayTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentCrefoPayTransfer 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...
16
use SprykerEco\Zed\CrefoPay\Persistence\CrefoPayRepositoryInterface;
17
18
class CrefoPayReader implements CrefoPayReaderInterface
19
{
20
    protected const SUCCESS_RESULT_CODES = [0, 1];
21
22
    /**
23
     * @var \SprykerEco\Zed\CrefoPay\Persistence\CrefoPayRepositoryInterface
24
     */
25
    protected $repository;
26
27
    /**
28
     * @param \SprykerEco\Zed\CrefoPay\Persistence\CrefoPayRepositoryInterface $repository
29
     */
30
    public function __construct(CrefoPayRepositoryInterface $repository)
31
    {
32
        $this->repository = $repository;
33
    }
34
35
    /**
36
     * @param int $fkSalesOrder
37
     *
38
     * @return \Generated\Shared\Transfer\PaymentCrefoPayTransfer
39
     */
40
    public function findPaymentCrefoPayByIdSalesOrder(int $fkSalesOrder): PaymentCrefoPayTransfer
41
    {
42
        return $this->repository->findPaymentCrefoPayByFkSalesOrder($fkSalesOrder);
43
    }
44
45
    /**
46
     * @param string $crefoPayOrderId
47
     *
48
     * @return \Generated\Shared\Transfer\PaymentCrefoPayTransfer
49
     */
50
    public function findPaymentCrefoPayByCrefoPayOrderId(string $crefoPayOrderId): PaymentCrefoPayTransfer
51
    {
52
        return $this->repository->findPaymentCrefoPayByCrefoPayOrderId($crefoPayOrderId);
53
    }
54
55
    /**
56
     * @param int $idSalesOrderItem
57
     *
58
     * @return \Generated\Shared\Transfer\PaymentCrefoPayTransfer
59
     */
60
    public function findPaymentCrefoPayByIdSalesOrderItem(int $idSalesOrderItem): PaymentCrefoPayTransfer
61
    {
62
        return $this->repository->findPaymentCrefoPayByIdSalesOrderItem($idSalesOrderItem);
63
    }
64
65
    /**
66
     * @param string $crefoPayOrderId
67
     *
68
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer
69
     */
70
    public function findPaymentCrefoPayOrderItemsByCrefoPayOrderIdAndCaptureId(string $crefoPayOrderId): PaymentCrefoPayOrderItemCollectionTransfer
71
    {
72
        return $this->repository->findPaymentCrefoPayOrderItemsByCrefoPayOrderIdAndCaptureId($crefoPayOrderId);
73
    }
74
75
    /**
76
     * @param \Generated\Shared\Transfer\CrefoPayToSalesOrderItemsCollectionTransfer $crefoPayToSalesOrderItemsCollection
77
     *
78
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer
79
     */
80
    public function findPaymentCrefoPayOrderItemsByCrefoPayToSalesOrderItemsCollection(
81
        CrefoPayToSalesOrderItemsCollectionTransfer $crefoPayToSalesOrderItemsCollection
82
    ): PaymentCrefoPayOrderItemCollectionTransfer {
83
        $salesOrderItemIds = array_map(
84
            function (CrefoPayToSalesOrderItemTransfer $crefoPayToSalesOrderItemTransfer) {
85
                return $crefoPayToSalesOrderItemTransfer->getIdSalesOrderItem();
86
            },
87
            $crefoPayToSalesOrderItemsCollection->getCrefoPayToSalesOrderItems()->getArrayCopy()
88
        );
89
90
        return $this->repository->findPaymentCrefoPayOrderItemsBySalesOrderItemIds($salesOrderItemIds);
91
    }
92
93
    /**
94
     * @param int[] $salesOrderItemIds
95
     *
96
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer
97
     */
98
    public function findPaymentCrefoPayOrderItemsBySalesOrderItemIds(array $salesOrderItemIds): PaymentCrefoPayOrderItemCollectionTransfer
99
    {
100
        return $this->repository->findPaymentCrefoPayOrderItemsBySalesOrderItemIds($salesOrderItemIds);
101
    }
102
103
    /**
104
     * @param int $idSalesOrderItem
105
     * @param string $apiLogRequestType
106
     *
107
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer
108
     */
109
    public function findPaymentCrefoPayOrderItemToCrefoPayApiLogByIdSalesOrderItemAndRequestTypeAndSuccessResult(
110
        int $idSalesOrderItem,
111
        string $apiLogRequestType
112
    ): PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer {
113
        return $this->repository
114
            ->findPaymentCrefoPayOrderItemToCrefoPayApiLogByIdSalesOrderItemAndRequestTypeAndResultCodes(
115
                $idSalesOrderItem,
116
                $apiLogRequestType,
117
                static::SUCCESS_RESULT_CODES
118
            );
119
    }
120
121
    /**
122
     * @param int $idSalesOrderItem
123
     * @param string $notificationTransactionStatus
124
     *
125
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer
126
     */
127
    public function findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndTransactionStatus(
128
        int $idSalesOrderItem,
129
        string $notificationTransactionStatus
130
    ): PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer {
131
        return $this->repository
132
            ->findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndTransactionStatus(
133
                $idSalesOrderItem,
134
                $notificationTransactionStatus
135
            );
136
    }
137
138
    /**
139
     * @param int $idSalesOrderItem
140
     * @param string $notificationOredrStatus
141
     *
142
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer
143
     */
144
    public function findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndOrderStatus(
145
        int $idSalesOrderItem,
146
        string $notificationOredrStatus
147
    ): PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer {
148
        return $this->repository
149
            ->findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndOrderStatus(
150
                $idSalesOrderItem,
151
                $notificationOredrStatus
152
            );
153
    }
154
}
155