Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Checkout Goof - when transactions declined etc.


WoodsWalker

Recommended Posts

Posted

Hi Folks!

 

I have worked out most of the problems in my catalogue and it's almost ready to roll, but I have identified one stubborn problem in the checkout process.

 

INFO: The Moneris eSelect package I am using (including payment module) allows me to send dummy transactions to the Moneris test environment, which then mimicks the responses my site will receive as if it were a "real" transaction. The response (approved, declined, etc.) which is sent back is determined by the penny value of the transaction.

 

PROBLEM: When I send through any transaction that is not approved, the customer is sent back to checkout_payment.php as they should be, but no error message is displayed to tell them what went wrong. In fact, if I send through anything BUT an approvable transaction (including sending through bad code), the customer simply lands back on checkout_payment.php, with no hint of why. Seems kind of rude! :'(

 

I can see that all the error messages are defined in the files for the Moneris payment module, but they're not getting picked up by checkout_payment.

 

Checkout_payment.php does, however, display an error message when a "past" expiry date is entered - so that part of the code is working. I am assuming that this error message does not depend on a response from the test environment.

 

I have checked the database to make sure that these transactions were indeed received and the error responses sent back to my site - and they were.

 

I don't know where in the code to look for the foul up. Can someone point me there?

 

Thanks, good people!

 

~Wendy

Posted

Still no takers on this question?

 

To summarize, my page "checkout_payment.php" is not displaying the payment error messages (e.g. "Your payment has been declined") when the relevant info is passed to my site by my financial services provider. The user is simply redirected back to the payment page, with no explanation at the top.

 

"Internal" errors, such as not enough digits in the CC#, are properly displayed.

 

I have contacted my financial services provider, Moneris, who wrote the payment module, but they are very slow in replying, so I wondered if anyone had any ideas? I don't know for sure that it is a problem with the Moneris payment module.

 

Thanks,

Wendy

Posted

The problem has been solved. :)

 

Turns out the error message code in checkout_payment.php only responds to simple errors such as a "past" expiry date or not enough digits in the CC#. When these errors are made, the transaction normally does not even get as far as your payment gateway, but can be solved by the customer right away or abandoned.

 

The code that responds to error messages from your payment gateway resides at the bottom of catalog/includes/header.php. Moneris helped me find it. It should look something like this:

 

<?php
 if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr class="headerError">
<td class="headerError"><?php echo htmlspecialchars(stripslashes(urldecode($HTTP_GET_VARS['error_message']))); ?></td>
 </tr>
</table>
<?php
}
?>

 

The Problem and Solution: The first thing I saw was that all this code was commented out (placed between <!-- and -->, and also filled with slashes). When I took out the commenting and made it operational, my site disappeared. Usually this is caused by a syntax error. I don't know much PHP, but I noticed that the code, as it was, contained an opening curly bracket "{", but no closing one. I consulted my PHP manual, and figured out that I needed to open a PHP code again at the end of this snippet, and put in the closing curly bracket. Thus, the:

<?php

}

?>

at the end of the above code snippet. And VOILA :D , everything works now!

 

Why was that whole block of code commented out in the first place? (my osC install came from Bell Hosting). Obviously this was because it stopped the header (and thus whole pages) from rendering, and no one had bothered to analyze the code to see what was missing, but instead simply commented out a big hunk. Perhaps Bell did it, or someone earlier down the line than Bell. As no one else has posted this problem, I'll assume it's rare.

 

Hope this info saves someone some time!

~Wendy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...