|
|
|
@ -8,6 +8,7 @@ class TrackingStatus {
|
|
|
|
|
public const TRACKING_STATUS_DELIVERED = 3;
|
|
|
|
|
public const TRACKING_STATUS_RETURNED = 4;
|
|
|
|
|
public const TRACKING_STATUS_FAILURE = 5;
|
|
|
|
|
public const TRACKING_STATUS_INFO = 6;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Convert a status string API response to a constant integer.
|
|
|
|
@ -25,8 +26,10 @@ class TrackingStatus {
|
|
|
|
|
case "OUT_FOR_DELIVERY":
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_TRANSIT;
|
|
|
|
|
case "DELIVERED":
|
|
|
|
|
case "AVAILABLE_FOR_PICKUP":
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_DELIVERED;
|
|
|
|
|
case "AVAILABLE_FOR_PICKUP":
|
|
|
|
|
case "CANCELLED":
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_INFO;
|
|
|
|
|
case "RETURNED":
|
|
|
|
|
case "RETURN_TO_SENDER":
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_RETURNED;
|
|
|
|
@ -34,7 +37,6 @@ class TrackingStatus {
|
|
|
|
|
case "DELIVERY ATTEMPT":
|
|
|
|
|
case "ALERT":
|
|
|
|
|
case "ERROR":
|
|
|
|
|
case "CANCELLED":
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_FAILURE;
|
|
|
|
|
default:
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_UNKNOWN;
|
|
|
|
@ -58,6 +60,8 @@ class TrackingStatus {
|
|
|
|
|
return "RETURNED";
|
|
|
|
|
case TrackingStatus::TRACKING_STATUS_FAILURE:
|
|
|
|
|
return "FAILURE";
|
|
|
|
|
case TrackingStatus::TRACKING_STATUS_INFO:
|
|
|
|
|
return "INFO";
|
|
|
|
|
default:
|
|
|
|
|
return "UNKNOWN";
|
|
|
|
|
}
|
|
|
|
@ -175,19 +179,21 @@ class TrackingStatus {
|
|
|
|
|
case "VR":
|
|
|
|
|
case "WX":
|
|
|
|
|
case "AP":
|
|
|
|
|
case "CI": // stuck in customs
|
|
|
|
|
case "AT": // departed a transfer airport (int'l)
|
|
|
|
|
case "A0": // "Acceptance" from foreign country
|
|
|
|
|
case "CO": // "Inbound Out of Customs"
|
|
|
|
|
case "D0": // "Processed Through Facility" (int'l)
|
|
|
|
|
case "E0": // "Customs Clearance" (int'l)
|
|
|
|
|
case "F0": // "Customs Clearance Processing Complete" (int'l)
|
|
|
|
|
case "G0": // "Arrival at Post Office" (int'l)
|
|
|
|
|
case "MF": // "Processed through Facility" (int'l)
|
|
|
|
|
case "DG": // "Out for Delivery" (int'l)
|
|
|
|
|
case "ME": // "Held in Customs" (int'l, isn't necessarily bad)
|
|
|
|
|
case "TL": // "moving within the USPS network" filler message
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_TRANSIT;
|
|
|
|
|
case "CI": // stuck in customs
|
|
|
|
|
case "ME": // "Held in Customs" (int'l, isn't necessarily bad)
|
|
|
|
|
case "LD": // letter estimated to be delivered today
|
|
|
|
|
case "E0": // "Customs Clearance" (int'l)
|
|
|
|
|
case "F0": // "Customs Clearance Processing Complete" (int'l)
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_INFO;
|
|
|
|
|
case "01":
|
|
|
|
|
case "13":
|
|
|
|
|
case "17":
|
|
|
|
@ -201,7 +207,6 @@ class TrackingStatus {
|
|
|
|
|
case "85":
|
|
|
|
|
case "86":
|
|
|
|
|
case "87":
|
|
|
|
|
case "LD": // letter estimated to be delivered today
|
|
|
|
|
case "I0": // International something or other
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_DELIVERED;
|
|
|
|
|
case "04":
|
|
|
|
@ -247,8 +252,9 @@ class TrackingStatus {
|
|
|
|
|
switch ($eventcode) {
|
|
|
|
|
case "M":
|
|
|
|
|
case "MV":
|
|
|
|
|
case "ZA": // UPS My Choice redirect
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_PRE_TRANSIT;
|
|
|
|
|
case "ZA": // UPS My Choice redirect
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_INFO;
|
|
|
|
|
case "I":
|
|
|
|
|
case "P":
|
|
|
|
|
case "O":
|
|
|
|
@ -319,9 +325,12 @@ class TrackingStatus {
|
|
|
|
|
case "IP":
|
|
|
|
|
case "DO": // dropped off
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_TRANSIT;
|
|
|
|
|
case "AE": // Arriving early
|
|
|
|
|
case "AS": // Address corrected
|
|
|
|
|
case "HP": // Ready for pickup
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_INFO;
|
|
|
|
|
case "RC": // Recipient
|
|
|
|
|
case "DL": // Delivered
|
|
|
|
|
case "HP": // Ready for pickup
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_DELIVERED;
|
|
|
|
|
case "RS":
|
|
|
|
|
return TrackingStatus::TRACKING_STATUS_RETURNED;
|
|
|
|
|