:sadwalk:
Guys . . . I don't know what to tell ya. I'm back to my orginal code. I've removed the security holes, added USER ID use; updated a lot of the fields to make it flow a lot better. The only thing I can't get past is this :censored: error handling. I need someone who's an expert with ZenCart to help with this. I'm at my wits end. I've now spent a solid 12 hours trying this and trying that only to end up back where I started. I do at least have an understanding of the problem. I am, and always have been, an expert on ViaKlix and VirtualMerchant; without giving too much away, you could say I have more knowledge than most . . . I would say the most knowledge of anyone on the boards. The issue is not my understanding of VM or KLIX; it's my lack of understanding of PHP and ZenCart (which is actually not that bad, but as I can't figure this out my faith is shaken)
So one more time, here is the problem. In order for a transaction to be successful you need to get an ssl_result of 0 or ssl_result='0' . Declines, as referenced by a Decline from a card issuer or any message that comes from Nova's systems are already handled. In my testing I got 'Call Auth Center' and 'Please Retry 5303' error messages. These typically will have an ssl_result message of say 2 or 1 or 5000; depending on the message. The problem comes with logic errors.
Typically Zen & Java handle most of those. Credit Card not passing the Mod 10 check, an invalid expiry date, etc;. However, there are some that Zen miss as it has no way of knowing the settings that are setup in the Admin side of VM or Klix. An example I keep referring to is the HTTP referrers. Logic errors are returned or 'stopped' at the gateway level and never reach Nova (understanding I mean Nova the processor not Nova the developer of VM & Klix) As I was saying, I continue to refer to HTTP referrers but this would also apply to someone having an address that was too long and up until a fix of theirs went in anyone that had a dash (-) in their email would have gotten a logic error.
So, as it stands currently the module will work but I STRONGLY recommend that NO ONE install it until these issues are resolved. This was to be my first contribution to the community and I will not release a half done product. That said, I'll share where my problem is and I hope someone out there can lend a hand. Here is the error handling:
switch (true) {
case (zen_not_null($curl_error)):
if($curl_error == 'SSL connection timeout') {$errorstr = '&errormessage=' . urlencode(MYVIRTUALMERCHANT_ERROR_MESSAGE_TIME_OUT);}
$error_return = 'payment_error=' . $this->code . $errorstr . '&myvirtualmerchant_cc_owner=' . urlencode($_SESSION['myvirtualmerchant_cc_owner']) . '&myvirtualmerchant_cc_expires_month=' . $_SESSION['myvirtualmerchant_cc_expires_month'] . '&myvirtualmerchant_cc_expires_year=' . $_SESSION['myvirtualmerchant_cc_expires_year'] . '&myvirtualmerchant_cvv_number=' . $_SESSION['myvirtualmerchant_cvv_number']. '&myvirtualmerchant_cvv_indicator=' . $_SESSION['myvirtualmerchant_cvv_indicator'];
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $error_return, 'SSL', true, false));
break;
// note to self mack - removed === to be ==
case ($response['ssl_result'] == 0):
//APPROVED - no redirect needed
break;
case ($response['ssl_result'] == 1 ||
$response['ssl_result'] == 4000 ||
$response['ssl_result'] == 5000 ||
$response['ssl_result'] == 6000):
//USER ERROR
$error_return = 'payment_error=' . $this->code . '&errormessage=' . urlencode($response['ssl_result_message']) . '&myvirtualmerchant_cc_owner=' . urlencode($_POST['myvirtualmerchant_cc_owner']) . '&myvirtualmerchant_cc_expires_month=' . $_SESSION['myvirtualmerchant_cc_expires_month'] . '&myvirtualmerchant_cc_expires_year=' . $_SESSION['myvirtualmerchant_cc_expires_year'] . '&myvirtualmerchant_cvv_number=' . $_SESSION['myvirtualmerchant_cvv_number']. '&myvirtualmerchant_cvv_indicator=' . $_SESSION['myvirtualmerchant_cvv_indicator'];
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $error_return, 'SSL', true, false));
break;
case ($response['ssl_result'] == 2 ||
$response['ssl_result'] == 3 ||
$response['ssl_result'] == 4 ||
$response['ssl_result'] == 'N/A' ||
$response['ssl_result'] == 1000 ||
$response['ssl_result'] == 4016 ||
$response['ssl_result'] == 7000 ||
$response['ssl_result'] == 8000):
//INTERNAL ERROR
$error_return = 'payment_error=' . $this->code . '&errormessage=' . urlencode(MYVIRTUALMERCHANT_ERROR_MESSAGE_INTERNAL_ERROR) . '&myvirtualmerchant_cc_owner=' . urlencode($_SESSION['myvirtualmerchant_cc_owner']) . '&myvirtualmerchant_cc_expires_month=' . $_SESSION['myvirtualmerchant_cc_expires_month'] . '&myvirtualmerchant_cc_expires_year=' . $_SESSION['myvirtualmerchant_cc_expires_year'] . '&myvirtualmerchant_cvv_number=' . $_SESSION['myvirtualmerchant_cvv_number']. '&myvirtualmerchant_cvv_indicator=' . $_SESSION['myvirtualmerchant_cvv_indicator'];
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $error_return, 'SSL', true, false));
break;
default:
// die('here');
error_log("ERROR - Hit default result for transaction. ssl_result " . $response['ssl_result'] , 0);
$error_return = 'payment_error=' . $this->code . '&myvirtualmerchant_cc_owner=' . urlencode($_SESSION['myvirtualmerchant_cc_owner']) . '&myvirtualmerchant_cc_expires_month=' . $_SESSION['myvirtualmerchant_cc_expires_month'] . '&myvirtualmerchant_cc_expires_year=' . $_SESSION['myvirtualmerchant_cc_expires_year'] . '&myvirtualmerchant_cvv_number=' . $_SESSION['myvirtualmerchant_cvv_number']. '&myvirtualmerchant_cvv_indicator=' . $_SESSION['myvirtualmerchant_cvv_indicator'];
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $error_return, 'SSL', true, false));
}
}
function after_process() {
unset($_SESSION['myvirtualmerchant_cc_number'], $_SESSION['myvirtualmerchant_cc_expires_month'], $_SESSION['myvirtualmerchant_cc_expires_year'], $_SESSION['myvirtualmerchant_cvv_indicator'], $_SESSION['myvirtualmerchant_cvv_number']);
return false;
}
function get_error() {
global $_GET;
$error = array('title' => MYVIRTUALMERCHANT_ERROR_HEADING,
'error' => MYVIRTUALMERCHANT_ERROR_HEADING . '<br />' . ((isset($_GET['errormessage'])) ? stripslashes(urldecode($_GET['errormessage'])) : MYVIRTUALMERCHANT_ERROR_MESSAGE_GENERAL));
return $error;
}
The ideal would be to have something that looked for ssl_result=0; if it found said result then it would continue on. If it found ssl_result=>0 (greater than 0) or if it doesn't get an ssl_result at all then it would return the customer to the previous page (checkout_payment) with instructions to try again and if problems persist to contact the site owner or try an alternate form of payment.
I'm open to ANY suggestions.
Thank you,
Samuel Turnmire
co-Founder
geekFoundry