X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FBilling_Realtime.pm;h=f089059aa387f709b1978576a9b81004e592a6e4;hb=2ebfd5c5a550befcd4546edeed8de8300e0c59d2;hp=5d376e6c21ca5b7cf3d1af657f40d3d2856e8b5b;hpb=df92ab34778ae931caeaf87daa9c763e75feeede;p=freeside.git diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index 5d376e6c2..f089059aa 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -416,6 +416,13 @@ sub realtime_bop { # set fields from passed cust_payby _bop_cust_payby_options(\%options); + # check for banned credit card/ACH + my $ban = FS::banned_pay->ban_search( + 'payby' => $bop_method2payby{$options{method}}, + 'payinfo' => $options{payinfo}, + ); + return "Banned credit card" if $ban && $ban->bantype ne 'warn'; + # possibly run a separate transaction to tokenize card number, # so that we never store tokenized card info in cust_pay_pending if (($options{method} eq 'CC') && !$self->tokenized($options{'payinfo'})) { @@ -502,16 +509,6 @@ sub realtime_bop { die $@ if $@; ### - # check for banned credit card/ACH - ### - - my $ban = FS::banned_pay->ban_search( - 'payby' => $bop_method2payby{$options{method}}, - 'payinfo' => $options{payinfo}, - ); - return "Banned credit card" if $ban && $ban->bantype ne 'warn'; - - ### # check for term discount validity ### @@ -1793,6 +1790,13 @@ sub realtime_verify_bop { return "No cust_payby" unless $options{'cust_payby'}; _bop_cust_payby_options(\%options); + # check for banned credit card/ACH + my $ban = FS::banned_pay->ban_search( + 'payby' => $bop_method2payby{'CC'}, + 'payinfo' => $options{payinfo}, + ); + return "Banned credit card" if $ban && $ban->bantype ne 'warn'; + # possibly run a separate transaction to tokenize card number, # so that we never store tokenized card info in cust_pay_pending if (($options{method} eq 'CC') && !$self->tokenized($options{'payinfo'})) { @@ -1813,16 +1817,6 @@ sub realtime_verify_bop { die $@ if $@; ### - # check for banned credit card/ACH - ### - - my $ban = FS::banned_pay->ban_search( - 'payby' => $bop_method2payby{'CC'}, - 'payinfo' => $options{payinfo}, - ); - return "Banned credit card" if $ban && $ban->bantype ne 'warn'; - - ### # massage data ### @@ -2230,6 +2224,13 @@ sub realtime_tokenize { return '' unless $options{method} eq 'CC'; return '' if $self->tokenized($options{payinfo}); #already tokenized + # check for banned credit card/ACH + my $ban = FS::banned_pay->ban_search( + 'payby' => $bop_method2payby{'CC'}, + 'payinfo' => $options{payinfo}, + ); + return "Banned credit card" if $ban && $ban->bantype ne 'warn'; + ### # select a gateway ### @@ -2258,16 +2259,6 @@ sub realtime_tokenize { && grep /^Tokenize$/, @{$supported_actions{'CC'}}; ### - # check for banned credit card/ACH - ### - - my $ban = FS::banned_pay->ban_search( - 'payby' => $bop_method2payby{'CC'}, - 'payinfo' => $options{payinfo}, - ); - return "Banned credit card" if $ban && $ban->bantype ne 'warn'; - - ### # massage data ### @@ -2472,7 +2463,7 @@ CUSTLOOP: } if ($require_tokenized && $opt{'daily'}) { - $log->critical("Untokenized card number detected in cust_payby ".$cust_payby->custpaybynum); + $log->info("Untokenized card number detected in cust_payby ".$cust_payby->custpaybynum. '; tokenizing'); $dbh->commit or die $dbh->errstr; # commit log message } @@ -2573,7 +2564,7 @@ CUSTLOOP: } if ($require_tokenized && $opt{'daily'}) { - $log->critical("Untokenized card number detected in $table ".$record->get($record->primary_key)); + $log->info("Untokenized card number detected in $table ".$record->get($record->primary_key). ';tokenizing'); $dbh->commit or die $dbh->errstr; # commit log message } @@ -2715,7 +2706,15 @@ sub _token_check_next_recnum { my $recnum = shift @$recnums; return $recnum if $recnum; my $tclass = 'FS::'.$table; - my $sth = $dbh->prepare('SELECT '.$tclass->primary_key.' FROM '.$table.' ORDER BY '.$tclass->primary_key.' LIMIT '.$step.' OFFSET '.$$offset) or die $dbh->errstr; + my $sth = $dbh->prepare( + 'SELECT '.$tclass->primary_key. + ' FROM '.$table. + " WHERE payby IN ( 'CARD', 'DCRD' ) ". + " AND ( length(payinfo) > 80 OR payinfo NOT LIKE '99%' )". + ' ORDER BY '.$tclass->primary_key. + ' LIMIT '.$step. + ' OFFSET '.$$offset + ) or die $dbh->errstr; $sth->execute() or die $sth->errstr; my @recnums; while (my $rec = $sth->fetchrow_hashref) {