projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ticket #30613: Can't Send E-mail
[freeside.git]
/
FS
/
FS
/
cust_main
/
Billing_Realtime.pm
diff --git
a/FS/FS/cust_main/Billing_Realtime.pm
b/FS/FS/cust_main/Billing_Realtime.pm
index
8285cbf
..
f9f3754
100644
(file)
--- a/
FS/FS/cust_main/Billing_Realtime.pm
+++ b/
FS/FS/cust_main/Billing_Realtime.pm
@@
-3,6
+3,7
@@
package FS::cust_main::Billing_Realtime;
use strict;
use vars qw( $conf $DEBUG $me );
use vars qw( $realtime_bop_decline_quiet ); #ugh
use strict;
use vars qw( $conf $DEBUG $me );
use vars qw( $realtime_bop_decline_quiet ); #ugh
+use Carp;
use Data::Dumper;
use Business::CreditCard 0.28;
use FS::UID qw( dbh );
use Data::Dumper;
use Business::CreditCard 0.28;
use FS::UID qw( dbh );
@@
-319,6
+320,10
@@
my %bop_method2payby = (
sub realtime_bop {
my $self = shift;
sub realtime_bop {
my $self = shift;
+ confess "Can't call realtime_bop within another transaction ".
+ '($FS::UID::AutoCommit is false)'
+ unless $FS::UID::AutoCommit;
+
local($DEBUG) = $FS::cust_main::DEBUG if $FS::cust_main::DEBUG > $DEBUG;
my %options = ();
local($DEBUG) = $FS::cust_main::DEBUG if $FS::cust_main::DEBUG > $DEBUG;
my %options = ();
@@
-360,6
+365,8
@@
sub realtime_bop {
if ( $DEBUG ) {
warn "$me realtime_bop (new): $options{method} $options{amount}\n";
warn " cc_surcharge = $cc_surcharge\n";
if ( $DEBUG ) {
warn "$me realtime_bop (new): $options{method} $options{amount}\n";
warn " cc_surcharge = $cc_surcharge\n";
+ }
+ if ( $DEBUG > 2 ) {
warn " $_ => $options{$_}\n" foreach keys %options;
}
warn " $_ => $options{$_}\n" foreach keys %options;
}
@@
-542,7
+549,9
@@
sub realtime_bop {
? $options{'balance'}
: $self->balance;
? $options{'balance'}
: $self->balance;
+ warn "claiming mutex on customer ". $self->custnum. "\n" if $DEBUG > 1;
$self->select_for_update; #mutex ... just until we get our pending record in
$self->select_for_update; #mutex ... just until we get our pending record in
+ warn "obtained mutex on customer ". $self->custnum. "\n" if $DEBUG > 1;
#the checks here are intended to catch concurrent payments
#double-form-submission prevention is taken care of in cust_pay_pending::check
#the checks here are intended to catch concurrent payments
#double-form-submission prevention is taken care of in cust_pay_pending::check
@@
-593,9
+602,16
@@
sub realtime_bop {
};
$cust_pay_pending->payunique( $options{payunique} )
if defined($options{payunique}) && length($options{payunique});
};
$cust_pay_pending->payunique( $options{payunique} )
if defined($options{payunique}) && length($options{payunique});
+
+ warn "inserting cust_pay_pending record for customer ". $self->custnum. "\n"
+ if $DEBUG > 1;
my $cpp_new_err = $cust_pay_pending->insert; #mutex lost when this is inserted
return $cpp_new_err if $cpp_new_err;
my $cpp_new_err = $cust_pay_pending->insert; #mutex lost when this is inserted
return $cpp_new_err if $cpp_new_err;
+ warn "inserted cust_pay_pending record for customer ". $self->custnum. "\n"
+ if $DEBUG > 1;
+ warn Dumper($cust_pay_pending) if $DEBUG > 2;
+
my( $action1, $action2 ) =
split( /\s*\,\s*/, $payment_gateway->gateway_action );
my( $action1, $action2 ) =
split( /\s*\,\s*/, $payment_gateway->gateway_action );
@@
-1093,7
+1109,10
@@
sub _realtime_bop_result {
};
my $error = send_email(
};
my $error = send_email(
- 'from' => $conf->config('invoice_from', $self->agentnum ),
+ 'from' => $conf->config('invoice_from_name', $self->agentnum ) ?
+ $conf->config('invoice_from_name', $self->agentnum ) . ' <' .
+ $conf->config('invoice_from', $self->agentnum ) . '>' :
+ $conf->config('invoice_from', $self->agentnum ),
'to' => [ grep { $_ ne 'POST' } $self->invoicing_list ],
'subject' => 'Your payment could not be processed',
'body' => [ $template->fill_in(HASH => $templ_hash) ],
'to' => [ grep { $_ ne 'POST' } $self->invoicing_list ],
'subject' => 'Your payment could not be processed',
'body' => [ $template->fill_in(HASH => $templ_hash) ],