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
|
|
|
|