[freeside-commits] branch master updated. bd5c864f75fd5d4aaddd60d2ba1ebc15f14a9aa8

Ivan ivan at 420.am
Tue Feb 14 08:33:25 PST 2017


The branch, master has been updated
       via  bd5c864f75fd5d4aaddd60d2ba1ebc15f14a9aa8 (commit)
       via  8f35bf476386cfd746ab9fd27d584a4d89d3eeb9 (commit)
      from  78bcb44366067f71caf7ebf70056a4ff24235927 (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 bd5c864f75fd5d4aaddd60d2ba1ebc15f14a9aa8
Merge: 8f35bf4 78bcb44
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Feb 14 08:33:21 2017 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 8f35bf476386cfd746ab9fd27d584a4d89d3eeb9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Feb 14 08:33:16 2017 -0800

    better scalability for token checks, RT#71513

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 1630f02..b6d0f07 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1620,6 +1620,8 @@ sub tables_hashref {
         'ship_mobile',   'varchar', 'NULL', 12, '', '', 
         'currency',         'char', 'NULL',  3, '', '',
 
+        'is_tokenized', 'char', 'NULL', '1', '', '',
+
         'geocode',  'varchar', 'NULL', 20,  '', '',
         'censustract', 'varchar', 'NULL', 20,  '', '', # 7 to save space?
         'censusyear', 'char', 'NULL', 4, '', '',
@@ -1666,6 +1668,7 @@ sub tables_hashref {
                           [ 'archived' ],
                           [ 'ship_locationnum' ],
                           [ 'bill_locationnum' ],
+                          [ 'is_tokenized' ],
                         ],
       'foreign_keys' => [
                           { columns    => [ 'agentnum' ],
@@ -1718,10 +1721,11 @@ sub tables_hashref {
         'paytype',     'varchar', 'NULL',   $char_d, '', '', 
         'payip',       'varchar', 'NULL',        15, '', '', 
         'locationnum',     'int', 'NULL',        '', '', '',
+        'is_tokenized',   'char', 'NULL',         1, '', '', 
       ],
       'primary_key'  => 'custpaybynum',
       'unique'       => [],
-      'index'        => [ [ 'custnum' ] ],
+      'index'        => [ [ 'custnum' ], [ 'is_tokenized' ] ],
       'foreign_keys' => [
                           { columns    => [ 'custnum' ],
                             table      => 'cust_main',
@@ -2415,11 +2419,13 @@ sub tables_hashref {
         'manual',       'char',    'NULL',   1, '', '',
         'discount_term','int',     'NULL',  '', '', '',
         'failure_status','varchar','NULL',  16, '', '',
+        'is_tokenized',   'char', 'NULL',    1, '', '', 
       ],
       'primary_key'  => 'paypendingnum',
       'unique'       => [ [ 'payunique' ] ],
       'index'        => [ [ 'custnum' ], [ 'status' ],
                           ['paynum'], ['void_paynum'], ['jobnum'], ['invnum'],
+                          [ 'is_tokenized' ],
                         ],
       'foreign_keys' => [
                           { columns    => [ 'custnum' ],
@@ -2466,7 +2472,8 @@ sub tables_hashref {
         'closed',         'char', 'NULL',       1, '', '', 
         'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
         'no_auto_apply',  'char', 'NULL',       1, '', '', 
-
+        'is_tokenized',   'char', 'NULL',       1, '', '', 
+          
         # cash/check deposit info fields
         'bank',        'varchar', 'NULL', $char_d, '', '',
         'depositor',   'varchar', 'NULL', $char_d, '', '',
@@ -2484,7 +2491,7 @@ sub tables_hashref {
       'primary_key'  => 'paynum',
       #i guess not now, with cust_pay_pending, if we actually make it here, we _do_ want to record it# 'unique' => [ [ 'payunique' ] ],
       'index'        => [ ['custnum'], ['paybatch'], ['payby'], ['_date'],
-                          ['usernum'],
+                          ['usernum'], ['is_tokenized'], 
                         ],
       'foreign_keys' => [
                           { columns    => [ 'custnum' ],
@@ -2522,6 +2529,7 @@ sub tables_hashref {
         'paybatch',    'varchar', 'NULL', $char_d, '', '', #for auditing purposes.
         'closed',        'char',  'NULL',       1, '', '', 
         'pkgnum', 'int',   'NULL', '', '', '', #desired pkgnum for pkg-balances
+        'is_tokenized',   'char', 'NULL',       1, '', '', 
 
         # cash/check deposit info fields
         'bank',       'varchar', 'NULL', $char_d, '', '',
@@ -2544,7 +2552,9 @@ sub tables_hashref {
       ],
       'primary_key'  => 'paynum',
       'unique'       => [],
-      'index'        => [ ['custnum'], ['usernum'], ['void_usernum'] ],
+      'index'        => [ ['custnum'], ['usernum'], ['void_usernum'],
+                          ['is_tokenized'],
+                        ],
       'foreign_keys' => [
                           { columns    => [ 'custnum' ],
                             table      => 'cust_main',
@@ -3086,10 +3096,11 @@ sub tables_hashref {
         'processor',  'varchar', 'NULL', $char_d, '', '', # module name
         'auth',       'varchar','NULL',16, '', '', # CC auth number
         'order_number', 'varchar','NULL',$char_d, '', '', # transaction number
+        'is_tokenized',   'char', 'NULL',    1, '', '', 
       ],
       'primary_key'  => 'refundnum',
       'unique'       => [],
-      'index'        => [ ['custnum'], ['_date'], [ 'usernum' ], ],
+      'index'        => [ ['custnum'], ['_date'], [ 'usernum' ], ['is_tokenized'] ],
       'foreign_keys' => [
                           { columns    => [ 'custnum' ],
                             table      => 'cust_main',
diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index c2cb2e3..0623fbb 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -2718,6 +2718,7 @@ sub _token_check_next_recnum {
   my $sth = $dbh->prepare(
     'SELECT '.$tclass->primary_key.
     ' FROM '.$table.
+    " WHERE ( is_tokenized IS NULL OR is_tokenized = '' ) ".
     ' ORDER BY '.$tclass->primary_key.
     ' LIMIT '.$step.
     ' OFFSET '.$$offset
diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index 136acf1..7e4a465 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -359,6 +359,7 @@ sub check {
     # see parallel checks in check_payinfo_cardtype & payinfo_Mixin::payinfo_check
     my $cardtype = $self->paycardtype;
     if ( $self->tokenized ) {
+      $self->('is_tokenized', 'Y'); #so we don't try to do it again
       if ( $self->paymask =~ /^\d+x/ ) {
         $cardtype = cardtype($self->paymask);
       } else {
@@ -559,6 +560,7 @@ sub check_payinfo_cardtype {
 
   # see parallel checks in cust_payby::check & payinfo_Mixin::payinfo_check
   if ( $self->tokenized($payinfo) ) {
+    $self->set('is_tokenized', 'Y'); #so we don't try to do it again
     if ( $self->paymask =~ /^\d+x/ ) {
       $self->set('paycardtype', cardtype($self->paymask));
     } else {
diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm
index 84759cc..c79729a 100644
--- a/FS/FS/payinfo_Mixin.pm
+++ b/FS/FS/payinfo_Mixin.pm
@@ -199,6 +199,7 @@ sub payinfo_check {
 
     # see parallel checks in cust_payby::check & cust_payby::check_payinfo_cardtype
     if ( $self->tokenized ) {
+      $self->('is_tokenized', 'Y'); #so we don't try to do it again
       if ( $self->paymask =~ /^\d+x/ ) {
         $self->set('paycardtype', cardtype($self->paymask));
       } else {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Schema.pm                     |   21 ++++++++++++++++-----
 FS/FS/cust_main/Billing_Realtime.pm |    1 +
 FS/FS/cust_payby.pm                 |    2 ++
 FS/FS/payinfo_Mixin.pm              |    1 +
 4 files changed, 20 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list