71513: Card tokenization [v3 backport]
[freeside.git] / httemplate / misc / process / payment.cgi
index 8c12b4d..75c89f2 100644 (file)
@@ -110,7 +110,7 @@ if ( $payby eq 'CHEK' ) {
   validate($payinfo)
     or errorpage(gettext('invalid_card'));
 
-  unless ( $payinfo =~ /^99\d{14}$/ ) { #token
+  unless ( $cust_main->tokenized($payinfo) ) { #token
 
     my $cardtype = cardtype($payinfo);
 
@@ -187,6 +187,11 @@ if ( $cgi->param('save') ) {
   errorpage("error saving info, payment not processed: $error")
     if $error;
   $cust_main = $new;
+
+} elsif ( $payby eq 'CARD' ) { # not saving
+
+  $paymask = FS::payinfo_Mixin->mask_payinfo('CARD',$payinfo); # for untokenized but tokenizable payinfo
+
 }
 
 my $error = '';