use vars qw( $bop_processor $bop_login $bop_password $bop_action @bop_options );
use vars qw( $ach_processor $ach_login $ach_password $ach_action @ach_options );
use vars qw( $invoice_lines @buf ); #yuck
+use vars qw( $quiet );
use Date::Format;
use Mail::Internet 1.44;
use Mail::Header;
$invoice_from = $conf->config('invoice_from');
$smtpmachine = $conf->config('smtpmachine');
+ ( $bop_processor,$bop_login, $bop_password, $bop_action ) = ( '', '', '', '');
+ @bop_options = ();
+ ( $ach_processor,$ach_login, $ach_password, $ach_action ) = ( '', '', '', '');
+ @ach_options = ();
+
if ( $conf->exists('cybercash3.2') ) {
require CCMckLib3_2;
#qw($MCKversion %Config InitConfig CCError CCDebug CCDebug2);
sub realtime_ach {
my $self = shift;
$self->realtime_bop(
- 'CHECK',
+ 'ECHECK',
$ach_processor,
$ach_login,
$ach_password,
sub realtime_bop {
my( $self, $method, $processor, $login, $password, $action, $options ) = @_;
+
+ #trim an extraneous blank line
+ pop @$options if scalar(@$options) % 2 && $options->[-1] =~ /^\s*$/;
+
my $cust_main = $self->cust_main;
my $amount = $self->owed;
$address .= ", ". $cust_main->address2 if $cust_main->address2;
my($payname, $payfirst, $paylast);
- if ( $cust_main->payname && $method ne 'CHECK' ) {
+ if ( $cust_main->payname && $method ne 'ECHECK' ) {
$payname = $cust_main->payname;
$payname =~ /^\s*([\w \,\.\-\']*)?\s+([\w\,\.\-\']+)\s*$/
or do {
$content{card_number} = $cust_main->payinfo;
$cust_main->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
$content{expiration} = "$2/$1";
- } elsif ( $method eq 'CHECK' ) {
+ } elsif ( $method eq 'ECHECK' ) {
my($account_number,$routing_code) = $cust_main->payinfo;
( $content{account_number}, $content{routing_code} ) =
split('@', $cust_main->payinfo);
$content{bank_name} = $cust_main->payname;
+ $content{account_type} = 'CHECKING';
+ $content{account_name} = $payname;
+ $content{customer_org} = $self->company ? 'B' : 'I';
+ $content{customer_ssn} = $self->ss;
} elsif ( $method eq 'LEC' ) {
$content{phone} = $cust_main->payinfo;
}
if ( $transaction->is_success() ) {
my %method2payby = (
- 'CC' => 'CARD',
- 'CHECK' => 'CHEK',
- 'LEC' => 'LECB',
+ '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 ( !$quiet && $conf->exists('emaildecline')
&& grep { $_ ne 'POST' } $cust_main->invoicing_list
) {
my @templ = $conf->config('declinetemplate');
or die "cannot load config file $templatefile";
$invoice_lines = 0;
my $wasfunc = 0;
- foreach ( grep /invoice_lines\(\d+\)/, @invoice_template ) { #kludgy
- /invoice_lines\((\d+)\)/;
- $invoice_lines += $1;
+ foreach ( grep /invoice_lines\(\d*\)/, @invoice_template ) { #kludgy
+ /invoice_lines\((\d*)\)/;
+ $invoice_lines += $1 || scalar(@buf);
$wasfunc=1;
}
die "no invoice_lines() functions in template?" unless $wasfunc;
#setup template variables
package FS::cust_bill::_template; #!
- use vars qw( $invnum $date $page $total_pages @address $overdue @buf );
+ use vars qw( $invnum $date $page $total_pages @address $overdue @buf $agent );
$invnum = $self->invnum;
$date = $self->_date;
$page = 1;
+ $agent = $self->cust_main->agent->agent;
if ( $FS::cust_bill::invoice_lines ) {
$total_pages =
# );
#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;
=head1 VERSION
-$Id: cust_bill.pm,v 1.41.2.10 2002-11-19 10:09:44 ivan Exp $
+$Id: cust_bill.pm,v 1.41.2.21 2003-06-30 18:56:02 ivan Exp $
=head1 BUGS