Passed
Push — feature/eco-2295/eco-2356-main... ( 914252...db8f10 )
by Aleksey
04:55
created

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