diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-04-23 00:14:10 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-04-23 00:14:10 -0700 |
commit | 7ff73ebf72cb30c9e9b8135038c30832d8f9188b (patch) | |
tree | 475b584236d631f61105ea12af3bd1671fa0b811 /FS | |
parent | 5f397d3550bae2903ddc2438e1bcfdc4ed94cb84 (diff) | |
parent | 13f21e01ac9faa50c07f64c20cbceae0ae50790c (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Schema.pm | 2 | ||||
-rw-r--r-- | FS/FS/agent.pm | 23 |
2 files changed, 22 insertions, 3 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index ab69410ef..ae43b6061 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -2232,7 +2232,7 @@ sub tables_hashref { 'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances 'status', 'varchar', '', $char_d, '', '', - 'session_id', 'varchar', 'NULL', $char_d, '', '', #only need 32 + 'session_id', 'varchar', 'NULL', 1024, '', '', # SHA-512-hex 'statustext', 'text', 'NULL', '', '', '', 'gatewaynum', 'int', 'NULL', '', '', '', #'cust_balance', @money_type, '', '', diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index fbfba9b4d..721749956 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; |