Giter VIP home page Giter VIP logo

tracking-number-validation's Introduction

tracking-number-validation

A simple way to validate tracking number for the following couriers.

supported couriers:

  • ups
  • usps
  • dhl
  • fedex
  • ontrac

Updates

v2 api changes. checkout out v1 and v2 branches.

v2 api:

  • getCourier(tracking) -> Array: [courier] //due to the similarity some times there is a match for more then 1 courier
  • getCourierOne: (tracking,courier) -> String: courier //not safe
  • isValid: (tracking) -> Boolean: true/false //return true if match one or more couriers
  • isCourier: (tracking,courier) -> Boolean: true/false
  • getTrackingUrl: (tracking,courier) -> String: url for tracking number.

Usage

v1 api:

Nodejs:

  • npm i tracking-number-validation --save
  • const tnv = require('tracking-number-validation')
  • tnv.getCourier('1Z2869Y60397722027') -> return courier like ups
  • tnv.isValid('1Z2869Y60397722027','fedex') -> return true/false

Javascript:

  • npm i tracking-number-validation --save
  • include main.js in your index.html
<script src="node_modules/tracking-number-validation/dist/main.js"></script>
  • const courier = TNV.getCourier(tr)

Demo

link

Tested Against

UPS:

  • "1Z9999W99999999999": "ups",
  • "1Z12345E1512345676": "ups",
  • "1Z12345E0205271688": "ups",
  • "1Z12345E6605272234": "ups",
  • "1Z12345E0305271640": "ups",
  • "1Z12345E0393657226": "ups",
  • "1Z12345E1305277940": "ups",
  • "1Z12345E6205277936": "ups",
  • "1Z12345E1505270452": "ups",
  • "1Z648616E192760718": "ups",
  • "1ZWX0692YP40636269": "ups",
  • T9999999999: "ups",

FEDEX:

  • "9999 9999 9999": "fedex",
  • "9999 9999 9999 999": "fedex",
  • "999999999999": "fedex",
  • "999999999999999": "fedex",
  • "661377569221": "fedex",
  • "624893691092": "fedex",
  • "61299995669352455464": "fedex",
  • "61299995669151880177": "fedex",

USPS:

  • "9400 1000 0000 0000 0000 00": "usps",
  • "9205 5000 0000 0000 0000 00": "usps",
  • "9407 3000 0000 0000 0000 00": "usps",
  • "9303 3000 0000 0000 0000 00": "usps",
  • "82 000 000 00": "usps",
  • "EC 000 000 000 US": "usps",
  • "9270 1000 0000 0000 0000 00": "usps",
  • "EA 000 000 000 US": "usps",
  • "CP 000 000 000 US": "usps",
  • "9208 8000 0000 0000 0000 00": "usps",
  • "9202 1000 0000 0000 0000 00": "usps",
  • "9400100000000000000000": "usps",
  • "9205500000000000000000": "usps",
  • "9407300000000000000000": "usps",
  • "9303300000000000000000": "usps",
  • "8200000000": "usps",
  • EC000000000US: "usps",
  • "9270100000000000000000": "usps",
  • EA000000000US: "usps",
  • CP000000000US: "usps",
  • "9208800000000000000000": "usps",
  • "9202100000000000000000": "usps",
  • "92748963438592543475924253": "usps",

ONTRAC:

  • C00000000000000: "ontrac",
  • C99999999999999: "ontrac",

DHL:

  • "125-12345678": "dhl",
  • "125 12345678": "dhl",
  • "12512345678": "dhl",
  • SEA1234567: "dhl",
  • LAX1234567: "dhl",

tracking-number-validation's People

Contributors

niradler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tracking-number-validation's Issues

FedEx tracking url leads to 404 page

When given a valid tracking number, the generated url leads to a 404 page.

Screen Shot 2022-06-07 at 9 13 31 AM

Previously, I was using this FedEx link as a template and substituting in the tracking number: https://www.fedex.com/fedextrack/?tracknumbers=${trackingNumber}.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.