Comparing version 0.1.2 to 0.1.4
@@ -21,6 +21,1 @@ var dwolla = require('../lib/dwolla'); | ||
}); | ||
dwolla.fundingSources(c.token, function(err, data) { | ||
if (err) { console.log(err); } | ||
console.log(data); | ||
}); |
@@ -76,5 +76,5 @@ var https = require('https'); | ||
/** | ||
* Toggle to use the UAT sandbox environment or the actual production Dwolla environment. | ||
* Toggle to use the UAT sandbox environment or the actual production Dwolla environment. | ||
* | ||
* You can read more about the sandboxed environment below: | ||
* You can read more about the sandboxed environment below: | ||
* https://developers.dwolla.com/dev/pages/sandbox | ||
@@ -406,2 +406,58 @@ **/ | ||
/** | ||
* Adds a funding source to the account authorized to the current | ||
* oauth_token | ||
* https://developers.dwolla.com/dev/docs/funding/add | ||
* | ||
* @param {String} oauth_token | ||
* @param {Number} account_number | ||
* @param {String} routing_numbers | ||
* @param {String} account_type | ||
* @param {String} name | ||
* @param {Function} fn | ||
*/ | ||
exports.addFundingSource = function(oauth_token, account_number, routing_number, account_type, name, fn) { | ||
if (typeof fn !== 'function') { throw new Error('Missing callback'); } | ||
if (!oauth_token) { throw new Error('Missing arg oauth_token'); } | ||
if (!account_number) { throw new Error('Missing arg account_number'); } | ||
if (!routing_number) { throw new Error('Missing arg routing_number'); } | ||
if (!account_type) { throw new Error('Missing arg account_type'); } | ||
if (!name) { throw new Error('Missing arg name'); } | ||
var params = {}; | ||
params.oauth_token = oauth_token; | ||
params.account_number = account_number; | ||
params.routing_number = routing_number; | ||
params.account_type = account_type; | ||
params.name = name; | ||
_post('/fundingsources/', params, fn); | ||
}; | ||
/** | ||
* Verifies an added funding source to a Dwolla account | ||
* http://developers.dwolla.com/dev/docs/funding/verify | ||
* | ||
* @param {String} oauth_token | ||
* @param {Number} deposit1 | ||
* @param {Number} deposit2 | ||
* @param {String} id | ||
* @param {Function} fn | ||
*/ | ||
exports.verifyFundingSource = function(oauth_token, deposit1, deposit2, id, fn) { | ||
if (typeof fn !== 'function') { throw new Error('Missing callback'); } | ||
if (!oauth_token) { throw new Error('Missing arg oauth_token'); } | ||
if (!deposit1) { throw new Error('Missing arg deposit1'); } | ||
if (!deposit2) { throw new Error('Missing arg deposit2'); } | ||
if (!id) { throw new Error('Missing arg id'); } | ||
var params = {}; | ||
params.oauth_token = oauth_token; | ||
params.deposit1 = deposit1; | ||
params.deposit2 = deposit2; | ||
params.id = id; | ||
_post('/fundingsources/' + id + '/verify', params, fn); | ||
}; | ||
/** | ||
* Moves an amount in to Dwolla from a funding source for the user | ||
@@ -510,1 +566,100 @@ * associated with the authorized access token. | ||
/** | ||
* Creates a MassPay Job for the user for the authorized access token. | ||
* Takes an array of objects, each containing amount, destination, | ||
* destinationType, and note as items. | ||
* | ||
* https://developers.dwolla.com/dev/docs/masspay/create | ||
* | ||
* Required arguments: | ||
* | ||
* @param {String} oauth_token | ||
* @param {string} fundsSource | ||
* @param {int} pin | ||
* @param {array} items | ||
* @param {object} params | ||
* @param {function} fn | ||
* | ||
* Optional params: | ||
* | ||
* boolean assumeCosts | ||
* string userJobId | ||
* | ||
**/ | ||
exports.createMassPayJob = function(oauth_token, fundsSource, pin, items, params, fn) { | ||
// params are optional | ||
if (!fn && typeof params === 'function') { | ||
fn = params; | ||
params = {}; | ||
} | ||
if (typeof fn !== 'function') { throw new Error('Missing callback'); } | ||
if (!oauth_token) { throw new Error('Missing arg oauth_token'); } | ||
if (!pin) { throw new Error('Missing arg pin'); } | ||
if (!fundsSource) { throw new Error('Missing arg fundsSource'); } | ||
if (!items) { throw new Error('Missing arg items'); } | ||
params = params || {}; | ||
params.oauth_token = oauth_token; | ||
params.fundsSource = fundsSource; | ||
params.pin = pin; | ||
params.items = items; | ||
_post('/masspay/', params, fn); | ||
}; | ||
/** | ||
* Fetches details about an existing MassPay Job, given a job_id. | ||
* | ||
* https://developers.dwolla.com/dev/docs/masspay/job | ||
* | ||
* Required arguments: | ||
* | ||
* @param {String} oauth_token | ||
* @param {string} job_id | ||
* @param {function} fn | ||
* | ||
**/ | ||
exports.getMassPayJob = function(oauth_token, job_id, fn) { | ||
if (typeof fn !== 'function') { throw new Error('Missing callback'); } | ||
if (!job_id) { throw new Error('Missing Job ID'); } | ||
if (!oauth_token) { throw new Error('Missing arg oauth_token'); } | ||
params = {}; | ||
params.oauth_token = oauth_token; | ||
_request('/masspay/' + job_id, params, fn); | ||
}; | ||
/** | ||
* Fetches all Items for a MassPay Job, given a job_id. | ||
* | ||
* https://developers.dwolla.com/dev/docs/masspay/jobs/items | ||
* | ||
* Required arguments: | ||
* | ||
* @param {String} oauth_token | ||
* @param {string} job_id | ||
* @param {function} fn | ||
* | ||
* Optional arguments: | ||
* | ||
* @param {integer} limit | ||
* @param {integer} skip | ||
* | ||
**/ | ||
exports.getMassPayJobItems = function(oauth_token, job_id, params, fn) { | ||
// params are optional | ||
if (!fn && typeof params === 'function') { | ||
fn = params; | ||
params = {}; | ||
} | ||
if (!job_id) { throw new Error('Missing Job ID'); } | ||
if (typeof fn !== 'function') { throw new Error('Missing callback'); } | ||
if (!oauth_token) { throw new Error('Missing arg oauth_token'); } | ||
params = params || {}; | ||
params.oauth_token = oauth_token; | ||
_request('/masspay/' + job_id + '/items', params, fn); | ||
}; |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"repository": { | ||
@@ -18,0 +18,0 @@ "type": "git", |
@@ -25,2 +25,4 @@ # Dwolla API for node.js | ||
* fundingSourceById(oauth_token, id, fn) | ||
* [NEW!] addFundingSource(oauth_token, account_number, routing_number, account_type, name, fn) | ||
* [NEW!] verifyFundingSource(oauth_token, deposit1, deposit2, id, fn) | ||
* deposit(oauth_token, pin, sourceId, amount, fn) | ||
@@ -31,2 +33,7 @@ * fulfill(oauth_token, pin, sourceId[, params], fn) | ||
[MassPay](https://developers.dwolla.com/dev/docs/masspay) | ||
* createMassPayJob(oauth_token, fundsSource, pin, items[, params], fn) | ||
* getMassPayJob(oauth_token, job_id, fn) | ||
* getMassPayJobItems(oauth_token, job_id[, params], fn) | ||
All optional parameters are passed in as an optional object before the callback. | ||
@@ -36,3 +43,3 @@ | ||
If you desire to test your application with Dwolla's UAT sandbox, you can | ||
If you desire to test your application with Dwolla's UAT sandbox, you can | ||
dynamically toggle between sandbox and production mode by toggling the sandbox flag. | ||
@@ -43,3 +50,3 @@ | ||
The sandbox environment is disabled by default. | ||
The sandbox environment is disabled by default. | ||
@@ -46,0 +53,0 @@ ### How to obtain a Dwolla OAuth2 token |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33036
20
835
109