예제 #1
0
 /**
  * Get the shipment status history.
  *
  * @param array $response
  *
  * @return Track
  */
 protected function getTrack(array $response)
 {
     $track = new Track();
     foreach ($response['tuStatus'][0]['history'] as $index => $historyItem) {
         $event = new Event();
         $status = $this->resolveStatus($response, $index);
         $event->setStatus($status);
         $event->setLocation($this->getLocation($historyItem));
         $event->setDescription($historyItem['evtDscr']);
         $event->setDate($this->getDate($historyItem));
         $event->addAdditionalDetails('eventNumber', $response['tuStatus'][0]['progressBar']['evtNos'][$index]);
         $track->addEvent($event);
         if ($status == Track::STATUS_DELIVERED) {
             $track->setRecipient($this->getRecipient($response));
         }
         if ($status == Track::STATUS_PICKUP) {
             $track->addAdditionalDetails('parcelShop', $this->getParcelShopDetails($response));
         }
     }
     return $track->sortEvents();
 }
예제 #2
0
 /** @test */
 public function it_can_access_additional_information()
 {
     $this->event->addAdditionalDetails('foo', 'additional info');
     $this->assertTrue($this->event->hasAdditionalDetails());
     $this->assertSame('additional info', $this->event->getAdditionalDetails('foo'));
 }