예제 #1
0
 /**
  * Add a tracking to the result
  *
  * @param AbstractResult|RateResult $result
  * @return $this
  */
 public function append($result)
 {
     if ($result instanceof AbstractResult) {
         $this->_trackings[] = $result;
     } elseif ($result instanceof RateResult) {
         $trackings = $result->getAllTrackings();
         foreach ($trackings as $track) {
             $this->append($track);
         }
     }
     return $this;
 }
 /**
  * Get tracking response
  *
  * @return string
  */
 public function getResponse()
 {
     $statuses = '';
     if ($this->_result instanceof \Magento\Shipping\Model\Tracking\Result) {
         if ($trackings = $this->_result->getAllTrackings()) {
             foreach ($trackings as $tracking) {
                 if ($data = $tracking->getAllData()) {
                     if (!empty($data['track_summary'])) {
                         $statuses .= __($data['track_summary']);
                     } else {
                         $statuses .= __('Empty response');
                     }
                 }
             }
         }
     }
     if (empty($statuses)) {
         $statuses = __('Empty response');
     }
     return $statuses;
 }