diff options
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 13 | ||||
-rw-r--r-- | FS/FS/Conf.pm | 14 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/card.html | 2 | ||||
-rwxr-xr-x | fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 1 | ||||
-rw-r--r-- | httemplate/misc/process/payment.cgi | 2 |
5 files changed, 29 insertions, 3 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index e15fb8c22..9330049eb 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -751,6 +751,8 @@ sub edit_info { $payby = $1; } + my $conf = new FS::Conf; + if ( $payby =~ /^(CARD|DCRD)$/ ) { $new->paydate($p->{'year'}. '-'. $p->{'month'}. '-01'); @@ -763,6 +765,10 @@ sub edit_info { $new->set( 'payby' => $p->{'auto'} ? 'CARD' : 'DCRD' ); + if ( $conf->exists('selfservice-onfile_require_cvv') ){ + return { 'error' => 'CVV2 is required' } unless $p->{'paycvv'}; + } + } elsif ( $payby =~ /^(CHEK|DCHK)$/ ) { my $payinfo; @@ -839,8 +845,9 @@ sub payment_info { 'card_types' => card_types(), - 'withcvv' => $conf->exists('selfservice-require_cvv'), #or enable optional cvv? - 'require_cvv' => $conf->exists('selfservice-require_cvv'), + 'withcvv' => $conf->exists('selfservice-require_cvv'), #or enable optional cvv? + 'require_cvv' => $conf->exists('selfservice-require_cvv'), + 'onfile_require_cvv' => $conf->exists('selfservice-onfile_require_cvv'), 'paytypes' => [ @FS::cust_main::paytypes ], @@ -1029,6 +1036,8 @@ sub validate_payment { or return { 'error' => "CVV2 (CVC2/CID) is three digits." }; $paycvv = $1; } + } elsif ( $conf->exists('selfservice-onfile_require_cvv') ) { + return { 'error' => 'CVV2 is required' }; } 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 e56cf3b2d..a6781e941 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2706,6 +2706,20 @@ and customer address. Include units.', }, { + 'key' => 'backoffice-require_cvv', + 'section' => 'billing', + 'description' => 'Require CVV for manual credit card entry.', + 'type' => 'checkbox', + }, + + { + 'key' => 'selfservice-onfile_require_cvv', + 'section' => 'self-service', + 'description' => 'Require CVV for on-file credit card during self-service payments.', + 'type' => 'checkbox', + }, + + { 'key' => 'selfservice-require_cvv', 'section' => 'self-service', 'description' => 'Require CVV for credit card self-service payments, except for cards on-file.', diff --git a/fs_selfservice/FS-SelfService/cgi/card.html b/fs_selfservice/FS-SelfService/cgi/card.html index c7db2b398..dfe63710c 100644 --- a/fs_selfservice/FS-SelfService/cgi/card.html +++ b/fs_selfservice/FS-SelfService/cgi/card.html @@ -26,7 +26,7 @@ </TD> </TR> <%= - if ( $withcvv ) { + if ( $withcvv || $require_cvv || $onfile_require_cvv ) { $OUT .= qq!<TR>!; $OUT .= qq!<TD ALIGN="right">CVV2 (<A HREF="javascript:myopen('cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>)</TD>!; $OUT .= qq!<TD><INPUT TYPE="text" NAME="paycvv" VALUE="" SIZE=4 MAXLENGTH=4></TD>!; diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index 0226d1183..4e21ad8df 100755 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -314,6 +314,7 @@ sub process_change_pay { 'error' => '<FONT COLOR="#FF0000">Postal or email required.</FONT>', }; } + _process_change_info( 'change_pay', @list ); } diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 981614e76..27b818660 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -122,6 +122,8 @@ if ( $payby eq 'CHEK' ) { or errorpage("CVV2 (CVC2/CID) is three digits."); $paycvv = $1; } + }elsif( $conf->exists('backoffice-require_cvv') ){ + errorpage("CVV2 is required"); } } |