7 replies [Last post]
jimijamesi's picture
Offline
Joined: 08/19/2007
Juice: 75
Was this information Helpful?

Trying to build a payment gateway for Beanstream.com
using authorize.net and moneris.com payment modules as a guide
when submitting the transaction, in both cases I got this error

Attempted to process payment but the gateway's function was not found.

the order is in the history as pending

what is the best way of identifying the error in more detail

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: troubleshooting payment gateway

The problem is probably in your implementation of hook_payment_gateway(). Did you change the credit function name there? You can post your code if you need to.

jimijamesi's picture
Offline
Joined: 08/19/2007
Juice: 75
Re: troubleshooting payment gateway

Thanks for the uberquick reply. I followed your lead through the code, it appears that the credit card gateway will only work with 1 single gateway installed. I removed the other gateway and it continued through through the next payment steps.

this happens in function uc_payment_process
around line 893 inside uc_payments.module version Alpha 7e

Thanks for the tip Ryan - btw i will be documenting the experience and contrib'ing the mod

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: troubleshooting payment gateway

Interesting... I'll test this on my Alpha 8 test site, but it should work with as many gateways installed as you want. It should use the default gateway or the first one it finds if you haven't specified a default. Will post back here if there was a bug in the system.

jimijamesi's picture
Offline
Joined: 08/19/2007
Juice: 75
Re: troubleshooting payment gateway

When submitting an order I am now getting this error
"We were unable to process your credit card payment. Please verify your card details and try again. If the problem persists, contact us to complete your order."

I could not find the location to adjust the credit function name based on Ryan's advise...
"The problem is probably in your implementation of hook_payment_gateway(). Did you change the credit function name there?"

If you could let me know your thoughts and the exact location(s) to adjust the credit function names that would be great, however I thought that the gateway was assigned a numeric id which was then used to identify it??

I am also documenting the process to assist in the documentation effort...thanks

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: troubleshooting payment gateway

Really can't do much without some code to look at... can you post any of the module, or is this a private one for you/a client?

jimijamesi's picture
Offline
Joined: 08/19/2007
Juice: 75
Re: Re: Re: troubleshooting payment gateway

module attached, thanks in advance

seems to be not getting past this function in the credit module

function uc_credit_order($op, &$arg1, $arg2) {
  switch ($op) {
    case 'submit':
      if ($arg1->payment_method == 'credit'
       && variable_get('uc_credit_checkout_process', FALSE)) {
        $pass = uc_payment_process('credit', $arg1->order_id, $arg1->order_total, NULL, TRUE, NULL, FALSE);
        if (!$pass) {
          $message = variable_get('uc_credit_fail_message', t('We were unable to process your credit card payment. Please verify your card details and try again.  If the problem persists, contact us to complete your order.'));
          return array(array('pass' => FALSE, 'message' => $message));
        }
AttachmentSize
uc_beanstreamcom.module.txt 8.84 KB
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: troubleshooting payment gateway

I'm pretty sure it's running through alright... the problem is you're not parsing the return value from beanstream. So you have this line,

<?php
 
if ($trnApproved != '1') {
?>

And it will always be TRUE, b/c you're not setting $trnApproved anywhere. You might want to insert

<?php
  curl_close
($ch);

 

// Insert this line.
 
drupal_set_message('<pre>'. print_r($authorize, TRUE) .'</pre>');

 

$response = split('\,', $authorize);
?>

That will display the unfiltered data for you to see. You might do it on $response after the data is split, too.