Skip to content

Instantly share code, notes, and snippets.

View wrimik's full-sized avatar

Mike Wright wrimik

View GitHub Profile
@wrimik
wrimik / fedex-rates-nodejs-soap-example.js
Last active January 25, 2022 18:19
FedEx Rates NodeJS SOAP Request
var soap = require('soap'); // npm i soap
var url = 'fedex-api/RateService/RateService_v24.wsdl'; // you'll need to download the wsdl file from https://www.fedex.com/en-us/developer/web-services/process.html#StandardServices
// if you change the order of these variables, everything gets fucked up because "wsdl" is a format for developers who have
// landed themselves in a middle circle of hell.
// this points at fedex's production server btw. if you use dev credentials you'll need to change the url WAAAY down
// by the bottom of the file, in "client.setEndpoint('https://ws.fedex.com:443/web-services');"
var data = {
"WebAuthenticationDetail": {
"UserCredential": {
/**
* accepts a nested array of integers,
* returns a flat array of integers.
* does not check for null, floats, or random objects
*
* var input = [1, 2, null, {}, [3, 4, [5]], 6, 7];
* console.log(flattenArray([]));
*
* @param a
* @returns {Array}