summaryrefslogtreecommitdiff
path: root/fs_selfservice
diff options
context:
space:
mode:
authorjeff <jeff>2006-11-27 07:11:53 +0000
committerjeff <jeff>2006-11-27 07:11:53 +0000
commitb5bd90f5ee35af1ca7989bf92dc50ada7c2cbcb8 (patch)
tree83f002ad9c43424027b7f9aff9c0b541a0eabbe8 /fs_selfservice
parentd1688630a1f43fcd0e780d98556282de3e756f6a (diff)
order package from self-service
Diffstat (limited to 'fs_selfservice')
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/customer_order_pkg.html10
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount_menu.html3
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/process_order_pkg.html13
-rw-r--r--fs_selfservice/FS-SelfService/cgi/selfservice.cgi61
4 files changed, 82 insertions, 5 deletions
diff --git a/fs_selfservice/FS-SelfService/cgi/customer_order_pkg.html b/fs_selfservice/FS-SelfService/cgi/customer_order_pkg.html
new file mode 100755
index 000000000..c01b6b384
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/customer_order_pkg.html
@@ -0,0 +1,10 @@
+<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD>
+<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
+<%= $url = "$selfurl?session=$session_id;action="; ''; %>
+<%= include('myaccount_menu') %>
+<TD VALIGN="top">
+<%= include('order_pkg') %>
+</TD></TR></TABLE>
+<HR>
+<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
+</BODY></HTML>
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 6dacc3ef4..aa24f5d8f 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -12,7 +12,8 @@ my @menu = (
{ title=>' ' },
{ title=>'Purchase', size=>'+1', },
-# { title=>'Purchase additional package*', url=>'order', 'indent'=>2 },
+ { title=>'Purchase additional package*',
+ url=>'customer_order_pkg', 'indent'=>2 },
);
if ( 1 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
diff --git a/fs_selfservice/FS-SelfService/cgi/process_order_pkg.html b/fs_selfservice/FS-SelfService/cgi/process_order_pkg.html
new file mode 100755
index 000000000..79be5eba5
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/process_order_pkg.html
@@ -0,0 +1,13 @@
+<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD>
+<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
+<%= $url = "$selfurl?session=$session_id;action="; ''; %>
+<%= include('myaccount_menu') %>
+<TD VALIGN="top">
+
+<FONT SIZE=4>Package order successful.</FONT>
+
+</TD></TR></TABLE>
+<HR>
+<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
+</BODY></HTML>
+
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index ed6d623d9..0f8979cd8 100644
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -T
#!/usr/bin/perl -Tw
use strict;
@@ -11,7 +10,7 @@ use HTML::Entities;
use FS::SelfService qw( login customer_info invoice
payment_info process_payment
process_prepay
- list_pkgs
+ list_pkgs order_pkg signup_info
part_svc_info provision_acct provision_external
unprovision_svc
list_svcs myaccount_passwd
@@ -66,7 +65,7 @@ $session_id = $cgi->param('session');
#order|pw_list XXX ???
$cgi->param('action') =~
- /^(myaccount|view_invoice|make_payment|payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|change_password|process_change_password)$/
+ /^(myaccount|view_invoice|make_payment|payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|customer_order_pkg|process_order_pkg|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|change_password|process_change_password)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -76,7 +75,9 @@ $FS::SelfService::DEBUG = $DEBUG;
my $result = eval "&$action();";
die $@ if $@;
-if ( $result->{error} eq "Can't resume session" ) { #ick
+if ( $result->{error} eq "Can't resume session"
+ || $result->{error} eq "Expired session" ) { #ick
+
do_template('login',{});
exit;
}
@@ -107,6 +108,58 @@ sub view_invoice {
}
+sub customer_order_pkg {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ return $init_data if ( $init_data->{'error'} );
+
+ my $customer_info = customer_info( 'session_id' => $session_id );
+ return $customer_info if ( $customer_info->{'error'} );
+
+ return {
+ ( map { $_ => $init_data->{$_} }
+ qw( part_pkg security_phrase svc_acct_pop ),
+ ),
+ %$customer_info,
+ };
+}
+
+sub process_order_pkg {
+
+ my $results = '';
+
+ unless ( length($cgi->param('_password')) ) {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ $results = { 'error' => $init_data->{msgcat}{empty_password} };
+ $results = { 'error' => $init_data->{error} } if($init_data->{error});
+ }
+ if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ $results = { 'error' => $init_data->{msgcat}{passwords_dont_match} };
+ $results = { 'error' => $init_data->{error} } if($init_data->{error});
+ $cgi->param('_password', '');
+ $cgi->param('_password2', '');
+ }
+
+ $results ||= order_pkg (
+ 'session_id' => $session_id,
+ map { $_ => $cgi->param($_) }
+ qw( custnum pkgpart username _password _password2 sec_phrase popnum )
+ );
+
+
+ if ( $results->{'error'} ) {
+ $action = 'customer_order_pkg';
+ return {
+ $cgi->Vars,
+ %{customer_order_pkg()},
+ 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
+ };
+ } else {
+ return $results;
+ }
+
+}
+
sub make_payment {
payment_info( 'session_id' => $session_id );
}