Easy node.js integration for Dwolla's MassPay API.
Based on the Dwolla Labs MassPay API which has two endpoints: Create Job and Job Details by ID. This module provides simple access to the two endpoints above, as well as an additional monitor timer that will poll the Job Details by ID endpoint on a specified interval until the job is complete, or a specified timeout reached.
npm install dwolla-masspay or if you already have a project with a package.json, add it as a dependency like:
Followed by running a
npm install in your project root.
Please see this test for a complete working example.
var config =token: processenvDWOLLA_OAUTH_TOKEN || null // Requiredpin: processenvDWOLLA_PIN || null // Requireduid: processenvDWOLLA_UID || null // Requiredmonitor_interval_ms: 500 // Optional (default 1000): how often to poll the job details endpointmonitor_timeout_ms: 0 // Optional (default 0): when to timeout, or 0 == never time outvar masspay = config;// NOTE: you must define email, filedata, assumeCosts, test, source, user_job_id in your codemasspay;
Notes on the config object:
- If you already have a config defined for the 'dwolla' module it should work here by simply adding in the
- This approach is designed to keep sensitive info externalized from your source code.
- If any of the auth keys are missing from the config object ('token', 'pin', or 'uid'), the dwolla-masspay module will throw an error immediately.
- This module does not require 'client_id' or 'client_secret' (unlike the 'dwolla' module) as they are not needed by the Mass Pay endpoints.
This executes a single integration test that covers all three API functions exposed by this module. It creates a Mass Pay job with Dwolla (in test mode), then starts a monitor timer that calls the job details endpoint on Dwolla to check job status until timeout. Mass Pay jobs created on Dwolla in test mode do not complete, so it is expected for this job to timeout. Testing is in Mocha with Should.js.
This module is MIT licensed here.