From: Jonathan Prykop Date: Tue, 3 May 2016 02:44:40 +0000 (-0500) Subject: RT#37632 Credit card validation [bug fixes] X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=7d8aea452e6d4090d6c97acce0b6bde0f1dccac1 RT#37632 Credit card validation [bug fixes] --- diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index b892e97c2..bbf86a55d 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -1932,8 +1932,10 @@ sub realtime_verify_bop { ); $reverse->content( 'action' => 'Reverse Authorization', + $self->_bop_auth(\%options), # B:OP + 'amount' => '1.00', 'authorization' => $transaction->authorization, 'order_number' => $ordernum, diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm index ec4eb7a59..50d9ee0f8 100644 --- a/FS/FS/cust_payby.pm +++ b/FS/FS/cust_payby.pm @@ -636,7 +636,21 @@ sub verify { my %opt = (); - $opt{$_} = $self->$_() for qw( payinfo payname paydate ); + # false laziness with check + my( $m, $y ); + if ( $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ ) { + ( $m, $y ) = ( $1, length($2) == 4 ? $2 : "20$2" ); + } elsif ( $self->paydate =~ /^19(\d{2})[\/\-](\d{1,2})[\/\-]\d+$/ ) { + ( $m, $y ) = ( $2, "19$1" ); + } elsif ( $self->paydate =~ /^(20)?(\d{2})[\/\-](\d{1,2})[\/\-]\d+$/ ) { + ( $m, $y ) = ( $3, "20$2" ); + } else { + return "Illegal expiration date: ". $self->paydate; + } + $m = sprintf('%02d',$m); + $opt{paydate} = "$y-$m-01"; + + $opt{$_} = $self->$_() for qw( payinfo payname paycvv ); if ( $self->locationnum ) { my $cust_location = $self->cust_location;