Passed
Push — feature/eco-1539-heidelpay-eas... ( 8d0432...a589be )
by Ruslan
06:14
created

HeidelpayFacade::executePaymentReservation()   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\Heidelpay\Business;
9
10
use Generated\Shared\Transfer\CheckoutResponseTransfer;
1 ignored issue
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\HeidelpayAuthorizeTransactionLogRequestTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...ctionLogRequestTransfer 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\HeidelpayCreditCardPaymentOptionsTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...dPaymentOptionsTransfer 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\HeidelpayCreditCardRegistrationTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...ardRegistrationTransfer 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\HeidelpayPaymentProcessingResponseTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...cessingResponseTransfer 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\HeidelpayRegistrationByIdAndQuoteRequestTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...AndQuoteRequestTransfer 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\HeidelpayRegistrationRequestTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...strationRequestTransfer 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 Generated\Shared\Transfer\HeidelpayRegistrationSaveResponseTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...ionSaveResponseTransfer 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 Generated\Shared\Transfer\HeidelpayTransactionLogTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...yTransactionLogTransfer 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...
19
use Generated\Shared\Transfer\OrderTransfer;
1 ignored issue
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...
20
use Generated\Shared\Transfer\PaymentMethodsTransfer;
1 ignored issue
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...
21
use Generated\Shared\Transfer\QuoteTransfer;
1 ignored issue
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...
22
use Generated\Shared\Transfer\SaveOrderTransfer;
1 ignored issue
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...
23
use Spryker\Zed\Kernel\Business\AbstractFacade;
24
25
/**
26
 * @method \SprykerEco\Zed\Heidelpay\Business\HeidelpayBusinessFactory getFactory()
27
 */
28
class HeidelpayFacade extends AbstractFacade implements HeidelpayFacadeInterface
29
{
30
    /**
31
     * {@inheritdoc}
32
     *
33
     * @api
34
     *
35
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
36
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
37
     *
38
     * @return \Generated\Shared\Transfer\CheckoutResponseTransfer
39
     */
40
    public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer): CheckoutResponseTransfer
