summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2004-09-14 13:00:47 +0000
committerivan <ivan>2004-09-14 13:00:47 +0000
commitb3e85cf7a5a514f185c7d9c5ba50550c759c9ab5 (patch)
tree50106c3941335b64dce0a23cf63f877c30ae86f5
parent07fd88f7c0cd757eb2f8e635b71acebe6a944602 (diff)
echeck/ACH refunds
-rw-r--r--FS/FS/cust_main.pm2
-rwxr-xr-xhttemplate/edit/cust_refund.cgi1
-rwxr-xr-xhttemplate/edit/process/cust_refund.cgi9
-rwxr-xr-xhttemplate/view/cust_main.cgi6
4 files changed, 12 insertions, 6 deletions
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 '<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.