self-service: make payment UI done
authorivan <ivan>
Sun, 18 May 2003 06:20:21 +0000 (06:20 +0000)
committerivan <ivan>
Sun, 18 May 2003 06:20:21 +0000 (06:20 +0000)
FS/FS/ClientAPI/MyAccount.pm
fs_selfservice/FS-SelfService/SelfService.pm
fs_selfservice/FS-SelfService/cgi/login.html
fs_selfservice/FS-SelfService/cgi/myaccount.html
fs_selfservice/FS-SelfService/cgi/selfservice.cgi

index 9983b5d..80c7330 100644 (file)
@@ -19,6 +19,7 @@ FS::ClientAPI->register_handlers(
   'MyAccount/customer_info' => \&customer_info,
   'MyAccount/invoice'       => \&invoice,
   'MyAccount/cancel'        => \&cancel,
   'MyAccount/customer_info' => \&customer_info,
   'MyAccount/invoice'       => \&invoice,
   'MyAccount/cancel'        => \&cancel,
+  'MyAccount/payment_info'  => \&payment_info,
 );
 
 #store in db?
 );
 
 #store in db?
@@ -112,6 +113,42 @@ sub customer_info {
 
 }
 
 
 }
 
+sub payment_info {
+  my $p = shift;
+  my $session = $cache->get($p->{'session_id'})
+    or return { 'error' => "Can't resume session" }; #better error message
+
+  my %return;
+
+  my $custnum = $session->{'custnum'};
+
+  my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
+    or return { 'error' => "unknown custnum $custnum" };
+
+  $return{balance} = $cust_main->balance;
+
+  $return{payname} = $cust_main->payname
+                     || $cust_main->first. ' '. $cust_main->get('last');
+
+  $return{$_} = $cust_main->get($_) for qw(address1 address2 city state zip);
+
+  if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
+    #$return{card_type} = 
+    $return{payinfo} = $cust_main->payinfo;
+    #exp date (month, year)
+
+    #CARD vd DCRD remembering
+  }
+
+  #list all states & counties
+
+  return { 'error' => '',
+           %return,
+         };
+
+};
+
+
 sub invoice {
   my $p = shift;
   my $session = $cache->get($p->{'session_id'})
 sub invoice {
   my $p = shift;
   my $session = $cache->get($p->{'session_id'})
index 4d68d61..c561dab 100644 (file)
@@ -23,6 +23,7 @@ $socket =  "/usr/local/freeside/selfservice_socket";
   'customer_info' => 'MyAccount/customer_info',
   'invoice'       => 'MyAccount/invoice',
   'cancel'        => 'MyAccount/cancel',
   'customer_info' => 'MyAccount/customer_info',
   'invoice'       => 'MyAccount/invoice',
   'cancel'        => 'MyAccount/cancel',
+  'payment_info'  => 'MyAccount/payment_info',
 );
 @EXPORT_OK = keys %autoload;
 
 );
 @EXPORT_OK = keys %autoload;
 
index 112cc34..ca6251e 100644 (file)
@@ -8,7 +8,7 @@
   <TH ALIGN="right">Username </TH>
   <TD>
     <!-- <INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"> -->
   <TH ALIGN="right">Username </TH>
   <TD>
     <!-- <INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"> -->
-    <INPUT TYPE="text" NAME="username" VALUE="awctwincities-l">
+    <INPUT TYPE="text" NAME="username" VALUE="hslink">
   </TD>
 </TR>
 <TR>
   </TD>
 </TR>
 <TR>
@@ -23,7 +23,7 @@
   <TH ALIGN="right">Password </TH>
   <TD>
     <!-- <INPUT TYPE="password" NAME="password"> -->
   <TH ALIGN="right">Password </TH>
   <TD>
     <!-- <INPUT TYPE="password" NAME="password"> -->
-    <INPUT TYPE="password" NAME="password" VALUE="6lrnsfCc">
+    <INPUT TYPE="password" NAME="password" VALUE="UwjM5zdb">
   </TD>
 </TR>
 </TABLE>
   </TD>
 </TR>
 </TABLE>
index d8bfe0c..f1a6387 100644 (file)
@@ -9,12 +9,9 @@
 Hello <%= $name %>!<BR><BR>
 Your contact information<BR><%= $small_custview %>
 <BR>
 Hello <%= $name %>!<BR><BR>
 Your contact information<BR><%= $small_custview %>
 <BR>
-<%= if ( $balance ) {
-  $OUT .= qq! <B><A HREF="${url}make_payment">Make a $balance payment</A></B>!;
+<%= if ( $balance > 0 ) {
+  $OUT .= qq! <B><A HREF="${url}make_payment">Make a payment</A></B><BR><BR>!;
 } %>
 } %>
-<BR><BR>
-<!--<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2 BORDERCOLOR="#999999">
-<TR><TH>Invoice</TH><TH>Date</TH><TH>Owed</TH></TR>-->
 <%=
   if ( @open_invoices ) {
     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
 <%=
   if ( @open_invoices ) {
     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
index 9b8bdc1..7b392bc 100644 (file)
@@ -6,7 +6,7 @@ use subs qw(do_template);
 use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use Text::Template;
 use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use Text::Template;
-use FS::SelfService qw(login customer_info invoice);
+use FS::SelfService qw(login customer_info invoice payment_info);
 
 $template_dir = '.';
 
 
 $template_dir = '.';
 
@@ -68,6 +68,7 @@ if ( $result->{error} eq "Can't resume session" ) { #ick
 #warn $result->{'open_invoices'};
 #warn scalar(@{$result->{'open_invoices'}});
 
 #warn $result->{'open_invoices'};
 #warn scalar(@{$result->{'open_invoices'}});
 
+warn "processing template $action\n";
 do_template($action, {
   'session_id' => $session_id,
   %{$result}
 do_template($action, {
   'session_id' => $session_id,
   %{$result}
@@ -89,7 +90,7 @@ sub view_invoice {
 }
 
 sub make_payment {
 }
 
 sub make_payment {
-
+  payment_info( 'session_id' => $session_id );
 }
 
 #--
 }
 
 #--