1.2.0 • Published 4 years ago
@compassdigital/freedompay v1.2.0
freedompay
Interacts with FreedomPay's library
Requirements
- node.js 8.10+
Installation
npm install @compassdigital/freedompay
Usage
const FreedomPayClient = require("@compassdigital/freedompay");
// Instantiate a new client for EVERY request
let client = new FreedomPayClient({
'environment': 'dev'
// Set other FreewayRequest properties here...
});
/**
* To reuse the client for a new request,
* call the reset() method on the client.
* WARNING: reset() is destructive and will
* clear any request properties previously
* set, as well as the response that was
* received from a FreewayAPI.Submit call.
*/
client.reset();
// Set new request properties...
client.request.test = "example";
client.submit();
/**
* client.request is an instance of FreewayJS/FreewayRequest
* client.reply is the FreewayJS/FreewayReply class, uninstantiated
* client.call is an instance of the FreewayAPI with the url provided through options,
* client.response is the response from the FreewayAPI.Submit method
* or defaults to UAT url
*/
Testing
npm install mocha -g # if you don't have it installed already
npm test