createPayoneRefundRequestSender()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 11
rs 9.9666
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Payone\Business;
9
10
use Generated\Shared\Transfer\PayoneStandardParameterTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...andardParameterTransfer 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\PayoneTransactionStatusUpdateTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ionStatusUpdateTransfer 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 Spryker\Zed\Kernel\Business\AbstractBusinessFactory;
13
use SprykerEco\Shared\Payone\Dependency\HashInterface;
14
use SprykerEco\Shared\Payone\Dependency\ModeDetectorInterface;
15
use SprykerEco\Shared\Payone\PayoneApiConstants;
16
use SprykerEco\Zed\Payone\Business\Api\Adapter\AdapterInterface;
17
use SprykerEco\Zed\Payone\Business\Api\Adapter\Http\Guzzle;
18
use SprykerEco\Zed\Payone\Business\Api\Log\ApiCallLogWriter;
19
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\AuthorizationResponseMapper;
20
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\AuthorizationResponseMapperInterface;
21
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CaptureResponseMapper;
22
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CaptureResponseMapperInterface;
23
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CreditCardCheckResponseMapper;
24
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CreditCardCheckResponseMapperInterface;
25
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\DebitResponseMapper;
26
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\DebitResponseMapperInterface;
27
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\RefundResponseMapper;
28
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\RefundResponseMapperInterface;
29
use SprykerEco\Zed\Payone\Business\Api\TransactionStatus\TransactionStatusRequest;
30
use SprykerEco\Zed\Payone\Business\ApiLog\ApiLogFinder;
31
use SprykerEco\Zed\Payone\Business\ApiLog\ApiLogFinderInterface;
32
use SprykerEco\Zed\Payone\Business\ConditionChecker\PaymentDataChecker;
33
use SprykerEco\Zed\Payone\Business\ConditionChecker\PaymentDataCheckerInterface;
34
use SprykerEco\Zed\Payone\Business\ConditionChecker\RefundChecker;
35
use SprykerEco\Zed\Payone\Business\ConditionChecker\RefundCheckerInterface;
36
use SprykerEco\Zed\Payone\Business\Distributor\OrderPriceDistributor;
37
use SprykerEco\Zed\Payone\Business\Distributor\OrderPriceDistributorInterface;
38
use SprykerEco\Zed\Payone\Business\Key\HashGenerator;
39
use SprykerEco\Zed\Payone\Business\Key\HashGeneratorInterface;
40
use SprykerEco\Zed\Payone\Business\Key\HashProvider;
41
use SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface;
42
use SprykerEco\Zed\Payone\Business\Key\UrlHmacGenerator;
43
use SprykerEco\Zed\Payone\Business\Mode\ModeDetector;
44
use SprykerEco\Zed\Payone\Business\Model\ParametersReader;
45
use SprykerEco\Zed\Payone\Business\Model\ParametersReaderInterface;
46
use SprykerEco\Zed\Payone\Business\Model\StoreReader;
47
use SprykerEco\Zed\Payone\Business\Model\StoreReaderInterface;
48
use SprykerEco\Zed\Payone\Business\Order\OrderManager;
49
use SprykerEco\Zed\Payone\Business\Order\OrderManagerInterface;
50
use SprykerEco\Zed\Payone\Business\Order\PayoneOrderItemStatusFinder;
51
use SprykerEco\Zed\Payone\Business\Order\PayoneOrderItemStatusFinderInterface;
52
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneBankAccountChecker;
53
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneBankAccountCheckerInterface;
54
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneCreditCardChecker;
55
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneCreditCardCheckerInterface;
56
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\DiscountMapper;
57
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\DiscountMapperInterface;
58
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ExpenseMapper;
59
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ExpenseMapperInterface;
60
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\PayoneRequestProductDataMapper;
61
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\PayoneRequestProductDataMapperInterface;
62
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ProductMapper;
63
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ProductMapperInterface;
64
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ShipmentMapper;
65
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ShipmentMapperInterface;
66
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\StandartParameterMapper;
67
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\StandartParameterMapperInterface;
68
use SprykerEco\Zed\Payone\Business\Payment\GenericPaymentMethodMapperInterface;
69
use SprykerEco\Zed\Payone\Business\Payment\Hook\PostSaveHook;
70
use SprykerEco\Zed\Payone\Business\Payment\Hook\PostSaveHookInterface;
71
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CashOnDelivery;
72
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CreditCardPseudo;
73
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CreditCardPseudoInterface;
74
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebit;
75
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebitInterface;
76
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\EWallet;
77
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\GenericPayment;
78
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\Invoice;
79
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\InvoiceInterface;
80
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\KlarnaPaymentMapper;
81
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\KlarnaPaymentMapperInterface;
82
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\OnlineBankTransfer;
83
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\Prepayment;
84
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\SecurityInvoice;
85
use SprykerEco\Zed\Payone\Business\Payment\PaymentMapperReader;
86
use SprykerEco\Zed\Payone\Business\Payment\PaymentMapperReaderInterface;
87
use SprykerEco\Zed\Payone\Business\Payment\PaymentMethodFilter;
88
use SprykerEco\Zed\Payone\Business\Payment\PaymentMethodFilterInterface;
89
use SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface;
90
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneFileReader;
91
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneFileReaderInterface;
92
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneInvoiceReader;
93
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneInvoiceReaderInterface;
94
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayonePaypalExpressCheckoutDetailsReader;
95
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayonePaypalExpressCheckoutDetailsReaderInterface;
96
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneSecurityInvoiceReader;
97
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneSecurityInvoiceReaderInterface;
98
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneAuthorizeRequestSender;
99
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneAuthorizeRequestSenderInterface;
100
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneBaseAuthorizeSender;
101
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneBaseAuthorizeSenderInterface;
102
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneCaptureRequestSender;
103
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneCaptureRequestSenderInterface;
104
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneDebitRequestSender;
105
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneDebitRequestSenderInterface;
106
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneGenericRequestMethodSender;
107
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneGenericRequestMethodSenderInterface;
108
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneInitPaypalExpressCheckoutMethodSender;
109
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneInitPaypalExpressCheckoutMethodSenderInterface;
110
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneKlarnaStartSessionMethodSender;
111
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneKlarnaStartSessionMethodSenderInterface;
112
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneManageMandateMethodSender;
113
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneManageMandateMethodSenderInterface;
114
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialCaptureRequestSender;
115
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialCaptureRequestSenderInterface;
116
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialRefundRequestSender;
117
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialRefundRequestSenderInterface;
118
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePreAuthorizeRequestSender;
119
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePreAuthorizeRequestSenderInterface;
120
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneRefundRequestSender;
121
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneRefundRequestSenderInterface;
122
use SprykerEco\Zed\Payone\Business\RiskManager\Factory\RiskCheckFactory;
123
use SprykerEco\Zed\Payone\Business\RiskManager\Factory\RiskCheckFactoryInterface;
124
use SprykerEco\Zed\Payone\Business\RiskManager\Mapper\RiskCheckMapper;
125
use SprykerEco\Zed\Payone\Business\RiskManager\Mapper\RiskCheckMapperInterface;
126
use SprykerEco\Zed\Payone\Business\RiskManager\RiskCheckManager;
127
use SprykerEco\Zed\Payone\Business\RiskManager\RiskCheckManagerInterface;
128
use SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProvider;
129
use SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface;
130
use SprykerEco\Zed\Payone\Business\TransactionStatus\TransactionStatusUpdateManager;
131
use SprykerEco\Zed\Payone\Business\TransactionStatus\TransactionStatusUpdateManagerInterface;
132
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToGlossaryFacadeInterface;
133
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeInterface;
134
use SprykerEco\Zed\Payone\PayoneDependencyProvider;
135
use Symfony\Component\HttpFoundation\RequestStack;
136
137
/**
138
 * @method \SprykerEco\Zed\Payone\PayoneConfig getConfig()
139
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneQueryContainerInterface getQueryContainer()
140
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneRepositoryInterface getRepository()
141
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneEntityManagerInterface getEntityManager()
142
 */
