X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpay_batch.pm;h=b6b69f3adbd2442a3e65fde7c1dd7a3c1a2bbc91;hp=2a048a115321e3c1c36a7738fb635e590e313d9a;hb=7516e3da0f17eeecba27219ef96a8b5f46af2083;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125 diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm index 2a048a115..b6b69f3ad 100644 --- a/FS/FS/pay_batch.pm +++ b/FS/FS/pay_batch.pm @@ -1,21 +1,19 @@ package FS::pay_batch; +use base qw( FS::Record ); use strict; -use vars qw( @ISA $DEBUG %import_info %export_info $conf ); +use vars qw( $DEBUG %import_info %export_info $conf ); +use Scalar::Util qw(blessed); +use IO::Scalar; +use List::Util qw(sum); use Time::Local; use Text::CSV_XS; -use FS::Record qw( dbh qsearch qsearchs ); -use FS::Conf; -use FS::cust_pay; -use FS::agent; use Date::Parse qw(str2time); use Business::CreditCard qw(cardtype); -use Scalar::Util 'blessed'; -use IO::Scalar; use FS::Misc qw(send_email); # for error notification -use List::Util qw(sum); - -@ISA = qw(FS::Record); +use FS::Record qw( dbh qsearch qsearchs ); +use FS::Conf; +use FS::cust_pay; =head1 NAME @@ -147,22 +145,10 @@ sub check { Returns the L object for this batch. -=cut - -sub agent { - qsearchs('agent', { 'agentnum' => $_[0]->agentnum }); -} - =item cust_pay_batch Returns all L objects for this batch. -=cut - -sub cust_pay_batch { - qsearch('cust_pay_batch', { 'batchnum' => $_[0]->batchnum }); -} - =item rebalance =cut @@ -450,12 +436,10 @@ sub import_results { } -use MIME::Base64; -use Storable 'thaw'; use Data::Dumper; sub process_import_results { my $job = shift; - my $param = thaw(decode_base64(shift)); + my $param = shift; $param->{'job'} = $job; warn Dumper($param) if $DEBUG; my $gatewaynum = delete $param->{'gatewaynum'}; @@ -735,7 +719,8 @@ sub import_from_gateway { $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 ) { @@ -946,7 +931,7 @@ sub export_batch { 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;