1 %$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!";
3 %my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
4 % or die "unknown custnum $custnum";
7 %if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) {
8 % my $bop = $FS::payby::payby2bop{$1};
9 % $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/
10 % or die "illegal refund amount ". $cgi->param('refund');
11 % my $refund = "$1$2";
12 % $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!";
14 % my $reason = $cgi->param('reason');
15 % $error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund,
16 % 'paynum' => $paynum,
17 % 'reason' => $reason, );
19 % die 'unimplemented';
20 % #my $new = new FS::cust_refund ( {
22 % # $_, scalar($cgi->param($_));
23 % # } ( fields('cust_refund'), 'paynum' )
25 % #$error = $new->insert;
30 % $cgi->param('error', $error);
31 % print $cgi->redirect(popurl(2). "cust_refund.cgi?". $cgi->query_string );
33 % print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum");