diff options
-rw-r--r-- | FS/FS/Conf.pm | 37 | ||||
-rw-r--r-- | FS/FS/cust_bill.pm | 39 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 46 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 45 | ||||
-rw-r--r-- | FS/MANIFEST | 2 | ||||
-rwxr-xr-x | bin/bind.export | 4 | ||||
-rwxr-xr-x | bin/fs-setup | 12 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/SelfService.pm | 9 | ||||
-rw-r--r-- | fs_selfservice/freeside-selfservice-server | 1 | ||||
-rwxr-xr-x | fs_signup/fs_signup_server | 12 |
10 files changed, 78 insertions, 129 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index be5d4ec7d..e805c8ee7 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -815,7 +815,7 @@ httemplate/docs/config.html { 'key' => 'username_policy', - 'section' => '', + 'section' => 'deprecated', 'description' => 'This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts. This should be one of \'prepend domsvc\' \'append domsvc\' \'append domain\' or \'append @domain\'', 'type' => 'select', 'select_enum' => [ 'prepend domsvc', 'append domsvc', 'append domain', 'append @domain' ], @@ -894,20 +894,6 @@ httemplate/docs/config.html }, { - 'key' => 'selfservice_server-quiet', - 'section' => '', - 'description' => 'Disable decline and cancel emails generated by transactions initiated by the selfservice server. Not recommended, unless the customer will get instant feedback from a customer service UI, and receiving an email would be confusing/overkill.', - 'type' => 'checkbox', - }, - - { - 'key' => 'signup_server-quiet', - 'section' => '', - 'description' => 'Disable decline and cancel emails generated by transactions initiated by the signup server. Not recommended, unless the customer will get instant feedback from a customer service UI, and receiving an email would be confusing/overkill. Does not disable welcome emails.', - 'type' => 'checkbox', - }, - - { 'key' => 'signup_server-payby', 'section' => '', 'description' => 'Acceptable payment types for the signup server', @@ -952,27 +938,6 @@ httemplate/docs/config.html }, { - 'key' => 'cancelmessage', - 'section' => 'billing', - 'description' => 'Template file for cancellation emails.', - 'type' => 'textarea', - }, - - { - 'key' => 'cancelsubject', - 'section' => 'billing', - 'description' => 'Subject line for cancellation emails.', - 'type' => 'text', - }, - - { - 'key' => 'emailcancel', - 'section' => 'billing', - 'description' => 'Enable emailing of cancellation notices.', - 'type' => 'checkbox', - }, - - { 'key' => 'require_cardname', 'section' => 'billing', 'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.', diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 01d0f1790..6856e5fe8 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -656,6 +656,28 @@ sub realtime_ach { ); } +=item realtime_lec + +Attempts to pay this invoice with phone bill (LEC) payment via a +Business::OnlinePayment realtime gateway. See +http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment +for supported processors. + +=cut + +sub realtime_lec { + my $self = shift; + $self->realtime_bop( + 'LEC', + $bop_processor, + $bop_login, + $bop_password, + $bop_action, + \@bop_options, + @_ + ); +} + sub realtime_bop { my( $self, $method, $processor, $login, $password, $action, $options ) = @_; my $cust_main = $self->cust_main; @@ -714,12 +736,13 @@ sub realtime_bop { ( $content{account_number}, $content{routing_code} ) = split('@', $cust_main->payinfo); $content{bank_name} = $cust_main->payname; + } elsif ( $method eq 'LEC' ) { + $content{phone} = $cust_main->payinfo; } my $transaction = new Business::OnlinePayment( $processor, @$options ); $transaction->content( - %content, 'type' => $method, 'login' => $login, 'password' => $password, @@ -739,6 +762,7 @@ sub realtime_bop { 'referer' => 'http://cleanwhisker.420.am/', 'email' => $email, 'phone' => $cust_main->daytime || $cust_main->night, + %content, #after ); $transaction->submit(); @@ -790,6 +814,7 @@ sub realtime_bop { my %method2payby = ( 'CC' => 'CARD', 'ECHECK' => 'CHEK', + 'LEC' => 'LECB', ); my $cust_pay = new FS::cust_pay ( { @@ -817,11 +842,9 @@ sub realtime_bop { my $perror = "$processor error, invnum #". $self->invnum. ': '. $transaction->result_code. ": ". $transaction->error_message; - if ( !($ENV{SIGNUP_SERVER} && $conf->exists('signup_server-quiet')) - && !($ENV{SELFSERVICE_SERVER} && $conf->exists('selfservice_server-quiet')) - && $conf->exists('emaildecline') + if ( $conf->exists('emaildecline') && grep { $_ ne 'POST' } $cust_main->invoicing_list - ) { + ) { my @templ = $conf->config('declinetemplate'); my $template = new Text::Template ( TYPE => 'ARRAY', @@ -1161,16 +1184,14 @@ sub print_text { # ); #and subroutine for the template - sub FS::cust_bill::_template::invoice_lines { - my $lines = shift or return @buf; + my $lines = shift || scalar(@buf); map { scalar(@buf) ? shift @buf : [ '', '' ]; } ( 1 .. $lines ); } - #and fill it in $FS::cust_bill::_template::page = 1; my $lines; @@ -1190,7 +1211,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.41.2.14 2002-12-14 11:13:53 steve Exp $ +$Id: cust_bill.pm,v 1.41.2.15 2002-12-14 12:19:16 steve Exp $ =head1 BUGS diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 9ee243789..fdb06200a 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -158,7 +158,7 @@ FS::Record. The following fields are currently supported: =item ship_fax - phone (optional) -=item payby - `CARD' (credit cards), `CHEK' (electronic check), `BILL' (billing), `COMP' (free), or `PREPAY' (special billing type: applies a credit - see L<FS::prepay_credit> and sets billing type to BILL) +=item payby - `CARD' (credit cards), `CHEK' (electronic check), `LECB' (Phone bill billing), `BILL' (billing), `COMP' (free), or `PREPAY' (special billing type: applies a credit - see L<FS::prepay_credit> and sets billing type to BILL) =item payinfo - card number, P.O., comp issuer (4-8 lowercase alphanumerics; think username) or prepayment identifier (see L<FS::prepay_credit>) @@ -482,14 +482,15 @@ sub replace { $self->invoicing_list( $invoicing_list ); } - if ( $self->payby =~ /^(CARD|CHEK)$/ && + if ( $self->payby =~ /^(CARD|CHEK|LECB)$/ && grep { $self->get($_) ne $old->get($_) } qw(payinfo paydate payname) ) { # card info has changed, want to retry realtime_card invoice events #false laziness w/collect foreach my $cust_bill_event ( grep { #$_->part_bill_event->plan eq 'realtime-card' - $_->part_bill_event->eventcode eq '$cust_bill->realtime_card();' + $_->part_bill_event->eventcode =~ + /^\$cust_bill\->realtime_(card|ach|lec)\(\);$/ && $_->status eq 'done' && $_->statustext } @@ -664,14 +665,14 @@ sub check { } } - $self->payby =~ /^(CARD|CHEK|BILL|COMP|PREPAY)$/ + $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREPAY)$/ or return "Illegal payby: ". $self->payby; $self->payby($1); if ( $self->payby eq 'CARD' ) { my $payinfo = $self->payinfo; - $payinfo =~ s/[^\d\@]//g; + $payinfo =~ s/\D//g; $payinfo =~ /^(\d{13,16})$/ or return gettext('invalid_card'); # . ": ". $self->payinfo; $payinfo = $1; @@ -684,11 +685,19 @@ sub check { } elsif ( $self->payby eq 'CHEK' ) { my $payinfo = $self->payinfo; - #$payinfo =~ s/[\D\@]//g; + $payinfo =~ s/[^\d\@]//g; $payinfo =~ /^(\d+)\@(\d{9})$/ or return 'invalid echeck account@aba'; $payinfo = "$1\@$2"; $self->payinfo($payinfo); + } elsif ( $self->payby eq 'LECB' ) { + + my $payinfo = $self->payinfo; + $payinfo =~ s/\D//g; + $payinfo =~ /^1?(\d{10})$/ or return 'invalid btn billing telephone number'; + $payinfo = $1; + $self->payinfo($payinfo); + } elsif ( $self->payby eq 'BILL' ) { $error = $self->ut_textn('payinfo'); @@ -713,7 +722,7 @@ sub check { if ( $self->paydate eq '' || $self->paydate eq '-' ) { return "Expriation date required" - unless $self->payby =~ /^(BILL|PREPAY|CHEK)$/; + unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB)$/; $self->paydate(''); } else { $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ @@ -1045,26 +1054,25 @@ sub bill { || $self->payby eq 'COMP' || $taxable_charged == 0 ) { - my $cust_main_county = - qsearchs('cust_main_county',{ + my $cust_main_county = qsearchs('cust_main_county',{ 'state' => $self->state, 'county' => $self->county, 'country' => $self->country, 'taxclass' => $part_pkg->taxclass, - } ) - or qsearchs('cust_main_county',{ + } ); + $cust_main_county ||= qsearchs('cust_main_county',{ 'state' => $self->state, 'county' => $self->county, 'country' => $self->country, 'taxclass' => '', - } ) - or do { - $dbh->rollback if $oldAutoCommit; - return - "fatal: can't find tax rate for state/county/country/taxclass ". - join('/', ( map $self->$_(), qw(state county country) ), - $part_pkg->taxclass ). "\n"; - }; + } ); + unless ( $cust_main_county ) { + $dbh->rollback if $oldAutoCommit; + return + "fatal: can't find tax rate for state/county/country/taxclass ". + join('/', ( map $self->$_(), qw(state county country) ), + $part_pkg->taxclass ). "\n"; + } if ( $cust_main_county->exempt_amount ) { my ($mon,$year) = (localtime($sdate) )[4,5]; diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 7a248256a..24b96c6e3 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -20,13 +20,6 @@ use FS::svc_domain; use FS::svc_www; use FS::svc_forward; -# need all this for sending cancel emails in sub cancel - -use FS::Conf; -use Date::Format; -use Mail::Internet 1.44; -use Mail::Header; - @ISA = qw( FS::Record ); sub _cache { @@ -298,45 +291,7 @@ sub cancel { $dbh->commit or die $dbh->errstr if $oldAutoCommit; - my $conf = new FS::Conf; - - if ( !($ENV{SIGNUP_SERVER} && $conf->exists('signup_server-quiet')) - && !($ENV{SELFSERVICE_SERVER} && $conf->exists('selfservice_server-quiet')) - && $conf->exists('emailcancel') - && grep { $_ ne 'POST' } $self->cust_main->invoicing_list) { - - my @invoicing_list = $self->cust_main->invoicing_list; - - my $invoice_from = $conf->config('invoice_from'); - my @print_text = map "$_\n", $conf->config('cancelmessage'); - my $subject = $conf->config('cancelsubject'); - my $smtpmachine = $conf->config('smtpmachine'); - - if ( grep { $_ ne 'POST' } @invoicing_list ) { #email invoice - #false laziness w/FS::cust_pay::delete & fs_signup_server && ::realtime_card - #$ENV{SMTPHOSTS} = $smtpmachine; - $ENV{MAILADDRESS} = $invoice_from; - my $header = new Mail::Header ( [ - "From: $invoice_from", - "To: ". join(', ', grep { $_ ne 'POST' } @invoicing_list ), - "Sender: $invoice_from", - "Reply-To: $invoice_from", - "Date: ". time2str("%a, %d %b %Y %X %z", time), - "Subject: $subject", - ] ); - my $message = new Mail::Internet ( - 'Header' => $header, - 'Body' => [ @print_text ], - ); - $!=0; - $message->smtpsend( Host => $smtpmachine ) - or $message->smtpsend( Host => $smtpmachine, Debug => 1 ); - #should this return an error? - } - } - ''; #no errors - } =item suspend diff --git a/FS/MANIFEST b/FS/MANIFEST index 1489cd0e9..578120d57 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -68,6 +68,7 @@ FS/part_export/cyrus.pm FS/part_export/domain_shellcommands.pm FS/part_export/http.pm FS/part_export/infostreet.pm +FS/part_export/ldap.pm FS/part_export/null.pm FS/part_export/shellcommands.pm FS/part_export/shellcommands_withdomain.pm @@ -142,6 +143,7 @@ t/part_export-cyrus.t t/part_export-domain_shellcommands.t t/part_export-http.t t/part_export-infostreet.t +t/part_export-ldap.t t/part_export-null.t t/part_export-shellcommands.t t/part_export-shellcommands_withdomain.t diff --git a/bin/bind.export b/bin/bind.export index 63fb0f60c..943aefbb0 100755 --- a/bin/bind.export +++ b/bin/bind.export @@ -39,7 +39,7 @@ foreach my $export ( @exports ) { or die "can't open $prefix/named.conf: $!"; open(CONF_HEADER,"<$prefix/named.conf.HEADER") - or die "can't open $prefix/named.conf.HEADER: $!" + or die "can't open $prefix/named.conf.HEADER: $!"; while (<CONF_HEADER>) { print NAMED_CONF $_; } close CONF_HEADER; @@ -139,7 +139,7 @@ foreach my $sexport ( @sexports ) { #false laziness with above or die "can't open $prefix/named.conf: $!"; open(CONF_HEADER,"<$prefix/named.conf.HEADER") - or die "can't open $prefix/named.conf.HEADER: $!" + or die "can't open $prefix/named.conf.HEADER: $!"; while (<CONF_HEADER>) { print NAMED_CONF $_; } close CONF_HEADER; diff --git a/bin/fs-setup b/bin/fs-setup index cf85ebb88..8e000c4ba 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.96.4.4 2002-12-14 11:16:04 steve Exp $ +# $Id: fs-setup,v 1.96.4.5 2002-12-14 12:19:19 steve Exp $ #to delay loading dbdef until we're ready BEGIN { $FS::Record::setup_hack = 1; } @@ -545,7 +545,7 @@ sub tables_hash_hack { '_date', @date_type, 'payby', 'char', '', 4, # CARD/BILL/COMP, should be index into # payment type table. - 'payinfo', 'varchar', 'NULL', 16, #see cust_main above + 'payinfo', 'varchar', 'NULL', $char_d, #see cust_main above 'paybatch', 'varchar', 'NULL', $char_d, #for auditing purposes. 'closed', 'char', 'NULL', 1, ], @@ -622,7 +622,7 @@ sub tables_hash_hack { 'reason', 'varchar', '', $char_d, 'payby', 'char', '', 4, # CARD/BILL/COMP, should be index # into payment type table. - 'payinfo', 'varchar', 'NULL', 16, #see cust_main above + 'payinfo', 'varchar', 'NULL', $char_d, #see cust_main above 'paybatch', 'varchar', 'NULL', $char_d, 'closed', 'char', 'NULL', 1, ], @@ -821,10 +821,12 @@ sub tables_hash_hack { 'columns' => [ 'recnum', 'int', '', '', 'svcnum', 'int', '', '', - 'reczone', 'varchar', '', $char_d, + #'reczone', 'varchar', '', $char_d, + 'reczone', 'varchar', '', 255, 'recaf', 'char', '', 2, 'rectype', 'char', '', 5, - 'recdata', 'varchar', '', $char_d, + #'recdata', 'varchar', '', $char_d, + 'recdata', 'varchar', '', 255, ], 'primary_key' => 'recnum', 'unique' => [], diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index da9a9fa06..9019ea4f8 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -22,16 +22,7 @@ $socket = "/usr/local/freeside/selfservice_socket"; 'login' => 'MyAccount/login', 'customer_info' => 'MyAccount/customer_info', 'invoice' => 'MyAccount/invoice', - 'start' => 'MyAccount/start', - 'update' => 'MyAccount/update', - 'collect' => 'MyAccount/collect', - 'cancel' => 'MyAccount/cancel', - 'uncancel' => 'MyAccount/uncancel', - 'getinfo' => 'MyAccount/getinfo', - 'charge' => 'MyAccount/charge', - 'new_customer' => 'MyAccount/new_customer', ); - @EXPORT_OK = keys %autoload; $ENV{'PATH'} ='/usr/bin:/usr/ucb:/bin'; diff --git a/fs_selfservice/freeside-selfservice-server b/fs_selfservice/freeside-selfservice-server index c167c7a4a..e55ca4984 100644 --- a/fs_selfservice/freeside-selfservice-server +++ b/fs_selfservice/freeside-selfservice-server @@ -19,7 +19,6 @@ use Net::SSH qw(sshopen2); use FS::UID qw(adminsuidsetup forksuidsetup); use FS::ClientAPI; -$ENV{SELFSERVICE_SERVER} = 'TRUE'; $Debug = 2; # >= 2 will log packet contents, including potentially compromising # information diff --git a/fs_signup/fs_signup_server b/fs_signup/fs_signup_server index 27dc4115c..e0fa9ba5f 100755 --- a/fs_signup/fs_signup_server +++ b/fs_signup/fs_signup_server @@ -18,7 +18,6 @@ use FS::Msgcat qw(gettext); use vars qw( $opt $Debug ); -$ENV{SIGNUP_SERVER} = 'TRUE'; $Debug = 2; my $user = shift or die &usage; @@ -95,7 +94,11 @@ while (1) { 'msgcat' => { map { $_=>gettext($_) } qw( passwords_dont_match invalid_card unknown_card_type not_a - ) } + ) }, + + 'statedefault' => $conf->config('statedefault') || 'CA', + + 'countrydefault' => $conf->config('countrydefault') || 'US', }; @@ -133,7 +136,7 @@ while (1) { map { $_ => $signup_data->{$_} } qw( last first ss company address1 address2 city county state zip country - daytime night fax payby payinfo paydate payname referral_custnum comments + daytime night fax payby payinfo paydate payname referral_custnum ), } ); @@ -141,6 +144,9 @@ while (1) { $error ||= "Illegal payment type" unless grep { $_ eq $signup_data->{'payby'} } @payby; + $cust_main->payinfo($cust_main->daytime) + if $cust_main->payby eq 'LECB' && ! $cust_main->payinfo; + my @invoicing_list = split( /\s*\,\s*/, $signup_data->{'invoicing_list'} ); $signup_data->{'pkgpart'} =~ /^(\d+)$/ or '' =~ /^()$/; |