Passed
Push — bugfix/eco-2800-paid-notificat... ( 786e71 )
by Aleksey
08:37
created

findPaymentCrefoPayOrderItemsByCaptureId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
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 findPaymentCrefoPayOrderItemsByCrefoPayOrderId(string $crefoPayOrderId): PaymentCrefoPayOrderItemCollectionTransfer
71
    {
72
        return $this->repository->findPaymentCrefoPayOrderItemsByCrefoPayOrderId($crefoPayOrderId);
73
    }
74
75
    /**
76
     * @param string $captureId
77
     *
78
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer
79
     */
80
    public function findPaymentCrefoPayOrderItemsByCaptureId(string $captureId): PaymentCrefoPayOrderItemCollectionTransfer
81
    {
82
        return $this->repository->findPaymentCrefoPayOrderItemsByCaptureId($captureId);
83
    }
84
85
    /**
86
     * @param \Generated\Shared\Transfer\CrefoPayToSalesOrderItemsCollectionTransfer $crefoPayToSalesOrderItemsCollection
87
     *
88
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer
89
     */
90
    public function findPaymentCrefoPayOrderItemsByCrefoPayToSalesOrderItemsCollection(
91
        CrefoPayToSalesOrderItemsCollectionTransfer $crefoPayToSalesOrderItemsCollection
92
    ): PaymentCrefoPayOrderItemCollectionTransfer {
93
        $salesOrderItemIds = array_map(
94
            function (CrefoPayToSalesOrderItemTransfer $crefoPayToSalesOrderItemTransfer) {
95
                return $crefoPayToSalesOrderItemTransfer->getIdSalesOrderItem();
96
            },
97
            $crefoPayToSalesOrderItemsCollection->getCrefoPayToSalesOrderItems()->getArrayCopy()
98
        );
99
100
        return $this->repository->findPaymentCrefoPayOrderItemsBySalesOrderItemIds($salesOrderItemIds);
101
    }
102
103
    /**
104
     * @param int[] $salesOrderItemIds
105
     *
106
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer
107
     */
108
    public function findPaymentCrefoPayOrderItemsBySalesOrderItemIds(array $salesOrderItemIds): PaymentCrefoPayOrderItemCollectionTransfer
109
    {
110
        return $this->repository->findPaymentCrefoPayOrderItemsBySalesOrderItemIds($salesOrderItemIds);
111
    }
112
113
    /**
114
     * @param int $idSalesOrderItem
115
     * @param string $apiLogRequestType
116
     *
117
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer
118
     */
119
    public function findPaymentCrefoPayOrderItemToCrefoPayApiLogByIdSalesOrderItemAndRequestTypeAndSuccessResult(
120
        int $idSalesOrderItem,
121
        string $apiLogRequestType
122
    ): PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer {
123
        return $this->repository
124
            ->findPaymentCrefoPayOrderItemToCrefoPayApiLogByIdSalesOrderItemAndRequestTypeAndResultCodes(
125
                $idSalesOrderItem,
126
                $apiLogRequestType,
127
                static::SUCCESS_RESULT_CODES
128
            );
129
    }
130
131
    /**
132
     * @param int $idSalesOrderItem
133
     * @param string $notificationTransactionStatus
134
     *
135
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer
136
     */
137
    public function findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndTransactionStatus(
138
        int $idSalesOrderItem,
139
        string $notificationTransactionStatus
140
    ): PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer {
141
        return $this->repository
142
            ->findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndTransactionStatus(
143
                $idSalesOrderItem,
144
                $notificationTransactionStatus
145
            );
146
    }
147
148
    /**
149
     * @param int $idSalesOrderItem
150
     * @param string $notificationOredrStatus
151
     *
152
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer
153
     */
154
    public function findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndOrderStatus(
155
        int $idSalesOrderItem,
156
        string $notificationOredrStatus
157
    ): PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer {
158
        return $this->repository
159
            ->findPaymentCrefoPayOrderItemToCrefoPayNotificationByIdSalesOrderItemAndOrderStatus(
160
                $idSalesOrderItem,
161
                $notificationOredrStatus
162
            );
163
    }
164
}
165