• Stars
    star
    272
  • Rank 146,504 (Top 3 %)
  • Language
    HTML
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Shipment tracking library for Golang.

Delibird

License GoDoc Go Report Card Coverage Status Build Status

Deploy

Delibird

Delibird is a shipment tracking library for Golang.

Delibird๋Š” ํƒ๋ฐฐ์‚ฌ์˜ ๋ฐฐ์†ก์กฐํšŒ ํŽ˜์ด์ง€๋ฅผ ํŒŒ์‹ฑํ•˜์—ฌ ์ •ํ˜•ํ™”๋œ ํ˜•ํƒœ๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค.

Courier List

์ง€์›ํ•˜๋Š” ํƒ๋ฐฐ์‚ฌ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.

Name Contributor
Korean Post / ์šฐ์ฒด๊ตญํƒ๋ฐฐ @purpleworks
CJ KoreaExpress / CJ๋Œ€ํ•œํ†ต์šด @purpleworks
KG Logis / KG๋กœ์ง€์Šค @serendip811
Logen / ๋กœ์  ํƒ๋ฐฐ @purpleworks

Installation

$ go get github.com/purpleworks/delibird

Usage

Code

package package_name

import "github.com/purpleworks/delibird"
import "github.com/purpleworks/delibird/couriers"

func GetCjTracking(n string) {
	courier, _ := couriers.New("CJ")
	data, _ := courier.Parse(n)

	fmt.Println("%s -> %s : %s", data.Sender, data.Receiver, data.StatusText)
}

API Server

Build and run API server:

$ ./build
$ bin/delibird_server

or

$ PORT=8080 bin/delibird_server

Server Configuration

  • ENVIRONMENT: development or production(optimize json output) (default development)
  • PORT: server port (default 9000)
  • ENABLE_CORS: enable cors if true (default false)

Request URL

Request Parameters

COURIER_CODE

Code Name
KPOST Korean Post / ์šฐ์ฒด๊ตญํƒ๋ฐฐ
CJ CJ Korea express / CJ๋Œ€ํ•œํ†ต์šด
KG KG Logis / KG๋กœ์ง€์Šค
LOGEN Logen / ๋กœ์  ํƒ๋ฐฐ

Response

Key Description Example
TrackingNumber ์†ก์žฅ๋ฒˆํ˜ธ 1234567890123
CompanyCode ํƒ๋ฐฐ์‚ฌ์ฝ”๋“œ KPOST, CJ, ...
CompanyName ํƒ๋ฐฐ์‚ฌ๋ช… CJ๋Œ€ํ•œํ†ต์šด
Sender ๋ณด๋‚ด๋Š”๋ถ„ ํ™ˆ*๋Ÿผ
Receiver ๋ฐ›๋Š”๋ถ„ ํ…Œ*ํŠธ
Signer ์ˆ˜๋ น์ธ ๋ณธ์ธ
StatusCode ์ƒํƒœ์ฝ”๋“œ ํ•˜๋‹จ ์ฐธ๊ณ 
StatusText ์ƒํƒœ ๋ฐฐ์†ก์™„๋ฃŒ
History ๋ฐฐ์†ก ์ƒํ™ฉ(array) ํ•˜๋‹จ ์ฐธ๊ณ 

Status Code

  • -1 (UnknownStatus) - ์•Œ์ˆ˜์—†์Œ
  • 1 (Pending) - ์ ‘์ˆ˜ ๋Œ€๊ธฐ
  • 2 (Ready) - ์˜์—…์  ์ ‘์ˆ˜ (SM์ž…๊ณ )
  • 3 (PickupComplete) - ์ง‘ํ™”์ฒ˜๋ฆฌ
  • 4 (Loading) - ๊ฐ„์„ ์ƒ์ฐจ / ๋ฌผ๊ฑด ์‹ค์Œ / ์ค‘๊ฐ„ ์ง‘ํ™”์ง€ ์ถœ๋ฐœ
  • 5 (Unloading) - ๊ฐ„์„ ํ•˜์ฐจ / ๋ถ„๋ฅ˜ / ์ค‘๊ฐ„ ์ง‘ํ™”์ง€ ๋„์ฐฉ
  • 51 (DeleveryStart) - ๋ฐฐ์†ก์ถœ๋ฐœ
  • 91 (DeleveryComplete) - ๋ฐฐ์†ก์™„๋ฃŒ
  • 99 (DoNotDelevery) - ๋ฏธ๋ฐฐ๋‹ฌ

