From 7d8aea452e6d4090d6c97acce0b6bde0f1dccac1 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 2 May 2016 21:44:40 -0500 Subject: [PATCH] RT#37632 Credit card validation [bug fixes] --- FS/FS/cust_main/Billing_Realtime.pm | 2 ++ FS/FS/cust_payby.pm | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) 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; -- 2.11.0