projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add svc_cable.ordernum, RT#22009
[freeside.git]
/
FS
/
FS
/
pay_batch.pm
diff --git
a/FS/FS/pay_batch.pm
b/FS/FS/pay_batch.pm
index
e98cf5a
..
8c6c368
100644
(file)
--- a/
FS/FS/pay_batch.pm
+++ b/
FS/FS/pay_batch.pm
@@
-201,7
+201,7
@@
foreach my $INC (@INC) {
\\%FS::pay_batch::$mod\::export_info,
\$FS::pay_batch::$mod\::name)";
$name ||= $mod; # in case it's not defined
\\%FS::pay_batch::$mod\::export_info,
\$FS::pay_batch::$mod\::name)";
$name ||= $mod; # in case it's not defined
- if
(
$@) {
+ if
(
$@) {
# in FS::cdr this is a die, not a warn. That's probably a bug.
warn "error using FS::pay_batch::$mod (skipping): $@\n";
next;
# in FS::cdr this is a die, not a warn. That's probably a bug.
warn "error using FS::pay_batch::$mod (skipping): $@\n";
next;
@@
-401,12
+401,12
@@
sub import_results {
foreach ('paid', '_date', 'payinfo') {
$new_cust_pay_batch->$_($hash{$_}) if $hash{$_};
}
foreach ('paid', '_date', 'payinfo') {
$new_cust_pay_batch->$_($hash{$_}) if $hash{$_};
}
- $error = $new_cust_pay_batch->approve(
$hash{'paybatch'} || $self->batchnum
);
+ $error = $new_cust_pay_batch->approve(
%hash
);
$total += $hash{'paid'};
} elsif ( &{$declined_condition}(\%hash) ) {
$total += $hash{'paid'};
} elsif ( &{$declined_condition}(\%hash) ) {
- $error = $new_cust_pay_batch->decline;
+ $error = $new_cust_pay_batch->decline
($hash{'error_message'});
;
}
}
@@
-572,8
+572,6
@@
sub import_from_gateway {
my $payby; # CARD or CHEK
my $error;
my $payby; # CARD or CHEK
my $error;
- # follow realtime gateway practice here
- # though eventually this stuff should go into separate fields...
my $paybatch = $gateway->gatewaynum . '-' . $gateway->gateway_module .
':' . $item->authorization . ':' . $item->order_number;
my $paybatch = $gateway->gatewaynum . '-' . $gateway->gateway_module .
':' . $item->authorization . ':' . $item->order_number;
@@
-644,8
+642,11
@@
sub import_from_gateway {
payby => $payby,
invnum => $item->invoice_number,
batchnum => $pay_batch->batchnum,
payby => $payby,
invnum => $item->invoice_number,
batchnum => $pay_batch->batchnum,
- paybatch => $paybatch,
payinfo => $payinfo,
payinfo => $payinfo,
+ gatewaynum => $gateway->gatewaynum,
+ processor => $gateway->gateway_module,
+ auth => $item->authorization,
+ order_number => $item->order_number,
}
);
$error ||= $cust_pay->insert;
}
);
$error ||= $cust_pay->insert;
@@
-725,11
+726,17
@@
sub import_from_gateway {
# approval status
if ( $item->approved ) {
# follow Billing_Realtime format for paybatch
# approval status
if ( $item->approved ) {
# follow Billing_Realtime format for paybatch
- $error = $cust_pay_batch->approve($paybatch);
+ $error = $cust_pay_batch->approve(
+ 'gatewaynum' => $gateway->gatewaynum,
+ 'processor' => $gateway->gateway_module,
+ 'auth' => $item->authorization,
+ 'order_number' => $item->order_number,
+ );
$total += $cust_pay_batch->paid;
}
else {
$total += $cust_pay_batch->paid;
}
else {
- $error = $cust_pay_batch->decline($item->error_message);
+ $error = $cust_pay_batch->decline($item->error_message,
+ $item->failure_status);
}
if ( $error ) {
}
if ( $error ) {
@@
-829,6
+836,9
@@
sub try_to_resolve {
}
return $error if $error;
}
}
return $error if $error;
}
+ } elsif ( @unresolved ) {
+ # auto resolve is not enabled, and we're not ready to resolve
+ return;
}
$self->set_status('R');
}
$self->set_status('R');
@@
-937,7
+947,7
@@
sub export_batch {
my $info = $export_info{$format} or die "Format not found: '$format'\n";
my $info = $export_info{$format} or die "Format not found: '$format'\n";
- &{$info->{'init'}}($conf) if exists($info->{'init'});
+ &{$info->{'init'}}($conf
, $self->agentnum
) if exists($info->{'init'});
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
@@
-1028,7
+1038,6
@@
sub manual_approve {
my $self = shift;
my $date = time;
my %opt = @_;
my $self = shift;
my $date = time;
my %opt = @_;
- my $paybatch = $opt{'paybatch'} || $self->batchnum;
my $usernum = $opt{'usernum'} || die "manual approval requires a usernum";
my $conf = FS::Conf->new;
return 'manual batch approval disabled'
my $usernum = $opt{'usernum'} || die "manual approval requires a usernum";
my $conf = FS::Conf->new;
return 'manual batch approval disabled'
@@
-1058,7
+1067,9
@@
sub manual_approve {
'_date' => $date,
'usernum' => $usernum,
};
'_date' => $date,
'usernum' => $usernum,
};
- my $error = $new_cust_pay_batch->approve($paybatch);
+ my $error = $new_cust_pay_batch->approve();
+ # there are no approval options here (authorization, order_number, etc.)
+ # because the transaction wasn't really approved
if ( $error ) {
$dbh->rollback;
return 'paybatchnum '.$cust_pay_batch->paybatchnum.": $error";
if ( $error ) {
$dbh->rollback;
return 'paybatchnum '.$cust_pay_batch->paybatchnum.": $error";
@@
-1083,7
+1094,7
@@
sub _upgrade_data {
for my $format (keys %export_info) {
my $mod = "FS::pay_batch::$format";
if ( $mod->can('_upgrade_gateway')
for my $format (keys %export_info) {
my $mod = "FS::pay_batch::$format";
if ( $mod->can('_upgrade_gateway')
- and
exists( $conf->config("batchconfig-$format")
) ) {
+ and
$conf->exists("batchconfig-$format"
) ) {
local $@;
my ($module, %gw_options) = $mod->_upgrade_gateway;
local $@;
my ($module, %gw_options) = $mod->_upgrade_gateway;