2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). "cust_refund.cgi?". $cgi->query_string ) %>
5 <% $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum") %>
10 unless $FS::CurrentUser::CurrentUser->access_right('Refund payment');
12 $cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!";
14 my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
15 or die "unknown custnum $custnum";
18 if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) {
20 my $bop = $FS::payby::payby2bop{$1};
21 $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/
22 or die "illegal refund amount ". $cgi->param('refund');
24 $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!";
26 my $reason = $cgi->param('reason');
27 my $paydate = $cgi->param('exp_year'). '-'. $cgi->param('exp_month'). '-01';
28 $options{'paydate'} = $paydate if $paydate =~ /^\d{2,4}-\d{1,2}-01$/;
29 $error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund,
35 #my $new = new FS::cust_refund ( {
37 # $_, scalar($cgi->param($_));
38 # } ( fields('cust_refund'), 'paynum' )
40 #$error = $new->insert;