Passed
Pull Request — master (#44)
by Michael
09:13 queued 03:53
created

updatePaymentComputopOrderItemPaymentConfirmation()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 21
rs 9.8333
cc 3
nc 3
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\ComputopNotificationTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...topNotificationTransfer 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\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...
12
use Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...mputopOrderItemTransfer 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\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...
14
use Orm\Zed\Computop\Persistence\SpyPaymentComputopOrderItem;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Computop\Persist...aymentComputopOrderItem 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 Spryker\Zed\Kernel\Persistence\AbstractEntityManager;
16
17
/**
18
 * @method \SprykerEco\Zed\Computop\Persistence\ComputopPersistenceFactory getFactory()
19
 */
20
class ComputopEntityManager extends AbstractEntityManager implements ComputopEntityManagerInterface
21
{
22
    /**
23
     * @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer
24
     *
25
     * @return void
26
     */
27
    public function savePaymentComputopNotification(ComputopNotificationTransfer $computopNotificationTransfer): void
28
    {
29
        $paymentComputopNotificationEntity = $this->getFactory()
30
            ->getPaymentComputopNotificationQuery()
31
            ->filterByPayId($computopNotificationTransfer->getPayId())
32
            ->filterByTransId($computopNotificationTransfer->getTransId())
33
            ->filterByXId($computopNotificationTransfer->getXId())
34
            ->findOneOrCreate();
35
36
        $paymentComputopNotificationEntity->fromArray(
37
            $computopNotificationTransfer->modifiedToArray(),
38
        );
39
        $paymentComputopNotificationEntity->save();
40
    }
41
42
    /**
43
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer $computopPaymentComputopDetailTransfer
44
     *
45
     * @return void
46
     */
47
    public function updateComputopPaymentDetail(
48
        ComputopPaymentComputopDetailTransfer $computopPaymentComputopDetailTransfer
49
    ): void {
50
        $computopPaymentComputopDetailEntity = $this->getFactory()
51
            ->getPaymentComputopDetailQuery()
52
            ->filterByIdPaymentComputop($computopPaymentComputopDetailTransfer->getIdPaymentComputop())
53
            ->findOne();
54
55
        if ($computopPaymentComputopDetailEntity === null) {
56
            return;
57
        }
58
59
        $computopPaymentComputopDetailEntity = $this->getFactory()
60
            ->createComputopMapper()
61
            ->mapComputopPaymentComputopDetailTransferToPaymentComputopDetailEntity(
62
                $computopPaymentComputopDetailTransfer,
63
                $computopPaymentComputopDetailEntity,
64
            );
65
66
        $computopPaymentComputopDetailEntity->save();
67
    }
68
69
    /**
70
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
71
     *
72
     * @return void
73
     */
74
    public function updateComputopPayment(ComputopPaymentComputopTransfer $computopPaymentComputopTransfer): void
75
    {
76
        $computopPaymentComputopEntity = $this->getFactory()
77
            ->getPaymentComputopQuery()
78
            ->filterByTransId($computopPaymentComputopTransfer->getTransId())
79
            ->findOne();
80
81
        if ($computopPaymentComputopEntity === null) {
82
            return;
83
        }
84
85
        $computopPaymentComputopEntity = $this->getFactory()
86
            ->createComputopMapper()
87
            ->mapComputopPaymentTransferToComputopPaymentEntity(
88
                $computopPaymentComputopTransfer,
89
                $computopPaymentComputopEntity,
90
            );
91
92
        $computopPaymentComputopEntity->save();
93
    }
94
95
    /**
96
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
97
     *
98
     * @return void
99
     */
100
    public function updateComputopPaymentComputopOrderItem(
101
        ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
102
    ): void {
103
        $paymentComputopOrderItemEntity = $this->getFactory()
104
            ->createComputopMapper()
105
            ->mapComputopPaymentComputopOrderItemTransferToPaymentComputopOrderItemEntity(
106
                $computopPaymentComputopOrderItemTransfer,
107
                new SpyPaymentComputopOrderItem(),
108
            );
109
110
        $paymentComputopOrderItemEntity->save();
111
    }
112
}
113