summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/cust_main')
-rw-r--r--FS/FS/cust_main/Billing_Realtime.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index f089059..c2cb2e3 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -2373,7 +2373,7 @@ is set, this will instead cause a critical error to be recorded in the log,
and any other tokenizable records will still be committed.
If the I<daily> flag is also set, detection of existing untokenized records will
-record a critical error in the system log (because they should have never appeared
+record an info message in the system log (because they should have never appeared
in the first place.) Tokenization will still be attempted.
If any configured gateways do NOT have the ability to tokenize, or if a
@@ -2386,6 +2386,7 @@ sub token_check {
#acts on all customers
my %opt = @_;
my $debug = !$opt{'quiet'} || $DEBUG;
+ my $hascritical = 0;
warn "token_check called with opts\n".Dumper(\%opt) if $debug;
@@ -2482,6 +2483,7 @@ CUSTLOOP:
}
my $error = "No gateway found for custnum ".$cust_main->custnum;
if ($opt{'queue'}) {
+ $hascritical = 1;
$log->critical($error);
$dbh->commit or die $dbh->errstr; # commit error message
next; # not next CUSTLOOP, want to record error for every cust_payby
@@ -2518,6 +2520,7 @@ CUSTLOOP:
if ($error) {
$error = "Error tokenizing cust_payby ".$cust_payby->custpaybynum.": ".$error;
if ($opt{'queue'}) {
+ $hascritical = 1;
$log->critical($error);
$dbh->commit or die $dbh->errstr; # commit log message, release mutex
next; # not next CUSTLOOP, want to record error for every cust_payby
@@ -2550,6 +2553,10 @@ CUSTLOOP:
while (my $recnum = _token_check_next_recnum($dbh,$table,$step,\$offset,\@recnums)) {
my $record = $tclass->by_key($recnum);
+ unless ($record->payby eq 'CARD') {
+ warn "Skipping non-card record for $table ".$record->get($record->primary_key) if $debug;
+ next;
+ }
if (FS::cust_main::Billing_Realtime->tokenized($record->payinfo)) {
warn "Skipping tokenized record for $table ".$record->get($record->primary_key) if $debug;
next;
@@ -2580,6 +2587,7 @@ CUSTLOOP:
} else {
my $error = "Could not load cust_main for $table ".$record->get($record->primary_key);
if ($opt{'queue'}) {
+ $hascritical = 1;
$log->critical($error);
$dbh->commit or die $dbh->errstr; # commit log message
next;
@@ -2682,6 +2690,7 @@ CUSTLOOP:
if ($error) {
$error = "Error tokenizing $table ".$record->get($record->primary_key).": ".$error;
if ($opt{'queue'}) {
+ $hascritical = 1;
$log->critical($error);
$dbh->commit or die $dbh->errstr; # commit log message, release mutex
next;
@@ -2697,7 +2706,7 @@ CUSTLOOP:
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
- return '';
+ return $hascritical ? 'Critical errors occurred on some records, see system log' : '';
}
# not a method!
@@ -2709,8 +2718,6 @@ sub _token_check_next_recnum {
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