41
    {
42
        return $this->getFactory()
43
            ->createPostSaveHook()
44
            ->execute($quoteTransfer, $checkoutResponseTransfer);
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     *
50
     * @api
51
     *
52
     * @param array $externalResponse
53
     *
54
     * @return \Generated\Shared\Transfer\HeidelpayPaymentProcessingResponseTransfer
55
     */
56
    public function processExternalPaymentResponse(array $externalResponse): HeidelpayPaymentProcessingResponseTransfer
57
    {
58
        return $this->getFactory()
59
            ->createExternalResponseTransactionHandler()
60
            ->processExternalPaymentResponse($externalResponse);
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     *
66
     * @api
67
     *
68
     * @param array $externalResponse
69
     *
70
     * @return \Generated\Shared\Transfer\HeidelpayPaymentProcessingResponseTransfer
71
     */
72
    public function processExternalEasyCreditPaymentResponse(
73
        array $externalResponse
74
    ): HeidelpayPaymentProcessingResponseTransfer {
75
        return $this->getFactory()
76
            ->createEasyCreditInitializeExternalResponseTransactionHandler()
77
            ->processExternalEasyCreditPaymentResponse($externalResponse);
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     *
83
     * @api
84
     *
85
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
86
     *
87
     * @return void
88
     */
89
    public function authorizePayment(OrderTransfer $orderTransfer): void
90
    {
91
        $this->getFactory()
92
            ->createAuthorizeTransactionHandler()
93
            ->authorize($orderTransfer);
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     *
99
     * @api
100
     *
101
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
102
     *
103
     */
104
    public function authorizeOnRegistrationPayment(OrderTransfer $orderTransfer)
105
    {
106
        $this->getFactory()
107
            ->createAuthorizeOnRegistrationTransactionHandler()
108
            ->authorizeOnRegistration($orderTransfer);
109
    }
110
111
    /**
112
     * {@inheritdoc}
113
     *
114
     * @api
115
     *
116
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
117
     *
118
     */
119
    public function initializePayment(QuoteTransfer $quoteTransfer)
120
    {
121
        return $this->getFactory()
122
            ->createInitializeTransactionHandler()
123
            ->initialize($quoteTransfer);
124
    }
125
126
    /**
127
     * {@inheritdoc}
128
     *
129
     * @api
130
     *
131
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
132
     *
133
     * @return void
134
     */
135
    public function debitPayment(OrderTransfer $orderTransfer): void
136
    {
137
        $this->getFactory()
138
            ->createDebitTransactionHandler()
139
            ->debit($orderTransfer);
140
    }
141
142
    /**
143
     * {@inheritdoc}
144
     *
145
     * @api
146
     *
147
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
148
     *
149
     */
150
    public function finalizePayment(OrderTransfer $orderTransfer)
151
    {
152
        $this->getFactory()
153
            ->createFinalizeTransactionHandler()
154
            ->finalize($orderTransfer);
155
    }
156
157
    /**
158
     * {@inheritdoc}
159
     *
160
     * @api
161
     *
162
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
163
     *
164
     */
165
    public function executePaymentReservation(OrderTransfer $orderTransfer)
166
    {
167
        $this->getFactory()
168
            ->createReservationTransactionHandler()
169
            ->executeReservation($orderTransfer);
170
    }
171
172
    /**
173
     * {@inheritdoc}
174
     *
175
     * @api
176
     *
177
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
178
     *
179
     * @return void
180
     */
181
    public function capturePayment(OrderTransfer $orderTransfer): void
182
    {
183
        $this->getFactory()
184
            ->createCaptureTransactionHandler()
185
            ->capture($orderTransfer);
186
    }
187
188
    /**
189
     * {@inheritdoc}
190
     *
191
     * @api
192
     *
193
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
194
     * @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer
195
     *
196
     * @return void
197
     */
198
    public function saveOrderPayment(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer): void
199
    {
200
        $this->getFactory()
201
            ->createOrderSaver()
202
            ->saveOrderPayment($quoteTransfer, $saveOrderTransfer);
203
    }
204
205
    /**
206
     * {@inheritdoc}
207
     *
208
     * @api
209
     *
210
     * @param int $idSalesOrder
211
     *
212
     * @return \Generated\Shared\Transfer\HeidelpayPaymentTransfer
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\HeidelpayPaymentTransfer 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...
213
     */
214
    public function getPaymentByIdSalesOrder(int $idSalesOrder)
215
    {
216
        return $this->getFactory()
217
            ->createPaymentReader()
218
            ->getPaymentByIdSalesOrder($idSalesOrder);
219
    }
220
221
    /**
222
     * {@inheritdoc}
223
     *
224
     * @api
225
     *
226
     * @param \Generated\Shared\Transfer\HeidelpayAuthorizeTransactionLogRequestTransfer $authorizeLogRequestTransfer
227
     *
228
     * @return \Generated\Shared\Transfer\HeidelpayTransactionLogTransfer
229
     */
230
    public function getAuthorizeTransactionLog(HeidelpayAuthorizeTransactionLogRequestTransfer $authorizeLogRequestTransfer): HeidelpayTransactionLogTransfer
231
    {
232
        return $this->getFactory()
233
            ->createTransactionLogReader()
234
            ->findOrderAuthorizeTransactionLogByOrderReference($authorizeLogRequestTransfer->getOrderReference());
235
    }
236
237
    /**
238
     * {@inheritdoc}
239
     *
240
     * @api
241
     *
242
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
243
     *
244
     * @return \Generated\Shared\Transfer\HeidelpayCreditCardPaymentOptionsTransfer
245
     */
246
    public function getCreditCardPaymentOptions(QuoteTransfer $quoteTransfer): HeidelpayCreditCardPaymentOptionsTransfer
247
    {
248
        return $this->getFactory()
249
            ->createPaymentOptionsCalculator()
250
            ->getCreditCardPaymentOptions($quoteTransfer);
251
    }
252
253
    /**
254
     * {@inheritdoc}
255
     *
256
     * @api
257
     *
258
     * @param \Generated\Shared\Transfer\HeidelpayRegistrationRequestTransfer $registrationRequestTransfer
259
     *
260
     * @return \Generated\Shared\Transfer\HeidelpayRegistrationSaveResponseTransfer
261
     */
262
    public function saveCreditCardRegistration(HeidelpayRegistrationRequestTransfer $registrationRequestTransfer): HeidelpayRegistrationSaveResponseTransfer
263
    {
264
        return $this->getFactory()
265
            ->createCreditCardRegistrationSaver()
266
            ->saveCreditCardRegistration($registrationRequestTransfer);
267
    }
268
269
    /**
270
     * {@inheritdoc}
271
     *
272
     * @api
273
     *
274
     * @param \Generated\Shared\Transfer\HeidelpayRegistrationByIdAndQuoteRequestTransfer $findRegistrationRequestTransfer
275
     *
276
     * @return \Generated\Shared\Transfer\HeidelpayCreditCardRegistrationTransfer
277
     */
278
    public function findCreditCardRegistrationByIdAndQuote(
279
        HeidelpayRegistrationByIdAndQuoteRequestTransfer $findRegistrationRequestTransfer
280
    ): HeidelpayCreditCardRegistrationTransfer {
281
        return $this->getFactory()
282
            ->createCreditCardRegistrationReader()
283
            ->findCreditCardRegistrationByIdAndQuote(
284
                $findRegistrationRequestTransfer->getIdRegistration(),
285
                $findRegistrationRequestTransfer->getQuote()
286
            );
287
    }
288
289
    /**
290
     * {@inheritdoc}
291
     *
292
     * @api
293
     *
294
     * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer
295
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
296
     *
297
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
298
     */
299
    public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer)
300
    {
301
        return $this->getFactory()
302
            ->createPaymentMethodFilter()
303
            ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer);
304
    }
305
}
306