diff options
author | ivan <ivan> | 2004-09-14 13:00:47 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-09-14 13:00:47 +0000 |
commit | b3e85cf7a5a514f185c7d9c5ba50550c759c9ab5 (patch) | |
tree | 50106c3941335b64dce0a23cf63f877c30ae86f5 /httemplate | |
parent | 07fd88f7c0cd757eb2f8e635b71acebe6a944602 (diff) |
echeck/ACH refunds
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/cust_refund.cgi | 1 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_refund.cgi | 9 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 6 |
3 files changed, 11 insertions, 5 deletions
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 '<BR>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 '</TABLE>'; 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! (<A HREF="!. qq!${p}edit/cust_refund.cgi?payby=CARD;!. + $refund = qq! (<A HREF="!. qq!${p}edit/cust_refund.cgi?payby=$1;!. qq!paynum=!. $cust_pay->paynum. qq!">refund</A>)!; } my $void = ''; if ( $cust_pay->closed !~ /^Y/i - && $cust_pay->payby ne 'CARD' + && $cust_pay->payby !~ /^(CARD|CHEK)$/ ) { $void = qq! (<A HREF="javascript:areyousure('!. qq!${p}misc/void-cust_pay.cgi?!. $cust_pay->paynum. |