X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=20755857bfdb4e40250e9c5019af47df0ce0b438;hp=2c21f1e46b1c19c43fc14610e1a8be9eed31ddc2;hb=0ada85923cfb057caf1d0e66b73a08b2700703bd;hpb=95a40a1b8ebf86c76784c220d0d561f952d934ef diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 2c21f1e46..20755857b 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -8,7 +8,7 @@ use vars qw( $xaction $E_NoErr ); use vars qw( $bop_processor $bop_login $bop_password $bop_action @bop_options ); use vars qw( $invoice_lines @buf ); #yuck use Date::Format; -use Mail::Internet; +use Mail::Internet 1.44; use Mail::Header; use Text::Template; use FS::Record qw( qsearch qsearchs ); @@ -458,7 +458,7 @@ sub realtime_card { my($payname, $payfirst, $paylast); if ( $cust_main->payname ) { $payname = $cust_main->payname; - $payname =~ /^\s*([\w \,\.\-\']*)?\s+([\w\,\.\-\']+)$/ + $payname =~ /^\s*([\w \,\.\-\']*)?\s+([\w\,\.\-\']+)\s*$/ or do { #$dbh->rollback if $oldAutoCommit; return "Illegal payname $payname"; @@ -466,7 +466,7 @@ sub realtime_card { ($payfirst, $paylast) = ($1, $2); } else { $payfirst = $cust_main->getfield('first'); - $paylast = $cust_main->getfield('first'); + $paylast = $cust_main->getfield('last'); $payname = "$payfirst $paylast"; } @@ -483,7 +483,9 @@ sub realtime_card { if ( $conf->exists('business-onlinepayment-description') ) { my $dtempl = $conf->config('business-onlinepayment-description'); - my $agent_obj = $cust_main->agent; + my $agent_obj = $cust_main->agent + or die "can't retreive agent for $cust_main (agentnum ". + $cust_main->agentnum. ")"; my $agent = $agent_obj->agent; my $pkgs = join(', ', map { $_->cust_pkg->part_pkg->pkg } @@ -516,12 +518,14 @@ sub realtime_card { 'expiration' => $exp, 'referer' => 'http://cleanwhisker.420.am/', 'email' => $email, + 'phone' => $cust_main->daytime || $cust_main->night, ); $transaction->submit(); if ( $transaction->is_success() && $action2 ) { my $auth = $transaction->authorization; my $ordernum = $transaction->order_number; + #warn "********* $auth ***********\n"; #warn "********* $ordernum ***********\n"; my $capture = @@ -587,7 +591,7 @@ sub realtime_card { $template->compile() or return "($perror) can't compile template: $Text::Template::ERROR"; - my $error = $transaction->error_message; + my $templ_hash = { error => $transaction->error_message }; #false laziness w/FS::cust_pay::delete & fs_signup_server && ::send $ENV{MAILADDRESS} = $invoice_from; @@ -601,7 +605,7 @@ sub realtime_card { ] ); my $message = new Mail::Internet ( 'Header' => $header, - 'Body' => [ $template->fill_in() ], + 'Body' => [ $template->fill_in(HASH => $templ_hash) ], ); $!=0; $message->smtpsend( Host => $smtpmachine ) @@ -723,8 +727,10 @@ sub batch_card { 'payname' => $cust_main->getfield('payname'), 'amount' => $self->owed, } ); - $cust_pay_batch->insert; + my $error = $cust_pay_batch->insert; + die $error if $error; + ''; } =item print_text [TIME]; @@ -945,7 +951,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.31 2002-04-16 22:52:14 ivan Exp $ +$Id: cust_bill.pm,v 1.37 2002-06-07 20:33:27 khoff Exp $ =head1 BUGS