Passed
Pull Request — master (#84)
by Olha
06:07
created

PayoneBusinessFactory::getStoreFacade()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

818
        return $this->getProvidedDependency(/** @scrutinizer ignore-deprecated */ PayoneDependencyProvider::STORE_CONFIG);

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
819
    }
820
821
    /**
822
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeInterface
823
     */
824
    public function getStoreFacade(): PayoneToStoreFacadeInterface
825
    {
826
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_STORE);
827
    }
828
829
    /**
830
     * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer
831
     */
832
    public function getStandardParameter(): PayoneStandardParameterTransfer
833
    {
834
        $storeTransfer = $this->getStoreFacade()->getCurrentStore();
835
836
        if ($this->standardParameter === null) {
837
            $this->standardParameter = $this->getConfig()->getRequestStandardParameter(
838
                current($storeTransfer->getAvailableCurrencyIsoCodes()),
839
                current($storeTransfer->getCountries())
840
            );
841
        }
842
843
        return $this->standardParameter;
844
    }
845
846
    /**
847
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToGlossaryFacadeInterface
848
     */
849
    public function getGlossaryFacade(): PayoneToGlossaryFacadeInterface
850
    {
851
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_GLOSSARY);
852
    }
853
854
    /**
855
     * @return \Symfony\Component\HttpFoundation\RequestStack
856
     */
857
    public function getRequestStack(): RequestStack
858
    {
859
        return $this->getProvidedDependency(PayoneDependencyProvider::SERVICE_REQUEST_STACK);
860
    }
861
}
862