diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-02-14 08:33:30 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-02-14 08:33:30 -0800 |
commit | 2b2111e072ce91322705e21215c55652d271e4ba (patch) | |
tree | a12e5d1cc1cfffa103df192130bd71b768aa165e | |
parent | 76ca0089cd161a0127c82a9d644b18ddb3a26963 (diff) |
better scalability for token checks, RT#71513
-rw-r--r-- | FS/FS/Schema.pm | 21 | ||||
-rw-r--r-- | FS/FS/cust_main/Billing_Realtime.pm | 1 | ||||
-rw-r--r-- | FS/FS/cust_payby.pm | 2 | ||||
-rw-r--r-- | FS/FS/payinfo_Mixin.pm | 1 |
4 files changed, 20 insertions, 5 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 7b42c0b..e0701fb 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1625,6 +1625,8 @@ sub tables_hashref { 'payip', 'varchar', 'NULL', 15, '', '', 'paycardtype', 'varchar', 'NULL', $char_d, '', '', + 'is_tokenized', 'char', 'NULL', '1', '', '', + 'geocode', 'varchar', 'NULL', 20, '', '', 'censustract', 'varchar', 'NULL', 20, '', '', # 7 to save space? 'censusyear', 'char', 'NULL', 4, '', '', @@ -1673,6 +1675,7 @@ sub tables_hashref { [ 'ship_locationnum' ], [ 'bill_locationnum' ], [ 'paycardtype' ], + [ 'is_tokenized' ], ], 'foreign_keys' => [ { columns => [ 'agentnum' ], @@ -1725,10 +1728,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', @@ -2422,11 +2426,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' ], @@ -2473,7 +2479,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, '', '', @@ -2491,7 +2498,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' ], @@ -2529,6 +2536,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, '', '', @@ -2551,7 +2559,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', @@ -3094,10 +3104,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 12f1979..85039c0 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -2717,6 +2717,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 { |