143
class PayoneBusinessFactory extends AbstractBusinessFactory
144
{
145
    /**
146
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePreAuthorizeRequestSenderInterface
147
     */
148
    public function createPayonePreAuthorizeRequestSender(): PayonePreAuthorizeRequestSenderInterface
149
    {
150
        return new PayonePreAuthorizeRequestSender(
151
            $this->getQueryContainer(),
152
            $this->createPaymentMapperReader(),
153
            $this->createPayoneBaseAuthorizeSender(),
154
            $this->createAuthorizationResponseMapper(),
155
        );
156
    }
157
158
    /**
159
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneAuthorizeRequestSenderInterface
160
     */
161
    public function createPayoneAuthorizeRequestSender(): PayoneAuthorizeRequestSenderInterface
162
    {
163
        return new PayoneAuthorizeRequestSender(
164
            $this->getQueryContainer(),
165
            $this->createPaymentMapperReader(),
166
            $this->createPayoneRequestProductDataMapper(),
167
            $this->createPayoneBaseAuthorizeSender(),
168
            $this->createAuthorizationResponseMapper(),
169
        );
170
    }
171
172
    /**
173
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneCaptureRequestSenderInterface
174
     */
175
    public function createPayoneCaptureRequestSender(): PayoneCaptureRequestSenderInterface
176
    {
177
        return new PayoneCaptureRequestSender(
178
            $this->createExecutionAdapter(),
179
            $this->getQueryContainer(),
180
            $this->createPaymentMapperReader(),
181
            $this->getStandardParameter(),
182
            $this->createOrderPriceDistributor(),
183
            $this->createStandartParameterMapper(),
184
            $this->createPayoneRequestProductDataMapper(),
185
            $this->createExpenseMapper(),
186
            $this->createCaptureResponseMapper(),
187
        );
188
    }
189
190
    /**
191
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialCaptureRequestSenderInterface
192
     */
193
    public function createPayonePartialCaptureRequestSender(): PayonePartialCaptureRequestSenderInterface
194
    {
195
        return new PayonePartialCaptureRequestSender(
196
            $this->createExecutionAdapter(),
197
            $this->getQueryContainer(),
198
            $this->createPaymentMapperReader(),
199
            $this->createExpenseMapper(),
200
            $this->getStandardParameter(),
201
            $this->getRepository(),
202
            $this->getEntityManager(),
203
            $this->createOrderPriceDistributor(),
204
            $this->createStandartParameterMapper(),
205
            $this->createShipmentMapper(),
206
            $this->createCaptureResponseMapper(),
207
        );
208
    }
209
210
    /**
211
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneDebitRequestSenderInterface
212
     */
213
    public function createPayoneDebitRequestSender(): PayoneDebitRequestSenderInterface
214
    {
215
        return new PayoneDebitRequestSender(
216
            $this->createExecutionAdapter(),
217
            $this->getQueryContainer(),
218
            $this->getStandardParameter(),
219
            $this->createStandartParameterMapper(),
220
            $this->createPaymentMapperReader(),
221
            $this->createDebitResponseMapper(),
222
        );
223
    }
224
225
    /**
226
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneRefundRequestSenderInterface
227
     */
228
    public function createPayoneRefundRequestSender(): PayoneRefundRequestSenderInterface
229
    {
230
        return new PayoneRefundRequestSender(
231
            $this->createExecutionAdapter(),
232
            $this->getQueryContainer(),
233
            $this->createPaymentMapperReader(),
234
            $this->getStandardParameter(),
235
            $this->createOrderPriceDistributor(),
236
            $this->createStandartParameterMapper(),
237
            $this->createPayoneRequestProductDataMapper(),
238
            $this->createRefundResponseMapper(),
239
        );
240
    }
241
242
    /**
243
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialRefundRequestSenderInterface
244
     */
245
    public function createPayonePartialRefundRequestSender(): PayonePartialRefundRequestSenderInterface
246
    {
247
        return new PayonePartialRefundRequestSender(
248
            $this->createExecutionAdapter(),
249
            $this->getQueryContainer(),
250
            $this->createPaymentMapperReader(),
251
            $this->getStandardParameter(),
252
            $this->getRepository(),
253
            $this->getEntityManager(),
254
            $this->createStandartParameterMapper(),
255
            $this->createRefundResponseMapper(),
256
        );
257
    }
258
259
    /**
260
     * @return \SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneBankAccountCheckerInterface
261
     */
262
    public function createPayoneBankAccountChecker(): PayoneBankAccountCheckerInterface
263
    {
264
        return new PayoneBankAccountChecker(
265
            $this->createExecutionAdapter(),
266
            $this->createPaymentMapperReader(),
267
            $this->getStandardParameter(),
268
            $this->createStandartParameterMapper(),
269
        );
270
    }
271
272
    /**
273
     * @return \SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneCreditCardCheckerInterface
274
     */
275
    public function createPayoneCreditCardChecker(): PayoneCreditCardCheckerInterface
276
    {
277
        return new PayoneCreditCardChecker(
278
            $this->createExecutionAdapter(),
279
            $this->getStandardParameter(),
280
            $this->createStandartParameterMapper(),
281
            $this->createPaymentMapperReader(),
282
            $this->createCreditCardCheckResponseMapper(),
283
        );
284
    }
285
286
    /**
287
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneManageMandateMethodSenderInterface
288
     */
289
    public function createPayoneManageMandateMethodSender(): PayoneManageMandateMethodSenderInterface
290
    {
291
        return new PayoneManageMandateMethodSender(
292
            $this->createExecutionAdapter(),
293
            $this->getStandardParameter(),
294
            $this->createStandartParameterMapper(),
295
            $this->createPaymentMapperReader(),
296
        );
297
    }
298
299
    /**
300
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneFileReaderInterface
301
     */
302
    public function createPayoneFileReader(): PayoneFileReaderInterface
303
    {
304
        return new PayoneFileReader(
305
            $this->createExecutionAdapter(),
306
            $this->getQueryContainer(),
307
            $this->getStandardParameter(),
308
            $this->createStandartParameterMapper(),
309
            $this->createPaymentMapperReader(),
310
        );
311
    }
312
313
    /**
314
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneInvoiceReaderInterface
315
     */
316
    public function createPayoneInvoiceReader(): PayoneInvoiceReaderInterface
317
    {
318
        return new PayoneInvoiceReader(
319
            $this->createExecutionAdapter(),
320
            $this->getQueryContainer(),
321
            $this->getStandardParameter(),
322
            $this->createStandartParameterMapper(),
323
            $this->createPaymentMapperReader(),
324
        );
325
    }
326
327
    /**
328
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneSecurityInvoiceReaderInterface
329
     */
330
    public function createPayoneSecurityInvoiceReader(): PayoneSecurityInvoiceReaderInterface
331
    {
332
        return new PayoneSecurityInvoiceReader(
333
            $this->createExecutionAdapter(),
334
            $this->getQueryContainer(),
335
            $this->getStandardParameter(),
336
            $this->createStandartParameterMapper(),
337
            $this->createPaymentMapperReader(),
338
        );
339
    }
340
341
    /**
342
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneInitPaypalExpressCheckoutMethodSenderInterface
343
     */
344
    public function createPayoneInitPaypalExpressCheckoutMethodSender(): PayoneInitPaypalExpressCheckoutMethodSenderInterface
345
    {
346
        return new PayoneInitPaypalExpressCheckoutMethodSender(
347
            $this->createPaymentMapperReader(),
348
            $this->createPayoneGenericRequestMethodSender(),
349
        );
350
    }
351
352
    /**
353
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayonePaypalExpressCheckoutDetailsReaderInterface
354
     */
355
    public function createPayonePaypalExpressCheckoutDetailsReader(): PayonePaypalExpressCheckoutDetailsReaderInterface
356
    {
357
        return new PayonePaypalExpressCheckoutDetailsReader(
358
            $this->createPaymentMapperReader(),
359
            $this->createPayoneGenericRequestMethodSender()
360
        );
361
    }
362
363
    /**
364
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneGenericRequestMethodSenderInterface
365
     */
366
    public function createPayoneGenericRequestMethodSender(): PayoneGenericRequestMethodSenderInterface
367
    {
368
        return new PayoneGenericRequestMethodSender(
369
            $this->createExecutionAdapter(),
370
            $this->getStandardParameter(),
371
            $this->createStandartParameterMapper(),
372
        );
373
    }
374
375
    /**
376
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneKlarnaStartSessionMethodSenderInterface
377
     */
378
    public function createPayoneKlarnaStartSessionMethodSender(): PayoneKlarnaStartSessionMethodSenderInterface
379
    {
380
        return new PayoneKlarnaStartSessionMethodSender(
381
            $this->createExecutionAdapter(),
382
            $this->createStandartParameterMapper(),
383
            $this->createPayoneRequestProductDataMapper(),
384
            $this->createKlarnaPaymentMapper(),
385
            $this->getStandardParameter(),
386
            $this->createSequenceNumberProvider(),
387
            $this->createUrlHmacGenerator(),
388
        );
389
    }
390
391
    /**
392
     * @return \SprykerEco\Zed\Payone\Business\Order\OrderManagerInterface
393
     */
394
    public function createOrderManager(): OrderManagerInterface
395
    {
396
        return new OrderManager($this->getConfig(), $this->getEntityManager());
397
    }
398
399
    /**
400
     * @return \SprykerEco\Zed\Payone\Business\TransactionStatus\TransactionStatusUpdateManagerInterface
401
     */
402
    public function createTransactionStatusManager(): TransactionStatusUpdateManagerInterface
403
    {
404
        return new TransactionStatusUpdateManager(
405
            $this->getQueryContainer(),
406
            $this->getStandardParameter(),
407
            $this->createHashGenerator()
408
        );
409
    }
410
411
    /**
412
     * @return \SprykerEco\Zed\Payone\Business\ApiLog\ApiLogFinderInterface
413
     */
414
    public function createApiLogFinder(): ApiLogFinderInterface
415
    {
416
        return new ApiLogFinder(
417
            $this->getQueryContainer()
418
        );
419
    }
420
421
    /**
422
     * @return \SprykerEco\Zed\Payone\Business\Api\Adapter\AdapterInterface
423
     */
424
    public function createExecutionAdapter(): AdapterInterface
425
    {
426
        return new Guzzle(
427
            $this->getStandardParameter()->getPaymentGatewayUrl(),
428
            $this->createApiCallLogWriter()
429
        );
430
    }
431
432
    /**
433
     * @return \SprykerEco\Zed\Payone\Business\Api\Log\ApiCallLogWriter
434
     */
435
    public function createApiCallLogWriter(): ApiCallLogWriter
436
    {
437
        return new ApiCallLogWriter(
438
            $this->getQueryContainer()
439
        );
440
    }
441
442
    /**
443
     * @return \SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface
444
     */
445
    public function createSequenceNumberProvider(): SequenceNumberProviderInterface
446
    {
447
        $defaultEmptySequenceNumber = $this->getConfig()->getEmptySequenceNumber();
448
449
        return new SequenceNumberProvider(
450
            $this->getQueryContainer(),
451
            $defaultEmptySequenceNumber
452
        );
453
    }
454
455
    /**
456
     * @return \SprykerEco\Shared\Payone\Dependency\HashInterface
457
     */
458
    public function createHashProvider(): HashInterface
459
    {
460
        return new HashProvider();
461
    }
462
463
    /**
464
     * @return \SprykerEco\Zed\Payone\Business\Key\HashGeneratorInterface
465
     */
466
    public function createHashGenerator(): HashGeneratorInterface
467
    {
468
        return new HashGenerator(
469
            $this->createHashProvider()
470
        );
471
    }
472
473
    /**
474
     * @return \SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface
475
     */
476
    public function createUrlHmacGenerator(): HmacGeneratorInterface
477
    {
478
        return new UrlHmacGenerator();
479
    }
480
481
    /**
482
     * @return \SprykerEco\Shared\Payone\Dependency\ModeDetectorInterface
483
     */
484
    public function createModeDetector(): ModeDetectorInterface
485
    {
486
        return new ModeDetector($this->getConfig());
487
    }
488
489
    /**
490
     * @param \Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer $transactionStatusUpdateTransfer
491
     *
492
     * @return \SprykerEco\Zed\Payone\Business\Api\TransactionStatus\TransactionStatusRequest
493
     */
494
    public function createTransactionStatusRequest(PayoneTransactionStatusUpdateTransfer $transactionStatusUpdateTransfer): TransactionStatusRequest
495
    {
496
        return new TransactionStatusRequest($transactionStatusUpdateTransfer->toArray());
497
    }
498
499
    /**
500
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneBaseAuthorizeSenderInterface
501
     */
502
    public function createPayoneBaseAuthorizeSender(): PayoneBaseAuthorizeSenderInterface
503
    {
504
        return new PayoneBaseAuthorizeSender(
505
            $this->createExecutionAdapter(),
506
            $this->getQueryContainer(),
507
            $this->createPaymentMapperReader(),
508
            $this->getStandardParameter(),
509
            $this->createStandartParameterMapper(),
510
        );
511
    }
512
513
    /**
514
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CreditCardPseudoInterface
515
     */
516
    public function createCreditCardPseudo(): CreditCardPseudoInterface
517
    {
518
        return new CreditCardPseudo();
519
    }
520
521
    /**
522
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebitInterface
523
     */
524
    public function createDirectDebit(): DirectDebitInterface
525
    {
526
        return new DirectDebit();
527
    }
528
529
    /**
530
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\InvoiceInterface
531
     */
532
    public function createInvoice(): InvoiceInterface
533
    {
534
        return new Invoice();
535
    }
536
537
    /**
538
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
539
     */
540
    public function createSecurityInvoice(): PaymentMethodMapperInterface
541
    {
542
        return new SecurityInvoice($this->getConfig());
543
    }
544
545
    /**
546
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
547
     */
548
    public function createOnlineBankTransfer(): PaymentMethodMapperInterface
549
    {
550
        return new OnlineBankTransfer();
551
    }
552
553
    /**
554
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
555
     */
556
    public function createEWallet(): PaymentMethodMapperInterface
557
    {
558
        return new EWallet();
559
    }
560
561
    /**
562
     * @param \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToGlossaryFacadeInterface $glossary
563
     *
564
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
565
     */
566
    public function createCashOnDelivery(PayoneToGlossaryFacadeInterface $glossary): PaymentMethodMapperInterface
567
    {
568
        return new CashOnDelivery($glossary);
569
    }
570
571
    /**
572
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
573
     */
574
    public function createPrepayment(): PaymentMethodMapperInterface
575
    {
576
        return new Prepayment();
577
    }
578
579
    /**
580
     * @return \SprykerEco\Zed\Payone\Business\Payment\GenericPaymentMethodMapperInterface
581
     */
582
    public function createGenericPayment(): GenericPaymentMethodMapperInterface
583
    {
584
        return new GenericPayment();
585
    }
586
587
    /**
588
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\KlarnaPaymentMapperInterface
589
     */
590
    public function createKlarnaPaymentMapper(): KlarnaPaymentMapperInterface
591
    {
592
        return new KlarnaPaymentMapper(
593
            $this->getStoreFacade(),
594
            $this->getRequestStack(),
595
            $this->createStoreReader()
596
        );
597
    }
598
599
    /**
600
     * @return \SprykerEco\Zed\Payone\Business\RiskManager\RiskCheckManagerInterface
601
     */
602
    public function createRiskCheckManager(): RiskCheckManagerInterface
603
    {
604
        return new RiskCheckManager(
605
            $this->createRiskCheckMapper(),
606
            $this->createExecutionAdapter(),
607
            $this->createRiskCheckFactory()
608
        );
609
    }
610
611
    /**
612
     * @return \SprykerEco\Zed\Payone\Business\RiskManager\Mapper\RiskCheckMapperInterface
613
     */
614
    public function createRiskCheckMapper(): RiskCheckMapperInterface
615
    {
616
        return new RiskCheckMapper(
617
            $this->createRiskCheckFactory(),
618
            $this->getStandardParameter(),
619
            $this->createModeDetector(),
620
            $this->getConfig()
621
        );
622
    }
623
624
    /**
625
     * @return \SprykerEco\Zed\Payone\Business\RiskManager\Factory\RiskCheckFactoryInterface
626
     */
627
    public function createRiskCheckFactory(): RiskCheckFactoryInterface
628
    {
629
        return new RiskCheckFactory();
630
    }
631
632
    /**
633
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodFilterInterface
634
     */
635
    public function createPaymentMethodFilter(): PaymentMethodFilterInterface
636
    {
637
        return new PaymentMethodFilter($this->getConfig());
638
    }
639
640
    /**
641
     * @return \SprykerEco\Zed\Payone\Business\Order\PayoneOrderItemStatusFinderInterface
642
     */
643
    public function createPayoneOrderItemStatusFinder(): PayoneOrderItemStatusFinderInterface
644
    {
645
        return new PayoneOrderItemStatusFinder($this->getRepository());
646
    }
647
648
    /**
649
     * @return \SprykerEco\Zed\Payone\Business\Distributor\OrderPriceDistributorInterface
650
     */
651
    public function createOrderPriceDistributor(): OrderPriceDistributorInterface
652
    {
653
        return new OrderPriceDistributor();
654
    }
655
656
    /**
657
     * @return \SprykerEco\Zed\Payone\Business\Payment\DataMapper\StandartParameterMapperInterface
658
     */
659
    public function createStandartParameterMapper(): StandartParameterMapperInterface
660
    {
661
        return new StandartParameterMapper($this->createHashGenerator(), $this->createModeDetector());
662
    }
663
664
    /**
665
     * @return \SprykerEco\Zed\Payone\Business\Payment\DataMapper\PayoneRequestProductDataMapperInterface
666
     */
667
    public function createPayoneRequestProductDataMapper(): PayoneRequestProductDataMapperInterface
668
    {
669
        return new PayoneRequestProductDataMapper(
670
            $this->createProductMapper(),
671
            $this->createShipmentMapper(),
672
            $this->createDiscountMapper(),
673
        );
674
    }
675
676
    /**
677
     * @return \SprykerEco\Zed\Payone\Business\Payment\DataMapper\ProductMapperInterface
678
     */
679
    public function createProductMapper(): ProductMapperInterface
680
    {
681
        return new ProductMapper();
682
    }
683
684
    /**
685
     * @return \SprykerEco\Zed\Payone\Business\Payment\DataMapper\ShipmentMapperInterface
686
     */
687
    public function createShipmentMapper(): ShipmentMapperInterface
688
    {
689
        return new ShipmentMapper();
690
    }
691
692
    /**
693
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMapperReaderInterface
694
     */
695
    public function createPaymentMapperReader(): PaymentMapperReaderInterface
696
    {
697
        $paymentMapperReader = new PaymentMapperReader(
698
            $this->createSequenceNumberProvider(),
699
            $this->createUrlHmacGenerator()
700
        );
701
702
        foreach ($this->getAvailablePaymentMethods() as $paymentMethod) {
703
            $paymentMapperReader->registerPaymentMethodMapper($paymentMethod, $this->getStandardParameter());
704
        }
705
706
        return $paymentMapperReader;
707
    }
708
709
    /**
710
     * @return \SprykerEco\Zed\Payone\Business\Payment\DataMapper\DiscountMapperInterface
711
     */
712
    public function createDiscountMapper(): DiscountMapperInterface
713
    {
714
        return new DiscountMapper();
715
    }
716
717
    /**
718
     * @return \SprykerEco\Zed\Payone\Business\Payment\DataMapper\ExpenseMapperInterface
719
     */
720
    public function createExpenseMapper(): ExpenseMapperInterface
721
    {
722
        return new ExpenseMapper();
723
    }
724
725
    /**
726
     * @return \SprykerEco\Zed\Payone\Business\ConditionChecker\RefundCheckerInterface
727
     */
728
    public function createRefundChecker(): RefundCheckerInterface
729
    {
730
        return new RefundChecker($this->getRepository(), $this->createPaymentDataChecker());
731
    }
732
733
    /**
734
     * @return \SprykerEco\Zed\Payone\Business\ConditionChecker\PaymentDataCheckerInterface
735
     */
736
    public function createPaymentDataChecker(): PaymentDataCheckerInterface
737
    {
738
        return new PaymentDataChecker($this->getRepository(), $this->getConfig());
739
    }
740
741
    /**
742
     * @return \SprykerEco\Zed\Payone\Business\Payment\Hook\PostSaveHookInterface
743
     */
744
    public function createPostSaveHook(): PostSaveHookInterface
745
    {
746
        return new PostSaveHook(
747
            $this->getRepository(),
748
            $this->createPaymentMapperReader(),
749
            $this->createPayoneRequestProductDataMapper(),
750
            $this->createPayoneBaseAuthorizeSender()
751
        );
752
    }
753
754
    /**
755
     * @return \SprykerEco\Zed\Payone\Business\Api\Response\Mapper\RefundResponseMapperInterface
756
     */
757
    public function createRefundResponseMapper(): RefundResponseMapperInterface
758
    {
759
        return new RefundResponseMapper();
760
    }
761
762
    /**
763
     * @return \SprykerEco\Zed\Payone\Business\Api\Response\Mapper\AuthorizationResponseMapperInterface
764
     */
765
    public function createAuthorizationResponseMapper(): AuthorizationResponseMapperInterface
766
    {
767
        return new AuthorizationResponseMapper();
768
    }
769
770
    /**
771
     * @return \SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CaptureResponseMapperInterface
772
     */
773
    public function createCaptureResponseMapper(): CaptureResponseMapperInterface
774
    {
775
        return new CaptureResponseMapper();
776
    }
777
778
    /**
779
     * @return \SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CreditCardCheckResponseMapperInterface
780
     */
781
    public function createCreditCardCheckResponseMapper(): CreditCardCheckResponseMapperInterface
782
    {
783
        return new CreditCardCheckResponseMapper();
784
    }
785
786
    /**
787
     * @return \SprykerEco\Zed\Payone\Business\Api\Response\Mapper\DebitResponseMapperInterface
788
     */
789
    public function createDebitResponseMapper(): DebitResponseMapperInterface
790
    {
791
        return new DebitResponseMapper();
792
    }
793
794
    /**
795
     * @return array
796
     */
797
    public function getAvailablePaymentMethods(): array
798
    {
799
        return [
800
            PayoneApiConstants::PAYMENT_METHOD_CREDITCARD_PSEUDO => $this->createCreditCardPseudo(),
801
            PayoneApiConstants::PAYMENT_METHOD_INVOICE => $this->createInvoice(),
802
            PayoneApiConstants::PAYMENT_METHOD_SECURITY_INVOICE => $this->createSecurityInvoice(),
803
            PayoneApiConstants::PAYMENT_METHOD_ONLINE_BANK_TRANSFER => $this->createOnlineBankTransfer(),
804
            PayoneApiConstants::PAYMENT_METHOD_E_WALLET => $this->createEWallet(),
805
            PayoneApiConstants::PAYMENT_METHOD_PREPAYMENT => $this->createPrepayment(),
806
            PayoneApiConstants::PAYMENT_METHOD_DIRECT_DEBIT => $this->createDirectDebit(),
807
            PayoneApiConstants::PAYMENT_METHOD_PAYPAL_EXPRESS_CHECKOUT => $this->createGenericPayment(),
808
            PayoneApiConstants::PAYMENT_METHOD_CASH_ON_DELIVERY => $this->createCashOnDelivery($this->getGlossaryFacade()),
809
            PayoneApiConstants::PAYMENT_METHOD_KLARNA => $this->createKlarnaPaymentMapper(),
810
        ];
811
    }
812
813
    /**
814
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeInterface
815
     */
816
    public function getStoreFacade(): PayoneToStoreFacadeInterface
817
    {
818
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_STORE);
819
    }
