You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
class Tracking {
|
|
|
|
/**
|
|
*
|
|
* @global type $SETTINGS
|
|
* @param string $code
|
|
* @return \TrackingInfo
|
|
* @throws TrackingException
|
|
*/
|
|
public static function track(string $code, string $carrier = ""): TrackingInfo {
|
|
|
|
$barcode = new TrackingBarcode($code);
|
|
if (!empty($carrier)) {
|
|
$carriercode = Carriers::getCarrierCode($carrier);
|
|
} else {
|
|
$carriercode = $barcode->getCarrier();
|
|
}
|
|
|
|
switch ($carriercode) {
|
|
case "ups_mi_datamatrix":
|
|
return Tracking_UPS_MailInnovations_DataMatrix::track($code);
|
|
case "fedex_pdf417":
|
|
return Tracking_FedEx_PDF417::track($code);
|
|
case "helena_express":
|
|
return Tracking_HelenaExpress::track($barcode->getSanitized());
|
|
case "usps":
|
|
return Tracking_USPS::track($barcode->getSanitized());
|
|
case "ups":
|
|
return Tracking_UPS::track($barcode->getSanitized());
|
|
default:
|
|
return Tracking_EasyPost::track($barcode->getSanitized());
|
|
//return Tracking_Shippo::track($barcode->getSanitized());
|
|
}
|
|
}
|
|
|
|
}
|