Passed
Pull Request — master (#84)
by Yaroslav
05:25
created

PayoneBusinessFactory::createEWallet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
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\Shared\Kernel\Store;
13
use Spryker\Zed\Kernel\Business\AbstractBusinessFactory;
14
use SprykerEco\Shared\Payone\Dependency\HashInterface;
15
use SprykerEco\Shared\Payone\Dependency\ModeDetectorInterface;
16
use SprykerEco\Shared\Payone\PayoneApiConstants;
17
use SprykerEco\Zed\Payone\Business\Api\Adapter\AdapterInterface;
18
use SprykerEco\Zed\Payone\Business\Api\Adapter\Http\Guzzle;
19
use SprykerEco\Zed\Payone\Business\Api\Log\ApiCallLogWriter;
20
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\AuthorizationResponseMapper;
21
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\AuthorizationResponseMapperInterface;
22
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CaptureResponseMapper;
23
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CaptureResponseMapperInterface;
24
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CreditCardCheckResponseMapper;
25
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\CreditCardCheckResponseMapperInterface;
26
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\DebitResponseMapper;
27
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\DebitResponseMapperInterface;
28
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\RefundResponseMapper;
29
use SprykerEco\Zed\Payone\Business\Api\Response\Mapper\RefundResponseMapperInterface;
30
use SprykerEco\Zed\Payone\Business\Api\TransactionStatus\TransactionStatusRequest;
31
use SprykerEco\Zed\Payone\Business\ApiLog\ApiLogFinder;
32
use SprykerEco\Zed\Payone\Business\ApiLog\ApiLogFinderInterface;
33
use SprykerEco\Zed\Payone\Business\ConditionChecker\PaymentDataChecker;
34
use SprykerEco\Zed\Payone\Business\ConditionChecker\PaymentDataCheckerInterface;
35
use SprykerEco\Zed\Payone\Business\ConditionChecker\RefundChecker;
36
use SprykerEco\Zed\Payone\Business\ConditionChecker\RefundCheckerInterface;
37
use SprykerEco\Zed\Payone\Business\Distributor\OrderPriceDistributor;
38
use SprykerEco\Zed\Payone\Business\Distributor\OrderPriceDistributorInterface;
39
use SprykerEco\Zed\Payone\Business\Key\HashGenerator;
40
use SprykerEco\Zed\Payone\Business\Key\HashGeneratorInterface;
41
use SprykerEco\Zed\Payone\Business\Key\HashProvider;
42
use SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface;
43
use SprykerEco\Zed\Payone\Business\Key\UrlHmacGenerator;
44
use SprykerEco\Zed\Payone\Business\Mode\ModeDetector;
45
use SprykerEco\Zed\Payone\Business\Model\ParametersReader;
46
use SprykerEco\Zed\Payone\Business\Model\ParametersReaderInterface;
47
use SprykerEco\Zed\Payone\Business\Order\OrderManager;
48
use SprykerEco\Zed\Payone\Business\Order\OrderManagerInterface;
49
use SprykerEco\Zed\Payone\Business\Order\PayoneOrderItemStatusFinder;
50
use SprykerEco\Zed\Payone\Business\Order\PayoneOrderItemStatusFinderInterface;
51
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneBankAccountChecker;
52
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneBankAccountCheckerInterface;
53
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneCreditCardChecker;
54
use SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneCreditCardCheckerInterface;
55
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\DiscountMapper;
56
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\DiscountMapperInterface;
57
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ExpenseMapper;
58
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ExpenseMapperInterface;
59
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\PayoneRequestProductDataMapper;
60
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\PayoneRequestProductDataMapperInterface;
61
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ProductMapper;
62
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ProductMapperInterface;
63
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ShipmentMapper;
64
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\ShipmentMapperInterface;
65
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\StandartParameterMapper;
66
use SprykerEco\Zed\Payone\Business\Payment\DataMapper\StandartParameterMapperInterface;
67
use SprykerEco\Zed\Payone\Business\Payment\GenericPaymentMethodMapperInterface;
68
use SprykerEco\Zed\Payone\Business\Payment\Hook\PostSaveHook;
69
use SprykerEco\Zed\Payone\Business\Payment\Hook\PostSaveHookInterface;
70
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CashOnDelivery;
71
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CreditCardPseudo;
72
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CreditCardPseudoInterface;
73
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebit;
74
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebitInterface;
75
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\EWallet;
76
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\GenericPayment;
77
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\Invoice;
78
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\InvoiceInterface;
79
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\KlarnaPaymentMapper;
80
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\KlarnaPaymentMapperInterface;
81
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\OnlineBankTransfer;
82
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\Prepayment;
83
use SprykerEco\Zed\Payone\Business\Payment\MethodMapper\SecurityInvoice;
84
use SprykerEco\Zed\Payone\Business\Payment\PaymentMapperReader;
85
use SprykerEco\Zed\Payone\Business\Payment\PaymentMapperReaderInterface;
86
use SprykerEco\Zed\Payone\Business\Payment\PaymentMethodFilter;
87
use SprykerEco\Zed\Payone\Business\Payment\PaymentMethodFilterInterface;
88
use SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface;
89
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneFileReader;
90
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneFileReaderInterface;
91
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneInvoiceReader;
92
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneInvoiceReaderInterface;
93
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayonePaypalExpressCheckoutDetailsReader;
94
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayonePaypalExpressCheckoutDetailsReaderInterface;
95
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneSecurityInvoiceReader;
96
use SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneSecurityInvoiceReaderInterface;
97
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneAuthorizeRequestSender;
98
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneAuthorizeRequestSenderInterface;
99
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneBaseAuthorizeSender;
100
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneBaseAuthorizeSenderInterface;
101
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneCaptureRequestSender;
102
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneCaptureRequestSenderInterface;
103
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneDebitRequestSender;
104
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneDebitRequestSenderInterface;
105
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneGenericRequestMethodSender;
106
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneGenericRequestMethodSenderInterface;
107
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneInitPaypalExpressCheckoutMethodSender;
108
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneInitPaypalExpressCheckoutMethodSenderInterface;
109
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneKlarnaStartSessionMethodSender;
110
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneKlarnaStartSessionMethodSenderInterface;
111
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneManageMandateMethodSender;
112
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneManageMandateMethodSenderInterface;
113
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialCaptureRequestSender;
114
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialCaptureRequestSenderInterface;
115
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialRefundRequestSender;
116
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialRefundRequestSenderInterface;
117
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePreAuthorizeRequestSender;
118
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePreAuthorizeRequestSenderInterface;
119
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneRefundRequestSender;
120
use SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneRefundRequestSenderInterface;
121
use SprykerEco\Zed\Payone\Business\RiskManager\Factory\RiskCheckFactory;
122
use SprykerEco\Zed\Payone\Business\RiskManager\Factory\RiskCheckFactoryInterface;
123
use SprykerEco\Zed\Payone\Business\RiskManager\Mapper\RiskCheckMapper;
124
use SprykerEco\Zed\Payone\Business\RiskManager\Mapper\RiskCheckMapperInterface;
125
use SprykerEco\Zed\Payone\Business\RiskManager\RiskCheckManager;
126
use SprykerEco\Zed\Payone\Business\RiskManager\RiskCheckManagerInterface;
127
use SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProvider;
128
use SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface;
129
use SprykerEco\Zed\Payone\Business\TransactionStatus\TransactionStatusUpdateManager;
130
use SprykerEco\Zed\Payone\Business\TransactionStatus\TransactionStatusUpdateManagerInterface;
131
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToGlossaryFacadeInterface;
132
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeInterface;
133
use SprykerEco\Zed\Payone\PayoneDependencyProvider;
134
use Symfony\Component\HttpFoundation\RequestStack;
135
136
/**
137
 * @method \SprykerEco\Zed\Payone\PayoneConfig getConfig()
138
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneQueryContainerInterface getQueryContainer()
139
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneRepositoryInterface getRepository()
140
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneEntityManagerInterface getEntityManager()
141
 */
142
class PayoneBusinessFactory extends AbstractBusinessFactory
143
{
144
    /**
145
     * @var \Generated\Shared\Transfer\PayoneStandardParameterTransfer
146
     */
147
    private $standardParameter;
0 ignored issues
show
introduced by
The private property $standardParameter is not used, and could be removed.
Loading history...
148
149
    /**
150
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePreAuthorizeRequestSenderInterface
151
     */
152
    public function createPayonePreAuthorizeRequestSender(): PayonePreAuthorizeRequestSenderInterface
153
    {
154
        return new PayonePreAuthorizeRequestSender(
155
            $this->getQueryContainer(),
156
            $this->createPaymentMapperReader(),
157
            $this->createPayoneBaseAuthorizeSender(),
158
            $this->createAuthorizationResponseMapper(),
159
        );
160
    }
161
162
    /**
163
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneAuthorizeRequestSenderInterface
164
     */
165
    public function createPayoneAuthorizeRequestSender(): PayoneAuthorizeRequestSenderInterface
166
    {
167
        return new PayoneAuthorizeRequestSender(
168
            $this->getQueryContainer(),
169
            $this->createPaymentMapperReader(),
170
            $this->createPayoneRequestProductDataMapper(),
171
            $this->createPayoneBaseAuthorizeSender(),
172
            $this->createAuthorizationResponseMapper(),
173
        );
174
    }
175
176
    /**
177
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneCaptureRequestSenderInterface
178
     */
179
    public function createPayoneCaptureRequestSender(): PayoneCaptureRequestSenderInterface
180
    {
181
        return new PayoneCaptureRequestSender(
182
            $this->createExecutionAdapter(),
183
            $this->getQueryContainer(),
184
            $this->createPaymentMapperReader(),
185
            $this->getStandardParameter(),
186
            $this->createOrderPriceDistributor(),
187
            $this->createStandartParameterMapper(),
188
            $this->createPayoneRequestProductDataMapper(),
189
            $this->createExpenseMapper(),
190
            $this->createCaptureResponseMapper(),
191
        );
192
    }
193
194
    /**
195
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialCaptureRequestSenderInterface
196
     */
197
    public function createPayonePartialCaptureRequestSender(): PayonePartialCaptureRequestSenderInterface
198
    {
199
        return new PayonePartialCaptureRequestSender(
200
            $this->createExecutionAdapter(),
201
            $this->getQueryContainer(),
202
            $this->createPaymentMapperReader(),
203
            $this->createExpenseMapper(),
204
            $this->getStandardParameter(),
205
            $this->getRepository(),
206
            $this->getEntityManager(),
207
            $this->createOrderPriceDistributor(),
208
            $this->createStandartParameterMapper(),
209
            $this->createShipmentMapper(),
210
            $this->createCaptureResponseMapper(),
211
        );
212
    }
213
214
    /**
215
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneDebitRequestSenderInterface
216
     */
217
    public function createPayoneDebitRequestSender(): PayoneDebitRequestSenderInterface
218
    {
219
        return new PayoneDebitRequestSender(
220
            $this->createExecutionAdapter(),
221
            $this->getQueryContainer(),
222
            $this->getStandardParameter(),
223
            $this->createStandartParameterMapper(),
224
            $this->createPaymentMapperReader(),
225
            $this->createDebitResponseMapper(),
226
        );
227
    }
228
229
    /**
230
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneRefundRequestSenderInterface
231
     */
232
    public function createPayoneRefundRequestSender(): PayoneRefundRequestSenderInterface
233
    {
234
        return new PayoneRefundRequestSender(
235
            $this->createExecutionAdapter(),
236
            $this->getQueryContainer(),
237
            $this->createPaymentMapperReader(),
238
            $this->getStandardParameter(),
239
            $this->createOrderPriceDistributor(),
240
            $this->createStandartParameterMapper(),
241
            $this->createPayoneRequestProductDataMapper(),
242
            $this->createRefundResponseMapper(),
243
        );
244
    }
245
246
    /**
247
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayonePartialRefundRequestSenderInterface
248
     */
249
    public function createPayonePartialRefundRequestSender(): PayonePartialRefundRequestSenderInterface
250
    {
251
        return new PayonePartialRefundRequestSender(
252
            $this->createExecutionAdapter(),
253
            $this->getQueryContainer(),
254
            $this->createPaymentMapperReader(),
255
            $this->getStandardParameter(),
256
            $this->getRepository(),
257
            $this->getEntityManager(),
258
            $this->createStandartParameterMapper(),
259
            $this->createRefundResponseMapper(),
260
        );
261
    }
262
263
    /**
264
     * @return \SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneBankAccountCheckerInterface
265
     */
266
    public function createPayoneBankAccountChecker(): PayoneBankAccountCheckerInterface
267
    {
268
        return new PayoneBankAccountChecker(
269
            $this->createExecutionAdapter(),
270
            $this->createPaymentMapperReader(),
271
            $this->getStandardParameter(),
272
            $this->createStandartParameterMapper(),
273
        );
274
    }
275
276
    /**
277
     * @return \SprykerEco\Zed\Payone\Business\Payment\Checker\PayoneCreditCardCheckerInterface
278
     */
279
    public function createPayoneCreditCardChecker(): PayoneCreditCardCheckerInterface
280
    {
281
        return new PayoneCreditCardChecker(
282
            $this->createExecutionAdapter(),
283
            $this->getStandardParameter(),
284
            $this->createStandartParameterMapper(),
285
            $this->createPaymentMapperReader(),
286
            $this->createCreditCardCheckResponseMapper(),
287
        );
288
    }
289
290
    /**
291
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneManageMandateMethodSenderInterface
292
     */
293
    public function createPayoneManageMandateMethodSender(): PayoneManageMandateMethodSenderInterface
294
    {
295
        return new PayoneManageMandateMethodSender(
296
            $this->createExecutionAdapter(),
297
            $this->getStandardParameter(),
298
            $this->createStandartParameterMapper(),
299
            $this->createPaymentMapperReader(),
300
        );
301
    }
302
303
    /**
304
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneFileReaderInterface
305
     */
306
    public function createPayoneFileReader(): PayoneFileReaderInterface
307
    {
308
        return new PayoneFileReader(
309
            $this->createExecutionAdapter(),
310
            $this->getQueryContainer(),
311
            $this->getStandardParameter(),
312
            $this->createStandartParameterMapper(),
313
            $this->createPaymentMapperReader(),
314
        );
315
    }
316
317
    /**
318
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneInvoiceReaderInterface
319
     */
320
    public function createPayoneInvoiceReader(): PayoneInvoiceReaderInterface
321
    {
322
        return new PayoneInvoiceReader(
323
            $this->createExecutionAdapter(),
324
            $this->getQueryContainer(),
325
            $this->getStandardParameter(),
326
            $this->createStandartParameterMapper(),
327
            $this->createPaymentMapperReader(),
328
        );
329
    }
330
331
    /**
332
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayoneSecurityInvoiceReaderInterface
333
     */
334
    public function createPayoneSecurityInvoiceReader(): PayoneSecurityInvoiceReaderInterface
335
    {
336
        return new PayoneSecurityInvoiceReader(
337
            $this->createExecutionAdapter(),
338
            $this->getQueryContainer(),
339
            $this->getStandardParameter(),
340
            $this->createStandartParameterMapper(),
341
            $this->createPaymentMapperReader(),
342
        );
343
    }
344
345
    /**
346
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneInitPaypalExpressCheckoutMethodSenderInterface
347
     */
348
    public function createPayoneInitPaypalExpressCheckoutMethodSender(): PayoneInitPaypalExpressCheckoutMethodSenderInterface
349
    {
350
        return new PayoneInitPaypalExpressCheckoutMethodSender(
351
            $this->createPaymentMapperReader(),
352
            $this->createPayoneGenericRequestMethodSender(),
353
        );
354
    }
355
356
    /**
357
     * @return \SprykerEco\Zed\Payone\Business\Payment\Reader\PayonePaypalExpressCheckoutDetailsReaderInterface
358
     */
359
    public function createPayonePaypalExpressCheckoutDetailsReader(): PayonePaypalExpressCheckoutDetailsReaderInterface
360
    {
361
        return new PayonePaypalExpressCheckoutDetailsReader(
362
            $this->createPaymentMapperReader(),
363
            $this->createPayoneGenericRequestMethodSender()
364
        );
365
    }
366
367
    /**
368
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneGenericRequestMethodSenderInterface
369
     */
370
    public function createPayoneGenericRequestMethodSender(): PayoneGenericRequestMethodSenderInterface
371
    {
372
        return new PayoneGenericRequestMethodSender(
373
            $this->createExecutionAdapter(),
374
            $this->getStandardParameter(),
375
            $this->createStandartParameterMapper(),
376
        );
377
    }
378
379
    /**
380
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneKlarnaStartSessionMethodSenderInterface
381
     */
382
    public function createPayoneKlarnaStartSessionMethodSender(): PayoneKlarnaStartSessionMethodSenderInterface
383
    {
384
        return new PayoneKlarnaStartSessionMethodSender(
385
            $this->createExecutionAdapter(),
386
            $this->createStandartParameterMapper(),
387
            $this->createPayoneRequestProductDataMapper(),
388
            $this->createKlarnaPaymentMapper(),
389
            $this->getStandardParameter(),
390
            $this->createSequenceNumberProvider(),
391
            $this->createUrlHmacGenerator(),
392
        );
393
    }
394
395
    /**
396
     * @return \SprykerEco\Zed\Payone\Business\Order\OrderManagerInterface
397
     */
398
    public function createOrderManager(): OrderManagerInterface
399
    {
400
        return new OrderManager($this->getConfig(), $this->getEntityManager());
401
    }
402
403
    /**
404
     * @return \SprykerEco\Zed\Payone\Business\TransactionStatus\TransactionStatusUpdateManagerInterface
405
     */
406
    public function createTransactionStatusManager(): TransactionStatusUpdateManagerInterface
407
    {
408
        return new TransactionStatusUpdateManager(
409
            $this->getQueryContainer(),
410
            $this->getStandardParameter(),
411
            $this->createHashGenerator()
412
        );
413
    }
414
415
    /**
416
     * @return \SprykerEco\Zed\Payone\Business\ApiLog\ApiLogFinderInterface
417
     */
418
    public function createApiLogFinder(): ApiLogFinderInterface
419
    {
420
        return new ApiLogFinder(
421
            $this->getQueryContainer()
422
        );
423
    }
424
425
    /**
426
     * @return \SprykerEco\Zed\Payone\Business\Api\Adapter\AdapterInterface
427
     */
428
    public function createExecutionAdapter(): AdapterInterface
429
    {
430
        return new Guzzle(
431
            $this->getStandardParameter()->getPaymentGatewayUrl(),
432
            $this->createApiCallLogWriter()
433
        );
434
    }
435
436
    /**
437
     * @return \SprykerEco\Zed\Payone\Business\Api\Log\ApiCallLogWriter
438
     */
439
    public function createApiCallLogWriter(): ApiCallLogWriter
440
    {
441
        return new ApiCallLogWriter(
442
            $this->getQueryContainer()
443
        );
444
    }
445
446
    /**
447
     * @return \SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface
448
     */
449
    public function createSequenceNumberProvider(): SequenceNumberProviderInterface
450
    {
451
        $defaultEmptySequenceNumber = $this->getConfig()->getEmptySequenceNumber();
452
453
        return new SequenceNumberProvider(
454
            $this->getQueryContainer(),
455
            $defaultEmptySequenceNumber
456
        );
457
    }
458
459
    /**
460
     * @return \SprykerEco\Shared\Payone\Dependency\HashInterface
461
     */
462
    public function createHashProvider(): HashInterface
463
    {
464
        return new HashProvider();
465
    }
466
467
    /**
468
     * @return \SprykerEco\Zed\Payone\Business\Key\HashGeneratorInterface
469
     */
470
    public function createHashGenerator(): HashGeneratorInterface
471
    {
472
        return new HashGenerator(
473
            $this->createHashProvider()
474
        );
475
    }
476
477
    /**
478
     * @return \SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface
479
     */
480
    public function createUrlHmacGenerator(): HmacGeneratorInterface
481
    {
482
        return new UrlHmacGenerator();
483
    }
484
485
    /**
486
     * @return \SprykerEco\Shared\Payone\Dependency\ModeDetectorInterface
487
     */
488
    public function createModeDetector(): ModeDetectorInterface
489
    {
490
        return new ModeDetector($this->getConfig());
491
    }
492
493
    /**
494
     * @param \Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer $transactionStatusUpdateTransfer
495
     *
496
     * @return \SprykerEco\Zed\Payone\Business\Api\TransactionStatus\TransactionStatusRequest
497
     */
498
    public function createTransactionStatusRequest(PayoneTransactionStatusUpdateTransfer $transactionStatusUpdateTransfer): TransactionStatusRequest
499
    {
500
        return new TransactionStatusRequest($transactionStatusUpdateTransfer->toArray());
501
    }
502
503
    /**
504
     * @return \SprykerEco\Zed\Payone\Business\Payment\RequestSender\PayoneBaseAuthorizeSenderInterface
505
     */
506
    public function createPayoneBaseAuthorizeSender(): PayoneBaseAuthorizeSenderInterface
507
    {
508
        return new PayoneBaseAuthorizeSender(
509
            $this->createExecutionAdapter(),
510
            $this->getQueryContainer(),
511
            $this->createPaymentMapperReader(),
512
            $this->getStandardParameter(),
513
            $this->createStandartParameterMapper(),
514
        );
515
    }
516
517
    /**
518
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\CreditCardPseudoInterface
519
     */
520
    public function createCreditCardPseudo(): CreditCardPseudoInterface
521
    {
522
        return new CreditCardPseudo();
523
    }
524
525
    /**
526
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebitInterface
527
     */
528
    public function createDirectDebit(): DirectDebitInterface
529
    {
530
        return new DirectDebit();
531
    }
532
533
    /**
534
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\InvoiceInterface
535
     */
536
    public function createInvoice(): InvoiceInterface
537
    {
538
        return new Invoice();
539
    }
540
541
    /**
542
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
543
     */
544
    public function createSecurityInvoice(): PaymentMethodMapperInterface
545
    {
546
        return new SecurityInvoice($this->getConfig());
547
    }
548
549
    /**
550
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
551
     */
552
    public function createOnlineBankTransfer(): PaymentMethodMapperInterface
553
    {
554
        return new OnlineBankTransfer();
555
    }
556
557
    /**
558
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
559
     */
560
    public function createEWallet(): PaymentMethodMapperInterface
561
    {
562
        return new EWallet();
563
    }
564
565
    /**
566
     * @param \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToGlossaryFacadeInterface $glossary
567
     *
568
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
569
     */
570
    public function createCashOnDelivery(PayoneToGlossaryFacadeInterface $glossary): PaymentMethodMapperInterface
571
    {
572
        return new CashOnDelivery($glossary);
573
    }
574
575
    /**
576
     * @return \SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface
577
     */
578
    public function createPrepayment(): PaymentMethodMapperInterface
579
    {
580
        return new Prepayment();
581
    }
582
583
    /**
584
     * @return \SprykerEco\Zed\Payone\Business\Payment\GenericPaymentMethodMapperInterface
585
     */
586
    public function createGenericPayment(): GenericPaymentMethodMapperInterface
587
    {
588
        return new GenericPayment();
589
    }
590
591
    /**
592
     * @return \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\KlarnaPaymentMapperInterface
593
     */
594
    public function createKlarnaPaymentMapper(): KlarnaPaymentMapperInterface
595
    {
596
        return new KlarnaPaymentMapper($this->getStoreFacade(), $this->getRequestStack());
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\ParametersReaderInterface
823
     */
824
    public function createParametersReader(): ParametersReaderInterface
825
    {
826
        return new ParametersReader(
827
            $this->getStoreFacade(),
828
            $this->getConfig(),
829
        );
830
    }
831
832
    /**
833
     * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer
834
     */
835
    public function getStandardParameter(): PayoneStandardParameterTransfer
836
    {
837
        return $this->createParametersReader()->getRequestStandardParameter();
838
    }
839
840
    /**
841
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToGlossaryFacadeInterface
842
     */
843
    public function getGlossaryFacade(): PayoneToGlossaryFacadeInterface
844
    {
845
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_GLOSSARY);
846
    }
847
848
    /**
849
     * @return \Symfony\Component\HttpFoundation\RequestStack
850
     */
851
    public function getRequestStack(): RequestStack
852
    {
853
        return $this->getProvidedDependency(PayoneDependencyProvider::SERVICE_REQUEST_STACK);
854
    }
855
}
856