[freeside-commits] branch master updated. 5b9bce86c42fd4e0c3a6d89e21e6b3eeb59f7f3a
Jonathan Prykop
jonathan at 420.am
Wed Feb 1 12:40:11 PST 2017
The branch, master has been updated
via 5b9bce86c42fd4e0c3a6d89e21e6b3eeb59f7f3a (commit)
from 375b84b1dcca3fb2f71aa3ac63281164501acc1e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5b9bce86c42fd4e0c3a6d89e21e6b3eeb59f7f3a
Author: Jonathan Prykop <jonathan at freeside.biz>
Date: Wed Feb 1 14:35:38 2017 -0600
71513: Card tokenization [refactor only tokenize cards; job critical error handling]
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
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main/Billing_Realtime.pm | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
More information about the freeside-commits
mailing list