diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-10-29 12:02:31 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-11-29 04:46:34 -0600 |
commit | 16498ac263bf5f3e90e23b866706ada768486f40 (patch) | |
tree | fb2a53f0045ce165151a3b5bca99bdb4e254bdb2 /FS/FS/payinfo_Mixin.pm | |
parent | 80542a7f5c52ac2f631adc82d0e4326554200793 (diff) |
71513: Card tokenization [checkpoint, not ready for backport]
Diffstat (limited to 'FS/FS/payinfo_Mixin.pm')
-rw-r--r-- | FS/FS/payinfo_Mixin.pm | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm index 3a32ad5..a0a2cbc 100644 --- a/FS/FS/payinfo_Mixin.pm +++ b/FS/FS/payinfo_Mixin.pm @@ -67,9 +67,9 @@ sub payinfo { my($self,$payinfo) = @_; if ( defined($payinfo) ) { - $self->paymask($self->mask_payinfo) unless $self->payinfo =~ /^99\d{14}$/; #make sure old mask is set + $self->paymask($self->mask_payinfo) unless $self->tokenized; #make sure old mask is set $self->setfield('payinfo', $payinfo); - $self->paymask($self->mask_payinfo) unless $payinfo =~ /^99\d{14}$/; #remask unless tokenizing + $self->paymask($self->mask_payinfo) unless $self->tokenized($payinfo); #remask unless tokenizing } else { $self->getfield('payinfo'); } @@ -130,7 +130,7 @@ sub mask_payinfo { # Check to see if it's encrypted... if ( ref($self) && $self->is_encrypted($payinfo) ) { return 'N/A'; - } elsif ( $payinfo =~ /^99\d{14}$/ || $payinfo eq 'N/A' ) { #token + } elsif ( $self->tokenized($payinfo) || $payinfo eq 'N/A' ) { #token return 'N/A (tokenized)'; #? } else { # if not, mask it... @@ -198,7 +198,7 @@ sub payinfo_check { my $payinfo = $self->payinfo; my $cardtype = cardtype($payinfo); - $cardtype = 'Tokenized' if $payinfo =~ /^99\d{14}$/; + $cardtype = 'Tokenized' if $self->tokenized; $self->set('paycardtype', $cardtype); if ( $ignore_masked_payinfo and $self->mask_payinfo eq $self->payinfo ) { @@ -233,6 +233,7 @@ sub payinfo_check { } } + return ''; } =item payby_payinfo_pretty [ LOCALE ] @@ -453,6 +454,15 @@ sub process_set_cardtype { } } +sub tokenized { + my $self = shift; + my $payinfo = scalar(@_) ? shift : $self->payinfo; + ## or just $self->cust_main->tokenized($payinfo) ?? + ## everything that currently uses this mixin is linked to cust_main, + ## but just in case, false laziness w/ FS::cust_main::Billing_Realtime + $payinfo =~ /^99\d{14}$/; +} + =back =head1 BUGS |