+my $link = $cgi->param('popup') ? 'popup' : '';
+
+my $payby = $cgi->param('payby');
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->refund_access_right($payby);
+
+$cgi->param('reasonnum') =~ /^(-?\d+)$/ or die "Illegal reasonnum";
+my ($reasonnum, $error) = $m->comp('/misc/process/elements/reason');
+$cgi->param('reasonnum', $reasonnum) unless $error;
+
+if ( $error ) {
+ # do nothing
+} elsif ( $payby =~ /^(CARD|CHEK)$/ ) {
+ my %options = ();
+ my $bop = $FS::payby::payby2bop{$1};