2.8.3 • Published 3 months ago

delivery-tracker v2.8.3

Weekly downloads
59
License
MIT
Repository
github
Last release
3 months ago

delivery-tracker

version download status status Standard - JavaScript Style Guide

delivery-tracker is delivery tracking library for Node.js

Courier List

NameContributorLink
Korea Post@egg-http://www.koreapost.go.kr/
Ecargo@egg-http://ecargo.asia/script/users/main.php
FedEx@egg-https://www.fedex.com/
Australia Post@egg-https://auspost.com.au/
Pantos@egg-http://www.epantos.com/
Rincos@egg-http://www.rincos.co.kr/
Royal Mail@egg-http://www.royalmail.com/
USPS@egg-https://www.usps.com/
CJ Korea Express (Korea)@egg-http://cjkoreaexpress.co.kr/ (https://www.doortodoor.co.kr)
POS Laju@egg-http://www.poslaju.com.my
Yello Express@egg-https://www.yello-express.com
EFS@egg-http://efs.asia/
UPS@egg-https://www.ups.com
TNT@egg-https://www.tnt.com
CESCO@egg-https://www.cesco-logistics.com/
XPOST@egg-https://www.xpost.ph/
KERRYTHAI@egg-https://th.kerryexpress.com
SICEPAT@egg-http://sicepat.com/
XIOExpress@egg-https://xioexpress.com/
eParcel@egg-https://eparcel.kr/
LBC@egg-https://www.lbcexpress.com/
J&T (PH)@egg-https://www.jtexpress.ph/
DHL@carstenschwedehttps://www.dhl.com/
Canada Post@egg-https://www.canadapost-postescanada.ca/
PAXEL@egg-https://paxel.co/

Installation

$ npm install delivery-tracker

Usage

var tracker = require('delivery-tracker')
var courier = tracker.courier(tracker.COURIER.KOREAPOST.CODE)

courier.trace('TRACE_NUMBER', function (err, result) {
  console.log(result)
})

Command Line

$ npm install -g delivery-tracker
$ delivery-tracker -h

Usage: index [options] <tracecode>

  Options:

    -h, --help               output usage information
    -c, --courier <courier>  Courier Namespace
    -k, --apikey <apikey>  Courier API key

$ delivery-tracker -c EMS EBXXXXXXXXXKR

Response

AttributeTypeDescription
courierCourier Objectcourier information
numberStringtracking number
statusStringdelivery status
checkpointsArray of Checkpoint ObjectArray of the checkpoint information.

Courier Object

AttributeTypeDescription
codeStringUnique code of courier.
nameStringCourier name

Checkpoint Object

AttributeTypeDescription
courierCourier Objectcourier information
locationStringLocation info of the checkpoint provided by the courier.
messageStringCheckpoint message
timeStringThe date and time of the checkpoint provided by the courier. The values can be:Empty string, YYYY-MM-DD, YYYY-MM-DDTHH:mm:ss YYYY-MM-DDTHH:mm:ss+Timezone

CODE

COURIER

tracker.COURIER.{NAMESPACE}

NAMESPACECODENAME
KOREAPOSTkoreapostKorea Post
ECARGOecargoEcargo
FEDEXfedexFedEx
AUSPOSTauspostAustralia Post
PANTOSpantosPantos
RINCOSrincosRincos
ROYALMAILroyalmailRoyal Mail
USPSuspsUSPS
CJKOREAEXPRESScjkoreaexpressCJ Korea Express
POSLAJUposlajuPOS Laju
YELLOEXPRESSyelloexpressYello Express
EFSefsEFS
UPSupsUPS
TNTtntTNT
CESCOcescoCESCO
XPOSTxpostXPOST
KERRYTHAIkerrythaiKERRYTHAI
SICEPATsicepatSICEPAT
XIOEXPRESSxioexpressXIOExpress
EPARCELeparceleParcel
LBClbcLBC
JNTjntJ&T
DHLdhlDHL
CANADAPOSTcanadapostCanada Post
PAXELpaxelPaxel

STATUS

tracker.STATUS.{CODE}

