0.2.0 • Published 4 years ago

nodejs-canadapost v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

node-canadapost

Build Status Dependency Status devDependency Status version license

A Node wrapper for Canada Post APIs

Installation

$ npm install node-canadapost

Initialization

var CanadaPost = require('node-canadapost');
var canadapost = CanadaPost(config)

Note: Configuration object MUST contain your API username and password, optional parameters include customernumber and contractid.

API

#getServiceOutageInfo(callbackerr, results)

This will call the Service Outage API from Canada Post, and return a object representation of their response as parsed by xml2js.

#isServiceDown(callbackerr, result)

This sums up what you really want to know from #getServiceOutageInfo. Barring some sort of error, this will give you a true/false answer if the service endpoint is down.

#getShippingRates(params, callbackerr, result)

This function will use the parameters provided to obtain the most accurate shipping rates for your shipment. Mandatory parameters include Parcel Characteristics (Height, Length, Weight, and Width), the Origin Postal Code (Canadian), and the shipment's destination (One of: 'domestic', 'united-states', or 'international').