History

  • Area - ์œ„์น˜
  • Tel - ์ „ํ™”๋ฒˆํ˜ธ
  • Date - ์‹œ๊ฐ„(timestamp)
  • DateText - ์‹œ๊ฐ„(YYYY-MM-DD hh:mm)
  • StatusCode - ์ƒํƒœ์ฝ”๋“œ
  • StatusText - ์ƒํƒœ

Response example

{
  "tracking_number": "xxxxxx",
  "company_code": "CJ",
  "company_name": "CJ๋Œ€ํ•œํ†ต์šด",
  "sender": "ํ™ˆ*๋Ÿผ",
  "receiver": "ํ…Œ*ํŠธ",
  "signer": "๊ฒฝ๋น„์‹ค",
  "status_code": 91,
  "status_text": "๋ฐฐ๋‹ฌ์™„๋ฃŒ",
  "history": [
    {
      "area": "์†กํŒŒB์ง์˜(์ฐจ์ƒ๋ฌธ)",
      "tel": "02-6937-6842",
      "date": 1460013885,
      "date_text": "2016-04-07 16:24",
      "status_code": 3,
      "status_text": "์ง‘ํ™”์ฒ˜๋ฆฌ"
    },
    {
      "area": "์†กํŒŒB์ง์˜(์ฐจ์ƒ๋ฌธ)",
      "tel": "02-6937-6842",
      "date": 1460013885,
      "date_text": "2016-04-07 16:24",
      "status_code": 2,
      "status_text": "SM์ž…๊ณ "
    },
    {
      "area": "์†กํŒŒA",
      "tel": "02-6937-6836",
      "date": 1460026859,
      "date_text": "2016-04-07 20:00",
      "status_code": 4,
      "status_text": "๊ฐ„์„ ์ƒ์ฐจ"
    },
    {
      "area": "์šฉ์ธHUB",
      "date": 1460050614,
      "date_text": "2016-04-08 02:36",
      "status_code": 5,
      "status_text": "๊ฐ„์„ ํ•˜์ฐจ"
    },
    {
      "area": "์šฉ์ธHUB",
      "date": 1460050669,
      "date_text": "2016-04-08 02:37",
      "status_code": 5,
      "status_text": "๊ฐ„์„ ํ•˜์ฐจ"
    },
    {
      "area": "์šฉ์ธHUB",
      "date": 1460050694,
      "date_text": "2016-04-08 02:38",
      "status_code": 4,
      "status_text": "๊ฐ„์„ ์ƒ์ฐจ"
    },
    {
      "area": "์šฉ์ธHUB",
      "date": 1460050750,
      "date_text": "2016-04-08 02:39",
      "status_code": 4,
      "status_text": "๊ฐ„์„ ์ƒ์ฐจ"
    },
    {
      "area": "๋…ธ์›",
      "tel": "02-2129-1278",
      "date": 1460067554,
      "date_text": "2016-04-08 07:19",
      "status_code": 5,
      "status_text": "๊ฐ„์„ ํ•˜์ฐจ"
    },
    {
      "area": "์„œ์šธ์„œ๋…ธ์›",
      "tel": "070-4191-7643",
      "date": 1460068287,
      "date_text": "2016-04-08 07:31",
      "status_code": 51,
      "status_text": "๋ฐฐ๋‹ฌ์ถœ๋ฐœ"
    },
    {
      "area": "์„œ์šธ์„œ๋…ธ์›",
      "tel": "070-4191-7643",
      "date": 1460098645,
      "date_text": "2016-04-08 15:57",
      "status_code": 91,
      "status_text": "๋ฐฐ๋‹ฌ์™„๋ฃŒ"
    }
  ]
}

Docker

docker build

$ DOCKER_BUILD=1 ./build
$ docker build -t purpleworks/delibird .

docker run

$ docker run --rm \
  -p 9000:9000 \
  -e ENVIRONMENT=production \
  -e ENABLE_CORS=ture \
  purpleworks/delibird

Test

Test with goconvey

$ go get github.com/smartystreets/goconvey

In the browser

$ goconvey

In the terminal

$ go test && go test ./server && go test ./couriers
$ go test -v && go test -v ./server && go test ./couriers # include the story

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/purpleworks/delibird

  1. Fork it ( https://github.com/purpleworks/delibird/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

Released under the MIT License.