This started in another thread. http://www.zen-cart.com/forum/showthread.php?t=36082
I've started working on getting the Securepay module to work properly.
So far, with a module provided by Securepay, I've been able to charge credit cards. After confirming an order with a credit card payment on Step 3 of 3 in the checkout process, I receive a return code, Approval Number, card response, avs respons and record number. These look like this on the screen:
"N,NOT APPROVED,NOT APPROVED INVALID CARD,NO DATA,2183250,END"
In the case above, I was using a test card that returns declined, but processes correctly. I did this so my credit card wouldn't be charge over and over again while testing. The problem is, I would expect to be returned to the previous page with an error displayed, or in the case of an approved card, to be returned to a Success page, or whatever.
In addition to being returned to the correct page, how, exactly, does the order information get inserted into the database in the case of an approved card? I've compared the securepay module to the "authorizenet" module, and they appear to be the same in structure as the "before_process" and "after_process" functions, as well as on the "process_button" function.
This is the before_process, after_process, and get_error functions from the securepay module:
// this method gets called after the processing is done but before the app server
// accepts the result. It is used to check for errors.
function before_process() {
global $db;
if ($_GET['RETURN_CODE'] != 'Y') {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_SECUREPAY_TEXT_GATEWAY_TIMEOUT), 'SSL', true, false));
}
if ($_GET['RESPONSE_CODE'] != 'AA') {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_SECUREPAY_TEXT_ERROR_MESSAGE . '<br>' . $_GET['AUTH_RESPONSE']), 'SSL', true, false));
}
}
function after_process() {
global $db;
return false;
}
function get_error() {
global $db;
$error = array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_ERROR,
'error' => stripslashes(urldecode($_GET['RETURN_ERROR'])));
return $error;
}
I guess I'm asking a lot here, but I'm sure this must be a fairly simple fix for those more capable than myself. Obviously, if anyone intends to try to help with this fix, and they want the module I've been working on, email or PM me, and I'll send it. I'll also provide the test card number. Hopefully someone can help here, but I'll continue to work on it myself.



