This is a discussion on Credit Card problems within the osCMax v1.7 Installation forums, part of the osCMax v1.7 Forums category; We are almost done setting up our site, www.truckracingparts.com/catalog/index.php However, whenever we go to check out with a live transaction ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| We are almost done setting up our site, www.truckracingparts.com/catalog/index.php However, whenever we go to check out with a live transaction with authorize.net it reads this at the top of the page: "There has been an error processing your credit card. Please try again." It then takes us back to where we put our CC number in. I put in the transaction key and the username. I've checked our account at authorize.net and the transaction isnt even getting that far. It is not in test mode either. Does anyone have any ideas? Please help. Thanks |
| Sponsored Links | ||
| ||
| |
|
#2
| ||||
| ||||
| OS_Max Repair of Authorize.net If credit cards rejected on error because /user/bin/curl broken on server This fix works around processing the authorize.net functions on the server using curl and processes them via php instead. 3 steps. 1): authorizenetaim.php This file placed placed in /catalog/includes/languages/english/modules/payment/ <?php /* $Id: authorizenetaim.php,v 1.1 2003/07/11 14:40:27 ecartz Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Copyright (c) 2004 eCartz.com, Inc. Released under the GNU General Public License */ define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_TITLE' , 'Authorize.net AIM'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_DESCRI PTION', 'Credit Card Test Info:<br><br>CC#: 4111111111111111<br>Expiry: Any'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_TYPE', 'Type:'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT _CARD_OWNER', 'Credit Card Owner:'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT _CARD_NUMBER', 'Credit Card Number:'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT _CARD_CVV', 'Credit Card Code:'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT _CARD_EXPIRES', 'Credit Card Expiry Date:'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_JS_CC_ OWNER', '* The owner\'s name of the credit card must be at least ' . CC_OWNER_MIN_LENGTH . ' characters.\n'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_JS_CC_ NUMBER', '* The credit card number must be at least ' . CC_NUMBER_MIN_LENGTH . ' characters.\n'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_ERROR_ MESSAGE', 'There has been an error processing your credit card. Please try again.'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_DECLIN ED_MESSAGE', 'Your credit card was declined. Please try another card or contact your bank for more info.'); define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_ERROR' , 'Credit Card Error!'); ?> 2) authorizenetaim.php This file placed in /catalog/includes/modules/payment/ <?php /* osCommerce 2.2 MS2 Open Source E-Commerce Solutions Authorizenet ADC Direct Connection Author: Bao Nguyen Email: baonguyenx@yahoo.com Last Update: May 2, 2004 By: eCartz.com, Inc. Changes made by eCartz.com, Inc copyright 2004 Some material is probably copyright osCommerce. It was not previously marked. Also includes text from a file with the following couple lines: Co-Author: Peter Drake Email: drakepj1@gcc.edu */ class authorizenetaim { var $code, $title, $description, $enabled; // class constructor function authorizenetaim() { $this->code = 'authorizenetaim'; $this->title = MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_TITLE; $this->description = MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_DESCRIPTION; $this->enabled = ((MODULE_PAYMENT_AUTHORIZENETAIM_STATUS == 'True') ? true : false); $this->error = ''; // Change made by using ADC Direct Connection $this->form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false); } // class methods function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.checkout_payment.authorizenetaim_cc_owner .value;' . "\n" . ' var cc_number = document.checkout_payment.authorizenetaim_cc_numbe r.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_AUTHORIZENETAIM_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_AUTHORIZENETAIM_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } 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' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_OW NER, 'field' => tep_draw_input_field('authorizenetaim_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_NU MBER, 'field' => tep_draw_input_field('authorizenetaim_cc_number')) , array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_CV V, 'field' => tep_draw_input_field('authorizenetaim_cc_cvv', '', 'size="4"')), array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_EX PIRES, 'field' => tep_draw_pull_down_menu('authorizenetaim_cc_expire s_month', $expires_month) . '&nbsp;' . tep_draw_pull_down_menu('authorizenetaim_cc_expire s_year', $expires_year)))); return $selection; } function pre_confirmation_check() { global $HTTP_POST_VARS, $cc_array; include(DIR_WS_CLASSES . 'cc_validation.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['authorizenetaim_cc_number'], $HTTP_POST_VARS['authorizenetaim_cc_expires_month'], $HTTP_POST_VARS['authorizenetaim_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) . '&authorizenetaim_cc_owner=' . urlencode($HTTP_POST_VARS['authorizenetaim_cc_owner']) . '&authorizenetaim_cc_expires_month=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_month'] . '&authorizenetaim_cc_expires_year=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYME NT, $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; $this->cc_cvv = $HTTP_POST_VARS['authorizenetaim_cc_cvv']; tep_session_register('cc_array'); $cc_array = array('card_type' => $this->cc_card_type, 'card_number' => $this->cc_card_number, 'card_code' => $this->cc_cvv, 'expiration' => $this->cc_expiry_month . substr($this->cc_expiry_year, -2)); } function confirmation() { global $HTTP_POST_VARS; $confirmation = array('title' => $this->title . ': ' . $this->cc_card_type, 'fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_OW NER, 'field' => $HTTP_POST_VARS['authorizenetaim_cc_owner']), array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_NU MBER, '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_AUTHORIZENETAIM_TEXT_CREDIT_CARD_EX PIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['authorizenetaim_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['authorizenetaim_cc_expires_year']))))); return $confirmation; } function process_button() { // Change made by using ADC Direct Connection $process_button_string = tep_draw_hidden_field(tep_session_name(), tep_session_id()); return $process_button_string; } function before_process() { global $customer_id, $order, $HTTP_POST_VARS, $HTTP_SERVER_VARS, $cc_array; $form_data = array( 'x_login' => MODULE_PAYMENT_AUTHORIZENETAIM_LOGIN, 'x_tran_key' => MODULE_PAYMENT_AUTHORIZENETAIM_PASSWORD, 'x_ADC_Delim_Data' => 'TRUE', 'x_ADC_URL' => 'FALSE', 'x_version' => '3.1', 'x_type' => 'AUTH_ONLY', 'x_method' => MODULE_PAYMENT_AUTHORIZENETAIM_METHOD, 'x_amount' => number_format($order->info['total'], 2), 'x_card_num' => $cc_array['card_number'], 'x_exp_date' => $cc_array['expiration'], 'x_card_code' => $cc_array['card_code'], 'x_email_customer' => MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL == '1' ? 'TRUE': 'FALSE', 'x_email_merchant' => MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_MERCHANT == '1' ? 'TRUE': 'FALSE', 'x_cust_id' => $customer_id, 'x_first_name' => $order->customer['firstname'], 'x_last_name' => $order->customer['lastname'], 'x_address' => $order->billing['street_address'], 'x_city' => $order->billing['city'], 'x_state' => $order->billing['state'], 'x_zip' => $order->billing['postcode'], 'x_country' => $order->billing['country']['title'], 'x_phone' => $order->customer['telephone'], 'x_email' => $order->customer['email_address'], 'x_ship_to_first_name' => $order->delivery['firstname'], 'x_ship_to_last_name' => $order->delivery['lastname'], 'x_ship_to_address' => $order->delivery['street_address'], 'x_ship_to_city' => $order->delivery['city'], 'x_ship_to_state' => $order->delivery['state'], 'x_ship_to_zip' => $order->delivery['postcode'], 'x_ship_to_country' => $order->delivery['country']['title'], 'x_customer_ip' => $HTTP_SERVER_VARS['REMOTE_ADDR'], 'x_description' => 'Your Products Description', tep_session_name() => tep_session_id()); if (tep_not_null($this->cc_cvv)) { $form_data['x_card_code'] = $this->cc_cvv; } if (MODULE_PAYMENT_AUTHORIZENETAIM_TESTMODE == 'Test') { $form_data['x_test_request'] = 'TRUE'; } // concatenate order information variables to $data while(list($key, $value) = each($form_data)) { $data .= $key . '=' . urlencode(ereg_replace(',', '', $value)) . '&'; } // take the last & out for the string $data = substr($data, 0, -1); // Post order info data to Authorize.net, make sure you have curl installed if (MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH != 'none') { exec(MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH . ' -d "' . $data . '" https://secure.authorize.net/gateway/transact.dll', $response); } else { // BEGIN PHP_CURL.DLL CODE - Author: Peter Drake - 4/29/03 // Use for Win32 or Unix-type systems with php-curl.dll // Get a CURL handle $curl_handle = curl_init(); // Tell CURL the URL of the CGI curl_setopt($curl_handle, CURLOPT_URL, "https://secure.authorize.net/gateway/transact.dll"); // This section sets various options. See http://www.php.net/manual/en/function.curl-setopt.php // for more details curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data); // Perform the POST and get the data returned by the server. $response = curl_exec ($curl_handle) or die ("There has been an error connecting to Authorize.net."); // Close the CURL handle curl_close ($curl_handle); //END PUP_CURL.DLL CODE } // Change made by using ADC Direct Connection $response_vars = explode(',', $response); if ($response_vars[0] != '1') { $this->error = array('title' => $response_vars[3], 'error' => stripslashes(urldecode($response_vars[2]))); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYME NT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_ERRO R_MESSAGE . implode(': ', $this->error)), 'SSL', true, false)); } else { if (!tep_session_is_registered('cc_transaction_id')) { tep_session_register('cc_transaction_id'); } global $cc_transaction_id; $cc_transaction_id = $response_vars[6]; } } function after_process() { tep_session_unregister('cc_array'); return false; } function get_error() { return $this->error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_AUTHORIZENETAIM_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Authorize.net Module', 'MODULE_PAYMENT_AUTHORIZENETAIM_STATUS', 'True', 'Do you want to accept Authorize.net payments via AIM?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Curl Path', 'MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH', 'none', 'Pathname to the curl executable. Set as none to use the built-in PHP curl functions.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login Username', 'MODULE_PAYMENT_AUTHORIZENETAIM_LOGIN', 'testing', 'The login username used for the Authorize.net service', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login Password', 'MODULE_PAYMENT_AUTHORIZENETAIM_PASSWORD', 'testing', 'The login password used for the Authorize.net service', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_AUTHORIZENETAIM_TESTMODE', 'Test', 'Transaction mode used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Method', 'MODULE_PAYMENT_AUTHORIZENETAIM_METHOD', 'Credit Card', 'Transaction method used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'Credit Card\', \'eCheck\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Customer Notifications', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_CUSTOMER', 'False', 'Should Authorize.Net e-mail a receipt to the customer?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Merchant Notifications', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_MERCHANT', 'True', 'Should Authorize.Net e-mail a receipt to the store owner?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Authorizenet - Sort order of display.', 'MODULE_PAYMENT_AUTHORIZENETAIM_SORT_ORDER', '0', 'Authorizenet - Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Authorizenet - Payment Zone', 'MODULE_PAYMENT_AUTHORIZENETAIM_ZONE', '0', 'Authorizenet - If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Authorizenet - Set Order Status', 'MODULE_PAYMENT_AUTHORIZENETAIM_ORDER_STATUS_ID', '0', 'Authorizenet - Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { $keys = ''; $keys_array = $this->keys(); for ($i=0; $i<sizeof($keys_array); $i++) { $keys .= "'" . $keys_array[$i] . "',"; } $keys = substr($keys, 0, -1); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")"); } function keys() { return array('MODULE_PAYMENT_AUTHORIZENETAIM_STATUS', 'MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH', 'MODULE_PAYMENT_AUTHORIZENETAIM_LOGIN', 'MODULE_PAYMENT_AUTHORIZENETAIM_PASSWORD', 'MODULE_PAYMENT_AUTHORIZENETAIM_TESTMODE', 'MODULE_PAYMENT_AUTHORIZENETAIM_METHOD', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_CUSTOMER', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_MERCHANT', 'MODULE_PAYMENT_AUTHORIZENETAIM_ZONE', 'MODULE_PAYMENT_AUTHORIZENETAIM_ORDER_STATUS_ID', 'MODULE_PAYMENT_AUTHORIZENETAIM_SORT_ORDER'); } } ?> 3) In Admin Panel > modules > payment : Remove authorize.net Install Authorize.net AIM > install edit options curl path = none
__________________ will work for foo! |
|
#3
| |||
| |||
| Here is the last post in a different format. Easier to copy and pastOS_Max Repair of Authorize.net If credit cards rejected on error because /user/bin/curl broken on server This fix works around processing the authorize.net functions on the server using curl and processes them via php instead. 3 steps. 1): authorizenetaim.php This file placed placed in /catalog/includes/languages/english/modules/payment/ Code: <?php
/*
$Id: authorizenetaim.php,v 1.1 2003/07/11 14:40:27 ecartz Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Copyright (c) 2004 eCartz.com, Inc.
Released under the GNU General Public License
*/
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_TITLE', 'Authorize.net AIM');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_DESCRIPTION', 'Credit Card Test Info:<br><br>CC#: 4111111111111111<br>Expiry: Any');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_TYPE', 'Type:');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_OWNER', 'Credit Card Owner:');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_NUMBER', 'Credit Card Number:');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_CVV', 'Credit Card Code:');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_EXPIRES', 'Credit Card Expiry Date:');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_JS_CC_OWNER', '* The owner\'s name of the credit card must be at least ' . CC_OWNER_MIN_LENGTH . ' characters.\n');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_JS_CC_NUMBER', '* The credit card number must be at least ' . CC_NUMBER_MIN_LENGTH . ' characters.\n');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_ERROR_MESSAGE', 'There has been an error processing your credit card. Please try again.');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_DECLINED_MESSAGE', 'Your credit card was declined. Please try another card or contact your bank for more info.');
define('MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_ERROR', 'Credit Card Error!');
?>
This file placed in /catalog/includes/modules/payment/ Code: <?php /* osCommerce 2.2 MS2 Open Source E-Commerce Solutions Authorizenet ADC Direct Connection Author: Bao Nguyen Email: baonguyenx@yahoo.com Last Update: May 2, 2004 By: eCartz.com, Inc. Changes made by eCartz.com, Inc copyright 2004 Some material is probably copyright osCommerce. It was not previously marked. Also includes text from a file with the following couple lines: Co-Author: Peter Drake Email: drakepj1@gcc.edu */ class authorizenetaim { var $code, $title, $description, $enabled; // class constructor function authorizenetaim() { $this->code = 'authorizenetaim'; $this->title = MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_TITLE; $this->description = MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_DESCRIPTION; $this->enabled = ((MODULE_PAYMENT_AUTHORIZENETAIM_STATUS == 'True') ? true : false); $this->error = ''; // Change made by using ADC Direct Connection $this->form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false); } // class methods function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.checkout_payment.authorizenetaim_cc_owner.value;' . "\n" . ' var cc_number = document.checkout_payment.authorizenetaim_cc_number.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_AUTHORIZENETAIM_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_AUTHORIZENETAIM_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } 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' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('authorizenetaim_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('authorizenetaim_cc_number')), array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_CVV, 'field' => tep_draw_input_field('authorizenetaim_cc_cvv', '', 'size="4"')), array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('authorizenetaim_cc_expires_month', $expires_month) . '&nbsp;' . tep_draw_pull_down_menu('authorizenetaim_cc_expires_year', $expires_year)))); return $selection; } function pre_confirmation_check() { global $HTTP_POST_VARS, $cc_array; include(DIR_WS_CLASSES . 'cc_validation.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['authorizenetaim_cc_number'], $HTTP_POST_VARS['authorizenetaim_cc_expires_month'], $HTTP_POST_VARS['authorizenetaim_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) . '&authorizenetaim_cc_owner=' . urlencode($HTTP_POST_VARS['authorizenetaim_cc_owner']) . '&authorizenetaim_cc_expires_month=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_month'] . '&authorizenetaim_cc_expires_year=' . $HTTP_POST_VARS['authorizenetaim_cc_expires_year']; tep_redirect(tep_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; $this->cc_cvv = $HTTP_POST_VARS['authorizenetaim_cc_cvv']; tep_session_register('cc_array'); $cc_array = array('card_type' => $this->cc_card_type, 'card_number' => $this->cc_card_number, 'card_code' => $this->cc_cvv, 'expiration' => $this->cc_expiry_month . substr($this->cc_expiry_year, -2)); } function confirmation() { global $HTTP_POST_VARS; $confirmation = array('title' => $this->title . ': ' . $this->cc_card_type, 'fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['authorizenetaim_cc_owner']), array('title' => MODULE_PAYMENT_AUTHORIZENETAIM_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_AUTHORIZENETAIM_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['authorizenetaim_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['authorizenetaim_cc_expires_year']))))); return $confirmation; } function process_button() { // Change made by using ADC Direct Connection $process_button_string = tep_draw_hidden_field(tep_session_name(), tep_session_id()); return $process_button_string; } function before_process() { global $customer_id, $order, $HTTP_POST_VARS, $HTTP_SERVER_VARS, $cc_array; $form_data = array( 'x_login' => MODULE_PAYMENT_AUTHORIZENETAIM_LOGIN, 'x_tran_key' => MODULE_PAYMENT_AUTHORIZENETAIM_PASSWORD, 'x_ADC_Delim_Data' => 'TRUE', 'x_ADC_URL' => 'FALSE', 'x_version' => '3.1', 'x_type' => 'AUTH_ONLY', 'x_method' => MODULE_PAYMENT_AUTHORIZENETAIM_METHOD, 'x_amount' => number_format($order->info['total'], 2), 'x_card_num' => $cc_array['card_number'], 'x_exp_date' => $cc_array['expiration'], 'x_card_code' => $cc_array['card_code'], 'x_email_customer' => MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL == '1' ? 'TRUE': 'FALSE', 'x_email_merchant' => MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_MERCHANT == '1' ? 'TRUE': 'FALSE', 'x_cust_id' => $customer_id, 'x_first_name' => $order->customer['firstname'], 'x_last_name' => $order->customer['lastname'], 'x_address' => $order->billing['street_address'], 'x_city' => $order->billing['city'], 'x_state' => $order->billing['state'], 'x_zip' => $order->billing['postcode'], 'x_country' => $order->billing['country']['title'], 'x_phone' => $order->customer['telephone'], 'x_email' => $order->customer['email_address'], 'x_ship_to_first_name' => $order->delivery['firstname'], 'x_ship_to_last_name' => $order->delivery['lastname'], 'x_ship_to_address' => $order->delivery['street_address'], 'x_ship_to_city' => $order->delivery['city'], 'x_ship_to_state' => $order->delivery['state'], 'x_ship_to_zip' => $order->delivery['postcode'], 'x_ship_to_country' => $order->delivery['country']['title'], 'x_customer_ip' => $HTTP_SERVER_VARS['REMOTE_ADDR'], 'x_description' => 'Your Products Description', tep_session_name() => tep_session_id()); if (tep_not_null($this->cc_cvv)) { $form_data['x_card_code'] = $this->cc_cvv; } if (MODULE_PAYMENT_AUTHORIZENETAIM_TESTMODE == 'Test') { $form_data['x_test_request'] = 'TRUE'; } // concatenate order information variables to $data while(list($key, $value) = each($form_data)) { $data .= $key . '=' . urlencode(ereg_replace(',', '', $value)) . '&'; } // take the last & out for the string $data = substr($data, 0, -1); // Post order info data to Authorize.net, make sure you have curl installed if (MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH != 'none') { exec(MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH . ' -d "' . $data . '" https://secure.authorize.net/gateway/transact.dll', $response); } else { // BEGIN PHP_CURL.DLL CODE - Author: Peter Drake - 4/29/03 // Use for Win32 or Unix-type systems with php-curl.dll // Get a CURL handle $curl_handle = curl_init(); // Tell CURL the URL of the CGI curl_setopt($curl_handle, CURLOPT_URL, "https://secure.authorize.net/gateway/transact.dll"); // This section sets various options. See http://www.php.net/manual/en/function.curl-setopt.php // for more details curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data); // Perform the POST and get the data returned by the server. $response = curl_exec ($curl_handle) or die ("There has been an error connecting to Authorize.net."); // Close the CURL handle curl_close ($curl_handle); //END PUP_CURL.DLL CODE } // Change made by using ADC Direct Connection $response_vars = explode(',', $response); if ($response_vars[0] != '1') { $this->error = array('title' => $response_vars[3], 'error' => stripslashes(urldecode($response_vars[2]))); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_ERROR_MESSAGE . implode(': ', $this->error)), 'SSL', true, false)); } else { if (!tep_session_is_registered('cc_transaction_id')) { tep_session_register('cc_transaction_id'); } global $cc_transaction_id; $cc_transaction_id = $response_vars[6]; } } function after_process() { tep_session_unregister('cc_array'); return false; } function get_error() { return $this->error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_AUTHORIZENETAIM_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Authorize.net Module', 'MODULE_PAYMENT_AUTHORIZENETAIM_STATUS', 'True', 'Do you want to accept Authorize.net payments via AIM?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Curl Path', 'MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH', 'none', 'Pathname to the curl executable. Set as none to use the built-in PHP curl functions.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login Username', 'MODULE_PAYMENT_AUTHORIZENETAIM_LOGIN', 'testing', 'The login username used for the Authorize.net service', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login Password', 'MODULE_PAYMENT_AUTHORIZENETAIM_PASSWORD', 'testing', 'The login password used for the Authorize.net service', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_AUTHORIZENETAIM_TESTMODE', 'Test', 'Transaction mode used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Method', 'MODULE_PAYMENT_AUTHORIZENETAIM_METHOD', 'Credit Card', 'Transaction method used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'Credit Card\', \'eCheck\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Customer Notifications', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_CUSTOMER', 'False', 'Should Authorize.Net e-mail a receipt to the customer?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Merchant Notifications', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_MERCHANT', 'True', 'Should Authorize.Net e-mail a receipt to the store owner?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Authorizenet - Sort order of display.', 'MODULE_PAYMENT_AUTHORIZENETAIM_SORT_ORDER', '0', 'Authorizenet - Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Authorizenet - Payment Zone', 'MODULE_PAYMENT_AUTHORIZENETAIM_ZONE', '0', 'Authorizenet - If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Authorizenet - Set Order Status', 'MODULE_PAYMENT_AUTHORIZENETAIM_ORDER_STATUS_ID', '0', 'Authorizenet - Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { $keys = ''; $keys_array = $this->keys(); for ($i=0; $i<sizeof($keys_array); $i++) { $keys .= "'" . $keys_array[$i] . "',"; } $keys = substr($keys, 0, -1); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")"); } function keys() { return array('MODULE_PAYMENT_AUTHORIZENETAIM_STATUS', 'MODULE_PAYMENT_AUTHORIZENETAIM_CURL_PATH', 'MODULE_PAYMENT_AUTHORIZENETAIM_LOGIN', 'MODULE_PAYMENT_AUTHORIZENETAIM_PASSWORD', 'MODULE_PAYMENT_AUTHORIZENETAIM_TESTMODE', 'MODULE_PAYMENT_AUTHORIZENETAIM_METHOD', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_CUSTOMER', 'MODULE_PAYMENT_AUTHORIZENETAIM_EMAIL_MERCHANT', 'MODULE_PAYMENT_AUTHORIZENETAIM_ZONE', 'MODULE_PAYMENT_AUTHORIZENETAIM_ORDER_STATUS_ID', 'MODULE_PAYMENT_AUTHORIZENETAIM_SORT_ORDER'); } } ?> > modules > payment : Remove authorize.net Install Authorize.net AIM > install edit options curl path = none |
|
#4
| |||
| |||
| A few weeks ago after installing osCMax 1.7.2 I ran into this credit card problem and used this "AIM" fix, which worked like a charm. Now I needed to reinstall the same online store, went through the same process. For some reason I now run into a problem when I install "AIM" in the Modules-Payment page. Getting: "Fatal error: Cannot instantiate non-existent class: authorizenetaim in /home/nordtcom/public_html/catalog/admin/modules.php on line 58" The modules.php file is the same as before, straight out of the box. How come the class was recognized a few weeks ago and not now? Any idea will be appreciated.
__________________ Marinus Internet Shoppes |
| Sponsored Links | ||
| ||
| |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Default install credit card and shipping problems | fourmat | osCMax v2 Installation issues | 3 | 06-02-2006 02:28 PM |
| Problems with My Account and adding Credit Card processing | nakadude | osCommerce 2.2 Modification Help | 0 | 04-18-2005 07:33 AM |
| Help with EPN credit card processing | joanstead | osCommerce 2.2 Modification Help | 1 | 03-08-2005 04:55 PM |
| Credit Card number problems! | bibleman | osCommerce 2.2 Modification Help | 4 | 08-11-2004 11:15 AM |
| Problems with Secure Credit Card - GPG | nscmonkey | osCommerce 2.2 Modification Help | 4 | 07-09-2004 01:27 PM |