Added 'disable_void_after' config option to disable the VOID-before-credit behavior...
authorkhoff <khoff>
Wed, 6 Jun 2007 19:59:21 +0000 (19:59 +0000)
committerkhoff <khoff>
Wed, 6 Jun 2007 19:59:21 +0000 (19:59 +0000)
pprove VOIDs for settled transactions.

FS/FS/Conf.pm
FS/FS/cust_main.pm

index a867648..bcfa5f6 100644 (file)
@@ -1797,6 +1797,13 @@ httemplate/docs/config.html
     'type'        => 'text',
   },
 
     'type'        => 'text',
   },
 
+  {
+    'key'         => 'disable_void_after',
+    'section'     => 'billing',
+    'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
+    'type'        => 'text',
+  },
+
 );
 
 1;
 );
 
 1;
index 708f014..252a5ca 100644 (file)
@@ -3025,8 +3025,19 @@ sub realtime_refund_bop {
     if length($auth); #echeck/ACH transactions have an order # but no auth
                       #(at least with authorize.net)
 
     if length($auth); #echeck/ACH transactions have an order # but no auth
                       #(at least with authorize.net)
 
+  my $disable_void_after;
+  if ($conf->exists('disable_void_after')
+      && $conf->config('disable_void_after') =~ /^(\d+)$/) {
+    $disable_void_after = $1;
+  }
+
   #first try void if applicable
   #first try void if applicable
-  if ( $cust_pay && $cust_pay->paid == $amount ) { #and check dates?
+  if ( $cust_pay && $cust_pay->paid == $amount
+    && (
+      ( not defined($disable_void_after) )
+      || ( time < ($cust_pay->_date + $disable_void_after ) )
+    )
+  ) {
     warn "  attempting void\n" if $DEBUG > 1;
     my $void = new Business::OnlinePayment( $processor, @bop_options );
     $void->content( 'action' => 'void', %content );
     warn "  attempting void\n" if $DEBUG > 1;
     my $void = new Business::OnlinePayment( $processor, @bop_options );
     $void->content( 'action' => 'void', %content );