X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpay_batch.pm;h=2561d3dc44c26f8d25cc6a928a2ef87625b647c0;hb=03eaa0e229c5f5fc68a178d20fb69733db709787;hp=0b8c9f79b0353d8495c5300365388693d4f0ca4c;hpb=bb617fa9977d6886ac930d7a97e9221b33899474;p=freeside.git 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 ( {