From: Ivan Kohler Date: Tue, 14 Jan 2014 05:37:36 +0000 (-0800) Subject: add option to require cvv for signup, RT#25476 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=be22bac9ba2930e201a652531a753eb976151edf add option to require cvv for signup, RT#25476 --- diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index 957945c76..8d8c39e67 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -175,6 +175,7 @@ sub signup_info { 'card_types' => card_types(), 'paytypes' => [ @FS::cust_main::paytypes ], 'cvv_enabled' => 1, + 'require_cvv' => $conf->exists('signup-require_cvv'), 'stateid_enabled' => $conf->exists('show_stateid'), 'paystate_enabled' => $conf->exists('show_bankstate'), 'ship_enabled' => 1, @@ -632,6 +633,11 @@ sub new_customer { if $gw && $gw->gateway_namespace eq 'Business::OnlineThirdPartyPayment'; } + return { 'error' => "CVV2 is required" } + if $cust_main->payby =~ /^(CARD|DCRD)$/ + && ! $cust_main->paycvv + && $conf->exists('signup-require_cvv'); + $cust_main->payinfo($cust_main->daytime) if $cust_main->payby eq 'LECB' && ! $cust_main->payinfo; diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 375d2d899..56b753002 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2663,6 +2663,13 @@ and customer address. Include units.', }, { + 'key' => 'signup-require_cvv', + 'section' => 'self-service', + 'description' => 'Require CVV for credit card signup.', + 'type' => 'checkbox', + }, + + { 'key' => 'manual_process-pkgpart', 'section' => 'billing', 'description' => 'Package to add to each manual credit card and ACH payment entered by employees from the backend. Enabling this option may be in violation of your merchant agreement(s), so please check it(/them) carefully before enabling this option.', diff --git a/fs_selfservice/FS-SelfService/cgi/signup.cgi b/fs_selfservice/FS-SelfService/cgi/signup.cgi index 88eab5cce..acd7a62db 100755 --- a/fs_selfservice/FS-SelfService/cgi/signup.cgi +++ b/fs_selfservice/FS-SelfService/cgi/signup.cgi @@ -208,6 +208,11 @@ if ( $magic eq 'process' || $action eq 'process_signup' ) { or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo; cardtype($payinfo) eq $cgi->param('CARD_type') or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type'); + + $error ||= 'CVV2 is required' + if ! $cgi->param('paycvv') + && $init_data->{require_cvv}; + } if ($init_data->{emailinvoiceonly} && (length $cgi->param('invoicing_list') < 1)) { diff --git a/fs_selfservice/FS-SelfService/cgi/signup.html b/fs_selfservice/FS-SelfService/cgi/signup.html index a9b67592b..003632a6a 100755 --- a/fs_selfservice/FS-SelfService/cgi/signup.html +++ b/fs_selfservice/FS-SelfService/cgi/signup.html @@ -196,7 +196,8 @@ else { if ( $cvv_enabled ) { foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 - $payby{$payby} .= qq!CVV2 (help)!; + my $cvv_r = $require_cvv ? '* ' : ''; + $payby{$payby} .= qq!${cvv_r}CVV2 (help)!; } } if ( $paystate_enabled ) { @@ -226,7 +227,8 @@ else { if ( $cvv_enabled ) { foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5 - $paybychecked{$payby} .= qq!CVV2 (help)!; + my $cvv_r = $require_cvv ? '* ' : ''; + $paybychecked{$payby} .= qq!${cvv_r}CVV2 (help)!; } } if ( $paystate_enabled ) {