src/pitneybowesTracker.js
function createParcelTrackerEntity(body) {

    const data = JSON.parse(body)

    const states = []
    data.scanHistory.scanDetails.forEach((elem) => {
        const state = {
            state : elem.eventDescription,
            date : elem.eventDate + "T" + elem.eventTime
        }
        if(elem.eventLocation && elem.eventLocation.country
            && elem.eventLocation.countyOrRegion
            && elem.eventLocation.city){
            state.area = elem.eventLocation.country
                + " - " + elem.eventLocation.countyOrRegion
                + " - " + elem.eventLocation.city
        }
        states.push(state)
    })

    return new ParcelTrackerInfo({
        attempts: 1,
        id: data.packageIdentifier,
        state: data.currentStatus.eventDescription,
        carrier: data.carrier,
        origin: data.senderLocation.country
            + " - " + data.senderLocation.countyOrRegion
            + " - " + data.senderLocation.city,
        destiny: data.destinationLocation.country
            + " - " + data.destinationLocation.countyOrRegion
            + " - " + data.destinationLocation.city,
        states: states
    })
}
function createParcelTrackerEntity(body) {

    const data = JSON.parse(body)

    const states = []
    data.scanHistory.scanDetails.forEach((elem) => {
        const state = {
            state : elem.eventDescription,
            date : elem.eventDate + "T" + elem.eventTime
        }
        if(elem.eventLocation && elem.eventLocation.country
            && elem.eventLocation.countyOrRegion
            && elem.eventLocation.city){
            state.area = elem.eventLocation.country
                + " - " + elem.eventLocation.countyOrRegion
                + " - " + elem.eventLocation.city
        }
        states.push(state)
    })

    return new ParcelTrackerInfo({
        attempts: 1,
        id: data.packageIdentifier,
        state: data.currentStatus.eventDescription,
        carrier: data.carrier,
        origin: data.senderLocation.country
            + " - " + data.senderLocation.countyOrRegion
            + " - " + data.senderLocation.city,
        destiny: data.destinationLocation.country
            + " - " + data.destinationLocation.countyOrRegion
            + " - " + data.destinationLocation.city,
        states: states
    })
}
function createParcelTrackerEntity ( body ) { const data = JSON . parse ( body ) const states = [ ] data . scanHistory . scanDetails . forEach ( ( elem ) => { const state = { state : elem . eventDescription , date : elem . eventDate + "T" + elem . eventTime } if ( elem . eventLocation && elem . eventLocation . country && elem . eventLocation . countyOrRegion && elem . eventLocation . city ) { state . area = elem . eventLocation . country + " - " + elem . eventLocation . countyOrRegion + " - " + elem . eventLocation . city } states . push ( state ) } ) return new ParcelTrackerInfo ( { attempts : 1 , id : data . packageIdentifier , state : data . currentStatus . eventDescription , carrier : data . carrier , origin : data . senderLocation . country + " - " + data . senderLocation . countyOrRegion + " - " + data . senderLocation . city , destiny : data . destinationLocation . country + " - " + data . destinationLocation . countyOrRegion + " - " + data . destinationLocation . city , states : states } ) }
Create parcel tracker entity from html
@param html
Create parcel tracker entity from html