summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2004-09-16 07:19:51 +0000
committerivan <ivan>2004-09-16 07:19:51 +0000
commit19826b5e1b5a7c8429fb1b2991b0d938a08f51de (patch)
tree96cb5a1ade5115e17119d8949dc1fb7f639c9267 /FS
parent324f65798f7e4f28cae94a39a77260c650aa2669 (diff)
allow blank auth for echeck refunds
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_main.pm35
1 files changed, 15 insertions, 20 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index a4a7935..075cce3 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -2068,13 +2068,13 @@ sub realtime_refund_bop {
my $cust_pay = '';
my $amount = $options{'amount'};
- my( $pay_processor, $auth, $order_number );
+ my( $pay_processor, $auth, $order_number ) = ( '', '', '' );
if ( $options{'paynum'} ) {
warn "FS::cust_main::realtime_bop: paynum: $options{paynum}\n" if $DEBUG;
$cust_pay = qsearchs('cust_pay', { paynum=>$options{'paynum'} } )
or return "Unknown paynum $options{'paynum'}";
$amount ||= $cust_pay->paid;
- $cust_pay->paybatch =~ /^(\w+):(\w+)(:(\w+))?$/
+ $cust_pay->paybatch =~ /^(\w+):(\w*)(:(\w+))?$/
or return "Can't parse paybatch for paynum $options{'paynum'}: ".
$cust_pay->paybatch;
( $pay_processor, $auth, $order_number ) = ( $1, $2, $4 );
@@ -2084,19 +2084,22 @@ sub realtime_refund_bop {
}
return "neither amount nor paynum specified" unless $amount;
+ my %content = (
+ 'type' => $method,
+ 'login' => $login,
+ 'password' => $password,
+ 'order_number' => $order_number,
+ 'amount' => $amount,
+ 'referer' => 'http://cleanwhisker.420.am/',
+ );
+ $content{authorization} = $auth
+ if length($auth); #echeck/ACH transactions have an order # but no auth
+ #(at least with authorize.net)
+
#first try void if applicable
if ( $cust_pay && $cust_pay->paid == $amount ) { #and check dates?
my $void = new Business::OnlinePayment( $processor, @bop_options );
- $void->content(
- 'type' => $method,
- 'action' => 'void',
- 'login' => $login,
- 'password' => $password,
- 'order_number' => $order_number,
- 'amount' => $amount,
- 'authorization' => $auth,
- 'referer' => 'http://cleanwhisker.420.am/',
- );
+ $void->content( 'action' => 'void', %content );
$void->submit();
if ( $void->is_success ) {
my $error = $cust_pay->void($options{'reason'});
@@ -2127,7 +2130,6 @@ sub realtime_refund_bop {
$payname = "$payfirst $paylast";
}
- my %content = ();
if ( $method eq 'CC' ) {
$content{card_number} = $self->payinfo;
@@ -2158,13 +2160,7 @@ sub realtime_refund_bop {
#then try refund
my $refund = new Business::OnlinePayment( $processor, @bop_options );
$refund->content(
- 'type' => $method,
'action' => 'credit',
- 'login' => $login,
- 'password' => $password,
- 'order_number' => $order_number,
- 'amount' => $amount,
- 'authorization' => $auth,
'customer_id' => $self->custnum,
'last_name' => $paylast,
'first_name' => $payfirst,
@@ -2174,7 +2170,6 @@ sub realtime_refund_bop {
'state' => $self->state,
'zip' => $self->zip,
'country' => $self->country,
- 'referer' => 'http://cleanwhisker.420.am/',
%content, #after
);
$refund->submit();