Completed
Push — master ( 2a18cf...56a686 )
by Oleksandr
14s queued 11s
created

HeidelpayFactory::getYvesConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Yves\Heidelpay;
9
10
use Spryker\Shared\Money\Dependency\Plugin\MoneyPluginInterface;
11
use Spryker\Yves\Kernel\AbstractFactory;
12
use Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
13
use Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface;
14
use SprykerEco\Yves\Heidelpay\Dependency\Client\HeidelpayToCalculationClientInterface;
15
use SprykerEco\Yves\Heidelpay\Dependency\Client\HeidelpayToQuoteClientInterface;
16
use SprykerEco\Yves\Heidelpay\Form\CreditCardSecureSubForm;
17
use SprykerEco\Yves\Heidelpay\Form\DataProvider\CreditCardSecureDataProvider;
18
use SprykerEco\Yves\Heidelpay\Form\DataProvider\EasyCreditDataProvider;
19
use SprykerEco\Yves\Heidelpay\Form\DataProvider\IdealDataProvider;
20
use SprykerEco\Yves\Heidelpay\Form\DataProvider\InvoiceSecuredB2cDataProvider;
21
use SprykerEco\Yves\Heidelpay\Form\DataProvider\PaypalAuthorizeDataProvider;
22
use SprykerEco\Yves\Heidelpay\Form\DataProvider\PaypalDebitDataProvider;
23
use SprykerEco\Yves\Heidelpay\Form\DataProvider\SofortDataProvider;
24
use SprykerEco\Yves\Heidelpay\Form\EasyCreditSubForm;
25
use SprykerEco\Yves\Heidelpay\Form\IdealSubForm;
26
use SprykerEco\Yves\Heidelpay\Form\InvoiceSecuredB2cSubForm;
27
use SprykerEco\Yves\Heidelpay\Form\PaypalAuthorizeSubForm;
28
use SprykerEco\Yves\Heidelpay\Form\PaypalDebitSubForm;
29
use SprykerEco\Yves\Heidelpay\Form\SofortSubForm;
30
use SprykerEco\Yves\Heidelpay\Handler\HeidelpayCreditCardHandler;
31
use SprykerEco\Yves\Heidelpay\Handler\HeidelpayHandler;
32
use SprykerEco\Yves\Heidelpay\Handler\HeidelpayHandlerInterface;
33
use SprykerEco\Yves\Heidelpay\Handler\PaymentFailureHandler;
34
use SprykerEco\Yves\Heidelpay\Handler\PaymentFailureHandlerInterface;
35
use SprykerEco\Yves\Heidelpay\Hydrator\CreditCardPaymentOptionsToQuote;
36
use SprykerEco\Yves\Heidelpay\Hydrator\CreditCardPaymentOptionsToQuoteInterface;
37
use SprykerEco\Yves\Heidelpay\Hydrator\EasyCreditResponseToQuoteHydrator;
38
use SprykerEco\Yves\Heidelpay\Hydrator\EasyCreditResponseToQuoteHydratorInterface;
39
use SprykerEco\Yves\Heidelpay\Hydrator\RegistrationToQuoteHydrator;
40
use SprykerEco\Yves\Heidelpay\Hydrator\RegistrationToQuoteHydratorInterface;
41
use SprykerEco\Yves\Heidelpay\Mapper\EasyCreditResponseToGetParametersMapper;
42
use SprykerEco\Yves\Heidelpay\Mapper\EasyCreditResponseToGetParametersMapperInterface;
43
use SprykerEco\Yves\Heidelpay\Mapper\HeidelpayResponseToIdealAuthorizeForm;
44
use SprykerEco\Yves\Heidelpay\Mapper\HeidelpayResponseToIdealAuthorizeFormInterface;
45
use SprykerEco\Yves\Heidelpay\Processor\HeidelpayPaymentResponseProcessor;
46
use SprykerEco\Yves\Heidelpay\Processor\HeidelpayPaymentResponseProcessorInterface;
47
use SprykerEco\Yves\Heidelpay\Processor\Notification\HeidelpayNotificationProcessor;
48
use SprykerEco\Yves\Heidelpay\Processor\Notification\HeidelpayNotificationProcessorInterface;
49
use SprykerEco\Yves\Heidelpay\Processor\Notification\Mapper\HeidelpayNotificationProcessorMapper;
50
use SprykerEco\Yves\Heidelpay\Processor\Notification\Mapper\HeidelpayNotificationProcessorMapperInterface;
51
52
/**
53
 * @method \SprykerEco\Yves\Heidelpay\HeidelpayConfig getConfig()
54
 * @method \SprykerEco\Client\Heidelpay\HeidelpayClientInterface getClient()
55
 */
