summaryrefslogtreecommitdiff
path: root/fs_signup
diff options
context:
space:
mode:
authorivan <ivan>2002-04-25 12:03:15 +0000
committerivan <ivan>2002-04-25 12:03:15 +0000
commit1f93febd8c42aa344867d9f46601075ecf949ec4 (patch)
tree08e517b754f1e29d3e75f1b2ec79c588d08bdab2 /fs_signup
parent2a22a4862979750c1886ac8f125043854be47d58 (diff)
alternate decline handline (Bug #408)
Diffstat (limited to 'fs_signup')
-rw-r--r--fs_signup/FS-SignupClient/cgi/decline.html5
-rwxr-xr-xfs_signup/FS-SignupClient/cgi/signup.cgi50
-rwxr-xr-xfs_signup/fs_signup_server17
3 files changed, 61 insertions, 11 deletions
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 @@
+<HTML><HEAD><TITLE>Processing error</TITLE></HEAD>
+<BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Processing error</FONT><BR><BR>
+There has been an error processing your account. Please contact customer
+support.
+</BODY></HTML>
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 %><BR>
END
}
+sub decline_default { #html to use if there is a decline
+ <<'END';
+<HTML><HEAD><TITLE>Processing error</TITLE></HEAD>
+<BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Processing error</FONT><BR><BR>
+There has been an error processing your account. Please contact customer
+support.
+</BODY></HTML>
+END
+}
+
sub signup_default { #html to use if you don't specify a template file
<<'END';
<HTML><HEAD><TITLE>ISP Signup form</TITLE></HEAD>
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;