Passed
Push — feature/eco-3135/eco-3149-dire... ( b1393a...0436c5 )
by Aleksey
05:03
created

HeidelpayFacade::executeDebitOnRegistration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
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\HeidelpayDirectDebitPaymentOptionsTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...tPaymentOptionsTransfer 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\HeidelpayDirectDebitRegistrationTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...bitRegistrationTransfer 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\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...
17
use 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...
18
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...
19
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...
20
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...
21
use Generated\Shared\Transfer\HeidelpayResponseTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...idelpayResponseTransfer 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\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...
23
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...
24
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...
25
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...
26
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...
27
use Spryker\Zed\Kernel\Business\AbstractFacade;
28
29
/**
30
 * @method \SprykerEco\Zed\Heidelpay\Business\HeidelpayBusinessFactory getFactory()
31
 * @method \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayEntityManagerInterface getEntityManager()
32
 * @method \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayRepositoryInterface getRepository()
33
 */
34
class HeidelpayFacade extends AbstractFacade implements HeidelpayFacadeInterface
35
{
36
    /**
37
     * {@inheritdoc}
38
     *
39
     * @api
40
     *
41
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
42
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
43
     *
44
     * @return \Generated\Shared\Transfer\CheckoutResponseTransfer
45
     */
46
    public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer): CheckoutResponseTransfer
