summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhoff <khoff>2007-06-06 20:02:33 +0000
committerkhoff <khoff>2007-06-06 20:02:33 +0000
commit699b10a01e7f034b061932057064ec8b3f91bb7f (patch)
treecfcb3b1dbab6c8904ea655d1cf25dfac808641ec
parent278929cadb65d4a2412c4e8ff9c32343d6df95f8 (diff)
Added 'disable_void_after' config option to disable the VOID-before-credit behavior of FS::cust_main::realtime_refund_bop after n seconds, if set. For broken gateways like SkipJack that a
pprove VOIDs for settled transactions. (Backport)
-rw-r--r--FS/FS/Conf.pm9
-rw-r--r--FS/FS/cust_main.pm13
2 files changed, 21 insertions, 1 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 318d6ad0f..b91651429 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2112,6 +2112,15 @@ httemplate/docs/config.html
'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;
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 55f012a0e..e5688d5b2 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3032,8 +3032,19 @@ sub realtime_refund_bop {
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
- 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 );