|
|
|
@ -152,6 +152,14 @@ class Carriers {
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const CARRIER_TRACKING_URLS = [
|
|
|
|
|
"usps" => "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1={{number}}",
|
|
|
|
|
"ups" => "https://wwwapps.ups.com/WebTracking/processInputRequest?tracknum={{number}}",
|
|
|
|
|
"fedex" => "https://www.fedex.com/fedextrack/?trknbr={{number}}",
|
|
|
|
|
"dhl_express" => "https://mydhl.express.dhl/us/en/tracking.html#/results?id={{number}}",
|
|
|
|
|
"helena_express" => "https://helena.express/track#{{number}}"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public static function getCarrierName(string $carrier): string {
|
|
|
|
|
// scan by internal ID
|
|
|
|
|
foreach (Carriers::CARRIERS as $id => $info) {
|
|
|
|
@ -184,4 +192,12 @@ class Carriers {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getCarrierTrackingUrl($carrier, $code) {
|
|
|
|
|
if (!empty(Carriers::CARRIER_TRACKING_URLS[$carrier])) {
|
|
|
|
|
return str_replace("{{number}}", $code, Carriers::CARRIER_TRACKING_URLS[$carrier]);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|