From 1f93febd8c42aa344867d9f46601075ecf949ec4 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Apr 2002 12:03:15 +0000 Subject: [PATCH] alternate decline handline (Bug #408) --- fs_signup/FS-SignupClient/cgi/decline.html | 5 +++ fs_signup/FS-SignupClient/cgi/signup.cgi | 50 +++++++++++++++++++++++++++--- fs_signup/fs_signup_server | 17 +++++----- 3 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 fs_signup/FS-SignupClient/cgi/decline.html diff --git a/fs_signup/FS-SignupClient/cgi/decline.html b/fs_signup/FS-SignupClient/cgi/decline.html new file mode 100644 index 000000000..a37ba3ab6 --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/decline.html @@ -0,0 +1,5 @@ +Processing error +Processing error

+There has been an error processing your account. Please contact customer +support. + diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 6ef535471..009a63304 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.26 2002-04-20 00:48:17 ivan Exp $ +# $Id: signup.cgi,v 1.27 2002-04-25 12:03:15 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $init_data $error @@ -10,12 +10,16 @@ use vars qw( @payby $cgi $locales $packages $pops $init_data $error $pkgpart $username $password $password2 $sec_phrase $popnum $agentnum $ieak_file $ieak_template $cck_file $cck_template - $signup_html $signup_template $success_html $success_template + $signup_html $signup_template + $success_html $success_template + $decline_html $decline_template $ac $exch $loc $email_name $pkg $self_url ); -use subs qw( print_form print_okay expselect signup_default success_default ); +use subs qw( print_form print_okay print_decline + signup_default success_default decline_default + expselect ); use CGI; #use CGI::Carp qw(fatalsToBrowser); use Text::Template; @@ -38,6 +42,9 @@ $signup_html = -e 'signup.html' $success_html = -e 'success.html' ? 'success.html' : '/usr/local/freeside/success.html'; +$decline_html = -e 'decline.html' + ? 'decline.html' + : '/usr/local/freeside/decline.html'; if ( -e $ieak_file ) { my $ieak_txt = Text::Template::_load_text($ieak_file) @@ -103,6 +110,24 @@ if ( -e $success_html ) { or die $Text::Template::ERROR; } +if ( -e $decline_html ) { + my $decline_txt = Text::Template::_load_text($decline_html) + or die $Text::Template::ERROR; + $decline_txt =~ /^(.*)$/s; #untaint the template source - it's trusted + $decline_txt = $1; + $decline_template = new Text::Template ( TYPE => 'STRING', + SOURCE => $decline_txt, + DELIMITERS => [ '<%=', '%>' ], + ) + or die $Text::Template::ERROR; +} else { + $decline_template = new Text::Template ( TYPE => 'STRING', + SOURCE => &decline_default, + DELIMITERS => [ '<%=', '%>' ], + ) + or die $Text::Template::ERROR; +} + ( $locales, $packages, $pops, $init_data ) = signup_info(); @payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}}; @@ -210,7 +235,9 @@ if ( defined $cgi->param('magic') ) { } - if ( $error ) { + if ( $error eq '_decline' ) { + print_decline(); + } elsif ( $error ) { print_form(); } else { print_okay(); @@ -262,6 +289,11 @@ sub print_form { } +sub print_decline { + print $cgi->header( '-expires' => 'now' ), + $decline_template->fill_in(); +} + sub print_okay { my $user_agent = new HTTP::Headers::UserAgent $ENV{HTTP_USER_AGENT}; @@ -425,6 +457,16 @@ Package: <%= $pkg %>
END } +sub decline_default { #html to use if there is a decline + <<'END'; +Processing error +Processing error

+There has been an error processing your account. Please contact customer +support. + +END +} + sub signup_default { #html to use if you don't specify a template file <<'END'; ISP Signup form diff --git a/fs_signup/fs_signup_server b/fs_signup/fs_signup_server index b636b6981..e7b372a4e 100755 --- a/fs_signup/fs_signup_server +++ b/fs_signup/fs_signup_server @@ -169,12 +169,7 @@ while (1) { %hash = ( $cust_pkg => [ $svc_acct ] ); $error ||= $cust_main->insert( \%hash, \@invoicing_list ); #msgcat - warn "[fs_signup_server] Sending results...\n" if $Debug; - print $writer $error, "\n"; - - next if $error; - - if ( $conf->exists('signup_server-realtime') ) { + if ( ! $error && $conf->exists('signup_server-realtime') ) { warn "[fs_signup_server] Billing customer...\n" if $Debug; @@ -191,10 +186,18 @@ while (1) { if ( $cust_main->balance > 0 ) { #should check list for errors... - $cust_main->suspend; + #$cust_main->suspend; + $cust_main->cancel; } } + $error ||= '_decline'; + + warn "[fs_signup_server] Sending results...\n" if $Debug; + print $writer $error, "\n"; + + next if $error; + if ( $conf->config('signup_server-email') ) { warn "[fs_signup_server] Sending email...\n" if $Debug; -- 2.11.0