diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-02-24 20:53:53 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-02-24 20:53:53 -0800 |
commit | c901bfbd9114865ce0c6fd76c6378e534c3616d5 (patch) | |
tree | 7245d73bde51aaf380f6b3a27ec7909b4e54f2f0 /FS/FS/cust_main.pm | |
parent | 59fe7dfd7fa6d31c30f3458af05510041ba529e0 (diff) |
banned card hashing rewrite, RT#32290, RT#23741
Diffstat (limited to 'FS/FS/cust_main.pm')
-rw-r--r-- | FS/FS/cust_main.pm | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 671ad21..c93a950 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -24,7 +24,6 @@ use Scalar::Util qw( blessed ); use Time::Local qw(timelocal); use Data::Dumper; use Tie::IxHash; -use Digest::MD5 qw(md5_base64); use Date::Format; #use Date::Manip; use File::Temp; #qw( tempfile ); @@ -2129,16 +2128,21 @@ sub cancel { return ( 'access denied' ) unless $FS::CurrentUser::CurrentUser->access_right('Cancel customer'); - if ( $opt{'ban'} && $self->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) { + if ( $opt{'ban'} ) { - #should try decryption (we might have the private key) - # and if not maybe queue a job for the server that does? - return ( "Can't (yet) ban encrypted credit cards" ) - if $self->is_encrypted($self->payinfo); + foreach my $cust_payby ( $self->cust_payby ) { - my $ban = new FS::banned_pay $self->_new_banned_pay_hashref; - my $error = $ban->insert; - return ( $error ) if $error; + #well, if they didn't get decrypted on search, then we don't have to + # try again... queue a job for the server that does have decryption + # capability if we're in a paranoid multi-server implementation? + return ( "Can't (yet) ban encrypted credit cards" ) + if $cust_payby->is_encrypted($cust_payby->payinfo); + + my $ban = new FS::banned_pay $cust_payby->_new_banned_pay_hashref; + my $error = $ban->insert; + return ( $error ) if $error; + + } } @@ -2175,13 +2179,6 @@ sub _banned_pay_hashref { }; } -sub _new_banned_pay_hashref { - my $self = shift; - my $hr = $self->_banned_pay_hashref; - $hr->{payinfo} = md5_base64($hr->{payinfo}); - $hr; -} - =item notes Returns all notes (see L<FS::cust_main_note>) for this customer. |