meltdevelop Posted May 28, 2008 Share Posted May 28, 2008 (edited) Hi, I've recently been integrating Psi Gate so we can process credit cards on our osCommerce store and everything seems to be working fine except in Test Mode when I set the Test Mode Result type to Decline, the error message that is supposed to be returned on the checkout_payment.php page, after redirecting from checkout_confirmation.php, doesn't show up. The information is displayed in the url, but it seems like it isn't accessing the variable $HTTP_GET_VARS['error'] in the function get_error. Any ideas? This is the part that returns the user to the checkout_payment.php in the function before_process: if ($psi_xml_error) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . $Psi_ErrMsg . ' - ' . urlencode(MODULE_PAYMENT_PSIGATE_XML_TEXT_DECLINED_MESSAGE), 'SSL', true, false)); } And this is where it is supposedly grabbing the error for display function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_PSIGATE_XML_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } Edited May 28, 2008 by meltdevelop Quote Link to comment Share on other sites More sharing options...
meltdevelop Posted May 29, 2008 Author Share Posted May 29, 2008 Hi, I've recently been integrating Psi Gate so we can process credit cards on our osCommerce store and everything seems to be working fine except in Test Mode when I set the Test Mode Result type to Decline, the error message that is supposed to be returned on the checkout_payment.php page, after redirecting from checkout_confirmation.php, doesn't show up. The information is displayed in the url, but it seems like it isn't accessing the variable $HTTP_GET_VARS['error'] in the function get_error. Any ideas? This is the part that returns the user to the checkout_payment.php in the function before_process: if ($psi_xml_error) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . $Psi_ErrMsg . ' - ' . urlencode(MODULE_PAYMENT_PSIGATE_XML_TEXT_DECLINED_MESSAGE), 'SSL', true, false)); } And this is where it is supposedly grabbing the error for display function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_PSIGATE_XML_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } Got a solution now, posting it here in case anyone else has this problem. The error string needed to be set up with 'payment_error' rather than 'error_message' in order for the checkout_payment.php page to call the get_error function. It also needs to have the $this->code and $error in the string, and for $Psi_ErrMsg to be urlencoded. The solution below also only displays either the Store Error (if there is one) - like if the store id or passphrase is wrong, or the decline message. This way if something is wrong with the store that is causing the transaction to not be processed, the customer won't think that it's their credit card being declined. if ($psi_xml_error) { $full_error = urlencode(MODULE_PAYMENT_PSIGATE_XML_TEXT_DECLINED_MESSAGE); if($Psi_ErrMsg != ""){ $full_error = ' Please report the following error message to the store owner: ' . urlencode($Psi_ErrMsg); } tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . $full_error, 'SSL', true, false)); } I'm also going to add this onto the contributions as well as some other small refinements. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.