[freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi view_usage.html, 1.1, 1.2 selfservice.cgi, 1.18, 1.19 process_order_recharge.html, NONE, 1.1

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Dec 6 18:40:33 PST 2006


Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory wavetail:/tmp/cvs-serv19099/fs_selfservice/FS-SelfService/cgi

Modified Files:
	view_usage.html selfservice.cgi 
Added Files:
	process_order_recharge.html 
Log Message:
retouch bandwidth countdown

--- NEW FILE: process_order_recharge.html ---
<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>


Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- selfservice.cgi	30 Nov 2006 02:27:55 -0000	1.18
+++ selfservice.cgi	7 Dec 2006 02:40:31 -0000	1.19
@@ -10,7 +10,7 @@
 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 @@
 
 #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_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 );
 }

Index: view_usage.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/view_usage.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- view_usage.html	30 Nov 2006 02:27:55 -0000	1.1
+++ view_usage.html	7 Dec 2006 02:40:31 -0000	1.2
@@ -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>



More information about the freeside-commits mailing list