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)$/ ) {
9 % my $bop = $FS::payby::payby2bop{$1};
10 % $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/
11 % or die "illegal refund amount ". $cgi->param('refund');
12 % my $refund = "$1$2";
13 % $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!";
15 % my $reason = $cgi->param('reason');
16 % my $paydate = $cgi->param('exp_year'). '-'. $cgi->param('exp_month'). '-01';
17 % $options{'paydate'} = $paydate if $paydate =~ /^\d{2,4}-\d{1,2}-01$/;
18 % $error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund,
19 % 'paynum' => $paynum,
20 % 'reason' => $reason,
23 % die 'unimplemented';
24 % #my $new = new FS::cust_refund ( {
26 % # $_, scalar($cgi->param($_));
27 % # } ( fields('cust_refund'), 'paynum' )
29 % #$error = $new->insert;
34 % $cgi->param('error', $error);
35 % print $cgi->redirect(popurl(2). "cust_refund.cgi?". $cgi->query_string );
37 % print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum");