Add attribution text and carrier logos to tracking API
This commit is contained in:
parent
e03c02d416
commit
d0d039d191
@ -9,6 +9,8 @@ class TrackingInfo {
|
||||
private $from = null;
|
||||
private $to = null;
|
||||
private $current_status = null;
|
||||
private $carrierImageUrl = "";
|
||||
private $attributionText = "";
|
||||
|
||||
public function __construct($code = null, $carrier = null, $to = null, $from = null, $current_status = null, $history = null) {
|
||||
$this->code = $code;
|
||||
@ -19,6 +21,14 @@ class TrackingInfo {
|
||||
$this->history = $history;
|
||||
}
|
||||
|
||||
public function setCarrierLogo(string $url) {
|
||||
$this->carrierImageUrl = $url;
|
||||
}
|
||||
|
||||
public function setCarrierAttributionText(string $text) {
|
||||
$this->attributionText = $text;
|
||||
}
|
||||
|
||||
public function setCode(string $code) {
|
||||
$this->code = $code;
|
||||
}
|
||||
@ -84,7 +94,9 @@ class TrackingInfo {
|
||||
"code" => $this->getCode(),
|
||||
"carrier" => [
|
||||
"code" => Carriers::getCarrierCode($this->getCarrier()),
|
||||
"name" => Carriers::getCarrierName($this->getCarrier())
|
||||
"name" => Carriers::getCarrierName($this->getCarrier()),
|
||||
"attribution" => $this->attributionText,
|
||||
"logo" => $this->carrierImageUrl
|
||||
],
|
||||
"service" => [
|
||||
"id" => $this->service->id,
|
||||
|
@ -89,6 +89,15 @@ class Tracking_UPS {
|
||||
|
||||
$info->setCarrier("ups");
|
||||
$info->setService(new Service($trackinfo["Service"]["Code"], $trackinfo["Service"]["Description"]));
|
||||
$info->setCarrierLogo(($_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://")
|
||||
. $_SERVER['HTTP_HOST'] . env("urlbase", "/")
|
||||
. "resources/logistics.tracking/logos/ups.gif");
|
||||
$info->setCarrierAttributionText("UPS, the UPS brand mark, and the Color Brown are "
|
||||
. "trademarks of United Parcel Service of America, Inc. All Rights Reserved. "
|
||||
. "© 2021 United Parcel Service of America, Inc. All Rights Reserved. Confidential "
|
||||
. "and Proprietary The use, disclosure, reproduction, modification, transfer, or "
|
||||
. "transmittal of this work for any purpose in any form or by any means without the "
|
||||
. "written permission of United Parcel Service is strictly prohibited.");
|
||||
|
||||
if (count($trackinfo["Package"]["Activity"]) > 0) {
|
||||
$current = $trackinfo["Package"]["Activity"][0];
|
||||
|
@ -51,6 +51,10 @@ class Tracking_USPS {
|
||||
|
||||
$info->setCarrier("usps");
|
||||
$info->setService(new Service((string) $trackinfo->ClassofMailCode, (string) $trackinfo->Class));
|
||||
// $info->setCarrierLogo(($_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://")
|
||||
// . $_SERVER['HTTP_HOST'] . env("urlbase", "/")
|
||||
// . "resources/logistics.tracking/logos/usps.png");
|
||||
$info->setCarrierAttributionText("Information provided by www.usps.com.");
|
||||
|
||||
$current_status = new TrackingEntry(
|
||||
TrackingStatus::USPSEventCodeToStatus($trackinfo->TrackSummary->EventCode),
|
||||
|
BIN
resources/logistics.tracking/logos/ups.gif
Normal file
BIN
resources/logistics.tracking/logos/ups.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Loading…
x
Reference in New Issue
Block a user