From: ivan Date: Tue, 14 Sep 2004 13:00:47 +0000 (+0000) Subject: echeck/ACH refunds X-Git-Tag: BEFORE_FINAL_MASONIZE~949 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=b3e85cf7a5a514f185c7d9c5ba50550c759c9ab5 echeck/ACH refunds --- diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 1540b61a3..a4a7935b3 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2208,7 +2208,7 @@ sub realtime_refund_bop { 'payby' => $method2payby{$method}, 'payinfo' => $self->payinfo, 'paybatch' => $paybatch, - 'reason' => $options{'reason'} || 'card refund', + 'reason' => $options{'reason'} || 'card or ACH refund', } ); my $error = $cust_refund->insert; if ( $error ) { diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi index 425c17738..8955c7cee 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -49,6 +49,7 @@ if ( $cust_pay ) { my $payby = $cust_pay->payby; my $payinfo = $cust_pay->payinfo; $payby =~ s/^BILL$/Check/ if $payinfo; + $payby =~ s/^CHEK$/Electronic check/; $payinfo = $cust_pay->payinfo_masked if $payby eq 'CARD'; print '
Payment'. ntable("#cccccc", 2). diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index fc1635781..7055d8ea6 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -6,14 +6,19 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) or die "unknown custnum $custnum"; my $error = ''; -if ( $cgi->param('payby') eq 'CARD' ) { +if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { + my %payby2bop = ( + 'CARD' => 'CC', + 'CHEK' => 'ECHECK', + ); + my $bop = $payby2bop{$1}; $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ or die "illegal refund amount ". $cgi->param('refund'); my $refund = "$1$2"; $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; my $paynum = $1; my $reason = $cgi->param('reason'); - $error = $cust_main->realtime_refund_bop( 'CC', 'amount' => $refund, + $error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund, 'paynum' => $paynum, 'reason' => $reason, ); } else { diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index e0986bbe7..4d27765d0 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -639,17 +639,17 @@ print ''; my $refund = ''; my $refund_days = $conf->config('card_refund-days') || 120; if ( $cust_pay->closed !~ /^Y/i - && $cust_pay->payby eq 'CARD' + && $cust_pay->payby =~ /^(CARD|CHEK)$/ && time-$cust_pay->_date < $refund_days*86400 && $cust_pay->unrefunded > 0 ) { - $refund = qq! (paynum. qq!">refund)!; } my $void = ''; if ( $cust_pay->closed !~ /^Y/i - && $cust_pay->payby ne 'CARD' + && $cust_pay->payby !~ /^(CARD|CHEK)$/ ) { $void = qq! (