diff options
author | ivan <ivan> | 2003-05-18 06:20:21 +0000 |
---|---|---|
committer | ivan <ivan> | 2003-05-18 06:20:21 +0000 |
commit | d1d57ae4fa0f2a30b36a70c656aa2672744f75a3 (patch) | |
tree | 7c3eff6ac0983e67ab838b5d50b169e4a38bb94e | |
parent | ac15b7153b154f5bb951f0ce62731f8216ff9fc4 (diff) |
self-service: make payment UI done
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 37 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/SelfService.pm | 1 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/login.html | 4 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/myaccount.html | 7 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 5 |
5 files changed, 45 insertions, 9 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 9983b5d26..80c7330e8 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 4d68d614a..c561dabdb 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 112cc34ea..ca6251eb1 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 d8bfe0cb1..f1a63870a 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 9b8bdc100..7b392bcf4 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 ); } #-- |