Passed
Pull Request — master (#13)
by Dmitri
05:33
created

PayolutionCommunicationFactory::createOmsEntityConverter()   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
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\Payolution\Communication;
9
10
use Orm\Zed\Sales\Persistence\SpySalesOrder;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Sales\Persistence\SpySalesOrder 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 Spryker\Zed\Kernel\Communication\AbstractCommunicationFactory;
12
use SprykerEco\Zed\Payolution\Communication\Plugin\Oms\Converter\OmsEntityConverter;
13
use SprykerEco\Zed\Payolution\Communication\Plugin\Oms\Converter\OmsEntityConverterInterface;
14
use SprykerEco\Zed\Payolution\Communication\Table\Payments;
15
use SprykerEco\Zed\Payolution\Communication\Table\RequestLog;
16
use SprykerEco\Zed\Payolution\Communication\Table\StatusLog;
17
use SprykerEco\Zed\Payolution\PayolutionDependencyProvider;
18
19
/**
20
 * @method \SprykerEco\Zed\Payolution\Persistence\PayolutionQueryContainerInterface getQueryContainer()
21
 * @method \SprykerEco\Zed\Payolution\PayolutionConfig getConfig()
22
 * @method \SprykerEco\Zed\Payolution\Business\PayolutionFacadeInterface getFacade()
23
 */
24
class PayolutionCommunicationFactory extends AbstractCommunicationFactory
25
{
26
    /**
27
     * @return \SprykerEco\Zed\Payolution\Communication\Table\GuiTableInterface
28
     */
29
    public function createPaymentsTable()
30
    {
31
        $paymentPayolutionQuery = $this->getQueryContainer()->queryPayments();
32
33
        return new Payments($paymentPayolutionQuery);
34
    }
35
36
    /**
37
     * @param int $idPayment
38
     *
39
     * @return \SprykerEco\Zed\Payolution\Communication\Table\GuiTableInterface
40
     */
41
    public function createRequestLogTable($idPayment)
42
    {
43
        $requestLogQuery = $this->getQueryContainer()->queryTransactionRequestLogByPaymentId($idPayment);
44
45
        return new RequestLog($requestLogQuery, $idPayment);
46
    }
47
48
    /**
49
     * @param int $idPayment
50
     *
51
     * @return \SprykerEco\Zed\Payolution\Communication\Table\GuiTableInterface
52
     */
53
    public function createStatusLogTable($idPayment)
54
    {
55
        $statusLogQuery = $this->getQueryContainer()->queryTransactionStatusLogByPaymentId($idPayment);
56
57
        return new StatusLog($statusLogQuery, $idPayment);
58
    }
59
60
    /**
61
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $orderItems
62
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity
63
     *
64
     * @return \SprykerEco\Zed\Payolution\Communication\Plugin\Oms\Converter\OmsEntityConverter
65
     */
66
    public function createOmsEntityConverter(array $orderItems, SpySalesOrder $orderEntity): OmsEntityConverterInterface
67
    {
68
        return new OmsEntityConverter($orderItems, $orderEntity, $this->getSalesFacade());
69
    }
70
71
    /**
72
     * @return \SprykerEco\Zed\Payolution\Dependency\Facade\PayolutionToMailInterface
73
     */
74
    public function getMailFacade()
75
    {
76
        return $this->getProvidedDependency(PayolutionDependencyProvider::FACADE_MAIL);
77
    }
78
79
    /**
80
     * @return \SprykerEco\Zed\Payolution\Dependency\Facade\PayolutionToGlossaryInterface
81
     */
82
    public function getGlossaryFacade()
83
    {
84
        return $this->getProvidedDependency(PayolutionDependencyProvider::FACADE_GLOSSARY);
85
    }
86
87
    /**
88
     * @return \SprykerEco\Zed\Payolution\Dependency\Facade\PayolutionToRefundInterface
89
     */
90
    public function getRefundFacade()
91
    {
92
        return $this->getProvidedDependency(PayolutionDependencyProvider::FACADE_REFUND);
93
    }
94
95
    /**
96
     * @return \SprykerEco\Zed\Payolution\Dependency\Facade\PayolutionToSalesInterface
97
     */
98
    public function getSalesFacade()
99
    {
100
        return $this->getProvidedDependency(PayolutionDependencyProvider::FACADE_SALES);
101
    }
102
}
103