From: Ivan Kohler Date: Fri, 25 Apr 2014 23:46:50 +0000 (-0700) Subject: only require self-service CVV when using a new card< RT#28486 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=2c4cf12af441dc22859e30c1474e279499edfa3a only require self-service CVV when using a new card< RT#28486 --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index d4c0d3723..c75a56b17 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -993,10 +993,14 @@ sub validate_payment { $payinfo = $p->{'payinfo'}; + my $onfile = 0; + #more intelligent matching will be needed here if you change #card_masking_method and don't remove existing paymasks - $payinfo = $cust_main->payinfo - if $cust_main->paymask eq $payinfo; + if ( $cust_main->paymask eq $payinfo ) { + $payinfo = $cust_main->payinfo; + $onfile = 1; + } $payinfo =~ s/\D//g; $payinfo =~ /^(\d{13,16}|\d{8,9})$/ @@ -1018,7 +1022,7 @@ sub validate_payment { or return { 'error' => "CVV2 (CVC2/CID) is three digits." }; $paycvv = $1; } - } elsif ( $conf->exists('selfservice-require_cvv') ) { #and you weren't using a card on file? + } elsif ( !$onfile && $conf->exists('selfservice-require_cvv') ) { return { 'error' => 'CVV2 is required' }; } diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 59198045d..59ccd90ab 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2677,7 +2677,7 @@ and customer address. Include units.', { 'key' => 'selfservice-require_cvv', 'section' => 'self-service', - 'description' => 'Require CVV for credit card self-service payments.', + 'description' => 'Require CVV for credit card self-service payments, except for cards on-file.', 'type' => 'checkbox', },