CodeValueDescription
INFO_RECEIVEDInfoReceivedThe carrier received a request from the shipper and wants to start shipping.
PENDINGPendingNew pending shipment to track or a new shipment without tracking information added.
IN_TRANSITInTransitThe carrier has received or received the carrier. Shipment is in progress.
DELIVEREDDeliveredThe shipment was successfully delivered.
RETURNEDReturnedThe shipment was returned.
EXCEPTIONExceptionCustom hold, undeliverable, shipper has shipped or shipped an exception.
FAIL_ATTEMPTFailAttemptThe courier tried to send but failed, but usually reminds and tries again.

ERROR

tracker.STATUS.{CODE}

CodeValueDescription
UNKNOWN-1Unknow error
NOT_SUPPORT_SHIPMENT20shipment does not support.
INVALID_NUMBER10invalid trace number.
INVALID_NUMBER_LENGTH11invalid trace number.
INVALID_NUMBER_HEADER12invalid trace number.
INVALID_NUMBER_COUNTRY13invalid trace number.

Sample

// KOREAPOST
{
  "courier": {
    "code": "koreapost",
    "name": "Korea Post"
  },
  "number": "EBCOMPLETE0KR",
  "status": "Delivered",
  "checkpoints": [
    {
      "courier": {
        "code": "koreapost",
        "name": "Korea Post"
      },
      "location": "MY4332",
      "message": "Delivery complete\nRecipient : K*NG()\nResult : Delivery complete",
      "time": "2016-07-04T11:40:00"
    },
    // ...
  ]
}

// FEDEX
{
  "courier": {
    "code": "fedex",
    "name": "FedEx"
  },
  "number": "DELIVEREDNUM",
  "status": "Delivered",
  "checkpoints": [
    {
      "courier": {
        "code": "fedex",
        "name": "FedEx"
      },
      "location": "SOUTH JORDAN, UT",
      "message": "Package delivered by U.S. Postal Service to addressee",
      "status": "Delivered",
      "time": "2016-12-14T13:17:00-07:00"
    },
    // ...
  ]
}

// PANTOS
{
  "courier": {
    "code": "pantos",
    "name": "Pantos"
  },
  "number": "DELIVEREDNUM-AUSPOST",
  "status": "Delivered",
  "checkpoints": [
    {
      "courier": {
        "code": "auspost",
        "name": "Australia Post"
      },
      "location": "Canning Vale, WA",
      "message": "Delivered",
      "status": "Delivered",
      "time": "2017-01-03T15:24:00+08:00"
    },
    // ...
    {
      "courier": {
        "code": "pantos",
        "name": "Pantos"
      },
      "location": "KRICN",
      "message": "Pick-Up (Pick-Up)",
      "status": "InfoReceived",
      "time": "2016-12-20T11:25"
    }
  ]
}

Test

Test with mocha

$ grunt

like watch

$ grunt watch

Contributing

Bug reports and pull requests are welcome on Github at https://github.com/egg-/delivery-tracker

  1. Fork it
  2. Create your feature branch.
  3. Commit your changes.
  4. Push to the branch.
  5. Create a new Pull Request.

Release History

See the CHANGELOG.md

License

delivery-tracker is licensed under the MIT license.

2.8.3

3 months ago

2.8.2

3 months ago

2.8.1

7 months ago

2.8.0

2 years ago

2.7.3

2 years ago

2.7.2

2 years ago

2.7.1

3 years ago

2.7.0

3 years ago

2.6.1

3 years ago

2.6.0

3 years ago

2.5.8

4 years ago

2.5.7

4 years ago

2.5.6

4 years ago

2.5.5

4 years ago

2.5.4

4 years ago

2.5.3

4 years ago

2.5.1

4 years ago

2.5.0

4 years ago

2.4.5

4 years ago

2.4.4

4 years ago

2.4.3

4 years ago

2.4.2

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.11

4 years ago

2.3.10

4 years ago

2.3.9

4 years ago

2.3.8

5 years ago

2.3.7

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.4

5 years ago

2.3.2

5 years ago

2.3.3

5 years ago

2.3.0

5 years ago

2.3.1

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.4

5 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.0

6 years ago

1.7.2

6 years ago

1.7.1

7 years ago

1.7.0

7 years ago

1.6.3

7 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.5

7 years ago

1.5.4

7 years ago

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.9.4

8 years ago

0.9.3

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.8.5

8 years ago

0.8.4

8 years ago

0.8.3

8 years ago

0.8.1

8 years ago

0.8.0

8 years ago

0.7.3

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.0

8 years ago

0.4.0

8 years ago

0.2.0

8 years ago