Add carrier barcode regex for USPS DataMatrix
This commit is contained in:
parent
5d0958b5d0
commit
3d142dc51f
@ -47,6 +47,14 @@ class Carriers {
|
||||
"carrier" => "usps",
|
||||
"pattern" => "/^420[0-9]{5}[0-9]+$/"
|
||||
],
|
||||
[
|
||||
"carrier" => "usps",
|
||||
"pattern" => "/^\\x1D420[0-9]{5,11}\\x1D[0-9]{10,}\\x1D?$/"
|
||||
],
|
||||
[
|
||||
"carrier" => "usps",
|
||||
"pattern" => "/^420[0-9]{5,11}\\x1D[0-9]{10,}\\x1D?$/"
|
||||
],
|
||||
[
|
||||
"carrier" => "fedex",
|
||||
"pattern" => "/^[0-9]{15}$/"
|
||||
|
@ -16,8 +16,8 @@ class TrackingBarcode {
|
||||
*/
|
||||
public function getSanitized(): string {
|
||||
$code = strtoupper($this->code);
|
||||
$code = trim($code);
|
||||
$code = preg_replace("/[^0-9A-Z]/", "", $code);
|
||||
$code = trim($code);
|
||||
return $code;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class Tracking_UPS_MailInnovations_DataMatrix {
|
||||
} else {
|
||||
$realcode = $codeparts[13];
|
||||
|
||||
$info = Tracking::track($realcode);
|
||||
$info = Tracking::track($realcode, "usps");
|
||||
|
||||
// Set detailed destination address from code data
|
||||
$to = $info->getTo();
|
||||
@ -48,7 +48,7 @@ class Tracking_UPS_MailInnovations_DataMatrix {
|
||||
$to->country = (new League\ISO3166\ISO3166)->numeric($codeparts[9])['alpha2'];
|
||||
$info->setTo($to);
|
||||
|
||||
$info->setService(new Service("", "UPS Mail Innovations"));
|
||||
$info->setService(new Service("", "Parcel Select/UPS Mail Innovations"));
|
||||
}
|
||||
|
||||
return $info;
|
||||
|
Loading…
x
Reference in New Issue
Block a user