Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable no-bitwise */
const fetch = require('isomorphic-fetch');
const { uniq, map, flatMap } = require('lodash');
const { eosd } = require('../../config/vars');
const { formatISO } = require('../utils/helpers');
fetch.Promise = require('bluebird');
const defaults = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
};
// Grab the correct, sorted sceope from the list of messages
// intended for a transaction
const getScope = messages =>
uniq(
flatMap(messages, msg => [msg.code, ...map(msg.authorization, auth => auth.account)]),
).sort();
const request = async (path, options = {}) => {
'use strict'
const Promise = require("bluebird")
const fetch = require('isomorphic-fetch')
fetch.Promise = Promise
const _extend = require('lodash.assignin')
const _get = require('lodash.get')
const _chunk = require('lodash.chunk')
const _flatten = require('lodash.flatten')
const xml2js = require('xml2js')
const Helpers = require('../utils/helpers')
const TrackingError = require('../errors/tracking')
const parseXMLString = xml2js.parseString
const url = 'https://webservice.correios.com.br/service/rastro'