summaryrefslogtreecommitdiff
path: root/FS/FS/agent.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-04-23 00:14:10 -0700
committerIvan Kohler <ivan@freeside.biz>2014-04-23 00:14:10 -0700
commit7ff73ebf72cb30c9e9b8135038c30832d8f9188b (patch)
tree475b584236d631f61105ea12af3bd1671fa0b811 /FS/FS/agent.pm
parent5f397d3550bae2903ddc2438e1bcfdc4ed94cb84 (diff)
parent13f21e01ac9faa50c07f64c20cbceae0ae50790c (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS/FS/agent.pm')
-rw-r--r--FS/FS/agent.pm23
1 files changed, 21 insertions, 2 deletions
diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm
index fbfba9b..7217499 100644
--- a/FS/FS/agent.pm
+++ b/FS/FS/agent.pm
@@ -271,8 +271,27 @@ sub payment_gateway {
# seeing the card number
my $gatewaynum =
$conf->config('selfservice-payment_gateway', $self->agentnum);
- my $gateway = FS::payment_gateway->by_key($gatewaynum)
- if $gatewaynum;
+ my $gateway;
+ $gateway = FS::payment_gateway->by_key($gatewaynum) if $gatewaynum;
+ return $gateway if $gateway;
+
+ # a little less kludgey than the above, and allows PayPal to coexist
+ # with credit card gateways
+ my $is_paypal = { op => '!=', value => 'PayPal' };
+ if ( uc($options{method}) eq 'PAYPAL' ) {
+ $is_paypal = 'PayPal';
+ }
+
+ $gateway = qsearchs({
+ table => 'payment_gateway',
+ addl_from => ' JOIN agent_payment_gateway USING (gatewaynum) ',
+ hashref => {
+ gateway_namespace => 'Business::OnlineThirdPartyPayment',
+ gateway_module => $is_paypal,
+ disabled => '',
+ },
+ extra_sql => ' AND agentnum = '.$self->agentnum,
+ });
if ( $gateway ) {
return $gateway;