summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2003-05-18 06:20:21 +0000
committerivan <ivan>2003-05-18 06:20:21 +0000
commitd1d57ae4fa0f2a30b36a70c656aa2672744f75a3 (patch)
tree7c3eff6ac0983e67ab838b5d50b169e4a38bb94e
parentac15b7153b154f5bb951f0ce62731f8216ff9fc4 (diff)
self-service: make payment UI done
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm37
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm1
-rw-r--r--fs_selfservice/FS-SelfService/cgi/login.html4
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount.html7
-rw-r--r--fs_selfservice/FS-SelfService/cgi/selfservice.cgi5
5 files changed, 45 insertions, 9 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 9983b5d..80c7330 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -19,6 +19,7 @@ FS::ClientAPI->register_handlers(
'MyAccount/customer_info' => \&customer_info,
'MyAccount/invoice' => \&invoice,
'MyAccount/cancel' => \&cancel,
+ 'MyAccount/payment_info' => \&payment_info,
);
#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'})
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index 4d68d61..c561dab 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -23,6 +23,7 @@ $socket = "/usr/local/freeside/selfservice_socket";
'customer_info' => 'MyAccount/customer_info',
'invoice' => 'MyAccount/invoice',
'cancel' => 'MyAccount/cancel',
+ 'payment_info' => 'MyAccount/payment_info',
);
@EXPORT_OK = keys %autoload;
diff --git a/fs_selfservice/FS-SelfService/cgi/login.html b/fs_selfservice/FS-SelfService/cgi/login.html
index 112cc34..ca6251e 100644
--- a/fs_selfservice/FS-SelfService/cgi/login.html
+++ b/fs_selfservice/FS-SelfService/cgi/login.html
@@ -8,7 +8,7 @@
<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>
@@ -23,7 +23,7 @@
<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>
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount.html b/fs_selfservice/FS-SelfService/cgi/myaccount.html
index d8bfe0c..f1a6387 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount.html
@@ -9,12 +9,9 @@
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">'.
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index 9b8bdc1..7b392bc 100644
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -6,7 +6,7 @@ use subs qw(do_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 = '.';
@@ -68,6 +68,7 @@ if ( $result->{error} eq "Can't resume session" ) { #ick
#warn $result->{'open_invoices'};
#warn scalar(@{$result->{'open_invoices'}});
+warn "processing template $action\n";
do_template($action, {
'session_id' => $session_id,
%{$result}
@@ -89,7 +90,7 @@ sub view_invoice {
}
sub make_payment {
-
+ payment_info( 'session_id' => $session_id );
}
#--