Skip to content

Commit

Permalink
Several fixes. Added / corrected documentation. Added more examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
klobyone committed Feb 3, 2013
1 parent cd62c37 commit 6276b7a
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 31 deletions.
3 changes: 3 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ lib/WebService/Dwolla.pm
examples/account_info.pl
examples/balance.pl
examples/contacts.pl
examples/deposit.pl
examples/funding_sources.pl
examples/gateway.cgi
examples/listings.pl
examples/oauth.cgi
examples/register.pl
examples/request.pl
examples/send.pl
examples/stats.pl
examples/webhook.cgi
examples/withdraw.pl
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ WriteMakefile(
'Data::Dumper' => 2.124,
'LWP::UserAgent' => 5.833,
'Crypt::SSLeay' => 0.57,
'Test::More' => 0,
'Digest::HMAC' => 1.01
},
($] >= 5.005 ? ## Add these new keywords supported since 5.005
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WebService::Dwolla version 0.01
WebService::Dwolla version 0.03
=============================

INSTALLATION
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NOTE: This module is in the very early stages. Do not use this for anything but

## Version

0.2
0.03

## Requrements (Module Dependcies)

Expand All @@ -27,15 +27,20 @@ The easiest way to install this module is via the CPAN command-line interface.
It also be can obtained from [here](http://search.cpan.org/~klobyone/). If done
this way you will have to resolve the dependecies yourself.

NaturalDocs code documatation will be made available [here[(http://pixdiv.com/dwolla-perl/).

## Examples / Quickstart

This repo includes various usage examples, including:

* Authenticating with OAuth [oauth.cgi]
* Deposit money [deposit.pl]
* Withdraw money [withdraw.pl]
* Register a new Dwolla account [register.pl]
* Sending money [send.pl]
* Request money [request.pl]
* Transaction listings [listings.pl]
* Transaction stats [stats.pl]
* Fetching account information [account_info.pl]
* Grabbing a user's contacts [contacts.pl]
* Listing a user's funding sources [funding_sources.pl]
Expand All @@ -44,11 +49,15 @@ This repo includes various usage examples, including:

## Changelog

0.2
0.03

* Numerous fixes. Added / corrected documentation. Added more examples.

0.02

* Added dependenies to Makefile.PL. Added / corrected documentation. Added examples to MANIFEST.

0.1
0.01

* Initial version.

Expand Down
1 change: 1 addition & 0 deletions examples/account_info.pl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
}

# Example 3: Get account information for an account given an email.
# NOTE: Got this from PHP API exmaples, but it doesn't seem to be implemented.

my $acct2 = $api->get_user('michael@dwolla.com');
if (!$acct2) {
Expand Down
25 changes: 25 additions & 0 deletions examples/deposit.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /usr/bin/perl

use strict;
use warnings;

use WebService::Dwolla;
use Data::Dumper;

my $api = WebService::Dwolla->new();

# Set key, secret, and OAuth token from config file.
$api->set_api_config_from_file('/usr/local/etc/dwolla_api.conf');

# Example 1: Deposit money from a funding source into Dwolla account.

my $source_id = 'a4946ae2d2b7f1f880790f31a36887f5';
my $pin = '1234';
my $amount = '1.00';

my $deposit = $api->deposit($source_id,$pin,$amount);
if (!$deposit) {
print Dumper($api->get_errors());
} else {
print Dumper($deposit);
}
28 changes: 28 additions & 0 deletions examples/funding_sources.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,31 @@
} else {
print Dumper($fs);
}

# Example 3: Add a funding source.

my $acctnum = '123456';
my $trnnum = '123456789';
my $type = 'Checking';
my $name = 'My Checking';

my $add = $api->add_funding_source($acctnum,$trnnum,$type,$name);
if (!$add) {
print Dumper($api->get_errors());
} else {
print Dumper($add);
}

# Example 4: Verify a funding source.

my $d1 = '0.01';
my $d2 = '0.02';
my $id = 'a4946ae2d2b7f1f880790f31a36887f5';

my $verify = $api->verify_funding_source($id,$d1,$d2);
if (!$verify) {
print Dumper($api->get_errors());
} else {
print Dumper($verify);
}

2 changes: 1 addition & 1 deletion examples/listings.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Example 1: Retrieve a list of transactions for the user associated with the
# provided OAuth token.

my $listings = $api->listings('02-01-2013');
my $listings = $api->listings('02-01-2012');

if (!$listings) {
print Dumper($api->get_errors());
Expand Down
23 changes: 23 additions & 0 deletions examples/stats.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/perl

use strict;
use warnings;

use WebService::Dwolla; # Include Dwolla REST API Client
use Data::Dumper; # Include this to help with debugging.

# Instantiate new client.
my $api = WebService::Dwolla->new();

# Set key, secret, and OAuth token from config file.
$api->set_api_config_from_file('/usr/local/etc/dwolla_api.conf');

# Example 1: Retrieve stats.

my $stats = $api->stats();

if (!$stats) {
print Dumper($api->get_errors());
} else {
print Dumper($stats);
}
25 changes: 25 additions & 0 deletions examples/withdraw.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /usr/bin/perl

use strict;
use warnings;

use WebService::Dwolla;
use Data::Dumper;

my $api = WebService::Dwolla->new();

# Set key, secret, and OAuth token from config file.
$api->set_api_config_from_file('/usr/local/etc/dwolla_api.conf');

# Example 1: Withdraw money from a to a funding source.

my $source_id = 'a4946ae2d2b7f1f880790f31a36887f5';
my $pin = '1234';
my $amount = '1.00';

my $withdrawal = $api->withdraw($source_id,$pin,$amount);
if (!$withdrawal) {
print Dumper($api->get_errors());
} else {
print Dumper($withdrawal);
}
Loading

0 comments on commit 6276b7a

Please sign in to comment.