56
class HeidelpayFactory extends AbstractFactory
57
{
58
    /**
59
     * @return \SprykerEco\Yves\Heidelpay\Handler\HeidelpayHandlerInterface
60
     */
61
    public function createHeidelpayHandler(): HeidelpayHandlerInterface
62
    {
63
        return new HeidelpayHandler();
64
    }
65
66
    /**
67
     * @return \SprykerEco\Yves\Heidelpay\Handler\HeidelpayHandlerInterface
68
     */
69
    public function createHeidelpayCreditCardHandler(): HeidelpayHandlerInterface
70
    {
71
        return new HeidelpayCreditCardHandler(
72
            $this->getCalculationClient(),
73
            $this->getQuoteClient()
74
        );
75
    }
76
77
    /**
78
     * @return \SprykerEco\Yves\Heidelpay\Handler\PaymentFailureHandlerInterface
79
     */
80
    public function createPaymentFailureHandler(): PaymentFailureHandlerInterface
81
    {
82
        return new PaymentFailureHandler(
83
            $this->getClient(),
84
            $this->getConfig()
85
        );
86
    }
87
88
    /**
89
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
90
     */
91
    public function createSofortForm(): SubFormInterface
92
    {
93
        return new SofortSubForm();
94
    }
95
96
    /**
97
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
98
     */
99
    public function createIdealForm(): SubFormInterface
100
    {
101
        return new IdealSubForm();
102
    }
103
104
    /**
105
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
106
     */
107
    public function createCreditCardSecureForm(): SubFormInterface
108
    {
109
        return new CreditCardSecureSubForm();
110
    }
111
112
    /**
113
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
114
     */
115
    public function createEasyCreditForm(): SubFormInterface
116
    {
117
        return new EasyCreditSubForm();
118
    }
119
120
    /**
121
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
122
     */
123
    public function createPaypalAuthorizeForm(): SubFormInterface
124
    {
125
        return new PaypalAuthorizeSubForm();
126
    }
127
128
    /**
129
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
130
     */
131
    public function createPaypalDebitForm(): SubFormInterface
132
    {
133
        return new PaypalDebitSubForm();
134
    }
135
136
    /**
137
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
138
     */
139
    public function createInvoiceSecuredB2cSubForm(): SubFormInterface
140
    {
141
        return new InvoiceSecuredB2cSubForm();
142
    }
143
144
    /**
145
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
146
     */
147
    public function createSofortFormDataProvider(): StepEngineFormDataProviderInterface
148
    {
149
        return new SofortDataProvider();
150
    }
151
152
    /**
153
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
154
     */
155
    public function createIdealFormDataProvider(): StepEngineFormDataProviderInterface
156
    {
157
        return new IdealDataProvider();
158
    }
159
160
    /**
161
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
162
     */
163
    public function createCreditCardSecureFormDataProvider(): StepEngineFormDataProviderInterface
164
    {
165
        return new CreditCardSecureDataProvider(
166
            $this->createCreditCardPaymentOptionsToQuoteHydrator()
167
        );
168
    }
169
170
    /**
171
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
172
     */
173
    public function createPaypalAuthorizeFormDataProvider(): StepEngineFormDataProviderInterface
174
    {
175
        return new PaypalAuthorizeDataProvider();
176
    }
177
178
    /**
179
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
180
     */
181
    public function createPaypalDebitFormDataProvider(): StepEngineFormDataProviderInterface
182
    {
183
        return new PaypalDebitDataProvider();
184
    }
185
186
    /**
187
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
188
     */
189
    public function createEasyCreditFormDataProvider(): StepEngineFormDataProviderInterface
190
    {
191
        return new EasyCreditDataProvider($this->getConfig());
192
    }
193
194
    /**
195
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
196
     */
197
    public function createInvoiceSecuredB2cDataProvider(): StepEngineFormDataProviderInterface
198
    {
199
        return new InvoiceSecuredB2cDataProvider();
200
    }
201
202
    /**
203
     * @return \SprykerEco\Yves\Heidelpay\Mapper\HeidelpayResponseToIdealAuthorizeFormInterface
204
     */
205
    public function createHeidelpayResponseToIdealAuthorizeFormMapper(): HeidelpayResponseToIdealAuthorizeFormInterface
206
    {
207
        return new HeidelpayResponseToIdealAuthorizeForm();
208
    }
209
210
    /**
211
     * @return \SprykerEco\Yves\Heidelpay\Hydrator\RegistrationToQuoteHydratorInterface
212
     */
213
    public function createCreditCardRegistrationToQuoteHydrator(): RegistrationToQuoteHydratorInterface
214
    {
215
        return new RegistrationToQuoteHydrator(
216
            $this->createHeidelpayCreditCardHandler()
217
        );
218
    }
219
220
    /**
221
     * @return \SprykerEco\Yves\Heidelpay\Hydrator\EasyCreditResponseToQuoteHydratorInterface
222
     */
223
    public function createEasyCreditResponseToQuoteHydrator(): EasyCreditResponseToQuoteHydratorInterface
224
    {
225
        return new EasyCreditResponseToQuoteHydrator($this->getMoneyPlugin());
226
    }
227
228
    /**
229
     * @return \SprykerEco\Yves\Heidelpay\Mapper\EasyCreditResponseToGetParametersMapperInterface
230
     */
231
    public function createEasyCreditResponseToGetParametersMapper(): EasyCreditResponseToGetParametersMapperInterface
232
    {
233
        return new EasyCreditResponseToGetParametersMapper();
234
    }
235
236
    /**
237
     * @return \SprykerEco\Yves\Heidelpay\Hydrator\CreditCardPaymentOptionsToQuoteInterface
238
     */
239
    public function createCreditCardPaymentOptionsToQuoteHydrator(): CreditCardPaymentOptionsToQuoteInterface
240
    {
241
        return new CreditCardPaymentOptionsToQuote($this->getClient());
242
    }
243
244
    /**
245
     * @return \SprykerEco\Yves\Heidelpay\Processor\Notification\HeidelpayNotificationProcessorInterface
246
     */
247
    public function createHeidelpayNotificationProcessor(): HeidelpayNotificationProcessorInterface
248
    {
249
        return new HeidelpayNotificationProcessor(
250
            $this->createHeidelpayNotificationProcessorMapper(),
251
            $this->getClient()
252
        );
253
    }
254
255
    /**
256
     * @return \SprykerEco\Yves\Heidelpay\Processor\Notification\Mapper\HeidelpayNotificationProcessorMapperInterface
257
     */
258
    public function createHeidelpayNotificationProcessorMapper(): HeidelpayNotificationProcessorMapperInterface
259
    {
260
        return new HeidelpayNotificationProcessorMapper();
261
    }
262
263
    /**
264
     * @return \SprykerEco\Yves\Heidelpay\Processor\HeidelpayPaymentResponseProcessorInterface
265
     */
266
    public function createHeidelpayPaymentResponseProcessor(): HeidelpayPaymentResponseProcessorInterface
267
    {
268
        return new HeidelpayPaymentResponseProcessor(
269
            $this->getClient(),
270
            $this->getQuoteClient()
271
        );
272
    }
273
274
    /**
275
     * @return \SprykerEco\Yves\Heidelpay\Dependency\Client\HeidelpayToCalculationClientInterface
276
     */
277
    public function getCalculationClient(): HeidelpayToCalculationClientInterface
278
    {
279
        return $this->getProvidedDependency(HeidelpayDependencyProvider::CLIENT_CALCULATION);
280
    }
281
282
    /**
283
     * @return \Spryker\Shared\Money\Dependency\Plugin\MoneyPluginInterface
284
     */
285
    public function getMoneyPlugin(): MoneyPluginInterface
286
    {
287
        return $this->getProvidedDependency(HeidelpayDependencyProvider::PLUGIN_MONEY);
288
    }
289
290
    /**
291
     * @return \SprykerEco\Yves\Heidelpay\Dependency\Client\HeidelpayToQuoteClientInterface
292
     */
293
    public function getQuoteClient(): HeidelpayToQuoteClientInterface
294
    {
295
        return $this->getProvidedDependency(HeidelpayDependencyProvider::CLIENT_QUOTE);
296
    }
297
}
298