Completed
Pull Request — master (#25)
by Andrey
11:08 queued 03:02
created

createAmazonPayDataQuoteInitializer()   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
 * Apache OSL-2
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AmazonPay\Business\Quote;
9
10
use SprykerEco\Zed\AmazonPay\Business\Api\Adapter\AdapterFactoryInterface;
11
use SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToShipmentInterface;
12
13
class QuoteUpdateFactory implements QuoteUpdateFactoryInterface
14
{
15
    /**
16
     * @var \SprykerEco\Zed\AmazonPay\Business\Api\Adapter\AdapterFactoryInterface
17
     */
18
    protected $adapterFactory;
19
20
    /**
21
     * @var \SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToShipmentInterface
22
     */
23
    protected $shipmentFacade;
24
25
    /**
26
     * @param \SprykerEco\Zed\AmazonPay\Business\Api\Adapter\AdapterFactoryInterface $adapterFactory
27
     * @param \SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToShipmentInterface $shipmentFacade
28
     */
29
    public function __construct(
30
        AdapterFactoryInterface $adapterFactory,
31
        AmazonPayToShipmentInterface $shipmentFacade
32
    ) {
33
        $this->adapterFactory = $adapterFactory;
34
        $this->shipmentFacade = $shipmentFacade;
35
    }
36
37
    /**
38
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface
39
     */
40
    public function createShippingAddressQuoteDataUpdater()
41
    {
42
        return new ShippingAddressDataQuoteUpdater(
43
            $this->adapterFactory->createSetOrderReferenceDetailsAmazonpayAdapter()
44
        );
45
    }
46
47
    /**
48
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface
49
     */
50
    public function createQuoteUpdaterCollection()
51
    {
52
        return new QuoteUpdaterCollection(
53
            $this->getQuoteUpdaterPlugins()
54
        );
55
    }
56
57
    /**
58
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface[]
59
     */
60
    protected function getQuoteUpdaterPlugins()
61
    {
62
        return [
63
            $this->createAmazonPayDataQuoteInitializer(),
64
            $this->createGuestCustomerDataQuoteUpdater(),
65
            $this->createShipmentDataQuoteInitializer(),
66
            $this->createPaymentDataQuoteUpdater(),
67
        ];
68
    }
69
70
    /**
71
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface
72
     */
73
    public function createAmazonPayDataQuoteInitializer()
74
    {
75
        return new AmazonpayDataQuoteInitializer();
76
    }
77
78
    /**
79
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface
80
     */
81
    public function createShipmentDataQuoteInitializer()
82
    {
83
        return new ShipmentDataQuoteInitializer();
84
    }
85
86
    /**
87
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface
88
     */
89
    public function createShipmentDataQuoteUpdater()
90
    {
91
        return new ShipmentDataQuoteUpdater(
92
            $this->shipmentFacade
93
        );
94
    }
95
96
    /**
97
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface
98
     */
99
    protected function createGuestCustomerDataQuoteUpdater()
100
    {
101
        return new GuestCustomerDataQuoteUpdater(
102
            $this->adapterFactory->createObtainProfileInformationAdapter()
103
        );
104
    }
105
106
    /**
107
     * @return \SprykerEco\Zed\AmazonPay\Business\Quote\QuoteUpdaterInterface
108
     */
109
    protected function createPaymentDataQuoteUpdater()
110
    {
111
        return new PaymentDataQuoteUpdater();
112
    }
113
}
114