Passed
Push — feature/eco-3047/eco-3049-invo... ( 13c8f0...216985 )
by Aleksey
04:06
created

getPaymentHeidelpayNotificationQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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\Heidelpay\Persistence;
9
10
use Generated\Shared\Transfer\HeidelpayNotificationTransfer;
1 ignored issue
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...
11
use Generated\Shared\Transfer\HeidelpayPaymentTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\HeidelpayPaymentTransfer 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 Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayNotificationQuery;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Heidelpay\Persis...delpayNotificationQuery 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 Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayQuery;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Heidelpay\Persis...pyPaymentHeidelpayQuery 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 Spryker\Zed\Kernel\Persistence\AbstractRepository;
15
use SprykerEco\Zed\Heidelpay\Persistence\Propel\Mapper\HeidelpayPersistenceMapper;
16
17
/**
18
 * @method \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayPersistenceFactory getFactory()
19
 */
20
class HeidelpayRepository extends AbstractRepository implements HeidelpayRepositoryInterface
21
{
22
    /**
23
     * @param int $idSalesOrder
24
     *
25
     * @return \Generated\Shared\Transfer\HeidelpayPaymentTransfer|null
26
     */
27
    public function findHeidelpayPaymentByIdSalesOrder(int $idSalesOrder): ?HeidelpayPaymentTransfer
28
    {
29
        $paymentHeidelpayEntity = $this->getPaymentHeidelpayQuery()
30
            ->filterByFkSalesOrder($idSalesOrder)
31
            ->findOne();
32
33
        if ($paymentHeidelpayEntity === null) {
34
            return null;
35
        }
36
37
        return $this->getMapper()
38
            ->mapEntityToHeidelpayPaymentTransfer(
39
                $paymentHeidelpayEntity,
40
                new HeidelpayPaymentTransfer()
41
            );
42
    }
43
44
    /**
45
     * @param string $uniqueId
46
     *
47
     * @return \Generated\Shared\Transfer\HeidelpayNotificationTransfer|null
48
     */
49
    public function findPaymentHeidelpayNotificationByUniqueId(string $uniqueId): ?HeidelpayNotificationTransfer
50
    {
51
        $paymentHeidelpayNotification = $this->getPaymentHeidelpayNotificationQuery()
52
            ->filterByUniqueId($uniqueId)
53
            ->findOne();
54
55
        if ($paymentHeidelpayNotification === null) {
56
            return null;
57
        }
58
59
        return $this->getMapper()
60
            ->mapEntityToHeidelpayNotificationTransfer(
61
                $paymentHeidelpayNotification,
62
                new HeidelpayNotificationTransfer()
63
            );
64
    }
65
66
    /**
67
     * @return \SprykerEco\Zed\Heidelpay\Persistence\Propel\Mapper\HeidelpayPersistenceMapper
68
     */
69
    protected function getMapper(): HeidelpayPersistenceMapper
70
    {
71
        return $this->getFactory()->createHeidelpayPersistenceMapper();
72
    }
73
74
    /**
75
     * @return \Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayQuery
76
     */
77
    protected function getPaymentHeidelpayQuery(): SpyPaymentHeidelpayQuery
78
    {
79
        return $this->getFactory()->createPaymentHeidelpayQuery();
80
    }
81
82
    /**
83
     * @return \Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayNotificationQuery
84
     */
85
    protected function getPaymentHeidelpayNotificationQuery(): SpyPaymentHeidelpayNotificationQuery
86
    {
87
        return $this->getFactory()->createPaymentHeidelpayNotificationQuery();
88
    }
89
}
90