Passed
Push — feature/paypal-express ( 8563e1...be7cfc )
by Volodymyr
05:52 queued 11s
created

BraintreeFacade::captureItemsPayment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
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\Braintree\Business;
9
10
use Generated\Shared\Transfer\BraintreeTransactionResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...sactionResponseTransfer 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\CheckoutResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CheckoutResponseTransfer 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\OrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderTransfer 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\PaymentMethodsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentMethodsTransfer 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 Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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 Generated\Shared\Transfer\SaveOrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\SaveOrderTransfer 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...
16
use Generated\Shared\Transfer\TransactionMetaTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\TransactionMetaTransfer 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...
17
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...
18
use Spryker\Zed\Kernel\Business\AbstractFacade;
19
20
/**
21
 * @method \SprykerEco\Zed\Braintree\Business\BraintreeBusinessFactory getFactory()
22
 * @method \SprykerEco\Zed\Braintree\Persistence\BraintreeRepositoryInterface getRepository()
23
 */
24
class BraintreeFacade extends AbstractFacade implements BraintreeFacadeInterface
25
{
26
    /**
27
     * {@inheritdoc}
28
     *
29
     * @api
30
     *
31
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
32
     * @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer
33
     *
34
     * @return void
35
     */
36
    public function saveOrderPayment(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer)
37
    {
38
        $this->getFactory()
39
            ->createOrderSaver()
40
            ->saveOrderPayment($quoteTransfer, $saveOrderTransfer);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     *
46
     * @api
47
     *
48
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
49
     *
50
     * @return \Generated\Shared\Transfer\BraintreeTransactionResponseTransfer
51
     */
52
    public function preCheckPayment(QuoteTransfer $quoteTransfer)
53
    {
54
        return $this
55
            ->getFactory()
56
            ->createPreCheckTransactionHandler()
57
            ->preCheck($quoteTransfer);
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     *
63
     * @api
64
     *
65
     * @param \Generated\Shared\Transfer\TransactionMetaTransfer $transactionMetaTransfer
66
     *
67
     * @return \Generated\Shared\Transfer\BraintreeTransactionResponseTransfer
68
     */
69
    public function authorizePayment(TransactionMetaTransfer $transactionMetaTransfer)
70
    {
71
        return $this
72
            ->getFactory()
73
            ->createAuthorizeTransactionHandler()
74
            ->authorize($transactionMetaTransfer);
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     *
80
     * @api
81
     *
82
     * @param \Generated\Shared\Transfer\TransactionMetaTransfer $transactionMetaTransfer
83
     *
84
     * @return \Generated\Shared\Transfer\BraintreeTransactionResponseTransfer
85
     */
86
    public function capturePayment(TransactionMetaTransfer $transactionMetaTransfer)
87
    {
88
        return $this
89
            ->getFactory()
90
            ->createCaptureTransactionHandler()
91
            ->capture($transactionMetaTransfer);
92
    }
93
94
    /**
95
     * {@inheritdoc}
96
     *
97
     * @api
98
     *
99
     * @param \Generated\Shared\Transfer\TransactionMetaTransfer $transactionMetaTransfer
100
     *
101
     * @return \Generated\Shared\Transfer\BraintreeTransactionResponseTransfer
102
     */
103
    public function revertPayment(TransactionMetaTransfer $transactionMetaTransfer)
104
    {
105
        return $this
106
            ->getFactory()
107
            ->createRevertTransactionHandler()
108
            ->revert($transactionMetaTransfer);
109
    }
110
111
    /**
112
     * {@inheritdoc}
113
     *
114
     * @api
115
     *
116
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $salesOrderItems
117
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $salesOrderEntity
118
     *
119
     * @return \Generated\Shared\Transfer\BraintreeTransactionResponseTransfer
120
     */
121
    public function refundPayment(array $salesOrderItems, SpySalesOrder $salesOrderEntity)
122
    {
123
        return $this
124
            ->getFactory()
125
            ->createRefundTransactionHandler()
126
            ->refund($salesOrderItems, $salesOrderEntity);
127
    }
128
129
    /**
130
     * {@inheritdoc}
131
     *
132
     * @api
133
     *
134
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
135
     *
136
     * @return bool
137
     */
138
    public function isAuthorizationApproved(OrderTransfer $orderTransfer)
139
    {
140
        return $this
141
            ->getFactory()
142
            ->createTransactionStatusLog()
143
            ->isAuthorizationApproved($orderTransfer);
144
    }
145
146
    /**
147
     * {@inheritdoc}
148
     *
149
     * @api
150
     *
151
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
152
     *
153
     * @return bool
154
     */
155
    public function isReversalApproved(OrderTransfer $orderTransfer)
156
    {
157
        return $this
158
            ->getFactory()
159
            ->createTransactionStatusLog()
160
            ->isReversalApproved($orderTransfer);
161
    }
162
163
    /**
164
     * {@inheritdoc}
165
     *
166
     * @api
167
     *
168
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
169
     *
170
     * @return bool
171
     */
172
    public function isCaptureApproved(OrderTransfer $orderTransfer)
173
    {
174
        return $this
175
            ->getFactory()
176
            ->createTransactionStatusLog()
177
            ->isCaptureApproved($orderTransfer);
178
    }
179
180
    /**
181
     * {@inheritdoc}
182
     *
183
     * @api
184
     *
185
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
186
     *
187
     * @return bool
188
     */
189
    public function isRefundApproved(OrderTransfer $orderTransfer)
190
    {
191
        return $this
192
            ->getFactory()
193
            ->createTransactionStatusLog()
194
            ->isRefundApproved($orderTransfer);
195
    }
196
197
    /**
198
     * {@inheritdoc}
199
     *
200
     * @api
201
     *
202
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
203
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse
204
     *
205
     * @return \Generated\Shared\Transfer\CheckoutResponseTransfer
206
     */
207
    public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
208
    {
209
        return $this
210
            ->getFactory()
211
            ->createPostSaveHook()
212
            ->postSaveHook($quoteTransfer, $checkoutResponse);
213
    }
214
215
    /**
216
     * {@inheritdoc}
217
     *
218
     * @api
219
     *
220
     * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer
221
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
222
     *
223
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
224
     */
225
    public function filterPaypalExpressPaymentMethod(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer
226
    {
227
        return $this
228
            ->getFactory()
229
            ->createPaypalExpressCheckoutPaymentMethod()
230
            ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer);
231
    }
232
233
    /**
234
     * {@inheritdoc}
235
     *
236
     * @api
237
     *
238
     * @param \Generated\Shared\Transfer\TransactionMetaTransfer $transactionMetaTransfer
239
     *
240
     * @return \Generated\Shared\Transfer\BraintreeTransactionResponseTransfer
241
     */
242
    public function captureOrderPayment(TransactionMetaTransfer $transactionMetaTransfer): BraintreeTransactionResponseTransfer
243
    {
244
        // TODO: Implement captureOrderPayment() method.
245
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Generated\Shared\Transfe...sactionResponseTransfer. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
246
247
    /**
248
     * {@inheritdoc}
249
     *
250
     * @api
251
     *
252
     * @param \Generated\Shared\Transfer\TransactionMetaTransfer $transactionMetaTransfer
253
     *
254
     * @return \Generated\Shared\Transfer\BraintreeTransactionResponseTransfer
255
     */
256
    public function captureItemsPayment(TransactionMetaTransfer $transactionMetaTransfer): BraintreeTransactionResponseTransfer
257
    {
258
        // TODO: Implement captureItemsPayment() method.
259
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Generated\Shared\Transfe...sactionResponseTransfer. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
260
}
261