RT#37632 Credit card validation [bug fixes]
authorJonathan Prykop <jonathan@freeside.biz>
Tue, 3 May 2016 02:44:40 +0000 (21:44 -0500)
committerJonathan Prykop <jonathan@freeside.biz>
Tue, 3 May 2016 02:44:40 +0000 (21:44 -0500)
FS/FS/cust_main/Billing_Realtime.pm
FS/FS/cust_payby.pm

index b892e97..bbf86a5 100644 (file)
@@ -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,
 
index ec4eb7a..50d9ee0 100644 (file)
@@ -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;