summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-05-14 18:45:40 -0700
committerIvan Kohler <ivan@freeside.biz>2013-05-14 18:45:40 -0700
commit1a67fad0119e58b139307d866d8c331d9f41f014 (patch)
treede6f276b5eb5ecdd3441431557f4e2fa6bf645da
parent1ab3d1021689645456ef4073066c60043ea1633b (diff)
add "Tokenized" card type to searches, RT#22953
-rwxr-xr-xhttemplate/search/elements/cust_pay_or_refund.html15
-rw-r--r--httemplate/search/elements/report_cust_pay_or_refund.html1
2 files changed, 14 insertions, 2 deletions
diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index 7b2a17058..234121fa3 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -271,7 +271,7 @@ if ( $cgi->param('magic') ) {
foreach my $payby ( $cgi->param('payby') ) {
$payby =~
- /^(CARD|CHEK|BILL|PREP|CASH|WEST|MCRD)(-(VisaMC|Amex|Discover|Maestro))?$/
+ /^(CARD|CHEK|BILL|PREP|CASH|WEST|MCRD)(-(VisaMC|Amex|Discover|Maestro|Tokenized))?$/
or die "illegal payby $payby";
my $payby_search = "$table.payby = '$1'";
@@ -282,6 +282,7 @@ if ( $cgi->param('magic') ) {
my $search;
if ( $cardtype eq 'VisaMC' ) {
+
#avoid posix regexes for portability
$search =
" ( ( substring($table.payinfo from 1 for 1) = '4' ".
@@ -305,11 +306,14 @@ if ( $cgi->param('magic') ) {
" OR substring($table.payinfo from 1 for 2) = '55' ".
# " OR substring($table.payinfo from 1 for 2) = '36' ". #Diner's int'l was processed as Visa/MC inside US, now Discover
" ) ";
+
} elsif ( $cardtype eq 'Amex' ) {
+
$search =
" ( substring($table.payinfo from 1 for 2 ) = '34' ".
" OR substring($table.payinfo from 1 for 2 ) = '37' ".
" ) ";
+
} elsif ( $cardtype eq 'Discover' ) {
my $conf = new FS::Conf;
@@ -347,7 +351,9 @@ if ( $cgi->param('magic') ) {
).
" OR substring($table.payinfo from 1 for 3 ) = '622' ". #China Union Pay processed as Discover outside CN
" ) ";
- } elsif ( $cardtype eq 'Maestro' ) {
+
+ } elsif ( $cardtype eq 'Maestro' ) {
+
$search =
" ( substring($table.payinfo from 1 for 2 ) = '63' ".
" OR substring($table.payinfo from 1 for 2 ) = '67' ".
@@ -364,6 +370,11 @@ if ( $cgi->param('magic') ) {
" OR substring($table.payinfo from 1 for 6 ) ".
" SIMILAR TO '49118[1-2]' ".
" ) ";
+
+ } elsif ( $cardtype eq 'Tokenized' ) {
+
+ $search = " substring($table.payinfo from 1 for 2 ) = '99' ";
+
} else {
die "unknown card type $cardtype";
}
diff --git a/httemplate/search/elements/report_cust_pay_or_refund.html b/httemplate/search/elements/report_cust_pay_or_refund.html
index 0462f1cd9..cdbcee234 100644
--- a/httemplate/search/elements/report_cust_pay_or_refund.html
+++ b/httemplate/search/elements/report_cust_pay_or_refund.html
@@ -37,6 +37,7 @@ Examples:
<OPTION VALUE="CARD-Amex" SELECTED><% mt('credit card (American Express)') |h %></OPTION>
<OPTION VALUE="CARD-Discover" SELECTED><% mt('credit card (Discover)') |h %></OPTION>
<OPTION VALUE="CARD-Maestro" SELECTED><% mt('credit card (Maestro/Switch/Solo)') |h %></OPTION>
+ <OPTION VALUE="CARD-Tokenized" SELECTED><% mt('credit card (Tokenized)') |h %></OPTION>
<OPTION VALUE="CHEK" SELECTED><% mt('electronic check / ACH') |h %></OPTION>
<OPTION VALUE="BILL" SELECTED><% mt('check') |h %></OPTION>
<OPTION VALUE="PREP" SELECTED><% mt('prepaid card') |h %></OPTION>