1 | <?php |
||
7 | class Partner extends Base implements PartnerInterface |
||
8 | { |
||
9 | private $mappingClasses; |
||
10 | |||
11 | /** |
||
12 | * {@inheritdoc} |
||
13 | */ |
||
14 | 4 | public function getName() |
|
18 | |||
19 | /** |
||
20 | * Gets Venture service. |
||
21 | * @return \Iris\Interfaces\IrisVenture |
||
22 | */ |
||
23 | 3 | public function getVentureService() |
|
27 | |||
28 | /** |
||
29 | * Gets Stock service. |
||
30 | * @return \Iris\Interfaces\Stock |
||
31 | */ |
||
32 | 2 | public function getStockService() |
|
36 | |||
37 | /** |
||
38 | * Gets Stock service. |
||
39 | * @return \Iris\Interfaces\Catalog |
||
40 | 2 | */ |
|
41 | public function getCatalogService() |
||
45 | |||
46 | |||
47 | //order |
||
48 | /** |
||
49 | 1 | * {@inheritdoc} |
|
50 | */ |
||
51 | 1 | public function isVentureItem(\Iris\Transfer\Sales\Order\Item $item) |
|
58 | 1 | ||
59 | /** |
||
60 | 1 | * {@inheritdoc} |
|
61 | 1 | */ |
|
62 | public function sendOrderToVenture( |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 1 | public function dropReserveAndUpdateStock( |
|
83 | |||
84 | 4 | /** |
|
85 | * {@inheritdoc} |
||
86 | 4 | */ |
|
87 | public function confirmOrderPaidOnVenture( |
||
88 | \Iris\Transfer\Sales\Order $order, |
||
89 | \Iris\Transfer\Venture $venture |
||
90 | ) { |
||
91 | return $this->getPartnerApiClient() |
||
92 | 1 | ->confirmPaymentOnVenture( |
|
93 | $venture->getVentureCode(), |
||
94 | 1 | $order->getOrderNr() |
|
95 | ); |
||
96 | 1 | } |
|
97 | 1 | ||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function cancelOrderOnVenture( |
||
111 | |||
112 | 1 | /** |
|
113 | * {@inheritdoc} |
||
114 | 1 | */ |
|
115 | 1 | public function cancelOrderFromVenture($orderNr, $ventureCode) |
|
116 | { |
||
117 | |||
118 | $order = $this->getOrderService() |
||
119 | ->getOrderByOrderNumberAndVentureCode($orderNr, $ventureCode); |
||
120 | |||
121 | 1 | $this->getOrderService()->cancelOrderFromVenture($order); |
|
122 | return ['order_number' => $order->getOrderNr()]; |
||
123 | 1 | } |
|
124 | 1 | ||
125 | 1 | /** |
|
126 | 1 | * {@inheritdoc} |
|
127 | 1 | */ |
|
128 | 1 | public function bindVentureOrder($orderNr, $ventureCode, $ventureorderNr) |
|
129 | 1 | { |
|
130 | $this->getVentureService() |
||
131 | ->bindPartnerOrderWithVentureOrder( |
||
132 | $orderNr, |
||
133 | $ventureCode, |
||
134 | $ventureOrderNr |
||
135 | 2 | ); |
|
136 | } |
||
137 | 2 | ||
138 | /** |
||
139 | * Gets an specific mapping classs |
||
140 | * |
||
141 | * @param string $mappingName |
||
142 | */ |
||
143 | public function getMapping($mappingName) |
||
144 | { |
||
145 | if (!$this->mappingClasses[$mappingName]) { |
||
146 | $mappingClass = '\Iris\Mapping\\' . $mappingName; |
||
147 | $this->mappingClasses[$mappingName] = $mappingClass::getInstance(); |
||
148 | |||
149 | } |
||
150 | return $this->mappingClasses[$mappingName]; |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * Set an specific mapping classs |
||
155 | * |
||
156 | * @param string $mappingName |
||
157 | * @param $mappingClass |
||
158 | * @return \Iris\SaleWrapper\Partner |
||
159 | */ |
||
160 | public function setMapping($mappingName, $mappingClass) |
||
165 | |||
166 | //tracking |
||
167 | /** |
||
168 | * {@inheritdoc} |
||
169 | */ |
||
170 | public function setOrderStatusToShippedFromVenture(array $orderData) |
||
171 | { |
||
172 | $order = $this->getMapping('Order')->assign($orderData); |
||
173 | |||
174 | foreach ($order->getItemCollection() as $item) { |
||
175 | if (!$item->getTrackingCode()) { |
||
176 | $item->setTrackingCode(md5($item->getTrackingUrl())); |
||
177 | } |
||
178 | } |
||
179 | |||
180 | return $this->getOrderService()->shippedByVenture($order); |
||
181 | } |
||
182 | |||
183 | /** |
||
184 | * {@inheritdoc} |
||
185 | */ |
||
186 | public function setOrderStatusToDeliveredFromVenture(array $orderData, $ventureCode) |
||
187 | { |
||
188 | $order = $this->getMapping('Order')->assign($orderData); |
||
189 | return $this->getOrderService()->deliveredByVenture($order, $ventureCode); |
||
190 | } |
||
191 | |||
192 | //products |
||
193 | /** |
||
194 | * {@inheritdoc} |
||
195 | */ |
||
196 | public function updatePriceFromVenture(array $productsData, $ventureCode) |
||
197 | { |
||
198 | $configCollection = $this->getMapping('ConfigCollection')->assign($productsData); |
||
199 | return $this->getCatalogService()->updatePrice($configCollection); |
||
200 | } |
||
201 | |||
202 | /** |
||
203 | * {@inheritdoc} |
||
204 | */ |
||
205 | public function updateStockFromVenture(array $productsData, $ventureCode) |
||
206 | { |
||
207 | $configCollection = $this->getMapping('SimpleCollection')->assign($productsData); |
||
208 | return $this->getStockService()->updateAbsoluteStock($configCollection); |
||
209 | } |
||
210 | |||
211 | /** |
||
212 | * {@inheritdoc} |
||
213 | */ |
||
214 | public function createProductsFromVenture(array $productsData, $ventureCode) |
||
215 | { |
||
216 | $configCollection = \Iris\Mapping\ConfigCollection::assign($productsData); |
||
217 | return $this->getCatalogService()->createProducts($configCollection, $ventureCode); |
||
218 | } |
||
219 | |||
220 | /** |
||
221 | * {@inheritdoc} |
||
222 | */ |
||
223 | public function sendProductCreationConfirmationToVenture( |
||
234 | |||
235 | /** |
||
236 | * {@inheritdoc} |
||
237 | */ |
||
238 | public function updateProductsFromVenture(array $productsData, $ventureCode) |
||
239 | { |
||
240 | $configCollection = \Iris\Mapping\ConfigCollection::assign($productsData); |
||
241 | return $this->getCatalogService()->updateProducts($configCollection, $ventureCode); |
||
242 | } |
||
243 | |||
244 | /** |
||
245 | * {@inheritdoc} |
||
246 | */ |
||
247 | public function updateProductImagesFromVenture(array $productsData, $ventureCode) |
||
252 | |||
253 | /** |
||
254 | * {@inheritdoc} |
||
255 | */ |
||
256 | public function shippedOrder( |
||
277 | |||
278 | /** |
||
279 | * {@inheritdoc} |
||
280 | */ |
||
281 | public function setOrderStatusToDeliveryFailedFromVenture( |
||
289 | |||
290 | /** |
||
291 | * {@inheritdoc} |
||
292 | */ |
||
293 | public function isInvalidOrder(\Iris\Transfer\Sales\Order $order) |
||
297 | } |
||
298 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: