X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay_batch.pm;h=6e261c6ab215d82b7e4fc86964ac9c4c20c30ee8;hb=13a6b896a3f9d0137ade340c4be89b04d127b345;hp=c9a546870bb95b3ecbd9082d007d4eb7e79bce0d;hpb=2c8748ac26281934a1b75671c6a5d0125145660a;p=freeside.git diff --git a/FS/FS/cust_pay_batch.pm b/FS/FS/cust_pay_batch.pm index c9a546870..6e261c6ab 100644 --- a/FS/FS/cust_pay_batch.pm +++ b/FS/FS/cust_pay_batch.pm @@ -3,10 +3,11 @@ package FS::cust_pay_batch; use strict; use vars qw( @ISA $DEBUG ); use FS::Record qw(dbh qsearch qsearchs); +use FS::payinfo_Mixin; use FS::part_bill_event qw(due_events); use Business::CreditCard 0.28; -@ISA = qw( FS::Record ); +@ISA = qw( FS::Record FS::payinfo_Mixin ); # 1 is mostly method/subroutine entry and options # 2 traces progress of some operations @@ -124,7 +125,7 @@ sub check { my $error = $self->ut_numbern('paybatchnum') - || $self->ut_numbern('trancode') #depriciated + || $self->ut_numbern('trancode') #deprecated || $self->ut_money('amount') || $self->ut_number('invnum') || $self->ut_number('custnum') @@ -142,11 +143,7 @@ sub check { $self->first =~ /^([\w \,\.\-\']+)$/ or return "Illegal first name"; $self->first($1); - $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP|CASH|WEST|MCRD)$/ - or return "Illegal payby"; - $self->payby($1); - - $error = FS::payby::payinfo_check($self->payby, \$self->payinfo); + $error = $self->payinfo_check(); return $error if $error; if ( $self->exp eq '' ) { @@ -177,15 +174,16 @@ sub check { $self->payname($1); } - #$self->zip =~ /^\s*(\w[\w\-\s]{3,8}\w)\s*$/ - # or return "Illegal zip: ". $self->zip; - #$self->zip($1); + #we have lots of old zips in there... don't hork up batch results cause of em + $self->zip =~ /^\s*(\w[\w\-\s]{3,8}\w)\s*$/ + or return "Illegal zip: ". $self->zip; + $self->zip($1); $self->country =~ /^(\w\w)$/ or return "Illegal country: ". $self->country; $self->country($1); - $error = $self->ut_zip('zip', $self->country); - return $error if $error; + #$error = $self->ut_zip('zip', $self->country); + #return $error if $error; #check invnum, custnum, ? @@ -380,8 +378,11 @@ sub import_results { $hook = sub { my $hash = shift; + my $cpb = shift; $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'}); #hmmmm $hash->{'_date'} = time; # got a better one? + $hash->{'payinfo'} = $cpb->{'payinfo'} + if( substr($hash->{'payinfo'}, -4) eq substr($cpb->{'payinfo'}, -4) ); }; $approved_condition = sub { @@ -530,7 +531,7 @@ sub import_results { my $new_cust_pay_batch = new FS::cust_pay_batch { $cust_pay_batch->hash }; - &{$hook}(\%hash); + &{$hook}(\%hash, $cust_pay_batch->hashref); if ( &{$approved_condition}(\%hash) ) {