X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_signup%2FFS-SignupClient%2FSignupClient.pm;h=fb2b12fb055e24903c660ae27d8c2ba7490fbac3;hb=e975ed0585280f4cbb90b02f57114dedc43f58be;hp=3933703ae7e2c3a8870df22641d85b6f5e113cd8;hpb=8fc4118f1f055195d280b3250b39a3b5fcdf13dc;p=freeside.git diff --git a/fs_signup/FS-SignupClient/SignupClient.pm b/fs_signup/FS-SignupClient/SignupClient.pm index 3933703ae..fb2b12fb0 100644 --- a/fs_signup/FS-SignupClient/SignupClient.pm +++ b/fs_signup/FS-SignupClient/SignupClient.pm @@ -1,30 +1,19 @@ package FS::SignupClient; use strict; -use vars qw($VERSION @ISA @EXPORT_OK $fs_signupd_socket); +use vars qw($VERSION @ISA @EXPORT_OK); # $fs_signupd_socket); use Exporter; -use Socket; -use FileHandle; -use IO::Handle; -use Storable qw(nstore_fd fd_retrieve); +#use Socket; +#use FileHandle; +#use IO::Handle; +#use Storable qw(nstore_fd fd_retrieve); +use FS::SelfService; # qw( new_customer signup_info ); -$VERSION = '0.02'; +$VERSION = '0.04'; @ISA = qw( Exporter ); @EXPORT_OK = qw( signup_info new_customer ); -$fs_signupd_socket = "/usr/local/freeside/fs_signupd_socket"; - -$ENV{'PATH'} ='/usr/bin:/usr/ucb:/bin'; -$ENV{'SHELL'} = '/bin/sh'; -$ENV{'IFS'} = " \t\n"; -$ENV{'CDPATH'} = ''; -$ENV{'ENV'} = ''; -$ENV{'BASH_ENV'} = ''; - -my $freeside_uid = scalar(getpwnam('freeside')); -die "not running as the freeside user\n" if $> != $freeside_uid; - =head1 NAME FS::SignupClient - Freeside signup client API @@ -33,8 +22,10 @@ FS::SignupClient - Freeside signup client API use FS::SignupClient qw( signup_info new_customer ); - ( $locales, $packages, $pops ) = signup_info; + #this is the backwards-compatibility bit + ( $locales, $packages, $pops, $real_signup_info ) = signup_info; + #this is compatible with FS::SelfService::new_customer $error = new_customer ( { 'first' => $first, 'last' => $last, @@ -52,15 +43,18 @@ FS::SignupClient - Freeside signup client API 'fax' => $fax, 'payby' => $payby, 'payinfo' => $payinfo, + 'paycvv' => $paycvv, 'paydate' => $paydate, 'payname' => $payname, 'invoicing_list' => $invoicing_list, 'referral_custnum' => $referral_custnum, + 'comments' => $comments, 'pkgpart' => $pkgpart, 'username' => $username, '_password' => $password, 'sec_phrase' => $sec_phrase, 'popnum' => $popnum, + 'agentnum' => $agentnum, #optional } ); =head1 DESCRIPTION @@ -98,16 +92,14 @@ Each hash reference has the following keys: ac exch +(Future expansion: fourth argument is the $init_data hash reference) + =cut +#compatibility bit sub signup_info { - socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; - connect(SOCK, sockaddr_un($fs_signupd_socket)) or die "connect: $!"; - print SOCK "signup_info\n"; - SOCK->flush; - my $init_data = fd_retrieve(\*SOCK); - close SOCK; + my $init_data = FS::SelfService::signup_info(); (map { $init_data->{$_} } qw( cust_main_county part_pkg svc_acct_pop ) ), $init_data; @@ -134,44 +126,26 @@ a paramater with the following keys: fax payby payinfo + paycvv paydate payname invoicing_list referral_custnum + comments pkgpart username _password + sec_phrase popnum Returns a scalar error message, or the empty string for success. =cut -sub new_customer { - my $hashref = shift; - - #things that aren't necessary in base class, but are for signup server -# return "Passwords don't match" -# if $hashref->{'_password'} ne $hashref->{'_password2'} - return "Empty password" unless $hashref->{'_password'}; - return "No POP selected" unless $hashref->{'popnum'}; - - socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!"; - connect(SOCK, sockaddr_un($fs_signupd_socket)) or die "connect: $!"; - print SOCK "new_customer\n"; - - my $signup_data = { map { $_ => $hashref->{$_} } qw( - first last ss company address1 address2 city county state zip country - daytime night fax payby payinfo paydate payname invoicing_list - referral_custnum pkgpart username _password popnum - ) }; - - # - nstore_fd($signup_data, \*SOCK) or die "can't send customer signup: $!"; - SOCK->flush; - - chop( my $error = ); - $error; +#compatibility bit +sub new_customer { + my $hash = FS::SelfService::new_customer(@_); + $hash->{'error'}; } =back