Skip to content

Commit

Permalink
updated dwolla module to support new API endpoint and response format
Browse files Browse the repository at this point in the history
  • Loading branch information
nanek committed Dec 1, 2011
1 parent cd8d4b2 commit e644060
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/modules/dwolla.js
Expand Up @@ -25,11 +25,20 @@ oauthModule.submodule('dwolla')

.fetchOAuthUser( function (accessToken) {
var promise = this.Promise();
rest.get(this.apiHost() + '/accountapi/accountinformation', {
rest.get(this.apiHost() + '/users/', {
query: { oauth_token: accessToken, alt: 'json' }
}).on('success', function (data, res) {
var oauthUser = data;
promise.fulfill(oauthUser);
try {
data = JSON.parse(data);
if (data.Success === true) {
var oauthUser = data.Response;
promise.fulfill(oauthUser);
} else {
promise.fail(data.Message);
}
} catch (e) {
promise.fail('Failed to parse Dwolla response');
}
}).on('error', function (data, res) {
promise.fail(data);
});
Expand Down

0 comments on commit e644060

Please sign in to comment.