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