diff options
author | Mark Wells <mark@freeside.biz> | 2014-04-22 17:53:01 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-04-23 23:55:30 -0700 |
commit | 8de8d7f1a7c7049698cd12a13bd9f9680fbfa5ae (patch) | |
tree | 23e33ce73093d71f5595494ea7b54a6e91105c17 | |
parent | 759c31ea0334763f69c1f8bad4439f41b10d40dd (diff) |
fix certain problems with third-party payment, #23579
-rw-r--r-- | FS/FS/Schema.pm | 2 | ||||
-rw-r--r-- | FS/FS/agent.pm | 23 | ||||
-rw-r--r-- | ng_selfservice/elements/post_thirdparty.php | 3 | ||||
-rw-r--r-- | ng_selfservice/freeside.class.php | 2 |
4 files changed, 27 insertions, 3 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index f97495d89..849dc3e83 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1640,7 +1640,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 700ea061e..1dd6796cb 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -262,8 +262,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; diff --git a/ng_selfservice/elements/post_thirdparty.php b/ng_selfservice/elements/post_thirdparty.php index a543be93a..c0b1015ea 100644 --- a/ng_selfservice/elements/post_thirdparty.php +++ b/ng_selfservice/elements/post_thirdparty.php @@ -1,7 +1,10 @@ <? if ( $payment_results['error'] ) { // an error at this stage isn't meaningful to the user + // but make sure it's logged + error_log("[start_thirdparty] $error"); $error = 'Internal error communicating with payment processor.'; + include('error.php'); } elseif ( isset($payment_results['url']) ) { $url = $payment_results['url']; ?> diff --git a/ng_selfservice/freeside.class.php b/ng_selfservice/freeside.class.php index 9815d3fd5..ee77ce016 100644 --- a/ng_selfservice/freeside.class.php +++ b/ng_selfservice/freeside.class.php @@ -59,6 +59,8 @@ class FreesideSelfService { ))); $file = file_get_contents($this->URL, false, $context); $response = xmlrpc_decode($file); + // uncomment to trace everything + //error_log(print_r($response, true)); if (xmlrpc_is_fault($response)) { trigger_error("[FreesideSelfService] XML-RPC communication error: $response[faultString] ($response[faultCode])"); } else { |