summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-04-22 17:53:01 -0700
committerMark Wells <mark@freeside.biz>2014-04-22 17:53:35 -0700
commit13f21e01ac9faa50c07f64c20cbceae0ae50790c (patch)
tree8c4143410da3a7e47be3387db3b259071db36177 /FS/FS
parent16fde520a71f364cc8c941290ab293b6d7cd98ef (diff)
fix certain problems with third-party payment, #23579
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/Schema.pm2
-rw-r--r--FS/FS/agent.pm23
2 files changed, 22 insertions, 3 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index a1004d0..49e8bd7 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 796a160..0bb7561 100644
--- a/FS/FS/agent.pm
+++ b/FS/FS/agent.pm
@@ -248,8 +248,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;