package FS::SelfService;
use strict;
-use vars qw($VERSION @ISA @EXPORT_OK $socket %autoload $tag);
+use vars qw($VERSION @ISA @EXPORT_OK $DEBUG $dir $socket %autoload $tag);
use Exporter;
use Socket;
use FileHandle;
@ISA = qw( Exporter );
-$socket = "/usr/local/freeside/selfservice_socket";
+$DEBUG = 0;
+
+$dir = "/usr/local/freeside";
+$socket = "$dir/selfservice_socket";
$socket .= '.'.$tag if defined $tag && length($tag);
#maybe should ask ClientAPI for this list
'customer_info' => 'MyAccount/customer_info',
'edit_info' => 'MyAccount/edit_info', #add to ss cgi!
'invoice' => 'MyAccount/invoice',
+ 'invoice_logo' => 'MyAccount/invoice_logo',
'list_invoices' => 'MyAccount/list_invoices', #?
'cancel' => 'MyAccount/cancel', #add to ss cgi!
'payment_info' => 'MyAccount/payment_info',
'process_payment' => 'MyAccount/process_payment',
- 'list_pkgs' => 'MyAccount/list_pkgs', #add to ss cgi!
+ 'process_prepay' => 'MyAccount/process_prepay',
+ 'list_pkgs' => 'MyAccount/list_pkgs', #add to ss cgi (added?)
+ 'list_svcs' => 'MyAccount/list_svcs', #add to ss cgi (added?)
+ 'list_svc_usage' => 'MyAccount/list_svc_usage',
+ 'list_support_usage' => 'MyAccount/list_support_usage',
'order_pkg' => 'MyAccount/order_pkg', #add to ss cgi!
+ 'change_pkg' => 'MyAccount/change_pkg',
+ 'order_recharge' => 'MyAccount/order_recharge',
'cancel_pkg' => 'MyAccount/cancel_pkg', #add to ss cgi!
'charge' => 'MyAccount/charge', #?
'part_svc_info' => 'MyAccount/part_svc_info',
'provision_acct' => 'MyAccount/provision_acct',
'provision_external' => 'MyAccount/provision_external',
'unprovision_svc' => 'MyAccount/unprovision_svc',
+ 'myaccount_passwd' => 'MyAccount/myaccount_passwd',
'signup_info' => 'Signup/signup_info',
'new_customer' => 'Signup/new_customer',
'agent_login' => 'Agent/agent_login',
my $freeside_uid = scalar(getpwnam('freeside'));
die "not running as the freeside user\n" if $> != $freeside_uid;
+-e $dir or die "FATAL: $dir doesn't exist!";
+-d $dir or die "FATAL: $dir isn't a directory!";
+-r $dir or die "FATAL: Can't read $dir as freeside user!";
+-x $dir or die "FATAL: $dir not searchable (executable) as freeside user!";
+
foreach my $autoload ( keys %autoload ) {
my $eval =
if ( ref($_[0]) ) {
$param = shift;
} else {
+ #warn scalar(@_). ": ". join(" / ", @_);
$param = { @_ };
}
sub simple_packet {
my $packet = shift;
+ warn "sending ". $packet->{_packet}. " to server"
+ if $DEBUG;
socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!";
- connect(SOCK, sockaddr_un($socket)) or die "connect: $!";
+ connect(SOCK, sockaddr_un($socket)) or die "connect to $socket: $!";
nstore_fd($packet, \*SOCK) or die "can't send packet: $!";
SOCK->flush;
# my $w = new IO::Select;
# $w->add(\*SOCK);
# my @wait = $w->can_read;
+
+ warn "reading message from server"
+ if $DEBUG;
+
my $return = fd_retrieve(\*SOCK) or die "error reading result: $!";
die $return->{'_error'} if defined $return->{_error} && $return->{_error};
+ warn "returning message to client"
+ if $DEBUG;
+
$return;
}
'payby' => $payby,
'payinfo' => $payinfo,
'paycvv' => $paycvv,
+ 'paystart_month' => $paystart_month
+ 'paystart_year' => $paystart_year,
+ 'payissue' => $payissue,
+ 'payip' => $payip
'paydate' => $paydate,
'payname' => $payname,
'invoicing_list' => $invoicing_list,
}
my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!;
for ( 1 .. 12 ) {
- $return .= "<OPTION";
+ $return .= qq!<OPTION VALUE="$_"!;
$return .= " SELECTED" if $_ == $m;
$return .= ">$_";
}
$return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!;
my @t = localtime;
my $thisYear = $t[5] + 1900;
- for ( ($thisYear > $y && $y > 0 ? $y : $thisYear) .. 2037 ) {
- $return .= "<OPTION";
+ for ( ($thisYear > $y && $y > 0 ? $y : $thisYear) .. ($thisYear+10) ) {
+ $return .= qq!<OPTION VALUE="$_"!;
$return .= " SELECTED" if $_ == $y;
$return .= ">$_";
}
Note: Resellers can also use the B<signup_info> and B<new_customer> functions
with their active session, and the B<customer_info> and B<order_pkg> functions
-with their active session and an additonal I<custnum> parameter.
+with their active session and an additional I<custnum> parameter.
=over 4