1.0.3 • Published 7 years ago

taxcloudjs v1.0.3

Weekly downloads
7
License
GPL-3.0
Repository
github
Last release
7 years ago

taxcloudjs

TaxCloud Integration - Using promises and fetch

Why this module:

  • Promises
  • Allows to use env for sensitive data without extra coding
  • Only one dependency: node-fetch
  • Active and open for Pull Requests
  • Follows TaxCloud documentation
  • Uses TaxCloud JSON faster API, not SOAP

If you think you can contribute, please do. Looking for co-maintainers.

Install

$ npm install taxcloudjs

Setting up

By default, the following environmet variables will be used if present:

  • TAXCLOUD_LOGIN_ID
  • TAXCLOUD_KEY
  • TAXCLOUD_USPS_USER_ID

You can override any of them passing properties to TaxCloud constructor:

  • apiLoginId
  • apiKey
  • USPDUserId

Example:

var props = {
  apiLoginId: 'xxxxxxxxxx', // Required
  apiKey: 'xxxxxxxxxxxxxx', // Required
  USPSUserId: 'xxxxxxxxxx'  // Optional - for address validation only
}

// using constructor
var TaxCloud = require('taxcloudjs')
var taxcloudjs = new TaxCloud(props);

// intialize factory method
var taxcloudjs = require('taxcloudjs').initialize(props);

Optional Properties

PropertyTypeDefaultDescription
maxCartSizeint100Maximun number of Items in a Cart. read TaxCloud documentation before changing this.

Ping

var taxcloudjs = require('taxcloudjs').initialize();

taxcloudjs.ping()
.then((result) => {
  console.log(result ? 'Pong!' : 'Nothing ...');
})
.catch((err) => {
  // Handle it ...
})

More methods

Methods will receive and return what TaxCloud is expecting as JSON. Read TaxCloud documentation to learn more.

All important methods to operate with TaxCloud returns a Promise that will give you the Object returned by the API or an error to be catched with API Error code and messages depending on the method called, such as [{"ResponseType":0,"Message":"Invalid apiLoginID and/or apiKey"}].

This implementation uses TaxCloud API as is, all validation, except some basic validation done on lookup, are performed on their end and returned as errors. All methods accepts as params objects just like requested on documentation and responses are resolved as they come. Its your job to send proper information and manipulate the response.

MethodParamsReturnsDescription
getTICs-Promise:Array of IdsReturns all available TICs
getTICsGroups-Promise:Array of GroupsReturns all available TIC Groups
getTICsByGroupticId:intPromise:Array of IdsReturns all available TICs for a Given group
updateTICIdList-PromiseUpdates the internal TICs cache
isTicticId:intbooleanWhether or not a given ID is in the TICs cache
verifyAddresscart:ObjectPromise:ObjectSee TaxCloud docs
lookupcart:ObjectPromise:ObjectSee TaxCloud docs
authorizedtransaction:ObjectPromise:ObjectSee TaxCloud docs
capturetransaction:ObjectPromise:ObjectSee TaxCloud docs
authorizedWithCapturetransaction:ObjectPromise:ObjectSee TaxCloud docs
returnedtransaction:ObjectPromise:ObjectSee TaxCloud docs
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago