{
'key' => 'username_policy',
- 'section' => 'deprecated',
+ 'section' => '',
'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' ],
},
{
+ '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',
},
{
+ '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.',
);
}
-=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;
( $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,
'referer' => 'http://cleanwhisker.420.am/',
'email' => $email,
'phone' => $cust_main->daytime || $cust_main->night,
- %content, #after
);
$transaction->submit();
my %method2payby = (
'CC' => 'CARD',
'ECHECK' => 'CHEK',
- 'LEC' => 'LECB',
);
my $cust_pay = new FS::cust_pay ( {
my $perror = "$processor error, invnum #". $self->invnum. ': '.
$transaction->result_code. ": ". $transaction->error_message;
- if ( $conf->exists('emaildecline')
+ if ( !($ENV{SIGNUP_SERVER} && $conf->exists('signup_server-quiet'))
+ && !($ENV{SELFSERVICE_SERVER} && $conf->exists('selfservice_server-quiet'))
+ && $conf->exists('emaildecline')
&& grep { $_ ne 'POST' } $cust_main->invoicing_list
- ) {
+ ) {
my @templ = $conf->config('declinetemplate');
my $template = new Text::Template (
TYPE => 'ARRAY',
# );
#and subroutine for the template
+
sub FS::cust_bill::_template::invoice_lines {
- my $lines = shift || scalar(@buf);
+ my $lines = shift or return @buf;
map {
scalar(@buf) ? shift @buf : [ '', '' ];
}
( 1 .. $lines );
}
+
#and fill it in
$FS::cust_bill::_template::page = 1;
my $lines;
=head1 VERSION
-$Id: cust_bill.pm,v 1.41.2.13 2002-12-04 12:31:50 ivan Exp $
+$Id: cust_bill.pm,v 1.41.2.14 2002-12-14 11:13:53 steve Exp $
=head1 BUGS
=item ship_fax - phone (optional)
-=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 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 payinfo - card number, P.O., comp issuer (4-8 lowercase alphanumerics; think username) or prepayment identifier (see L<FS::prepay_credit>)
$self->invoicing_list( $invoicing_list );
}
- if ( $self->payby =~ /^(CARD|CHEK|LECB)$/ &&
+ if ( $self->payby =~ /^(CARD|CHEK)$/ &&
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 =~
- /^\$cust_bill\->realtime_(card|ach|lec)\(\);$/
+ $_->part_bill_event->eventcode eq '$cust_bill->realtime_card();'
&& $_->status eq 'done'
&& $_->statustext
}
}
}
- $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREPAY)$/
+ $self->payby =~ /^(CARD|CHEK|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;
} 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');
if ( $self->paydate eq '' || $self->paydate eq '-' ) {
return "Expriation date required"
- unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB)$/;
+ unless $self->payby =~ /^(BILL|PREPAY|CHEK)$/;
$self->paydate('');
} else {
$self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/
|| $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,
- } );
- $cust_main_county ||= qsearchs('cust_main_county',{
+ } )
+ or qsearchs('cust_main_county',{
'state' => $self->state,
'county' => $self->county,
'country' => $self->country,
'taxclass' => '',
- } );
- 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";
- }
+ } )
+ 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";
+ };
if ( $cust_main_county->exempt_amount ) {
my ($mon,$year) = (localtime($sdate) )[4,5];
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 {
$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