X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpayinfo_Mixin.pm;h=a0a2cbcc945fcbf1c3c76bee068efa718f06a0b7;hp=3a32ad5b23a20f0bab1050022d0fa85881e35ca4;hb=b72e70605eb51f2336230bbef8bf7f6fd2fe6456;hpb=0d9ffbafedc170c79ef5587af8c836579eb1c6fc diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm index 3a32ad5b2..a0a2cbcc9 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