Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dwolla

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dwolla - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

examples.js

120

lib/dwolla.js
var https = require('https');
var qs = require('querystring');
var keys = {
client_id: process.env.DWOLLA_CLIENT_ID || null
, client_secret: process.env.DWOLLA_CLIENT_SECRET || null
};
var defaultOptions = {
host: 'www.dwolla.com',
};
var API_PATH = '/oauth/rest';
function _request(path, params, fn) {
var options = defaultOptions;
options.path = API_PATH + path;
var options = {
host: 'www.dwolla.com'
, path: API_PATH + path
};
if (params) {

@@ -35,3 +28,3 @@ options.path += '?' + qs.stringify(params);

} catch (e) {
fn('Error parsing response from dwolla api.', null);
fn('Error parsing response from dwolla api.', data);
}

@@ -46,6 +39,14 @@ });

* https://www.dwolla.com/developers/endpoints/users/basicinformation
*
* @param {String} client_id
* @param {String} client_secret
* @param {String} id
* @param {Function} fn
**/
exports.basicAccountInfo = function(id, fn) {
exports.basicAccountInfo = function(client_id, client_secret, id, fn) {
var path = '/users/' + id;
_request(path, keys, fn);
var params = {};
params.client_id = client_id;
params.client_secret = client_secret;
_request(path, params, fn);
};

@@ -56,2 +57,5 @@

* https://www.dwolla.com/developers/endpoints/users/accountinformation
*
* @param {String} oauth_token
* @param {Function} fn
**/

@@ -66,2 +70,5 @@ exports.fullAccountInfo = function(oauth_token, fn) {

* https://www.dwolla.com/developers/endpoints/balance/account
*
* @param {String} oauth_token
* @param {Function} fn
* */

@@ -77,7 +84,18 @@ exports.balance = function(oauth_token, fn) {

*
* @param {String} search
* @param {String} types
* @param {int} limit
* Optional params:
*
* - search
* - types
* - limit
*
* @param {String} oauth_token
* @param {Object} params
* @param {Function} fn
* */
exports.contacts = function(oauth_token, params, fn) {
// params are optional
if (!fn || typeof params === 'function') {
fn = params;
params = {};
}
params = params || {};

@@ -94,12 +112,24 @@ params.oauth_token = oauth_token;

*
* @param {String} lat
* @param {String} long
* @param {int} range
* @param {int} limit
* Optional params:
*
* - range
* - limit
*
* @param {String} client_id
* @param {String} client_secret
* @param {String} lat
* @param {String} lon
* @param {Object} params
* @param {Function} fn
**/
exports.nearby = function(lat, lon, params, fn) {
if (keys.client_id !== null) {
exports.nearby = function(client_id, client_secret, lat, lon, params, fn) {
// params are optional
if (!fn || typeof params === 'function') {
fn = params;
params = {};
}
if (client_id !== null) {
params = params || {};
params.client_id = keys.client_id;
params.client_secret = keys.client_secret;
params.client_id = client_id;
params.client_secret = client_secret;
params.latitude = lat;

@@ -119,3 +149,5 @@ params.longitude = lon;

*
* @param {int} transactionId
* @param {String} oauth_token
* @param {int} transactionId
* @param {Function} fn
**/

@@ -132,8 +164,19 @@ exports.transactionById = function(oauth_token, id, fn) {

*
* @param {String} sinceDate
* @param {String} types
* @param {int} limit
* @param {int} skip
* Optional params:
*
* - sinceDate
* - types
* - limit
* - skip
*
* @param {String} oauth_token
* @param {Object} params
* @param {Function} fn
**/
exports.transactions = function(oauth_token, params, fn) {
// params are optional
if (!fn || typeof params === 'function') {
fn = params;
params = {};
}
params = params || {};

@@ -148,7 +191,18 @@ params.oauth_token = oauth_token;

*
* @param {String} types
* @param {String} startDate
* @param {String} endDate
* Optional params:
*
* - types
* - startDate
* - endDate
*
* @param {String} oauth_token
* @param {Object} params
* @param {Function} fn
**/
exports.transactionsStats = function(oauth_token, params, fn) {
// params are optional
if (!fn || typeof params === 'function') {
fn = params;
params = {};
}
params = params || {};

@@ -155,0 +209,0 @@ params.oauth_token = oauth_token;

@@ -5,3 +5,3 @@ {

"description": "Dwolla API for node.js",
"version": "0.0.2",
"version": "0.0.3",
"repository": {

@@ -16,3 +16,9 @@ "type": "git",

"dependencies": {},
"devDependencies": {}
"devDependencies": {
"should": "",
"mocha": ""
},
"scripts": {
"test": "mocha"
}
}

@@ -6,16 +6,20 @@ # Dwolla API for node.js

Requires application client_id and client_secret
Requires your Dwolla application client_id and client_secret.
* basicAccountInfo
* nearby(lat, long)
* basicAccountInfo(client_id, client_secret, id, callback)
* nearby(client_id, client_secret, lat, lon, [, params], callback)
Requires OAuth2 Token
Requires a valid user OAuth2 token. Note token do not expire and may be
reused. See https://github.com/bnoguchi/everyauth for an example on how
to get authorize and get a Dwolla OAuth2 token.
* fullAccountInfo
* balance
* contacts
* transactionById(id)
* transactions
* transactionsStats
* fullAccountInfo(oauth_token, callback)
* balance(oauth_token, callback)
* contacts(oauth_token[, params], callback)
* transactions(oauth_token[, params], callback)
* transactionById(oauth_token, id, callback)
* transactionsStats(oauth_token[, params], callback)
All optional parameters are passed in as an optional object before the callback.
## Installation

@@ -25,9 +29,4 @@

You need to register your application with Dwolla to get a client_id and
client_secret to make API requests. Set these as env variables.
DWOLLA_CLIENT_ID=''
DWOLLA_CLIENT_SECRET=''
## Example Usage
See examples.js.

@@ -44,5 +43,7 @@ var dwolla = require('dwolla');

});
dwolla.transactions(token, null, function(err, data) {
dwolla.transactions(token, function(err, data) {
console.log("Transactions: " + data);
});
var params = {};

@@ -54,1 +55,10 @@ params.search = 'Ben';

});
## Tests
Tests use mocha and should
$ npm test
or
$ mocha
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc