Passed
Push — feature/eco-574/eco-2266-check... ( 8cf5ab...290cb9 )
by Aleksey
05:34
created

AfterPayQueryContainer::querySalesOrder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 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\AfterPay\Persistence;
9
10
use Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayAuthorizationQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\AfterPay\Persist...erPayAuthorizationQuery 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 Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayOrderItemQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\AfterPay\Persist...tAfterPayOrderItemQuery 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\AfterPay\Persistence\SpyPaymentAfterPayQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\AfterPay\Persist...SpyPaymentAfterPayQuery 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\AfterPay\Persistence\SpyPaymentAfterPayTransactionLogQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\AfterPay\Persist...rPayTransactionLogQuery 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\Sales\Persistence\SpySalesOrderQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Sales\Persistence\SpySalesOrderQuery 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\AbstractQueryContainer;
16
use SprykerEco\Shared\AfterPay\AfterPayConfig;
17
18
/**
19
 * @method \SprykerEco\Zed\AfterPay\Persistence\AfterPayPersistenceFactory getFactory()
20
 */
21
class AfterPayQueryContainer extends AbstractQueryContainer implements AfterPayQueryContainerInterface
22
{
23
    public const TRANSACTION_TYPE_AUTHORIZE = AfterPayConfig::TRANSACTION_TYPE_AUTHORIZE;
24
    public const TRANSACTION_TYPE_CAPTURE = AfterPayConfig::TRANSACTION_TYPE_CAPTURE;
25
    public const TRANSACTION_TYPE_CANCEL = AfterPayConfig::TRANSACTION_TYPE_CANCEL;
26
    public const TRANSACTION_TYPE_REFUND = AfterPayConfig::TRANSACTION_TYPE_REFUND;
27
28
    /**
29
     * @api
30
     *
31
     * @param string $orderReference
32
     *
33
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayTransactionLogQuery
34
     */
35
    public function queryAuthorizeTransactionLog(string $orderReference): SpyPaymentAfterPayTransactionLogQuery
36
    {
37
        return $this->getFactory()
38
            ->createPaymentAfterPayTransactionLogQuery()
39
            ->filterByOrderReference($orderReference)
40
            ->filterByTransactionType(static::TRANSACTION_TYPE_AUTHORIZE);
41
    }
42
43
    /**
44
     * @api
45
     *
46
     * @param string $orderReference
47
     *
48
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayTransactionLogQuery
49
     */
50
    public function queryCaptureTransactionLog(string $orderReference): SpyPaymentAfterPayTransactionLogQuery
51
    {
52
        return $this->getFactory()
53
            ->createPaymentAfterPayTransactionLogQuery()
54
            ->filterByOrderReference($orderReference)
55
            ->filterByTransactionType(static::TRANSACTION_TYPE_CAPTURE);
56
    }
57
58
    /**
59
     * @api
60
     *
61
     * @param string $orderReference
62
     *
63
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayTransactionLogQuery
64
     */
65
    public function queryCancelTransactionLog(string $orderReference): SpyPaymentAfterPayTransactionLogQuery
66
    {
67
        return $this->getFactory()
68
            ->createPaymentAfterPayTransactionLogQuery()
69
            ->filterByOrderReference($orderReference)
70
            ->filterByTransactionType(static::TRANSACTION_TYPE_CANCEL);
71
    }
72
73
    /**
74
     * @api
75
     *
76
     * @param string $orderReference
77
     *
78
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayTransactionLogQuery
79
     */
80
    public function queryRefundTransactionLog(string $orderReference): SpyPaymentAfterPayTransactionLogQuery
81
    {
82
        return $this->getFactory()
83
            ->createPaymentAfterPayTransactionLogQuery()
84
            ->filterByOrderReference($orderReference)
85
            ->filterByTransactionType(static::TRANSACTION_TYPE_REFUND);
86
    }
87
88
    /**
89
     * @api
90
     *
91
     * @param int $idSalesOrder
92
     *
93
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayQuery
94
     */
95
    public function queryPaymentByIdSalesOrder(int $idSalesOrder): SpyPaymentAfterPayQuery
96
    {
97
        return $this
98
            ->getFactory()
99
            ->createPaymentAfterPayQuery()
100
            ->filterByFkSalesOrder($idSalesOrder);
101
    }
102
103
    /**
104
     * @api
105
     *
106
     * @param int $idSalesOrderItem
107
     * @param int $idPayment
108
     *
109
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayOrderItemQuery
110
     */
111
    public function queryPaymentOrderItemByIdSalesOrderAndIdPayment(int $idSalesOrderItem, int $idPayment): SpyPaymentAfterPayOrderItemQuery
112
    {
113
        return $this
114
            ->getFactory()
115
            ->createPaymentAfterPayOrderItemQuery()
116
            ->filterByFkSalesOrderItem($idSalesOrderItem)
117
            ->filterByFkPaymentAfterPay($idPayment);
118
    }
119
120
    /**
121
     * @api
122
     *
123
     * @param string $orderReference
124
     * @param string $transactionType
125
     *
126
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayTransactionLogQuery
127
     */
128
    public function queryTransactionByIdSalesOrderAndType(string $orderReference, string $transactionType): SpyPaymentAfterPayTransactionLogQuery
129
    {
130
        return $this->getFactory()
131
            ->createPaymentAfterPayTransactionLogQuery()
132
            ->filterByOrderReference($orderReference)
133
            ->filterByTransactionType($transactionType);
134
    }
135
136
    /**
137
     * @api
138
     *
139
     * @param string $orderReference
140
     *
141
     * @return \Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayAuthorizationQuery
142
     */
143
    public function queryAuthorizationByOrderReference(string $orderReference): SpyPaymentAfterPayAuthorizationQuery
144
    {
145
        return $this->getFactory()
146
            ->createPaymentAfterPayAuthorizationQuery()
147
            ->filterByOrderReference($orderReference);
148
    }
149
150
    /**
151
     * @api
152
     *
153
     * @param int $idSalesOrder
154
     *
155
     * @return \Orm\Zed\Sales\Persistence\SpySalesOrderQuery
156
     */
157
    public function querySalesOrder(int $idSalesOrder): SpySalesOrderQuery
158
    {
159
        return $this->getFactory()
160
            ->createSalesOrderQuery()
161
            ->filterByPrimaryKey($idSalesOrder);
162
    }
163
}
164