summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2010-08-24 03:03:31 +0000
committermark <mark>2010-08-24 03:03:31 +0000
commit990d37e8da0eceab234e842a67a6665e868f38c6 (patch)
treedc09450e62361166662ec741f18f65be953e1f40
parent5820b395e421ac466714a72da27c9709def962a4 (diff)
delete CVV when processing batch results, RT#9652
-rw-r--r--FS/FS/cust_main.pm3
-rw-r--r--FS/FS/pay_batch.pm12
2 files changed, 13 insertions, 2 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index a5d964c73..fa0634493 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -5612,8 +5612,7 @@ sub _new_realtime_bop {
#false laziness w/misc/process/payment.cgi - check both to make sure working
# correctly
- if ( defined $self->dbdef_table->column('paycvv')
- && length($self->paycvv)
+ if ( length($self->paycvv)
&& ! grep { $_ eq cardtype($options{payinfo}) } $conf->config('cvv-save')
) {
my $error = $self->remove_cvv;
diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm
index 0b8c9f79b..2561d3dc4 100644
--- a/FS/FS/pay_batch.pm
+++ b/FS/FS/pay_batch.pm
@@ -7,6 +7,7 @@ use Text::CSV_XS;
use FS::Record qw( dbh qsearch qsearchs );
use FS::cust_pay;
use FS::Conf;
+use Business::CreditCard qw(cardtype);
@ISA = qw(FS::Record);
@@ -198,6 +199,8 @@ sub import_results {
my $job = $param->{'job'};
$job->update_statustext(0) if $job;
+ my $conf = new FS::Conf;
+
my $filetype = $info->{'filetype'}; # CSV or fixed
my @fields = @{ $info->{'fields'}};
my $formatre = $info->{'formatre'}; # for fixed
@@ -356,6 +359,15 @@ sub import_results {
return "error updating status of paybatchnum $hash{'paybatchnum'}: $error\n";
}
+ # purge CVV when the batch is processed
+ if ( $payby =~ /^(CARD|DCRD)$/ ) {
+ my $payinfo = $hash{'payinfo'} || $cust_pay_batch->payinfo;
+ if ( ! grep { $_ eq cardtype($payinfo) }
+ $conf->config('cvv-save') ) {
+ $new_cust_pay_batch->cust_main->remove_cvv;
+ }
+ }
+
if ( $new_cust_pay_batch->status =~ /Approved/i ) {
my $cust_pay = new FS::cust_pay ( {