Passed
Push — bugfix/supesc-213-is-capture-a... ( b2b98a )
by Roman
08:15
created

CaptureTransactionChecker::isSuccessful()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 7
c 1
b 0
f 0
rs 10
cc 1
nc 1
nop 1
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\Business\Checker;
9
10
use Orm\Zed\Sales\Persistence\SpySalesOrderItem;
11
use SprykerEco\Zed\Heidelpay\Persistence\HeidelpayQueryContainerInterface;
12
13
class CaptureTransactionChecker implements CaptureTransactionCheckerInterface
14
{
15
    /**
16
     * @var \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayQueryContainerInterface
17
     */
18
    protected $heidelpayQueryContainer;
19
20
    /**
21
     * @param \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayQueryContainerInterface $heidelpayQueryContainer
22
     */
23
    public function __construct(HeidelpayQueryContainerInterface $heidelpayQueryContainer)
24
    {
25
        $this->heidelpayQueryContainer = $heidelpayQueryContainer;
26
    }
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    public function isSuccessful(SpySalesOrderItem $orderItem): bool
32
    {
33
        $successTransactionLogEntity = $this->heidelpayQueryContainer
34
            ->queryCaptureSuccessTransactionLog($orderItem->getFkSalesOrder())
35
            ->findOne();
36
37
        return ($successTransactionLogEntity !== null);
38
    }
39
}
40