Returns a payment gateway object (see L<FS::payment_gateway>) for this agent.
-Currently available options are I<nofatal>, I<method>, I<thirdparty>,
-<conf> and I<load_gatewaynum>.
+Currently available options are I<nofatal>, I<method>, I<thirdparty> and I<conf>.
If I<nofatal> is set, and no gateway is available, then the empty string
will be returned instead of throwing a fatal exception.
}
}
- my $override = qsearchs('agent_payment_gateway', { agentnum => $self->agentnum } );
+ my $cardtype_search = "AND cardtype != 'ACH'";
+ $cardtype_search = "AND cardtype = 'ACH'" if $options{method} eq 'ECHECK';
+
+ my $override =
+ qsearchs({
+ "table" => 'agent_payment_gateway',
+ "hashref" => { agentnum => $self->agentnum, },
+ "extra_sql" => $cardtype_search,
+ });
my $payment_gateway = FS::payment_gateway->by_key_or_default(
gatewaynum => $override ? $override->gatewaynum : '',