1 | <?php |
||
5 | class Venture extends Base |
||
6 | { |
||
7 | /** |
||
8 | * @return \Iris\Interfaces\IrisPartner |
||
9 | */ |
||
10 | 7 | public function getPartnerService() |
|
14 | |||
15 | /** |
||
16 | * @return \Iris\Interfaces\Customer |
||
17 | */ |
||
18 | 2 | public function getCustomerService() |
|
22 | |||
23 | /** |
||
24 | * Create order from partner |
||
25 | * |
||
26 | * @param array $orderData |
||
27 | * @param string $originCode |
||
28 | * @return array returns an array with order_number like: ['order_number' => 123]. |
||
29 | * @throws \Iris\Exceptions\PartnerNotFound |
||
30 | * @throws \Iris\Exceptions\UnableToCreateCustomer |
||
31 | * @throws \Iris\Exceptions\UnableToCreateOrder |
||
32 | * @throws \Iris\Exceptions\UnableToSaveExternalData |
||
33 | */ |
||
34 | 2 | public function createOrder(array $orderData, $originCode) |
|
35 | { |
||
36 | 2 | $partner = $this->getPartnerService()->findByCode($originCode); |
|
37 | |||
38 | 2 | $salesOrder = $this->getOrderMapping()->assign($orderData); |
|
39 | |||
40 | 2 | $salesOrder->setCustomer( |
|
41 | 2 | $this->getCustomerService() |
|
42 | 2 | ->create($salesOrder->getCustomer()) |
|
43 | 2 | ); |
|
44 | |||
45 | try { |
||
46 | 2 | $order = $this->getOrderService()->getOrderByOrderNumberAndPartnerCode( |
|
47 | 2 | $orderData['order_number'], |
|
48 | 2 | $partner->getPartnerCode() |
|
49 | 2 | ); |
|
50 | 1 | $result = array('order_number' => $order->getOrderNr()); |
|
51 | |||
52 | 2 | } catch (\Iris\Exceptions\OrderNotFound $exception) { |
|
53 | 1 | $salesOrder = $this->getOrderService()->save($salesOrder); |
|
54 | 1 | $result = array('order_number' => $salesOrder->getOrderNr()); |
|
55 | } |
||
56 | |||
57 | 2 | return $result; |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * Confirm payment from partner |
||
62 | * |
||
63 | * @param string $orderNr |
||
64 | * @param string $originCode |
||
65 | * @return array returns an array with order_number like: ['order_number' => 123]. |
||
66 | * @throws \Iris\Exceptions\OrderNotFound |
||
67 | * @throws \Iris\Exceptions\PartnerNotFound |
||
68 | * @throws \Iris\Exceptions\UnableToConfirmOrder |
||
69 | */ |
||
70 | 2 | public function confirmPaymentOrder($orderNr, $originCode) |
|
71 | { |
||
72 | 2 | $partner = $this->getPartnerService()->findByCode($originCode); |
|
73 | 2 | $order = $this->getOrderService()->getOrderByOrderNumberAndPartnerCode( |
|
74 | 2 | $orderNr, |
|
75 | 2 | $partner->getPartnerCode() |
|
76 | 2 | ); |
|
77 | 2 | if (!$this->getOrderService()->confirmPayment($order)) { |
|
78 | 1 | throw new \RuntimeException(sprintf('Order number %s can\'t be confirmed', $orderNr)); |
|
79 | } |
||
80 | 1 | return array('order_number' => $order->getOrderNr()); |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * Cancel order from partner |
||
85 | * |
||
86 | * @param string $orderNr |
||
87 | * @param string $originCode |
||
88 | * @return array returns an array with order_number like: ['order_number' => 123]. |
||
89 | * @throws \Iris\Exceptions\OrderNotFound |
||
90 | * @throws \Iris\Exceptions\PartnerNotFound |
||
91 | * @throws \Iris\Exceptions\UnableToCancelOrder |
||
92 | */ |
||
93 | 2 | public function cancelOrder($orderNr, $originCode) |
|
94 | { |
||
95 | 2 | $partner = $this->getPartnerService()->findByCode($originCode); |
|
96 | 2 | $order = $this->getOrderService()->getOrderByOrderNumberAndPartnerCode( |
|
97 | 2 | $orderNr, |
|
98 | 2 | $partner->getPartnerCode() |
|
99 | 2 | ); |
|
100 | 2 | if (!$this->getOrderService()->cancel($order)) { |
|
101 | 1 | throw new \RuntimeException(sprintf('Order number %s can\'t be canceled', $orderNr)); |
|
102 | } |
||
103 | 1 | return array('order_number' => $order->getOrderNr()); |
|
104 | } |
||
105 | |||
106 | /** |
||
107 | * Create products on partner |
||
108 | * |
||
109 | * @param \Iris\Transfer\Catalog\ConfigCollection $products |
||
|
|||
110 | * @param string $partnerCode |
||
111 | * @return bool |
||
112 | * @throws \Iris\Exceptions\RetryMessage |
||
113 | */ |
||
114 | 1 | public function createProductsOnPartner( |
|
115 | \Iris\Transfer\Catalog\ConfigCollection $configCollection, |
||
116 | $partnerCode |
||
117 | ) { |
||
118 | 1 | $this->getVentureApiClient()->createProducts( |
|
119 | 1 | $configCollection, |
|
120 | $partnerCode |
||
121 | 1 | ); |
|
122 | 1 | } |
|
123 | |||
124 | /** |
||
125 | * Update products on partner |
||
126 | * |
||
127 | * @param \Iris\Transfer\Catalog\ConfigCollection $products |
||
128 | * @return bool |
||
129 | * @throws \Iris\Exceptions\RetryMessage |
||
130 | */ |
||
131 | 1 | public function updateProductsOnPartner( |
|
132 | \Iris\Transfer\Catalog\ConfigCollection $configCollection |
||
133 | ) { |
||
134 | 1 | $this->getVentureApiClient()->updateProducts($configCollection); |
|
135 | 1 | } |
|
136 | |||
137 | /** |
||
138 | * Update stock on partner |
||
139 | * |
||
140 | * @param string $skuSimple |
||
141 | * @param int $stock |
||
142 | * @return bool |
||
143 | * @throws \Iris\Exceptions\RetryMessage |
||
144 | */ |
||
145 | 1 | public function updateStockOnPartner($skuSimple, $stock) |
|
149 | |||
150 | /** |
||
151 | * Update price on partner |
||
152 | * |
||
153 | * @param string $skuSimple |
||
154 | * @param float $price |
||
155 | * @param float $specialPrice |
||
156 | * @param string $specialFromDate |
||
157 | * @param string $specialToDate |
||
158 | * @return bool |
||
159 | * @throws \Iris\Exceptions\RetryMessage |
||
160 | */ |
||
161 | 1 | public function updatePriceOnPartner( |
|
176 | |||
177 | /** |
||
178 | * Change order items to shipped status |
||
179 | * |
||
180 | * @param \Iris\Transfer\Tracking\ShippedCollection |
||
181 | * @return bool|\GuzzleHttp\Message\Response |
||
182 | * @throws \Iris\Exceptions\RetryMessage |
||
183 | */ |
||
184 | 1 | public function setStatusToShippedOnPartner( |
|
189 | |||
190 | /** |
||
191 | * Change order items to delivered status |
||
192 | * |
||
193 | * @param \Iris\Transfer\Tracking\DeliveredCollection |
||
194 | * @return bool|\GuzzleHttp\Message\Response |
||
195 | * @throws \Iris\Exceptions\RetryMessage |
||
196 | */ |
||
197 | 1 | public function setStatusToDeliveredOnPartner( |
|
202 | |||
203 | /** |
||
204 | * Change order items canceled status |
||
205 | * |
||
206 | * @param \Iris\Transfer\Tracking\CanceledCollection |
||
207 | * @return bool|\GuzzleHttp\Message\Response |
||
208 | * @throws \Iris\Exceptions\RetryMessage |
||
209 | */ |
||
210 | 1 | public function setStatusToCanceledOnPartner( |
|
215 | |||
216 | /** |
||
217 | * Change order items to failed delivery status |
||
218 | * |
||
219 | * @param \Iris\Transfer\Tracking\FailedDeliveryCollection |
||
220 | * @return bool|\GuzzleHttp\Message\Response |
||
221 | * @throws \Iris\Exceptions\RetryMessage |
||
222 | */ |
||
223 | 1 | public function setStatusToFailedDeliveryOnPartner( |
|
228 | } |
||
229 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.