freeside/FS/FS cust_main.pm,1.161,1.162

ivan ivan at pouncequick.420.am
Thu Sep 16 00:19:54 PDT 2004


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv20804

Modified Files:
	cust_main.pm 
Log Message:
allow blank auth for echeck refunds

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- cust_main.pm	14 Sep 2004 13:00:47 -0000	1.161
+++ cust_main.pm	16 Sep 2004 07:19:51 -0000	1.162
@@ -2068,13 +2068,13 @@
 
   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 @@
   }
   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 @@
     $payname =  "$payfirst $paylast";
   }
 
-  my %content = ();
   if ( $method eq 'CC' ) { 
 
     $content{card_number} = $self->payinfo;
@@ -2158,13 +2160,7 @@
   #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 @@
     'state'          => $self->state,
     'zip'            => $self->zip,
     'country'        => $self->country,
-    'referer'        => 'http://cleanwhisker.420.am/',
     %content, #after
   );
   $refund->submit();




More information about the freeside-commits mailing list