Passed
Push — feature/paypal-express ( 95d04f...1b9976 )
by Volodymyr
05:14
created

filterPaypalExpressPaymentMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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