summaryrefslogtreecommitdiff
path: root/fs_selfservice
diff options
context:
space:
mode:
authorjeff <jeff>2006-12-07 02:40:32 +0000
committerjeff <jeff>2006-12-07 02:40:32 +0000
commit6194551336a925ae5455cede68a7f73660b06bb6 (patch)
tree54be12685fdfcc4b3da1ccfca8a42bff1a2b128c /fs_selfservice
parent571d5e87ffc63a155072dab88fba16d5918cc57d (diff)
retouch bandwidth countdown
Diffstat (limited to 'fs_selfservice')
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm1
-rw-r--r--fs_selfservice/FS-SelfService/cgi/process_order_recharge.html13
-rw-r--r--fs_selfservice/FS-SelfService/cgi/selfservice.cgi31
-rw-r--r--fs_selfservice/FS-SelfService/cgi/view_usage.html32
4 files changed, 63 insertions, 14 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index 216e3729d..980c899c5 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -38,6 +38,7 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'list_pkgs' => 'MyAccount/list_pkgs', #add to ss cgi (added?)
'list_svcs' => 'MyAccount/list_svcs', #add to ss cgi (added?)
'order_pkg' => 'MyAccount/order_pkg', #add to ss cgi!
+ 'order_recharge' => 'MyAccount/order_recharge',
'cancel_pkg' => 'MyAccount/cancel_pkg', #add to ss cgi!
'charge' => 'MyAccount/charge', #?
'part_svc_info' => 'MyAccount/part_svc_info',
diff --git a/fs_selfservice/FS-SelfService/cgi/process_order_recharge.html b/fs_selfservice/FS-SelfService/cgi/process_order_recharge.html
new file mode 100644
index 000000000..851bbed44
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/process_order_recharge.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><%= $svc %> recharged successfully.</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 1a2c74a64..e2fd7f6a4 100644
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -10,7 +10,7 @@ use HTML::Entities;
use FS::SelfService qw( login customer_info invoice
payment_info process_payment
process_prepay
- list_pkgs order_pkg signup_info
+ list_pkgs order_pkg signup_info order_recharge
part_svc_info provision_acct provision_external
unprovision_svc
list_svcs myaccount_passwd
@@ -65,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|customer_order_pkg|process_order_pkg|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|view_usage||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|process_order_recharge|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|view_usage||change_password|process_change_password)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -160,6 +160,33 @@ sub process_order_pkg {
}
+sub process_order_recharge {
+
+ my $results = '';
+
+ $results ||= order_recharge (
+ 'session_id' => $session_id,
+ map { $_ => $cgi->param($_) }
+ qw( svcnum )
+ );
+
+
+ if ( $results->{'error'} ) {
+ $action = 'view_usage';
+ if ($results->{'error'} eq '_decline') {
+ $results->{'error'} = "There has been an error processing your account. Please contact customer support."
+ }
+ return {
+ $cgi->Vars,
+ %{view_usage()},
+ 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
+ };
+ } else {
+ return $results;
+ }
+
+}
+
sub make_payment {
payment_info( 'session_id' => $session_id );
}
diff --git a/fs_selfservice/FS-SelfService/cgi/view_usage.html b/fs_selfservice/FS-SelfService/cgi/view_usage.html
index 40aec7bcf..73ad1e4af 100644
--- a/fs_selfservice/FS-SelfService/cgi/view_usage.html
+++ b/fs_selfservice/FS-SelfService/cgi/view_usage.html
@@ -6,8 +6,9 @@
<FONT SIZE=4>Service usage</FONT><BR><BR>
-<FORM ACTION="<%= $selfurl %>" METHOD="POST">
-<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>">
+<%= if ( $error ) {
+ $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
+} ''; %>
<TABLE BGCOLOR="#cccccc">
<TR>
@@ -18,13 +19,6 @@
<TH ALIGN="right">Total remaining</TH>
</TR>
<%= foreach my $svc ( @svcs ) {
- my $totalbytes = '';
- if ( ($svc->{'upbytes'} + 0) eq $svc->{'upbytes'}
- || ($svc->{'downbytes'} + 0) eq $svc->{'downbytes'} ) {
-
- $totalbytes = $svc->{'upbytes'} + $svc->{'downbytes'};
- }
-
$OUT .= '<TR><TD>';
$OUT .= $svc->{'label'}. ': '. $svc->{'value'};
$OUT .= '</TD><TD ALIGN="right">';
@@ -34,15 +28,29 @@
$OUT .= '</TD><TD ALIGN="right">';
$OUT .= $svc->{'downbytes'};
$OUT .= '</TD><TD ALIGN="right">';
- $OUT .= $totalbytes;
+ $OUT .= $svc->{'totalbytes'};
$OUT .= '</TD></TR>';
+ if ( $svc->{'recharge_amount'} ) {
+ my $link = "${url}process_order_recharge;".
+ "svcnum=$svc->{'svcnum'}";
+ $OUT .= '<TR><TD ALIGN="right">';
+ $OUT .= qq!<A HREF="$link">!.'Recharge for $';
+ $OUT .= $svc->{'recharge_amount'} . '</A> with';
+ $OUT .= '</TD><TD ALIGN="right">';
+ $OUT .= $svc->{'recharge_seconds'} if $svc->{'recharge_seconds'};
+ $OUT .= '</TD><TD ALIGN="right">';
+ $OUT .= $svc->{'recharge_upbytes'} if $svc->{'recharge_upbytes'};
+ $OUT .= '</TD><TD ALIGN="right">';
+ $OUT .= $svc->{'recharge_downbytes'} if $svc->{'recharge_downbytes'};
+ $OUT .= '</TD><TD ALIGN="right">';
+ $OUT .= $svc->{'recharge_totalbytes'} if $svc->{'recharge_totalbytes'};
+ $OUT .= '</TD></TR>';
+ }
} %>
</TABLE>
<BR>
-</FORM>
-
</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>