- my $url = $packet->{url};
- my $payment_gateway =
- qsearchs('payment_gateway', { 'gateway_callback_url' => popurl(0, $url) } );
-
- unless ($payment_gateway) {
-
- my ( $processor, $login, $password, $action, @bop_options ) =
- $conf->config('business-onlinepayment');
- $action ||= 'normal authorization';
- pop @bop_options if scalar(@bop_options) % 2 && $bop_options[-1] =~ /^\s*$/;
- die "No real-time processor is enabled - ".
- "did you set the business-onlinepayment configuration value?\n"
- unless $processor;
-
- $payment_gateway = new FS::payment_gateway( {
- gateway_namespace => $conf->config('business-onlinepayment-namespace'),
- gateway_module => $processor,
- gateway_username => $login,
- gateway_password => $password,
- gateway_action => $action,
- options => [ ( @bop_options ) ],
- });
-
+ my $payment_gateway;
+ if ( my $gwnum = $conf->config('selfservice-payment_gateway') ) {
+ $payment_gateway = qsearchs('payment_gateway', { 'gatewaynum' => $gwnum })
+ or die "configured gatewaynum $gwnum not found!";
+ }
+ else {
+ my $url = $packet->{url};
+
+ $payment_gateway = qsearchs('payment_gateway',
+ { 'gateway_callback_url' => popurl(0, $url) }
+ );
+ if (!$payment_gateway) {
+
+ my ( $processor, $login, $password, $action, @bop_options ) =
+ $conf->config('business-onlinepayment');
+ $action ||= 'normal authorization';
+ pop @bop_options if scalar(@bop_options) % 2 && $bop_options[-1] =~ /^\s*$/;
+ die "No real-time processor is enabled - ".
+ "did you set the business-onlinepayment configuration value?\n"
+ unless $processor;
+
+ $payment_gateway = new FS::payment_gateway( {
+ gateway_namespace => $conf->config('business-onlinepayment-namespace'),
+ gateway_module => $processor,
+ gateway_username => $login,
+ gateway_password => $password,
+ gateway_action => $action,
+ options => [ ( @bop_options ) ],
+ });
+ }