Jump to content
Sign in to follow this  
am1971

edit authorizenetaim.php to show credit card declined error on page

Recommended Posts

Hi

 

I hope someone can help.

 

authorizenetaim is working fine, I just would like to know how to edit the file authorizenetaim.php to show the cc declined error message on the page itself and not under my logo on the top.

 

Thanks

Share this post


Link to post
Share on other sites

The problem is in how the authorizenetaim module handles errors. The authorizenetaim module class has an error property and a get_error method to retrieve it. Using a getter to retrieve a class property is good object-oriented design, but the authorizenetaim object does not persist through the session. Every time you refresh or get redirected to a different page, the authorizenetaim object gets destroyed and then recreated with it's default values. So, when the $error propetry gets set in checkout_process.php, it will get set back to its default value when checkout_process.php redirects to checkout_payment.php. The changes I made are just making the authorizenetaim module handle errors in the same way that authorizenet module does.

 

Line 100

$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&authorizenetaim_cc_owner=' . urlencode($HTTP_POST_VARS['authorizenetaim_cc_owner']) . '&authorizenetaim_cc_expires_month=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_month'] . '&authorizenetaim_cc_expires_year=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_year'];

 

Line 224

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($response_vars[3]) . '&authorizenetaim_cc_owner=' . urlencode($HTTP_POST_VARS['authorizenetaim_cc_owner']) . '&authorizenetaim_cc_expires_month=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_month'] . '&authorizenetaim_cc_expires_year=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_year'], 'SSL', true, false));

 

Line 240

function get_error() {
  global $HTTP_GET_VARS;
  $error = array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_ERROR,
				 'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

  return $error;
}

 

The get_error() function is the same function in the authorizenet module, only the title reference was changed to reference the authorizenetaim title instead. Hope this helps.

 

Hi

 

I hope someone can help.

 

authorizenetaim is working fine, I just would like to know how to edit the file authorizenetaim.php to show the cc declined error message on the page itself and not under my logo on the top.

 

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×