summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-02-01 12:16:21 -0800
committerIvan Kohler <ivan@freeside.biz>2017-02-01 12:16:21 -0800
commit2ebfd5c5a550befcd4546edeed8de8300e0c59d2 (patch)
treeeb5757d20ebc97f6b3deb072edad2e65e6712556
parent87d108d379a5c077370afc04728d1c28e9edef30 (diff)
only tokenize cards
-rw-r--r--FS/FS/cust_main/Billing_Realtime.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index d96b8ba99..f089059aa 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -2463,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
}
@@ -2564,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
}
@@ -2706,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) {