X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpayinfo_Mixin.pm;h=3a51022d3cbe2dc4313b4baaec3109b838e3546b;hp=a0a2cbcc945fcbf1c3c76bee068efa718f06a0b7;hb=9a8399783bb9d87ef662b4371bebe983d2781dce;hpb=b72e70605eb51f2336230bbef8bf7f6fd2fe6456 diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm index a0a2cbcc9..3a51022d3 100644 --- a/FS/FS/payinfo_Mixin.pm +++ b/FS/FS/payinfo_Mixin.pm @@ -8,7 +8,8 @@ use FS::UID qw(driver_name); use FS::Cursor; use Time::Local qw(timelocal); -use vars qw($ignore_masked_payinfo); +# allow_closed_replace only relevant to cust_pay/cust_refund, for upgrade tokenizing +use vars qw( $ignore_masked_payinfo $allow_closed_replace ); =head1 NAME @@ -67,7 +68,7 @@ sub payinfo { my($self,$payinfo) = @_; if ( defined($payinfo) ) { - $self->paymask($self->mask_payinfo) unless $self->tokenized; #make sure old mask is set + $self->paymask($self->mask_payinfo) unless $self->getfield('paymask') || $self->tokenized; #make sure old mask is set $self->setfield('payinfo', $payinfo); $self->paymask($self->mask_payinfo) unless $self->tokenized($payinfo); #remask unless tokenizing } else { @@ -213,7 +214,7 @@ sub payinfo_check { validate($self->payinfo) or return "Illegal credit card number"; return "Unknown card type" if $cardtype eq "Unknown"; } else { - $self->payinfo('N/A'); #??? + $self->payinfo('N/A'); #??? re-masks card } } } else { @@ -454,12 +455,18 @@ sub process_set_cardtype { } } +=item tokenized [ PAYINFO ] + +Returns true if object payinfo is tokenized + +Optionally, an arbitrary payby and payinfo can be passed. + +=cut + 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 + return 0 unless $payinfo; #avoid uninitialized value error $payinfo =~ /^99\d{14}$/; }