+ my $gw;
+ my $gatewaynum = $conf->config('selfservice-payment_gateway');
+ if ( $gatewaynum ) {
+ $gw = qsearchs('payment_gateway', { gatewaynum => $gatewaynum });
+ die "configured gatewaynum $gatewaynum not found!" if !$gw;
+ }
+ else {
+ $gw = $agent->payment_gateway( 'method' => FS::payby->payby2bop($payby),
+ 'nofatal' => 1,