Results 1 to 8 of 8
  1. #1
    Join Date
    May 2005
    Posts
    50
    Plugin Contributions
    0

    Default Bad Credit Card - Error Page Blank

    I am using Zen Cart 1.3.9d and I am having trouble with the payment module.

    I am using Sage (Not SagePay) payment module. When the credit card is entered correctly, everything is ok. When I put in a bad credit card number, the page is blank and the URL of that blank page is:

    9zxs.com/hnstore/index.php?main_page=checkout_payment&payment_error=net1&error=The+credit+card+nu mber+starting+with+1234+was+not+entered+correctly%2C+or+we+do+not+accept+that+ki nd+of+card.+Please+try+again+or+use+another+credit+card.&net1_cc_owner_firstname =&net1_cc_owner_lastname=&net1_cc_expires_month=01&net1_cc_expires_year=13&zenid =5084c7e95d12ff21864c4ce9702c333e

    How do I fix it?

    The Sage module is in the addon area:

    "Sage Payment Solutins Moduel"

    Web address:

    http://www.healthnewsweb.com

    Please help!

  2. #2
    Join Date
    Jan 2004
    Posts
    60,545
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: Bad Credit Card - Error Page Blank

    That module is for an older version of Zen Cart, and is incompatible with v1.3.9 because it passes error messages in the URL ... and spam protection tools block long URL keyword values.
    You'll need to rewrite the parts of the module that pass the '&error' to the URL and set those into the messageStack instead.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



  3. #3
    Join Date
    May 2005
    Posts
    50
    Plugin Contributions
    0

    Default Re: Bad Credit Card - Error Page Blank

    I will happily pay you to do that. I have no idea how to make it happen. I am in a real jam. Any ideas?

  4. #4
    Join Date
    May 2005
    Posts
    50
    Plugin Contributions
    0

    Default Re: Bad Credit Card - Error Page Blank

    Here is the module, what do I change?

    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers |
    // | |
    // | http://www.zen-cart.com/index.php |
    // | |
    // | Portions Copyright (c) 2003 osCommerce |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license, |
    // | that is bundled with this package in the file LICENSE, and is |
    // | available through the world-wide-web at the following url: |
    // | http://www.zen-cart.com/license/2_0.txt. |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to |
    // | license@zen-cart.com so we can mail you a copy immediately. |
    // +----------------------------------------------------------------------+
    // | Net1 Payment Services Payment Module |
    // | http://www.eftsecure.com/default.aspx |
    // | |
    // | includes/modules/payment/net1.php |
    // | Released under GPL |
    // | Designed by Jeramie Risinger, gapc23, Bean Fairbanks |
    // | Version 1.0 May 25, 2005 |
    // +----------------------------------------------------------------------+
    //$Id: net1.php 1 2005-05-25 12:00:00Z jersbox gapc23 beanfair$

    class net1 {
    var $code, $title, $description, $enabled;

    // class constructor
    function net1() {
    global $order;

    $this->code = 'net1';
    if ($_GET['main_page'] != '') {
    $this->title = MODULE_PAYMENT_NET1_TEXT_CATALOG_TITLE; // Payment module title in Catalog
    } else {
    $this->title = MODULE_PAYMENT_NET1_TEXT_ADMIN_TITLE; // Payment module title in Admin
    }
    $this->description = MODULE_PAYMENT_NET1_TEXT_DESCRIPTION; //Payment module description Admin
    $this->enabled = ((MODULE_PAYMENT_NET1_STATUS == 'True') ? true : false);
    $this->sort_order = MODULE_PAYMENT_NET1_SORT_ORDER;

    $this->form_action_url = zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false); // Defined in filenames.php

    if ((int)MODULE_PAYMENT_NET1_ORDER_STATUS_ID > 0) {
    $this->order_status = MODULE_PAYMENT_NET1_ORDER_STATUS_ID;
    }

    if (is_object($order)) $this->update_status();

    }


    // class methods

    function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NET1_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NET1_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
    while (!$check->EOF) {
    if ($check->fields['zone_id'] < 1) {
    $check_flag = true;
    break;
    } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
    $check_flag = true;
    break;
    }
    $check->MoveNext();
    }

    if ($check_flag == false) {
    $this->enabled = false;
    }
    }
    }

    /* Validate the credit card information structure (name, number format and CVV) via javascript.
    This validates format only it does NOT validate credit card viabilty. */
    function javascript_validation() {
    $js = ' if (payment_value == "' . $this->code . '") {' . "\n" .
    ' var cc_owner = document.checkout_payment.net1_cc_owner.value;' . "\n" .
    ' var cc_number = document.checkout_payment.net1_cc_number.value;' . "\n" .
    ' var cc_cvv = document.checkout_payment.net1_cc_cvv.value;' . "\n" .
    ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
    ' error_message = error_message + "' . MODULE_PAYMENT_NET1_TEXT_JS_CC_OWNER . '";' . "\n" .
    ' error = 1;' . "\n" .
    ' }' . "\n" .
    ' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
    ' error_message = error_message + "' . MODULE_PAYMENT_NET1_TEXT_JS_CC_NUMBER . '";' . "\n" .
    ' error = 1;' . "\n" .
    ' }' . "\n" .
    ' if (cc_cvv == "" || cc_cvv.length < "3") {' . "\n".
    ' error_message = error_message + "' . MODULE_PAYMENT_NET1_TEXT_JS_CC_CVV . '";' . "\n" .
    ' error = 1;' . "\n" .
    ' }' . "\n" .
    ' }' . "\n";

    return $js;
    }// end javascript_validation

    // Display Credit Card Information Submission Fields on the Checkout Payment Page
    function selection() {
    global $order;

    for ($i=1; $i<13; $i++) {
    $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));
    }

    $today = getdate();
    for ($i=$today['year']; $i < $today['year']+10; $i++) {
    $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));
    }

    $selection = array('id' => $this->code,
    'module' => MODULE_PAYMENT_NET1_TEXT_CATALOG_TITLE,
    'fields' => array(array('title' => MODULE_PAYMENT_NET1_TEXT_CREDIT_CARD_OWNER,
    'field' => zen_draw_input_field('net1_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
    array('title' => MODULE_PAYMENT_NET1_TEXT_CREDIT_CARD_NUMBER,
    'field' => zen_draw_input_field('net1_cc_number')),
    array('title' => MODULE_PAYMENT_NET1_TEXT_CREDIT_CARD_EXPIRES,
    'field' => zen_draw_pull_down_menu('net1_cc_expires_month', $expires_month) . '&nbsp;' . zen_draw_pull_down_menu('net1_cc_expires_year', $expires_year)),
    array('title' => MODULE_PAYMENT_NET1_TEXT_CVV2_NUMBER,
    'field' => zen_draw_input_field('net1_cc_cvv','','SIZE=4, MAXLENGTH=4'))));

    return $selection;
    }//end selection

    //Reports the appropriate error to the user if it doesn't pass the format validation
    function pre_confirmation_check() {
    global $_POST;

    include(DIR_WS_CLASSES . 'cc_validation.php');

    $cc_validation = new cc_validation();
    $result = $cc_validation->validate($_POST['net1_cc_number'], $_POST['net1_cc_expires_month'], $_POST['net1_cc_expires_year']);

    $error = '';
    switch ($result) {
    case -1:
    $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4));
    break;
    case -2:
    case -3:
    case -4:
    $error = TEXT_CCVAL_ERROR_INVALID_DATE;
    break;
    case false:
    $error = TEXT_CCVAL_ERROR_INVALID_NUMBER;
    break;
    }

    if ( ($result == false) || ($result < 1) ) {
    $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&net1_cc_owner_firstname=' . urlencode($_POST['net1_cc_owner_firstname']) . '&net1_cc_owner_lastname=' . urlencode($_POST['net1_cc_owner_lastname']) . '&net1_cc_expires_month=' . $_POST['net1_cc_expires_month'] . '&net1_cc_expires_year=' . $_POST['net1_cc_expires_year'];

    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
    }

    $this->cc_card_type = $cc_validation->cc_type;
    $this->cc_card_number = $cc_validation->cc_number;
    $this->cc_expiry_month = $cc_validation->cc_expiry_month;
    $this->cc_expiry_year = $cc_validation->cc_expiry_year;
    }//end pre_confirmation_check

    //Creates an array of CC information to post to the confirmation page
    function confirmation() {
    global $_POST;

    $confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,
    'fields' => array(array('title' => MODULE_PAYMENT_NET1_TEXT_CREDIT_CARD_OWNER,
    'field' => $_POST['net1_cc_owner']),
    array('title' => MODULE_PAYMENT_NET1_TEXT_CVV2_NUMBER,
    'field' => $_POST['net1_cc_cvv']),
    array('title' => MODULE_PAYMENT_NET1_TEXT_CREDIT_CARD_NUMBER,
    'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)),
    array('title' => MODULE_PAYMENT_NET1_TEXT_CREDIT_CARD_EXPIRES,
    'field' => strftime('%B, %Y', mktime(0,0,0,$_POST['net1_cc_expires_month'], 1, '20' . $_POST['net1_cc_expires_year'])))));

    return $confirmation;
    } //end confirmation

    //Sets the order number and hidden fields
    function process_button() {
    global $_POST, $order, $db;
    //assigns an orderID
    $last_order_id = $db->Execute("select * from " . TABLE_ORDERS . " order by orders_id desc limit 1");
    $new_order_id = $last_order_id->fields['orders_id'];
    $new_order_id = ($new_order_id + 1);


    $process_button_string =
    zen_draw_hidden_field('M_id', MODULE_PAYMENT_NET1_MERCHANT_ID) .
    zen_draw_hidden_field('M_key', MODULE_PAYMENT_NET1_MERCHANT_KEY) .
    zen_draw_hidden_field('T_amt', number_format($order->info['total'], 2)) .
    zen_draw_hidden_field('T_ordernum', $new_order_id) .
    zen_draw_hidden_field('C_cardnumber', $this->cc_card_number) .
    zen_draw_hidden_field('C_exp', $this->cc_expiry_month . substr($this->cc_expiry_year, -2)) .
    zen_draw_hidden_field('C_name', $order->billing['firstname'] . ' ' . $order->billing['lastname']) .
    zen_draw_hidden_field('C_address', $order->billing['street_address']) .
    zen_draw_hidden_field('C_city', $order->billing['city']) .
    zen_draw_hidden_field('C_state', $order->billing['state']) .
    zen_draw_hidden_field('C_zip', $order->billing['postcode']) .
    zen_draw_hidden_field('C_email', $order->billing['email']) .
    zen_draw_hidden_field('C_cvv', $_POST['net1_cc_cvv']) .
    zen_draw_hidden_field('T_code', "02");
    return $process_button_string;


    }//end process_button

    function before_process() {
    global $_POST;

    //Net1's posting site for golden oldies and new hits...
    $eftsecure_url = 'https://va.eftsecure.net/cgi-bin/eftBankcard.dll?transaction';

    //should be set from the admin panel
    $data = "M_id=" . MODULE_PAYMENT_NET1_MERCHANT_ID; //merchant id
    $data .= "&M_key=" . MODULE_PAYMENT_NET1_MERCHANT_KEY; //merchant key

    /*Encode data to be sent to Net1.
    This stuff was grabbed from the earlier creation of
    the process_button_string (those little hidden input fields)
    All customer data should be encoded for security*/
    $data .= "&T_amt=" . urlencode( $_POST['T_amt'] );
    $data .= "&C_name=" . urlencode( $_POST['C_name'] );
    $data .= "&C_address=" . urlencode( $_POST['C_address'] );
    $data .= "&C_city=" . urlencode( $_POST['C_city'] );
    $data .= "&C_state=" . urlencode( $_POST['C_state'] );
    $data .= "&C_zip=" . urlencode( $_POST['C_zip'] );
    $data .= "&C_email=" . urlencode( $_POST['C_email'] );
    $data .= "&C_cardnumber=" . urlencode( $_POST['C_cardnumber'] );
    $data .= "&C_exp=" . urlencode( $_POST['C_exp'] );
    $data .= "&T_code=02"; //transaction type indicator

    //curl procedures
    $ch = curl_init(); //initialize the CURL library.
    curl_setopt($ch, CURLOPT_URL, $eftsecure_url); // set the URL to post to.
    curl_setopt($ch, CURLOPT_POST, 1); // tell it to POST not GET (you can GET but POST is //preferred)
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // set the data to be posted.
    /* this tells the library to return the
    data to you instead of writing it to a file */
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $res = curl_exec($ch); // make the post.
    curl_close($ch); // shut down the curl library.

    /*Simple check. if the resp is not 'A' then fail and redirect.
    Otherwise the default action is the success page */
    if ( $res[1] != 'A' ) {
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_NET1_TEXT_ERROR_MESSAGE), 'SSL', true, false));
    }

    }// end before_process

    function after_process() {

    return false;

    }//end after_process

    //Grabs the text version of the error to create a user friendly error page
    function get_error() {
    global $_GET;

    $error = array('title' => MODULE_PAYMENT_NET1_TEXT_ERROR,
    'error' => stripslashes(urldecode($_GET['error'])));

    return $error;
    }//end get_error

    //Checks the status of the module as set in the admin panel
    function check() {
    global $db;
    if (!isset($this->_check)) {
    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NET1_STATUS'");
    $this->_check = $check_query->RecordCount();
    }
    return $this->_check;
    }//end check

    // Installs the configuration for Net1 into the payments module in Admin
    function install() {
    global $db;
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable NetOne Module', 'MODULE_PAYMENT_NET1_STATUS', 'True', 'Do you want to accept Net1 payments?', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_NET1_MERCHANT_ID', '636287356486', 'Merchant ID used for the Net1 service', '6', '2', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant Key', 'MODULE_PAYMENT_NET1_MERCHANT_KEY', 'O9L6K8B0C7C7', 'Merchant Key used for the Net1 service', '6', '3', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Type', 'MODULE_PAYMENT_NET1_TRANSACTION_TYPE', 'PreAuth', 'Transaction type to use for the Net1 service', '6', '4', 'zen_cfg_select_option(array(\'Sale\', \'AuthOnly\', \'Force\', \'Void\', \'Credit\'), ', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_NET1_CURRENCY', 'USD', 'The currency to use for credit card transactions', '6', '6', 'zen_cfg_select_option(array(\'CAD\', \'USD\'), ', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_NET1_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_NET1_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_NET1_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
    }//end install

    //Removes the configuration information from the Admin panel. It does NOT remove the module
    function remove() {
    global $db;
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    //Keys set in the Admin Panel
    function keys() {
    return array('MODULE_PAYMENT_NET1_STATUS',
    'MODULE_PAYMENT_NET1_MERCHANT_ID',
    'MODULE_PAYMENT_NET1_MERCHANT_KEY',
    'MODULE_PAYMENT_NET1_TRANSACTION_TYPE',
    'MODULE_PAYMENT_NET1_CURRENCY',
    'MODULE_PAYMENT_NET1_ZONE',
    'MODULE_PAYMENT_NET1_ORDER_STATUS_ID',
    'MODULE_PAYMENT_NET1_SORT_ORDER');
    }//end keys

    }
    ?>

  5. #5
    Join Date
    May 2005
    Posts
    50
    Plugin Contributions
    0

    Default Re: Bad Credit Card - Error Page Blank

    Solved!

    I sent a PM to Scott Wilson - swguy - and he directed me to http://www.gticustom.com/index.php?main_page=index who had actually updated the Sage Payment (formally Net1 and eftsecure) module.

    I installed it and it works with Zen Cart 1.3.9d and PHP 5.3.

    Thanks a ton for everyone's help and my store is finally up and running!

    Thanks
    Rod McKenzie

  6. #6
    Join Date
    Oct 2010
    Posts
    13
    Plugin Contributions
    0

    Default Re: Bad Credit Card - Error Page Blank

    I have installed the net1 version from GTI and I get an error from internet explorer.... Internet Explorer cannot read this webpage format error http 406... can someone help guide me to resolve this problem???

  7. #7
    Join Date
    Oct 2010
    Posts
    13
    Plugin Contributions
    0

    Default Re: Bad Credit Card - Error Page Blank

    update for anyone that may be interested.... when I first installed the mod I had problems... turned it off and on and tried to figure out what the problem was... no luck.... came back at a later time to see what I could figure out and turned the mod on and everything worked fime.... not sure what happened, it just worked...

  8. #8
    Join Date
    Jan 2004
    Posts
    60,545
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: Bad Credit Card - Error Page Blank

    This code will send error messages that are too long, and thus trigger the 406 errors:
    Code:
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_NET1_TEXT_ERROR_MESSAGE), 'SSL', true, false));
    Needs to be changed to this instead:
    Code:
    global $messageStack;
    $messageStack->add_session('checkout_payment', MODULE_PAYMENT_NET1_TEXT_ERROR_MESSAGE, 'error');
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
    Or just shorten the definition of MODULE_PAYMENT_NET1_TEXT_ERROR_MESSAGE in the language file so it's less than 40 characters.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



 

 

Similar Threads

  1. Change credit card error message at top of page
    By WindRush in forum General Questions
    Replies: 7
    Last Post: 9 Dec 2010, 08:31 PM
  2. Credit Card Check Out error, help, can not process credit cards after Super Orders
    By ciscomemory_net in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 28 Jul 2009, 06:01 AM
  3. Redirect to error page if credit card is denied
    By rakisisesindekibalik in forum Contribution-Writing Guidelines
    Replies: 0
    Last Post: 5 Apr 2008, 04:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •