diff options
author | mark <mark> | 2009-08-19 05:47:08 +0000 |
---|---|---|
committer | mark <mark> | 2009-08-19 05:47:08 +0000 |
commit | aa02cc5759a4ecf515a7ea0275330e36e107d92d (patch) | |
tree | 3ad4b9fcce57db818fc2af1b5a7351e5f0d766cd | |
parent | 0536726f420e8bbfd874abab32e15436807ac3d0 (diff) |
Fix transret format changeBusiness_OnlinePayment_WesternACH_0_07
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | lib/Business/OnlinePayment/WesternACH.pm | 10 |
2 files changed, 11 insertions, 2 deletions
@@ -1,5 +1,8 @@ Revision history for Business-OnlinePayment-WesternACH +0.07 Tue Aug 18 22:45:10 PDT 2009 + - Handle format change to transret.php results. + 0.06 Thu Aug 13 14:56:12 PDT 2009 - Make transret.php the default returns method. - Old method is still available via returns_method => 'requester'. diff --git a/lib/Business/OnlinePayment/WesternACH.pm b/lib/Business/OnlinePayment/WesternACH.pm index e81f0a3..4a73897 100644 --- a/lib/Business/OnlinePayment/WesternACH.pm +++ b/lib/Business/OnlinePayment/WesternACH.pm @@ -11,7 +11,7 @@ use Date::Parse 'str2time'; use vars qw($VERSION @ISA $me $DEBUG); @ISA = qw(Business::OnlinePayment::HTTPS); -$VERSION = '0.06'; +$VERSION = '0.07'; $me = 'Business::OnlinePayment::WesternACH'; $DEBUG = 0; @@ -229,6 +229,7 @@ sub get_returns { $self->is_success(0); return; } + my $index_date_ret = 2; # Usual position of 'Date Returned' foreach my $trans (split("\cJ", $page)) { my @fields = split(',', $trans); # fields: @@ -237,8 +238,13 @@ sub get_returns { # we only care about id and date. next if scalar(@fields) < 10; + if($fields[0] eq 'id') { + # Use this header row to find the 'Date Returned' field. + ($index_date_ret) = grep { lc($fields[$_]) eq 'date returned' } ( 0..scalar(@fields)-1 ); + $index_date_ret ||= 2; + } next if not($fields[0] =~ /^\d+$/); - my $rettime = str2time($fields[1]); + my $rettime = str2time($fields[$index_date_ret]); next if (!$rettime or $rettime < $starttime or $rettime > $endtime); carp $trans if $DEBUG > 1; push @tids, $fields[0]; |