Passed
Push — feature/paypal-express ( be9f92...d19b14 )
by Volodymyr
05:26
created

BraintreeFactory::createPaypalResponseMapper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 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\Braintree;
9
10
use Spryker\Yves\Kernel\AbstractFactory;
11
use SprykerEco\Yves\Braintree\Form\CreditCardSubForm;
12
use SprykerEco\Yves\Braintree\Form\DataProvider\CreditCardDataProvider;
13
use SprykerEco\Yves\Braintree\Form\DataProvider\PayPalDataProvider;
14
use SprykerEco\Yves\Braintree\Form\PayPalSubForm;
15
use SprykerEco\Yves\Braintree\Handler\BraintreeHandler;
16
use SprykerEco\Yves\Braintree\Mapper\PaypalResponse\PaypalResponseMapper;
17
use SprykerEco\Yves\Braintree\Mapper\PaypalResponse\PaypalResponseMapperInterface;
18
use SprykerEco\Yves\Braintree\Processor\PaypalResponseProcessor;
19
use SprykerEco\Yves\Braintree\Processor\PaypalResponseProcessorInterface;
20
21
class BraintreeFactory extends AbstractFactory
22
{
23
    /**
24
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
25
     */
26
    public function createPayPalForm()
27
    {
28
        return new PayPalSubForm();
29
    }
30
31
    /**
32
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
33
     */
34
    public function createCreditCardForm()
35
    {
36
        return new CreditCardSubForm();
37
    }
38
39
    /**
40
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
41
     */
42
    public function createPayPalFormDataProvider()
43
    {
44
        return new PayPalDataProvider();
45
    }
46
47
    /**
48
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
49
     */
50
    public function createCreditCardFormDataProvider()
51
    {
52
        return new CreditCardDataProvider();
53
    }
54
55
    /**
56
     * @return \SprykerEco\Yves\Braintree\Handler\BraintreeHandlerInterface
57
     */
58
    public function createBraintreeHandler()
59
    {
60
        return new BraintreeHandler($this->getCurrencyPlugin());
61
    }
62
63
    /**
64
     * @return \Spryker\Yves\Currency\Plugin\CurrencyPluginInterface
65
     */
66
    public function getCurrencyPlugin()
67
    {
68
        return $this->getProvidedDependency(BraintreeDependencyProvider::PLUGIN_CURRENCY);
69
    }
70
71
    /**
72
     * @return \SprykerEco\Yves\Braintree\Processor\PaypalResponseProcessorInterface
73
     */
74
    public function createResponseProcessor(): PaypalResponseProcessorInterface
75
    {
76
        return new PaypalResponseProcessor(
77
            $this->createPaypalResponseMapper()
78
        );
79
    }
80
81
    /**
82
     * @return \SprykerEco\Yves\Braintree\Mapper\PaypalResponse\PaypalResponseMapperInterface
83
     */
84
    public function createPaypalResponseMapper(): PaypalResponseMapperInterface
85
    {
86
        return new PaypalResponseMapper();
87
    }
88
}
89