X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=site_perl%2Fcust_pay_batch.pm;h=c7a0ccb9db9f209b4c1afaa4d822b64718089699;hb=1e3eae905b861761f93643aa5fce14a8be5d9ed2;hp=f7350c116788500e91193071b53b183ddeca1367;hpb=1f2d8690193476319d61b20b78461eb1a3ff106e;p=freeside.git diff --git a/site_perl/cust_pay_batch.pm b/site_perl/cust_pay_batch.pm index f7350c116..c7a0ccb9d 100644 --- a/site_perl/cust_pay_batch.pm +++ b/site_perl/cust_pay_batch.pm @@ -143,20 +143,24 @@ sub check { $cardnum = $1; $self->cardnum($cardnum); validate($cardnum) or return "Illegal credit card number"; - return "Unknown card type" if cardtype($self->payinfo) eq "Unknown"; + return "Unknown card type" if cardtype($cardnum) eq "Unknown"; if ( $self->exp eq '' ) { - return "Expriation date required"; + return "Expriation date required"; #unless $self->exp(''); } else { - $self->exp =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ - or return "Illegal expiration date"; - if ( length($2) == 4 ) { - $self->exp("$2-$1-01"); - } elsif ( $2 > 98 ) { #should pry change to check for "this year" - $self->exp("19$2-$1-01"); + if ( $self->exp =~ /^(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2})$/ ) { + $self->exp("$1-$2-$3"); + } elsif ( $self->exp =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ ) { + if ( length($2) == 4 ) { + $self->exp("$2-$1-01"); + } elsif ( $2 > 98 ) { #should pry change to check for "this year" + $self->exp("19$2-$1-01"); + } else { + $self->exp("20$2-$1-01"); + } } else { - $self->exp("20$2-$1-01"); + return "Illegal expiration date"; } } @@ -168,7 +172,8 @@ sub check { $self->payname($1); } - $self->zip =~ /^([\w\-]{10})$/ or return "Illegal zip"; + $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 \w\wy"; @@ -183,7 +188,7 @@ sub check { =head1 VERSION -$Id: cust_pay_batch.pm,v 1.3 1998-12-29 11:59:44 ivan Exp $ +$Id: cust_pay_batch.pm,v 1.5 1999-07-29 07:49:04 ivan Exp $ =head1 BUGS @@ -202,7 +207,13 @@ added hfields ivan@sisd.com 97-nov-13 $Log: cust_pay_batch.pm,v $ -Revision 1.3 1998-12-29 11:59:44 ivan +Revision 1.5 1999-07-29 07:49:04 ivan +fixes for bugs noticed by Joel Griffiths + +Revision 1.4 1999/07/17 22:02:16 ivan +another bug noticed by Steve Gertz + +Revision 1.3 1998/12/29 11:59:44 ivan mostly properly OO, some work still to be done with svc_ stuff Revision 1.2 1998/11/18 09:01:44 ivan