Socket
Socket
Sign inDemoInstall

delivery-tracker

Package Overview
Dependencies
80
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.7.1 to 2.7.2

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# 2.7.2
* fixed an issue in JNT is not working
# 2.7.1

@@ -2,0 +5,0 @@ * fixed an issue in JNT is not working

28

lib/courier/jnt.js

@@ -23,8 +23,9 @@ 'use strict'

body: {
method: 'app.findTrack',
method: 'order.orderTrack',
data: {
billcode: number,
billCode: number,
lang: 'en',
source: 3
},
version: '2.2.22',
pId: 'testtesttest',

@@ -38,3 +39,3 @@ pst: '712d5af47cd24adf54fe39ebc4ed0aea'

var parser = {
trace: function (data) {
trace: function (data, number) {
var courier = {

@@ -46,3 +47,3 @@ code: tracker.COURIER.JNT.CODE,

courier: courier,
number: data.billcode,
number: number,
status: tracker.STATUS.PENDING

@@ -54,5 +55,3 @@ }

var item = data.details[i]
var message = [
item.desc
].join(' - ')
var message = [item.scanstatus].join(' - ')
var checkpoint = {

@@ -63,6 +62,8 @@ courier: courier,

status: tracker.STATUS.IN_TRANSIT,
time: moment(item.scantime + 'T+0800', 'YYYY-MM-DD HH:mm:ssZ').utc().format('YYYY-MM-DDTHH:mmZ')
time: moment(item.acceptTime + 'T+0800', 'YYYY-MM-DD HH:mm:ss.0Z')
.utc()
.format('YYYY-MM-DDTHH:mmZ')
}
if (item.scanstatus === 'Delivered') {
if (item.scanscode === '5') {
checkpoint.status = tracker.STATUS.DELIVERED

@@ -101,7 +102,10 @@ } else if (item.scanstatus === 'Returned') {

return cb(tracker.error(res.statusMessage))
} else if (body.code !== 20000) {
} else if (body.code !== 200) {
return cb(tracker.error(body.code, body.desc))
}
var result = parser.trace(JSON.parse(body.data))
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
var result = parser.trace(JSON.parse(body.data), number)
cb(
result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER),
result
)
} catch (e) {

@@ -108,0 +112,0 @@ cb(tracker.error(e.message))

@@ -56,3 +56,7 @@ 'use strict'

req(tracking.detail(token), function (err, res, body) {
var response = JSON.parse(body)
try {
var response = JSON.parse(body)
} catch (error) {
return cb(error)
}
if (response.statusCode !== '200') {

@@ -59,0 +63,0 @@ return cb(response.statusText)

{
"name": "delivery-tracker",
"version": "2.7.1",
"version": "2.7.2",
"author": {

@@ -5,0 +5,0 @@ "name": "egg",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc