![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/extmag/dhlshipping2/Helper/Response/ |
<?php /** * Copyright © Extmag. All rights reserved. */ namespace Extmag\DhlShipping\Helper\Response; class Track extends Dhl { /** * @var string */ protected $requestType = 'Track'; /** * @inheritdoc */ protected function parseSuccess(array $data, string $context) { $service = []; $shipments = $this->get($data['AWBInfo'] ?? []); if (!empty($shipments)) { $service['TrackingFinalStatus'] = 0; foreach ($shipments as $shipment) { $service['ShipmentIdentification'] = $shipment['AWBNumber']; $activity = $this->get($shipment['ShipmentInfo']['ShipmentEvent'] ?? []); if (!empty($activity)) { foreach ($activity as $item) { $track = []; $track['Date'] = $item['Date'] ?? null; $track['Time'] = $item['Time'] ?? null; $track['GMTOffset'] = null; $track['Status']['Code'] = $item['ServiceEvent']['EventCode'] ?? null; $track['Status']['Description'] = $item['ServiceEvent']['Description'] ?? null; $track['Address']['City'] = $item['ServiceArea']['Description'] ?? null; if (!empty($item['ShipmentInfo']['DlvyNotificationFlag']) && $item['ShipmentInfo']['DlvyNotificationFlag'] == 'N') { $service['TrackingFinalStatus'] = 1; } $service['Tracks'][] = $track; } } elseif (!empty($shipment['Status']['ActionStatus']) && $shipment['Status']['ActionStatus'] == 'No Shipments Found' ) { $track = []; $track['Date'] = null; $track['Time'] = null; $track['GMTOffset'] = null; $track['Status']['Code'] = 'TEST_OR_ERROR'; $track['Status']['Description'] = 'TEST OR ERROR'; $track['Address']['City'] = 'Test'; $service['TrackingFinalStatus'] = 1; $service['Tracks'][] = $track; } } } $service['Status'] = 1; $service['Carrier'] = $this->carrier; $service['Context'] = $context; $service['Type'] = $this->requestType; return $service; } }