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.1.0 to 0.1.1

test/pending.js

137

lib/dwolla.js
var https = require('https');
var qs = require('querystring');
var qs = require('querystring');

@@ -22,3 +22,3 @@ var API_PATH = '/oauth/rest';

err.body = data;
err.body = data;
err.exception = e;

@@ -31,6 +31,4 @@

} else {
var err = new Error(data.Message);
err.body = data
var err = new Error(data.Message);
err.body = data;
fn(err);

@@ -41,5 +39,4 @@ }

function onError(err) {
res.removeListener('end', onEnd)
fn(err)
res.removeListener('end', onEnd);
fn(err);
}

@@ -49,3 +46,3 @@

res.once('error', onError);
}
};
}

@@ -55,4 +52,4 @@

var options = {
host: 'www.dwolla.com'
, path: API_PATH + path
host: 'www.dwolla.com',
path: API_PATH + path
};

@@ -68,6 +65,6 @@ if (params) {

var options = {
host: 'www.dwolla.com'
, path: API_PATH + path
, method: 'POST'
, headers: {
host: 'www.dwolla.com',
path: API_PATH + path,
method: 'POST',
headers: {
'Content-Type': 'application/json'

@@ -206,3 +203,3 @@ }

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

@@ -375,3 +372,3 @@ **/

* @param {String} oauth_token
* @param {String} fundingId
* @param {String} id
* @param {Function} fn

@@ -403,1 +400,105 @@ **/

/**
* Moves an amount in to Dwolla from a funding source for the user
* associated with the authorized access token.
* http://developers.dwolla.com/dev/docs/funding/deposit
*
* @param {String} oauth_token
* @param {Number} pin
* @param {String} sourceId
* @param {String} amount
* @param {Function} fn
*/
exports.deposit = function(oauth_token, pin, sourceId, amount, fn) {
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 (!sourceId) { throw new Error('Missing arg sourceId'); }
if (!amount) { throw new Error('Missing arg amount'); }
var params = {};
params.oauth_token = oauth_token;
params.pin = pin;
params.sourceId= sourceId;
params.amount = amount;
_post('/fundingsources/' + id + '/withdraw', params, fn);
};
/**
* Fulfills a pending transaction for the user associated
* with the authorized access token.
* http://developers.dwolla.com/dev/docs/requests/fulfill
*
* Optional params:
*
* - assumeCosts
* - facilitatorAmount
* - notes
*
* @param {String} oauth_token
* @param {Number} pin
* @param {String} sourceId
* @param {Function} fn
*/
exports.fulfill = function(oauth_token, pin, sourceId, 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 (!sourceId) { throw new Error('Missing arg sourceId'); }
if (!amount) { throw new Error('Missing arg amount'); }
params = params || {};
params.oauth_token = oauth_token;
params.pin = pin;
params.sourceId= sourceId;
params.amount = amount;
_post('/requests/' + sourceId + '/fulfill', params, fn);
};
/**
* Retrieves a list of pending transactions for the user
* associated with the authorized access token.
* http://developers.dwolla.com/dev/docs/requests/pending
*
* @param {String} oauth_token
* @param {Function} fn
*/
exports.pending = function(oauth_token, fn) {
if (typeof fn !== 'function') { throw new Error('Missing callback'); }
if (!oauth_token) { throw new Error('Missing arg oauth_token'); }
var params = { oauth_token: oauth_token };
_request('/requests/', params, fn);
};
/**
* Moves an amount from Dwolla into a funding source for the user
* associated with the authorized access token.
* http://developers.dwolla.com/dev/docs/funding/withdraw
*
* @param {String} oauth_token
* @param {Number} pin
* @param {String} sourceId
* @param {String} amount
* @param {Function} fn
*/
exports.withdraw = function(oauth_token, pin, sourceId, amount, fn) {
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 (!sourceId) { throw new Error('Missing arg sourceId'); }
if (!amount) { throw new Error('Missing arg amount'); }
var params = {};
params.oauth_token = oauth_token;
params.amount = amount;
params.pin = pin;
_post('/fundingsources/' + sourceId + '/withdraw', params, fn);
};

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

"description": "Dwolla API for node.js",
"version": "0.1.0",
"keywords": ["dwolla", "payment"],
"contributors": [
{
"name": "Dan Milon",
"email": "danmilon@gmail.com"
},
{
"name": "Rob Putnam"
}
],
"version": "0.1.1",
"repository": {

@@ -8,0 +18,0 @@ "type": "git",

30

README.md

@@ -8,5 +8,5 @@ # Dwolla API for node.js

* basicAccountInfo(client_id, client_secret, id, callback)
* nearby(client_id, client_secret, lat, lon, [, params], callback)
* register(client_id, client_secret, userInfo, callback)
* basicAccountInfo(client_id, client_secret, id, fn)
* nearby(client_id, client_secret, lat, lon, [, params], fn)
* register(client_id, client_secret, userInfo, fn)

@@ -16,12 +16,16 @@ Requires a valid user OAuth2 token. Note tokens do not expire and may be

* 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)
* send(oauth_token, pin, destinationId, amount[, params], callback)
* request(oauth_token, pin, sourceId, amount[, params], callback)
* fundingSources(oauth_token, callback)
* fundingSourceById(oauth_token, id, callback)
* fullAccountInfo(oauth_token, fn)
* balance(oauth_token, fn)
* contacts(oauth_token[, params], fn)
* transactions(oauth_token[, params], fn)
* transactionById(oauth_token, id, fn)
* transactionsStats(oauth_token[, params], fn)
* send(oauth_token, pin, destinationId, amount[, params], fn)
* request(oauth_token, pin, sourceId, amount[, params], fn)
* fundingSources(oauth_token, fn)
* fundingSourceById(oauth_token, id, fn)
* deposit(oauth_token, pin, sourceId, amount, fn)
* fulfill(oauth_token, pin, sourceId[, params], fn)
* pending(oauth_token, callback)
* withdraw(oauth_token, pin, sourceId, amount, fn)

@@ -28,0 +32,0 @@ All optional parameters are passed in as an optional object before the callback.

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