| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Iris\Api; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | class VentureClient extends BaseClient | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |      * Create products on partner | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |      * @param \Iris\Transfer\Catalog\ConfigCollection $products | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |      * @param string $partnerCode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |      * @return bool|\GuzzleHttp\Message\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 | 2 |  |     public function createProducts( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |         \Iris\Transfer\Catalog\ConfigCollection $products, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |         $partnerCode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 | 2 |  |         $response = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 | 2 |  |         $url = 'api/' . $this->getVersion() . '/' . $partnerCode . '/product'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 | 2 |  |         $body = $products->toSimpleArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 2 |  |             $response = $this->create($url, $body); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 1 |  |             $this->throwException($e, 'Unable to create products on partner'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 1 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * Update products on partner | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * @param \Iris\Transfer\Catalog\ConfigCollection $products | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * @return bool|\GuzzleHttp\Message\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 2 |  |     public function updateProducts(\Iris\Transfer\Catalog\ConfigCollection $products) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 | 2 |  |         $response = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 2 |  |         $url = 'api/' . $this->getVersion() . '/product'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 2 |  |         $body = $products->toSimpleArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 | 2 |  |             $response = $this->update($url, $body); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 1 |  |             $this->throwException($e, 'Unable to update products on partner'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 1 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * Inform partner to update stock | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      * @param string $sku | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * @param integer $quantity | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 2 |  |     public function updateStock($sku, $quantity) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 2 |  |         $response = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 2 |  |         $url = 'api/' . $this->getVersion() . '/product/' . $sku . '/stock'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 2 |  |         $body = ['quantity' => (int) $quantity]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 2 |  |             $response = $this->update($url, $body); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 1 |  |             $this->throwException( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 1 |  |                 $e, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 1 |  |                 'Unable to update stock on partner', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 1 |  |                 ['Sku' => $sku, 'Quantity' => $quantity] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 | 1 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 1 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      * Inform the partner a price update | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      * @param string $sku | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * @param float $price | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * @param float $specialPrice | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * @param string $specialFromDate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      * @param string $specialToDate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * @return bool | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 87 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 88 | 2 |  |     public function updatePrice($sku, $price, $specialPrice, $specialFromDate, $specialToDate) | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 90 | 2 |  |         $response = false; | 
            
                                                                        
                            
            
                                    
            
            
                | 91 | 2 |  |         $url = 'api/' . $this->getVersion() . '/product/' . $sku . '/price'; | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |         $body = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 93 | 2 |  |             'price' => (float) $price, | 
            
                                                                        
                            
            
                                    
            
            
                | 94 | 2 |  |             'special_price' => (float) $specialPrice, | 
            
                                                                        
                            
            
                                    
            
            
                | 95 | 2 |  |             'special_from_date' => $specialFromDate, | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  |             'special_to_date' => $specialToDate | 
            
                                                                        
                            
            
                                    
            
            
                | 97 | 2 |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 99 |  |  |         try { | 
            
                                                                        
                            
            
                                    
            
            
                | 100 | 2 |  |             $response = $this->update($url, $body); | 
            
                                                                        
                            
            
                                    
            
            
                | 101 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                        
                            
            
                                    
            
            
                | 102 | 1 |  |             $this->throwException( | 
            
                                                                        
                            
            
                                    
            
            
                | 103 | 1 |  |                 $e, | 
            
                                                                        
                            
            
                                    
            
            
                | 104 | 1 |  |                 'Unable to update price on partner', | 
            
                                                                        
                            
            
                                    
            
            
                | 105 |  |  |                 [ | 
            
                                                                        
                            
            
                                    
            
            
                | 106 | 1 |  |                     'Sku'               => $sku, | 
            
                                                                        
                            
            
                                    
            
            
                | 107 | 1 |  |                     'Price'             => $price, | 
            
                                                                        
                            
            
                                    
            
            
                | 108 | 1 |  |                     'SpecialPrice'      => $specialPrice, | 
            
                                                                        
                            
            
                                    
            
            
                | 109 | 1 |  |                     'SpecialFromDate'   => $specialFromDate, | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |                     'SpecialToDate'     => $specialToDate | 
            
                                                                        
                            
            
                                    
            
            
                | 111 | 1 |  |                 ] | 
            
                                                                        
                            
            
                                    
            
            
                | 112 | 1 |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 115 | 2 |  |         return $response; | 
            
                                                                        
                            
            
                                    
            
            
                | 116 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * Send shipped status to partner from a specific order item collection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * @param \Iris\Transfer\Tracking\ShippedCollection $items | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * @return bool|\GuzzleHttp\Message\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 | 2 |  |     public function setStatusToShippedOnPartner(\Iris\Transfer\Tracking\ShippedCollection $items) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 | 2 |  |         $response = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 | 2 |  |         $bodyData = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 | 2 |  |         foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 | 2 |  |             $bodyData['items'][] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 | 2 |  |                 'venture_order_item_id'     => $item->getVentureOrderItemId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 2 |  |                 'delivery_type'             => $item->getDeliveryType(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 | 2 |  |                 'shipping_provider'         => $item->getShippingProvider(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 | 2 |  |                 'tracking_url'              => $item->getTrackingUrl(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 | 2 |  |                 'nfe_key'                   => $item->getNfeKey() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 | 2 |  |             ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 | 2 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 | 2 |  |         $url = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 | 2 |  |             'api/%s/order/%s/ship', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 | 2 |  |             $this->getVersion(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 2 |  |             $items[0]->getVentureOrderNumber() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 | 2 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 | 2 |  |             $response = $this->update($url, $bodyData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 | 1 |  |             $this->throwException( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 | 1 |  |                 $e, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 | 1 |  |                 'Unable to set status to ship on partner', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |                 [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 | 1 |  |                     'VentureOrderItemId'    => $items[0]->getVentureOrderItemId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 | 1 |  |                     'PartnerCode'           => $items[0]->getPartnerCode(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 | 1 |  |                     'DeliveryType'          => $items[0]->getDeliveryType(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 | 1 |  |                     'ShippingProvider'      => $items[0]->getShippingProvider(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 | 1 |  |                     'TrackingUrl'           => $items[0]->getTrackingUrl(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 | 1 |  |                     'NfeKey'                => $items[0]->getNfeKey(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 | 1 |  |                     'VentureOrderNumber'    => $items[0]->getVentureOrderNumber(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 | 1 |  |                     'Event'                 => 'tracking-update', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |                     'EventType'             => 'notify-externalshop-shipped' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 | 1 |  |                 ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 | 1 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 | 2 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |      * Send delivered status to partner from a specific order item collection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |      * @param \Iris\Transfer\Tracking\DeliveredCollection $items | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |      * @return bool|\GuzzleHttp\Message\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 | 2 |  |     public function setStatusToDeliveredOnPartner(\Iris\Transfer\Tracking\DeliveredCollection $items) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 | 2 |  |         $response = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 | 2 |  |         $bodyData = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 | 2 |  |         foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 | 2 |  |             $bodyData['items'][] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 | 2 |  |                 'venture_order_item_id' => $item->getVentureOrderItemId() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 | 2 |  |             ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 | 2 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 | 2 |  |         $url = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 | 2 |  |             'api/%s/order/%s/deliver', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 | 2 |  |             $this->getVersion(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 | 2 |  |             $items[0]->getVentureOrderNumber() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 | 2 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 | 2 |  |             $response = $this->update($url, $bodyData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 | 1 |  |             $this->throwException( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 | 1 |  |                 $e, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 | 1 |  |                 'Unable to set status to delivered on partner', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |                 [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 | 1 |  |                     'VentureOrderItemId'    => $items[0]->getVentureOrderItemId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 | 1 |  |                     'PartnerCode'           => $items[0]->getPartnerCode(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 | 1 |  |                     'VentureOrderNumber'    => $items[0]->getVentureOrderNumber(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 | 1 |  |                     'Event'                 => 'tracking-update', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |                     'EventType'             => 'notify-externalshop-delivered' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 | 1 |  |                 ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 | 1 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 | 2 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * Send failed delivery status to partner from a specific order item collection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |      * @param \Iris\Transfer\Tracking\FailedDeliveryCollection $items | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |      * @return bool|\GuzzleHttp\Message\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 | 2 |  |     public function setStatusToFailedDeliveryOnPartner(\Iris\Transfer\Tracking\FailedDeliveryCollection $items) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 | 2 |  |         $response = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 | 2 |  |         $bodyData = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 | 2 |  |         foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 2 |  |             $bodyData['items'][] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 | 2 |  |                 'venture_order_item_id' => $item->getVentureOrderItemId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 | 2 |  |                 'reason'                => $item->getReason(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 | 2 |  |                 'reason_detail'         => $item->getReasonDetail() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 | 2 |  |             ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 | 2 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 | 2 |  |         $url = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 | 2 |  |             'api/%s/order/%s/failed-delivery', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 | 2 |  |             $this->getVersion(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 | 2 |  |             $items[0]->getVentureOrderNumber() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 | 2 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 | 2 |  |             $response = $this->update($url, $bodyData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 | 1 |  |             $this->throwException( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 | 1 |  |                 $e, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 | 1 |  |                 'Unable to set status to failed delivery on partner', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |                 [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 | 1 |  |                     'VentureOrderItemId'    => $items[0]->getVentureOrderItemId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 | 1 |  |                     'PartnerCode'           => $items[0]->getPartnerCode(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 | 1 |  |                     'Reason'                => $items[0]->getReason(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 | 1 |  |                     'ReasonDetail'          => $items[0]->getReasonDetail(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 | 1 |  |                     'VentureOrderNumber'    => $items[0]->getVentureOrderNumber(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 | 1 |  |                     'Event'                 => 'tracking-update', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |                     'EventType'             => 'notify-externalshop-failed-delivery' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 | 1 |  |                 ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 | 1 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 | 2 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |      * Send canceled status to partner from a specific order item collection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |      * @param \Iris\Transfer\Tracking\CanceledCollection $items | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |      * @return bool|\GuzzleHttp\Message\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 | 2 |  |     public function setStatusToCanceledOnPartner(\Iris\Transfer\Tracking\CanceledCollection $items) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 | 2 |  |         $response = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 | 2 |  |         $bodyData = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 | 2 |  |         foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 | 2 |  |             $bodyData['items'][] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 | 2 |  |                 'venture_order_item_id' => $item->getVentureOrderItemId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 | 2 |  |                 'reason'                => $item->getReason(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 | 2 |  |                 'reason_detail'         => $item->getReasonDetail() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 | 2 |  |             ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 | 2 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 | 2 |  |         $url = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 | 2 |  |             'api/%s/order/%s/cancel', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 | 2 |  |             $this->getVersion(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 | 2 |  |             $items[0]->getVentureOrderNumber() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 | 2 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 | 2 |  |             $response = $this->update($url, $bodyData); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 | 2 |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 | 1 |  |             $this->throwException( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 | 1 |  |                 $e, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 | 1 |  |                 'Unable to set status to cancel on partner', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |                 [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 | 1 |  |                     'VentureOrderItemId'    => $items[0]->getVentureOrderItemId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 | 1 |  |                     'PartnerCode'           => $items[0]->getPartnerCode(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 | 1 |  |                     'Reason'                => $items[0]->getReason(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 | 1 |  |                     'ReasonDetail'          => $items[0]->getReasonDetail(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 | 1 |  |                     'VentureOrderNumber'    => $items[0]->getVentureOrderNumber(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 | 1 |  |                     'Event'                 => 'tracking-update', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |                     'EventType'             => 'notify-externalshop-cancelled' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 | 1 |  |                 ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 | 1 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 | 2 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |      * Confirm order on partner | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |      * @param \Iris\Transfer\Sales\Order $order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |      * @param string $partnerCode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |      * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |     public function confirmOrderOnPartner( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |         \Iris\Transfer\Sales\Order $order, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |         $partnerCode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |         $response = false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |         $bodyData = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |             'order_nr' => $order->getOrderNr(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |             'items'    => [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |         foreach ($order->getItemCollection() as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |             $bodyData['items'][] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                 'id_sales_order_item' => $item->getIdSalesOrderItem(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |                 'sku'                 => $item->getSku(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |                 'quantity'            => $item->getQuantity(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |                 'status'              => $item->getSuccess() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |             ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |         $url = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |             '/api/%s/order/%s/confirm', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |             $this->getVersion(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |             $order->getOrderNr() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |             $response = $this->update($url, $bodyData); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |         } catch (\Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |             $this->throwException( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |                 $e, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |                 'Unable to confirm order on partner', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |                 [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |                     'OrderNr'     => $order->getOrderNr(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |                     'PartnerCode' => $partnerCode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |                 ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 347 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 348 |  |  |  | 
            
                        
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.