820
821
    /**
822
     * @return \SprykerEco\Zed\Payone\Business\Model\StoreReaderInterface
823
     */
824
    public function createStoreReader(): StoreReaderInterface
825
    {
826
        return new StoreReader($this->getStoreFacade());
827
    }
828
829
    /**
830
     * @return \SprykerEco\Zed\Payone\Business\Model\ParametersReaderInterface
831
     */
832
    public function createParametersReader(): ParametersReaderInterface
833
    {
834
        return new ParametersReader(
835
            $this->getStoreFacade(),
836
            $this->getConfig(),
837
        );
838
    }
839
840
    /**
841
     * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer
842
     */
843
    public function getStandardParameter(): PayoneStandardParameterTransfer
844
    {
845
        return $this->createParametersReader()->getRequestStandardParameter();
846
    }
847
848
    /**
849
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToGlossaryFacadeInterface
850
     */
851
    public function getGlossaryFacade(): PayoneToGlossaryFacadeInterface
852
    {
853
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_GLOSSARY);
854
    }
855
856
    /**
857
     * @return \Symfony\Component\HttpFoundation\RequestStack
858
     */
859
    public function getRequestStack(): RequestStack
860
    {
861
        return $this->getProvidedDependency(PayoneDependencyProvider::SERVICE_REQUEST_STACK);
862
    }
863
}
864