Merge branch 'master' of git.freeside.biz:/home/git/freeside
authorIvan Kohler <ivan@freeside.biz>
Wed, 23 Apr 2014 07:14:10 +0000 (00:14 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 23 Apr 2014 07:14:10 +0000 (00:14 -0700)
FS/FS/Schema.pm
FS/FS/agent.pm
ng_selfservice/elements/post_thirdparty.php
ng_selfservice/freeside.class.php

index ab69410..ae43b60 100644 (file)
@@ -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,            '', '',
index fbfba9b..7217499 100644 (file)
@@ -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;
index a543be9..c0b1015 100644 (file)
@@ -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'];
 ?>
index 9815d3f..ee77ce0 100644 (file)
@@ -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 {