RT# 83259 - adding/editing tower sector will no check for required fields prior to...
[freeside.git] / httemplate / edit / process / cust_refund.cgi
index 33bc886..bea81bc 100755 (executable)
@@ -39,6 +39,8 @@ $cgi->param('reasonnum') =~ /^(-?\d+)$/ or die "Illegal reasonnum";
 my ($reasonnum, $error) = $m->comp('/misc/process/elements/reason');
 $cgi->param('reasonnum', $reasonnum) unless $error;
 
+$error = "No batch download format configured that allows electronic refunds" unless (FS::pay_batch->can_handle_electronic_refunds && !$error);
+
 if ( $error ) {
   # do nothing
 } elsif ( $payby =~ /^(CARD|CHEK)$/ ) { 
@@ -53,7 +55,7 @@ if ( $error ) {
              'CHEK' => 'electronic check (ACH)',
              );
 
-my( $cust_pay, $cust_payby, $payinfo, $paycvv, $month, $year, $payname );
+my( $cust_pay, $cust_payby, $payinfo, $paycvv, $month, $year, $payname, $paycardtype );
 my $paymask = '';
 
 ## get cust pay info if paynum exists
@@ -95,6 +97,10 @@ if ( $cgi->param('paynum') > 0) {
       $_, scalar($cgi->param($_))
     } fields('cust_refund');
 
+    $hash{'payinfo'} = $cust_main->payinfo;
+    $hash{'paymask'} = $cust_main->paymask;
+    $hash{'paycardtype'} = $cust_main->paycardtype;
+
     ## unapply payment before creating refund.
     while ( $cust_pay && $cust_pay->unapplied < $refund ) {
       my @cust_bill_pay = $cust_pay->cust_bill_pay;