47
    {
48
        return $this->getFactory()
49
            ->createPostSaveHook()
50
            ->execute($quoteTransfer, $checkoutResponseTransfer);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     *
56
     * @api
57
     *
58
     * @param array $externalResponse
59
     *
60
     * @return \Generated\Shared\Transfer\HeidelpayPaymentProcessingResponseTransfer
61
     */
62
    public function processExternalPaymentResponse(array $externalResponse): HeidelpayPaymentProcessingResponseTransfer
63
    {
64
        return $this->getFactory()
65
            ->createExternalResponseTransactionHandler()
66
            ->processExternalPaymentResponse($externalResponse);
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     *
72
     * @api
73
     *
74
     * @param array $externalResponse
75
     *
76
     * @return \Generated\Shared\Transfer\HeidelpayPaymentProcessingResponseTransfer
77
     */
78
    public function processExternalEasyCreditPaymentResponse(
79
        array $externalResponse
80
    ): HeidelpayPaymentProcessingResponseTransfer {
81
        return $this->getFactory()
82
            ->createEasyCreditInitializeExternalResponseTransactionHandler()
83
            ->processExternalEasyCreditPaymentResponse($externalResponse);
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     *
89
     * @api
90
     *
91
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
92
     *
93
     * @return void
94
     */
95
    public function authorizePayment(OrderTransfer $orderTransfer): void
96
    {
97
        $this->getFactory()
98
            ->createAuthorizeTransactionHandler()
99
            ->authorize($orderTransfer);
100
    }
101
102
    /**
103
     * {@inheritdoc}
104
     *
105
     * @api
106
     *
107
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
108
     *
109
     * @return \Generated\Shared\Transfer\HeidelpayResponseTransfer
110
     */
111
    public function authorizeOnRegistrationPayment(OrderTransfer $orderTransfer): HeidelpayResponseTransfer
112
    {
113
        return $this->getFactory()
114
            ->createAuthorizeOnRegistrationTransactionHandler()
115
            ->authorizeOnRegistration($orderTransfer);
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     *
121
     * @api
122
     *
123
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
124
     *
125
     * @return \Generated\Shared\Transfer\HeidelpayResponseTransfer
126
     */
127
    public function initializePayment(QuoteTransfer $quoteTransfer): HeidelpayResponseTransfer
128
    {
129
        return $this->getFactory()
130
            ->createInitializeTransactionHandler()
131
            ->initialize($quoteTransfer);
132
    }
133
134
    /**
135
     * {@inheritdoc}
136
     *
137
     * @api
138
     *
139
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
140
     *
141
     * @return void
142
     */
143
    public function debitPayment(OrderTransfer $orderTransfer): void
144
    {
145
        $this->getFactory()
146
            ->createDebitTransactionHandler()
147
            ->debit($orderTransfer);
148
    }
149
150
    /**
151
     * {@inheritdoc}
152
     *
153
     * @api
154
     *
155
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
156
     *
157
     * @return void
158
     */
159
    public function executeDebitOnRegistration(OrderTransfer $orderTransfer): void
160
    {
161
        $this->getFactory()
162
            ->createDebitOnRegistrationTransactionHandler()
163
            ->debitOnRegistration($orderTransfer);
164
    }
165
166
    /**
167
     * {@inheritdoc}
168
     *
169
     * @api
170
     *
171
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
172
     *
173
     * @return void
174
     */
175
    public function finalizePayment(OrderTransfer $orderTransfer): void
176
    {
177
        $this->getFactory()
178
            ->createFinalizeTransactionHandler()
179
            ->finalize($orderTransfer);
180
    }
181
182
    /**
183
     * {@inheritdoc}
184
     *
185
     * @api
186
     *
187
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
188
     *
189
     * @return void
190
     */
191
    public function executePaymentReservation(OrderTransfer $orderTransfer): void
192
    {
193
        $this->getFactory()
194
            ->createReservationTransactionHandler()
195
            ->executeReservation($orderTransfer);
196
    }
197
198
    /**
199
     * {@inheritdoc}
200
     *
201
     * @api
202
     *
203
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
204
     *
205
     * @return void
206
     */
207
    public function executeRefund(OrderTransfer $orderTransfer): void
208
    {
209
        $this->getFactory()
210
            ->createRefundTransactionHandler()
211
            ->executeRefund($orderTransfer);
212
    }
213
214
    /**
215
     * {@inheritdoc}
216
     *
217
     * @api
218
     *
219
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
220
     *
221
     * @return void
222
     */
223
    public function capturePayment(OrderTransfer $orderTransfer): void
224
    {
225
        $this->getFactory()
226
            ->createCaptureTransactionHandler()
227
            ->capture($orderTransfer);
228
    }
229
230
    /**
231
     * {@inheritdoc}
232
     *
233
     * @api
234
     *
235
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
236
     * @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer
237
     *
238
     * @return void
239
     */
240
    public function saveOrderPayment(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer): void
241
    {
242
        $this->getFactory()
243
            ->createOrderSaver()
244
            ->saveOrderPayment($quoteTransfer, $saveOrderTransfer);
245
    }
246
247
    /**
248
     * {@inheritdoc}
249
     *
250
     * @api
251
     *
252
     * @param int $idSalesOrder
253
     *
254
     * @return \Generated\Shared\Transfer\HeidelpayPaymentTransfer
255
     */
256
    public function getPaymentByIdSalesOrder(int $idSalesOrder): HeidelpayPaymentTransfer
257
    {
258
        return $this->getFactory()
259
            ->createPaymentReader()
260
            ->getPaymentByIdSalesOrder($idSalesOrder);
261
    }
262
263
    /**
264
     * {@inheritdoc}
265
     *
266
     * @api
267
     *
268
     * @param \Generated\Shared\Transfer\HeidelpayAuthorizeTransactionLogRequestTransfer $authorizeLogRequestTransfer
269
     *
270
     * @return \Generated\Shared\Transfer\HeidelpayTransactionLogTransfer
271
     */
272
    public function getAuthorizeTransactionLog(HeidelpayAuthorizeTransactionLogRequestTransfer $authorizeLogRequestTransfer): HeidelpayTransactionLogTransfer
273
    {
274
        return $this->getFactory()
275
            ->createTransactionLogReader()
276
            ->findOrderAuthorizeTransactionLogByOrderReference($authorizeLogRequestTransfer->getOrderReference());
277
    }
278
279
    /**
280
     * {@inheritdoc}
281
     *
282
     * @api
283
     *
284
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
285
     *
286
     * @return \Generated\Shared\Transfer\HeidelpayCreditCardPaymentOptionsTransfer
287
     */
288
    public function getCreditCardPaymentOptions(QuoteTransfer $quoteTransfer): HeidelpayCreditCardPaymentOptionsTransfer
289
    {
290
        return $this->getFactory()
291
            ->createPaymentOptionsCalculator()
292
            ->getCreditCardPaymentOptions($quoteTransfer);
293
    }
294
295
    /**
296
     * {@inheritdoc}
297
     *
298
     * @api
299
     *
300
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
301
     *
302
     * @return \Generated\Shared\Transfer\HeidelpayDirectDebitPaymentOptionsTransfer
303
     */
304
    public function getDirectDebitPaymentOptions(QuoteTransfer $quoteTransfer): HeidelpayDirectDebitPaymentOptionsTransfer
305
    {
306
        return $this->getFactory()
307
            ->createDirectDebitPaymentOptionsCalculator()
308
            ->getDirectDebitPaymentOptions($quoteTransfer);
309
    }
310
311
    /**
312
     * {@inheritdoc}
313
     *
314
     * @api
315
     *
316
     * @param \Generated\Shared\Transfer\HeidelpayRegistrationRequestTransfer $registrationRequestTransfer
317
     *
318
     * @return \Generated\Shared\Transfer\HeidelpayRegistrationSaveResponseTransfer
319
     */
320
    public function saveCreditCardRegistration(HeidelpayRegistrationRequestTransfer $registrationRequestTransfer): HeidelpayRegistrationSaveResponseTransfer
321
    {
322
        return $this->getFactory()
323
            ->createCreditCardRegistrationSaver()
324
            ->saveCreditCardRegistration($registrationRequestTransfer);
325
    }
326
327
    /**
328
     * {@inheritdoc}
329
     *
330
     * @api
331
     *
332
     * @param \Generated\Shared\Transfer\HeidelpayDirectDebitRegistrationTransfer $directDebitRegistrationTransfer
333
     *
334
     * @return \Generated\Shared\Transfer\HeidelpayDirectDebitRegistrationTransfer
335
     */
336
    public function saveDirectDebitRegistration(
337
        HeidelpayDirectDebitRegistrationTransfer $directDebitRegistrationTransfer
338
    ): HeidelpayDirectDebitRegistrationTransfer {
339
        return $this->getFactory()
340
            ->createDirectDebitRegistrationWriter()
341
            ->createDirectDebitRegistration($directDebitRegistrationTransfer);
342
    }
343
344
    /**
345
     * {@inheritdoc}
346
     *
347
     * @api
348
     *
349
     * @param \Generated\Shared\Transfer\HeidelpayRegistrationByIdAndQuoteRequestTransfer $findRegistrationRequestTransfer
350
     *
351
     * @return \Generated\Shared\Transfer\HeidelpayCreditCardRegistrationTransfer
352
     */
353
    public function findCreditCardRegistrationByIdAndQuote(
354
        HeidelpayRegistrationByIdAndQuoteRequestTransfer $findRegistrationRequestTransfer
355
    ): HeidelpayCreditCardRegistrationTransfer {
356
        return $this->getFactory()
357
            ->createCreditCardRegistrationReader()
358
            ->findCreditCardRegistrationByIdAndQuote(
359
                $findRegistrationRequestTransfer->getIdRegistration(),
360
                $findRegistrationRequestTransfer->getQuote()
361
            );
362
    }
363
364
    /**
365
     * {@inheritdoc}
366
     *
367
     * @api
368
     *
369
     * @param \Generated\Shared\Transfer\HeidelpayDirectDebitRegistrationTransfer $directDebitRegistrationTransfer
370
     *
371
     * @return \Generated\Shared\Transfer\HeidelpayDirectDebitRegistrationTransfer
372
     */
373
    public function retrieveDirectDebitRegistration(
374
        HeidelpayDirectDebitRegistrationTransfer $directDebitRegistrationTransfer
375
    ): HeidelpayDirectDebitRegistrationTransfer {
376
        return $this->getFactory()
377
            ->createDirectDebitRegistrationReader()
378
            ->retrieveDirectDebitRegistration($directDebitRegistrationTransfer);
379
    }
380
381
    /**
382
     * {@inheritdoc}
383
     *
384
     * @api
385
     *
386
     * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer
387
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
388
     *
389
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
390
     */
391
    public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer
392
    {
393
        return $this->getFactory()
394
            ->createPaymentMethodFilter()
395
            ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer);
396
    }
397
}
398