diff --git a/README.md b/README.md index 38c7d11..e7cac28 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,16 @@ TrackingResponse response = fedexApi.track(trackingRequest, accessToken); ``` -## Event Codes ## +## Tracking Status Codes ## -Scan event codes are 2 characters that can be decoded +Tracking Status (scan event) codes are 2 character strings that can be decoded ```java -String description = ScanEventType.lookup(code).getDescription(); +String description = TrackingStatusCodes scanEventType = TrackingStatusCodes.lookup(code).getDescription(); ``` - - Sandbox test numbers: https://developer.fedex.com/api/en-au/catalog/ship/docs.html - - Web Service Documentation: http://www.fedex.com/templates/components/apps/wpor/secure/downloads/pdf/Aug13/TrackServiceGuide_2013.pdf +## Other ## + + - Sandbox test numbers: [Sandbox Test Tracking Numbers](https://www.fedex.com/us/developer/webhelp/ws/2021/US/FedEx_WebServices_2021_Developer_Guide.htm#t=wsdvg%2FAppendix_F_Test_Server_Mock_Tracking_Numbers.htm) + - Web Service Documentation: [Web Service Developer Guide](https://www.fedex.com/us/developer/webhelp/ws/2021/US/FedEx_WebServices_2021_Developer_Guide.htm#t=wsdvg%2FAbout_This_Guide.htm) \ No newline at end of file diff --git a/src/main/java/com/ljunggren/fedex/api/tracking/response/ScanEventType.java b/src/main/java/com/ljunggren/fedex/api/tracking/response/ScanEventType.java deleted file mode 100644 index 80d0762..0000000 --- a/src/main/java/com/ljunggren/fedex/api/tracking/response/ScanEventType.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ljunggren.fedex.api.tracking.response; - -public enum ScanEventType { - - AA("At Airport"), - AD("At Delivery"), - AF("At FedEx Facility"), - AP("At Pickup"), - CA("Shipment Canceled"), - CH("Location Changed"), - DE("Delivery Exception"), - DL("Delivered"), - DP("Departed FedEx Location"), - DR("Vehicle Furnished, Not Used"), - DS("Vehicle Dispatched"), - DY("Delay"), - EA("Enroute to Airport delay"), - ED("Enroute to Delivery"), - EO("Enroute to Origin airport"), - EP("Enroute to Pickup"), - FD("At FedEx Destination"), - HL("Hold at Location"), - IT("In Transit"), - LO("Left Origin"), - OC("Order Created"), - OD("Out for Delivery"), - PF("Plane in Flight"), - PL("Plane Landed"), - PU("Picked Up"), - RS("Return to Shipper"), - SE("Shipment Exception"), - SF("At Sort Facility"), - SP("Split status - multiple statuses"), - TR("Transfer"), - UNKNOWN("Unknown"); - - private String description; - - private ScanEventType(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } - - public static ScanEventType lookup(String id) { - try { - return ScanEventType.valueOf(id); - } catch (IllegalArgumentException e) { - return ScanEventType.UNKNOWN; - } - } - -} diff --git a/src/main/java/com/ljunggren/fedex/api/tracking/response/TrackingStatusCodes.java b/src/main/java/com/ljunggren/fedex/api/tracking/response/TrackingStatusCodes.java new file mode 100644 index 0000000..603d120 --- /dev/null +++ b/src/main/java/com/ljunggren/fedex/api/tracking/response/TrackingStatusCodes.java @@ -0,0 +1,72 @@ +package com.ljunggren.fedex.api.tracking.response; + +public enum TrackingStatusCodes { + + AA("At Airport"), + AC("At Canada Post facility"), + AD("At Delivery"), + AF("At FedEx Facility"), + AP("At Pickup"), + AR("Arrived at"), + AX("At USPS facility"), + CA("Shipment Cancelled"), + CH("Location Changed"), + DD("Delivery Delay"), + DE("Delivery Exception"), + DL("Delivered"), + DP("Departed"), + DR("Vehicle furnished but not used"), + DS("Vehicle Dispatched"), + DY("Delay"), + EA("Enroute to Airport"), + ED("Enroute to Delivery"), + EO("Enroute to Origin Airport"), + EP("Enroute to Pickup"), + FD("At FedEx Destination"), + HL("Hold at Location"), + IT("In Transit"), + IX("In transit (see Details)"), + LO("Left Origin"), + OC("Order Created"), + OD("Out for Delivery"), + OF("At FedEx origin facility"), + OX("Shipment information sent to USPS"), + PD("Pickup Delay"), + PF("Plane in Flight"), + PL("Plane Landed"), + PM("In Progress"), + PU("Picked Up"), + PX("Picked up (see Details)"), + RR("CDO requested"), + RM("CDO Modified"), + RC("CDO Cancelled"), + RS("Return to Shipper"), + RP("Return label link emailed to return sender"), + LP("Return label link cancelled by shipment originator"), + RG("Return label link expiring soon"), + RD("Return label link expired"), + SE("Shipment Exception"), + SF("At Sort Facility"), + SP("Split Status"), + TR("Transfer"), + UNKNOWN("Unknown"); + + private String description; + + private TrackingStatusCodes(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + + public static TrackingStatusCodes lookup(String id) { + try { + return TrackingStatusCodes.valueOf(id); + } catch (IllegalArgumentException e) { + return TrackingStatusCodes.UNKNOWN; + } + } + +} diff --git a/src/test/java/com/ljunggren/fedex/api/tracking/response/ScanEventTypeTest.java b/src/test/java/com/ljunggren/fedex/api/tracking/response/ScanEventTypeTest.java deleted file mode 100644 index e3e28f2..0000000 --- a/src/test/java/com/ljunggren/fedex/api/tracking/response/ScanEventTypeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ljunggren.fedex.api.tracking.response; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ScanEventTypeTest { - - @Test - public void getDescriptionTest() { - String description = ScanEventType.AA.getDescription(); - assertEquals("At Airport", description); - } - - @Test - public void lookupTest() { - ScanEventType scanEventType = ScanEventType.lookup("AA"); - assertEquals(ScanEventType.AA, scanEventType); - } - - @Test - public void lookupUnknownTest() { - ScanEventType scanEventType = ScanEventType.lookup("ZZ"); - assertEquals(ScanEventType.UNKNOWN, scanEventType); - - } - -} diff --git a/src/test/java/com/ljunggren/fedex/api/tracking/response/TrackingStatusCodesTest.java b/src/test/java/com/ljunggren/fedex/api/tracking/response/TrackingStatusCodesTest.java new file mode 100644 index 0000000..2b26ae7 --- /dev/null +++ b/src/test/java/com/ljunggren/fedex/api/tracking/response/TrackingStatusCodesTest.java @@ -0,0 +1,28 @@ +package com.ljunggren.fedex.api.tracking.response; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class TrackingStatusCodesTest { + + @Test + public void getDescriptionTest() { + String description = TrackingStatusCodes.AA.getDescription(); + assertEquals("At Airport", description); + } + + @Test + public void lookupTest() { + TrackingStatusCodes scanEventType = TrackingStatusCodes.lookup("AA"); + assertEquals(TrackingStatusCodes.AA, scanEventType); + } + + @Test + public void lookupUnknownTest() { + TrackingStatusCodes scanEventType = TrackingStatusCodes.lookup("ZZ"); + assertEquals(TrackingStatusCodes.UNKNOWN, scanEventType); + + } + +}