Passed
Push — feature/eco-3656/eco-3658-enab... ( c68c7e...4d2e5e )
by
unknown
20:30
created

ComputopRepository::getComputopPaymentDetail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 13
rs 9.9666
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Computop\Persistence;
9
10
use Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...tComputopDetailTransfer 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\ComputopPaymentComputopOrderItemCollectionTransfer;
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...
12
use Generated\Shared\Transfer\ComputopPaymentComputopTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PaymentComputopTransfer 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\ComputopSalesOrderItemCollectionTransfer;
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...
14
use Spryker\Zed\Kernel\Persistence\AbstractRepository;
15
16
/**
17
 * @method \SprykerEco\Zed\Computop\Persistence\ComputopPersistenceFactory getFactory();
18
 */
19
class ComputopRepository extends AbstractRepository implements ComputopRepositoryInterface
20
{
21
    /**
22
     * @inheritDoc
23
     */
24
    public function getComputopPaymentByComputopTransId(string $transactionId): ComputopPaymentComputopTransfer
25
    {
26
        $paymentComputopQuery = $this->getFactory()->createPaymentComputopQuery();
27
        $computopPaymentEntity = $paymentComputopQuery->filterByTransId($transactionId)->findOne();
28
        $computopPaymentTransfer = new ComputopPaymentComputopTransfer();
29
30
        if ($computopPaymentEntity === null) {
31
            return $computopPaymentTransfer;
32
        }
33
34
        return $this->getFactory()
35
            ->createComputopEntityMapper()
36
            ->mapComputopPaymentEntityToComputopPaymentTransfer($computopPaymentEntity, $computopPaymentTransfer);
37
    }
38
39
    /**
40
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
41
     *
42
     * @return \Generated\Shared\Transfer\ComputopSalesOrderItemCollectionTransfer
43
     */
44
    public function getComputopSalesOrderItemsCollection(
45
        ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
46
    ): ComputopSalesOrderItemCollectionTransfer {
47
        $salesOrderItemsCollection = $this
48
            ->getFactory()->createSpySalesOrderItemQuery()
49
            ->filterByIdSalesOrderItem($computopPaymentComputopTransfer->getFKSalesOrder())
50
            ->find();
51
52
        $computopSalesOrderItemCollectionTransfer = $this->getFactory()
53
            ->createComputopEntityMapper()
54
            ->mapSalesOrderItemsCollectionToComputopSalesOrderItemCollectionTransfer(
55
                $salesOrderItemsCollection,
56
                new ComputopSalesOrderItemCollectionTransfer()
57
            );
58
59
        return $computopSalesOrderItemCollectionTransfer;
60
    }
61
62
    /**
63
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
64
     *
65
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemCollectionTransfer
66
     */
67
    public function getComputopPaymentComputopOrderItemsCollection(
68
        ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
69
    ): ComputopPaymentComputopOrderItemCollectionTransfer {
70
        $computopPaymentComputopOrderItemsEntityCollection = $this->getFactory()
71
            ->createPaymentComputopOrderItemQuery()
72
            ->filterByFkPaymentComputop($computopPaymentComputopTransfer->getIdPaymentComputop())
73
            ->find();
74
75
        $computopPaymentComputopOrderItemsCollectionTransfer = $this->getFactory()
76
            ->createComputopEntityMapper()
77
            ->mapPaymentComputopOrderItemEntityCollectionToComputopPaymentComputopOrderItemTransferCollection(
78
                $computopPaymentComputopOrderItemsEntityCollection,
79
                new ComputopPaymentComputopOrderItemCollectionTransfer()
80
            );
81
82
        return $computopPaymentComputopOrderItemsCollectionTransfer;
83
    }
84
85
    /**
86
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
87
     *
88
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer
89
     */
90
    public function getComputopPaymentDetail(
91
        ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
92
    ): ComputopPaymentComputopDetailTransfer {
93
        $paymentComputopDetailEntity = $this->getFactory()
94
            ->createPaymentComputopDetailQuery()
95
            ->filterByIdPaymentComputop($computopPaymentComputopTransfer->getIdPaymentComputop())
96
            ->findOne();
97
98
        return $this->getFactory()
99
            ->createComputopEntityMapper()
100
            ->mapPaymentComputopDetailEntityToComputopPaymentComputopDetailTransfer(
101
                $paymentComputopDetailEntity,
102
                new ComputopPaymentComputopDetailTransfer()
103
            );
104
    }
105
}
106