♥Vger Posted March 13, 2006 Share Posted March 13, 2006 (edited) This is a new support thread created for a new and updated version of the AuthorizeNet AIM (Advanced Integration Method) module, released under GPL. The module is located here: http://www.oscommerce.com/community/contributions,4091 Vger Edited March 13, 2006 by Vger SypePecezen 1 Quote Link to comment Share on other sites More sharing options...
devosc Posted March 13, 2006 Share Posted March 13, 2006 I havent installed and ran it but // Calculate the next expected order id $last_order_id = tep_db_query("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); Doesnt look like osCommerce MS2-2.2 code. If I can recall it should look something like $rQuery = tep_db_query("select orders_id from " . TABLE_ORDERS . " order by orders_id desc limit 1"); $new_order_id = $rQuery['orders_id'] + 1; Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
devosc Posted March 13, 2006 Share Posted March 13, 2006 $rQuery = tep_db_query("select orders_id from " . TABLE_ORDERS . " order by orders_id desc limit 1"); $aQuery = tep_db_fetch_array($rQuery); $new_order_id = $aQuery['orders_id'] + 1; Quote "Any fool can know. The point is to understand." -- Albert Einstein Link to comment Share on other sites More sharing options...
♥Vger Posted March 14, 2006 Author Share Posted March 14, 2006 I have added some additional information to the Install file so as to provide some extra info about switching between Test and Live mode. Vger darknessgc 1 Quote Link to comment Share on other sites More sharing options...
rkoechel2004 Posted March 14, 2006 Share Posted March 14, 2006 So I tried out this contribution. When I process do a live transaction it goes through as successfull to authorizenet but returns an error message to the customer: - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance. and on the oscommerce side it does go through as a succesful order. Any thoughts? I have added some additional information to the Install file so as to provide some extra info about switching between Test and Live mode. Vger Quote rkoechel2004 Link to comment Share on other sites More sharing options...
rkoechel2004 Posted March 14, 2006 Share Posted March 14, 2006 I thought i'd add some details to this: I had authorizenet work before and uninstalled that module before installing this one. I have register globals set to off. and curl is compiled here is the code of the authorizenet contrib i had working previously: includes/modules/payment/authorizenet2.php: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ class authorizenet2 { var $code, $title, $description, $enabled, $sort_order, $order_status, $form_action_url; var $cc_card_type, $cc_card_number, $cc_expiry_month, $cc_expiry_year; // class constructor function authorizenet2() { global $order; $this->code = 'authorizenet2'; $this->title = MODULE_PAYMENT_AUTHORIZENET2_TEXT_TITLE; $this->description = MODULE_PAYMENT_AUTHORIZENET2_TEXT_DESCRIPTION; $this->enabled = ((MODULE_PAYMENT_AUTHORIZENET2_STATUS == 'True') ? true : false); $this->sort_order = MODULE_PAYMENT_AUTHORIZENET2_SORT_ORDER; if ((int)MODULE_PAYMENT_AUTHORIZENET2_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_AUTHORIZENET2_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); if (MODULE_PAYMENT_AUTHORIZENET2_GATEWAY_METHOD == 'SIM') { $this->form_action_url = 'https://secure.authorize.net/gateway/transact.dll'; // } else $this->process_action_url = 'https://certification.authorize.net/gateway/transact.dll'; } else $this->process_action_url = 'https://secure.authorize.net/gateway/transact.dll'; } // Authorize.net utility functions // DISCLAIMER: // This code is distributed in the hope that it will be useful, but without any warranty; // without even the implied warranty of merchantability or fitness for a particular purpose. // Main Interfaces: // // function InsertFP ($loginid, $txnkey, $amount, $sequence) - Insert HTML form elements required for SIM // function CalculateFP ($loginid, $txnkey, $amount, $sequence, $tstamp) - Returns Fingerprint. // compute HMAC-MD5 // Uses PHP mhash extension. Pl sure to enable the extension // function hmac ($key, $data) { // return (bin2hex (mhash(MHASH_MD5, $data, $key))); //} // Thanks is lance from http://www.php.net/manual/en/function.mhash.php //lance_rushing at hot* spamfree *mail dot com //27-Nov-2002 09:36 // //Want to Create a md5 HMAC, but don't have hmash installed? // //Use this: function hmac ($key, $data) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing $b = 64; // byte length for md5 if (strlen($key) > $B) { $key = pack("H*",md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack("H*",md5($k_ipad . $data))); } // end code from lance (resume authorize.net code) // Calculate and return fingerprint // Use when you need control on the HTML output function CalculateFP ($loginid, $txnkey, $amount, $sequence, $tstamp, $currency = "") { return ($this->hmac ($txnkey, $loginid . "^" . $sequence . "^" . $tstamp . "^" . $amount . "^" . $currency)); } // Inserts the hidden variables in the HTML FORM required for SIM // Invokes hmac function to calculate fingerprint. function InsertFP ($loginid, $txnkey, $amount, $sequence, $currency = "") { $tstamp = time (); $fingerprint = $this->hmac ($txnkey, $loginid . "^" . $sequence . "^" . $tstamp . "^" . $amount . "^" . $currency); $vars = array('x_fp_sequence' => $sequence, 'x_fp_timestamp' => $tstamp, 'x_fp_hash' => $fingerprint); return $vars; } // end authorize.net code // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_AUTHORIZENET2_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_AUTHORIZENET2_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.checkout_payment.authorizenet2_cc_owner.value;' . "\n" . ' var cc_number = document.checkout_payment.authorizenet2_cc_number.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_AUTHORIZENET2_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_AUTHORIZENET2_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } function selection() { global $order; if (MODULE_PAYMENT_AUTHORIZENET2_METHOD == 'Credit Card') { 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_AUTHORIZENET2_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('authorizenet2_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('authorizenet2_cc_number')), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('authorizenet2_cc_expires_month', $expires_month, $today['mon']) . ' ' . tep_draw_pull_down_menu('authorizenet2_cc_expires_year', $expires_year)))); } else { // eCheck $acct_types = array(array('id' => 'CHECKING', 'text' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_TYPE_CHECK), array('id' => 'SAVINGS', 'text' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_TYPE_SAVINGS)); $org_types = array(array('id' => 'I', 'text' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_ORG_PERSONAL), array('id' => 'B', 'text' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_ORG_BUSINESS)); $fields = array(array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_NAME, 'field' => tep_draw_input_field('authorizenet2_bank_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_TYPE, 'field' => tep_draw_pull_down_menu('authorizenet2_bank_acct_type', $acct_types)), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_NAME, 'field' => tep_draw_input_field('authorizenet2_bank_name')), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ABA_CODE, 'field' => tep_image('images/symbol_route.gif') . tep_draw_input_field('authorizenet2_bank_aba') . tep_image('images/symbol_route.gif')), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_NUM, 'field' => tep_draw_input_field('authorizenet2_bank_acct'). tep_image('images/symbol_account.gif')), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_SAMPLE_CHECK_NAME, 'field' => tep_image('images/checksample.gif'))); if (MODULE_PAYMENT_AUTHORIZENET2_WELLSFARGO == 'Yes') { // Add extra fields $fields_wf = array(array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_ORG, 'field' => tep_draw_pull_down_menu('wellsfargo_org_type', $org_types)), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_INTRO, 'field' => ''), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_TAXID, 'field' => tep_draw_input_field('wellsfargo_taxid')), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_DLNUM, 'field' => tep_draw_input_field('wellsfargo_dlnum')), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_STATE, 'field' => tep_draw_input_field('wellsfargo_state')), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_DOB, 'field' => tep_draw_input_field('wellsfargo_dob'))); $fields = array_merge($fields, $fields_wf); } $selection = array('id' => $this->code, 'module' => $this->title, 'fields' => $fields); } return $selection; } function pre_confirmation_check() { global $HTTP_POST_VARS; if (MODULE_PAYMENT_AUTHORIZENET2_METHOD == 'Credit Card') { include(DIR_WS_CLASSES . 'cc_validation.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['authorizenet2_cc_number'], $HTTP_POST_VARS['authorizenet2_cc_expires_month'], $HTTP_POST_VARS['authorizenet2_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) . '&authorizenet2_cc_owner=' . urlencode($HTTP_POST_VARS['authorizenet2_cc_owner']) . '&authorizenet2_cc_expires_month=' . $HTTP_POST_VARS['authorizenet2_cc_expires_month'] . '&authorizenet2_cc_expires_year=' . $HTTP_POST_VARS['authorizenet2_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; } } function confirmation() { global $HTTP_POST_VARS; if (MODULE_PAYMENT_AUTHORIZENET2_METHOD == 'Credit Card') { $confirmation = array('title' => $this->title . ': ' . $this->cc_card_type, 'fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['authorizenet2_cc_owner']), array('title' => MODULE_PAYMENT_AUTHORIZENET2_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_AUTHORIZENET2_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$this->cc_expiry_month, 1, $this->cc_expiry_year))))); } else { // eCheck $fields = array(array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_NAME, 'field' => $HTTP_POST_VARS['authorizenet2_bank_owner']), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_TYPE, 'field' => $HTTP_POST_VARS['authorizenet2_bank_acct_type']), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_NAME, 'field' => $HTTP_POST_VARS['authorizenet2_bank_name']), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ABA_CODE, 'field' => $HTTP_POST_VARS['authorizenet2_bank_aba']), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_BANK_ACCT_NUM, 'field' => $HTTP_POST_VARS['authorizenet2_bank_acct'])); if (MODULE_PAYMENT_AUTHORIZENET2_WELLSFARGO == 'Yes') { // Add extra fields if (tep_not_null($HTTP_POST_VARS['wellsfargo_taxid'])) { $fields_wf = array(array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_TAXID, 'field' => $HTTP_POST_VARS['wellsfargo_taxid'])); } else { $fields_wf = array(array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_DLNUM, 'field' => $HTTP_POST_VARS['wellsfargo_dlnum']), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_STATE, 'field' => $HTTP_POST_VARS['wellsfargo_state']), array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_WF_DOB, 'field' => $HTTP_POST_VARS['wellsfargo_dob'])); } $fields = array_merge($fields, $fields_wf); } $confirmation = array('title' => $this->title . ' : eCheck', 'fields' => $fields); } return $confirmation; } function make_gateway_vars() { global $HTTP_SERVER_VARS, $order, $customer_id; if (MODULE_PAYMENT_AUTHORIZENET2_METHOD == 'Credit Card') { $gw_pay_type = array('x_Card_Num' => $this->cc_card_number, 'x_Exp_Date' => $this->cc_expiry_month . substr($this->cc_expiry_year, -2), 'x_Type' => MODULE_PAYMENT_AUTHORIZENET2_CREDIT_CAPTURE, 'x_Method' => 'CC'); } if (MODULE_PAYMENT_AUTHORIZENET2_METHOD == 'eCheck') { $gw_pay_type = array('x_bank_acct_name' => $this->ec_bank_owner, 'x_bank_acct_type' => $this->ec_bank_acct_type, 'x_bank_name' => $this->ec_bank_name, 'x_bank_aba_code' => $this->ec_bank_aba, 'x_bank_acct_num' => $this->ec_bank_acct, 'x_Type' => 'AUTH_CAPTURE', 'x_echeck_type' => 'WEB', 'x_Method' => 'ECHECK'); if (MODULE_PAYMENT_AUTHORIZENET2_WELLSFARGO == 'Yes') { // Add extra fields if (tep_not_null($this->wf_taxid)) { $gw_pay_type2 = array('x_customer_tax_id' => $this->wf_taxid, 'x_customer_organization_type' => $this->wf_org_type); } else { $gw_pay_type2 = array('x_drivers_license_number' => $this->wf_dlnum, 'x_drivers_license_state' => $this->wf_state, 'x_drivers_license_dob' => $this->wf_dob, 'x_customer_organization_type' => $this->wf_org_type); } $gw_pay_type = array_merge($gw_pay_type, $gw_pay_type2); } } $gw_common= array('x_Login' => MODULE_PAYMENT_AUTHORIZENET2_LOGIN, 'x_tran_key' => MODULE_PAYMENT_AUTHORIZENET2_TXNKEY, 'x_Amount' => number_format($order->info['total'], 2), 'x_Version' => '3.0', 'x_Cust_ID' => $customer_id, 'x_Email_Customer' => ((MODULE_PAYMENT_AUTHORIZENET2_EMAIL_CUSTOMER == 'True') ? 'TRUE': 'FALSE'), 'x_first_name' => $order->billing['firstname'], 'x_last_name' => $order->billing['lastname'], 'x_company' => $order->billing['company'], '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']); $gw_vars = array_merge($gw_common, $gw_pay_type); return $gw_vars; } function process_button() { $process_button_string = ''; if (MODULE_PAYMENT_AUTHORIZENET2_GATEWAY_METHOD == 'SIM') { $gw_vars = $this->make_gateway_vars(); $sequence = rand(1, 1000); $gw_vars = array_merge($gw_vars, $this->InsertFP(MODULE_PAYMENT_AUTHORIZENET2_LOGIN, MODULE_PAYMENT_AUTHORIZENET2_TXNKEY, $gw_vars['X_Amount'], $sequence)); $gw_vars['x_Relay_URL'] = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false); $gw_vars['x_Relay_Response'] = 'TRUE'; $gw_vars['x_delim_data'] = 'TRUE'; $gw_vars['x_delim_char'] = '|'; if (MODULE_PAYMENT_AUTHORIZENET2_TESTMODE == 'Test') $gw_vars['x_Test_Request'] = 'TRUE'; $gw_vars[tep_session_name()] = tep_session_id(); reset($gw_vars); while (list($key, $value) = each($gw_vars)) { $process_button_string .= tep_draw_hidden_field($key, $value) . "\n"; } } else { if (MODULE_PAYMENT_AUTHORIZENET2_METHOD == 'Credit Card') { $process_button_string .= tep_draw_hidden_field('authorizenet2_cc_number', $this->cc_card_number) . "\n"; $process_button_string .= tep_draw_hidden_field('authorizenet2_cc_expiry_month', $this->cc_expiry_month) . "\n"; $process_button_string .= tep_draw_hidden_field('authorizenet2_cc_expiry_year', $this->cc_expiry_year) . "\n"; } else { // eCheck $process_button_string .= tep_draw_hidden_field('authorizenet2_bank_owner', $HTTP_POST_VARS['authorizenet2_bank_owner']) . "\n"; $process_button_string .= tep_draw_hidden_field('authorizenet2_bank_acct_type', $HTTP_POST_VARS['authorizenet2_bank_acct_type']) . "\n"; $process_button_string .= tep_draw_hidden_field('authorizenet2_bank_name', $HTTP_POST_VARS['authorizenet2_bank_name']) . "\n"; $process_button_string .= tep_draw_hidden_field('authorizenet2_bank_aba', $HTTP_POST_VARS['authorizenet2_bank_aba']) . "\n"; $process_button_string .= tep_draw_hidden_field('authorizenet2_bank_acct', $HTTP_POST_VARS['authorizenet2_bank_acct']) . "\n"; if (MODULE_PAYMENT_AUTHORIZENET2_WELLSFARGO == 'Yes') { // Add extra fields $process_button_string .= tep_draw_hidden_field('wellsfargo_taxid', $HTTP_POST_VARS['wellsfargo_taxid']) . "\n"; $process_button_string .= tep_draw_hidden_field('wellsfargo_dlnum', $HTTP_POST_VARS['wellsfargo_dlnum']) . "\n"; $process_button_string .= tep_draw_hidden_field('wellsfargo_state', $HTTP_POST_VARS['wellsfargo_state']) . "\n"; $process_button_string .= tep_draw_hidden_field('wellsfargo_dob', $HTTP_POST_VARS['wellsfargo_dob']) . "\n"; $process_button_string .= tep_draw_hidden_field('wellsfargo_org_type', $HTTP_POST_VARS['wellsfargo_org_type']) . "\n"; } } } return $process_button_string; } function before_process() { global $HTTP_POST_VARS; if (MODULE_PAYMENT_AUTHORIZENET2_GATEWAY_METHOD == 'AIM') { if (MODULE_PAYMENT_AUTHORIZENET2_METHOD == 'Credit Card') { $this->cc_card_number = $HTTP_POST_VARS['authorizenet2_cc_number']; $this->cc_expiry_month = $HTTP_POST_VARS['authorizenet2_cc_expiry_month']; $this->cc_expiry_year = $HTTP_POST_VARS['authorizenet2_cc_expiry_year']; } else { // eCheck $this->ec_bank_owner = $HTTP_POST_VARS['authorizenet2_bank_owner']; $this->ec_bank_acct_type = $HTTP_POST_VARS['authorizenet2_bank_acct_type']; $this->ec_bank_name = $HTTP_POST_VARS['authorizenet2_bank_name']; $this->ec_bank_aba = $HTTP_POST_VARS['authorizenet2_bank_aba']; $this->ec_bank_acct = $HTTP_POST_VARS['authorizenet2_bank_acct']; if (MODULE_PAYMENT_AUTHORIZENET2_WELLSFARGO == 'Yes') { // Add extra fields $this->wf_taxid = $HTTP_POST_VARS['wellsfargo_taxid']; $this->wf_dlnum = $HTTP_POST_VARS['wellsfargo_dlnum']; $this->wf_state = $HTTP_POST_VARS['wellsfargo_state']; $this->wf_dob = $HTTP_POST_VARS['wellsfargo_dob']; $this->wf_org_type = $HTTP_POST_VARS['wellsfargo_org_type']; } } $gw_vars = $this->make_gateway_vars(); $sequence = rand(1, 1000); // $gw_vars = array_merge($gw_vars, $this->InsertFP(MODULE_PAYMENT_AUTHORIZENET2_LOGIN, MODULE_PAYMENT_AUTHORIZENET2_TXNKEY, $gw_vars['X_Amount'], $sequence)); if (MODULE_PAYMENT_AUTHORIZENET2_TESTMODE == 'Test') $gw_vars['x_Test_Request'] = 'TRUE'; $gw_vars[tep_session_name()] = tep_session_id(); $gw_vars['x_delim_data'] = 'TRUE'; $gw_vars['x_delim_char'] = '|'; $gw_vars['x_relay_response'] = 'FALSE'; reset($gw_vars); $curl_opts = $this->process_action_url; while (list($key, $value) = each($gw_vars)) { $curl_opts .= " -d " . $key . "=" . urlencode($value); } $handle = popen("/usr/bin/curl " . $curl_opts, "r"); $str = ''; while (!feof($handle)) { $str .= fread($handle, 2048); } pclose($handle); $result = explode("|", urldecode($str)); $x_response_code = $result[1]; $x_response_reason_text = $result[4]; } else { $x_response_code = $HTTP_POST_VARS['x_response_code']; $x_response_reason_text = $HTTP_POST_VARS['x_response_reason_text']; } if ($x_response_code == '1') return; if ($x_response_code == '2') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET2_TEXT_DECLINED_MESSAGE.$x_response_reason_text), 'SSL', true, false)); } // Code 3 is an error - but anything else is an error too (IMHO) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET2_TEXT_ERROR_MESSAGE.$x_response_reason_text) . '&error=' . urlencode($x_response_reason_text), 'SSL', true, false)); } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_AUTHORIZENET2_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_AUTHORIZENET2_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_AUTHORIZENET2_STATUS', 'True', 'Do you want to accept Authorize.net payments?', '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 ('Login Username', 'MODULE_PAYMENT_AUTHORIZENET2_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 ('Transaction Key', 'MODULE_PAYMENT_AUTHORIZENET2_TXNKEY', 'Test', 'Transaction Key used for encrypting TP data', '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_AUTHORIZENET2_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_AUTHORIZENET2_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 ('Gateway Method', 'MODULE_PAYMENT_AUTHORIZENET2_GATEWAY_METHOD', 'AIM', 'Gateway transaction method used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'AIM\', \'SIM\'), ', 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_AUTHORIZENET2_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, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_AUTHORIZENET2_SORT_ORDER', '0', '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 ('Payment Zone', 'MODULE_PAYMENT_AUTHORIZENET2_ZONE', '0', '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 ('Set Order Status', 'MODULE_PAYMENT_AUTHORIZENET2_ORDER_STATUS_ID', '0', '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())"); 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 ('Credit Card Mode', 'MODULE_PAYMENT_AUTHORIZENET2_CREDIT_CAPTURE', 'AUTH_CAPTURE', 'Credit Card processing method. Authorize Only or Authorize and Capture (Collect Funds)', '6', '0', 'tep_cfg_select_option(array(\'AUTH_CAPTURE\', \'AUTH_ONLY\'), ', 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 ('Wells Fargo Secure Source Account?', 'MODULE_PAYMENT_AUTHORIZENET2_WELLSFARGO', 'No', 'Set to YES if your account is with Wells Fargo', '6', '0', 'tep_cfg_select_option(array(\'No\', \'Yes\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_AUTHORIZENET2_STATUS', 'MODULE_PAYMENT_AUTHORIZENET2_LOGIN', 'MODULE_PAYMENT_AUTHORIZENET2_TXNKEY', 'MODULE_PAYMENT_AUTHORIZENET2_GATEWAY_METHOD', 'MODULE_PAYMENT_AUTHORIZENET2_TESTMODE', 'MODULE_PAYMENT_AUTHORIZENET2_METHOD', 'MODULE_PAYMENT_AUTHORIZENET2_CREDIT_CAPTURE', 'MODULE_PAYMENT_AUTHORIZENET2_WELLSFARGO', 'MODULE_PAYMENT_AUTHORIZENET2_EMAIL_CUSTOMER', 'MODULE_PAYMENT_AUTHORIZENET2_ZONE', 'MODULE_PAYMENT_AUTHORIZENET2_ORDER_STATUS_ID', 'MODULE_PAYMENT_AUTHORIZENET2_SORT_ORDER'); } } ?> So I tried out this contribution. When I process do a live transaction it goes through as successfull to authorizenet but returns an error message to the customer: - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance. and on the oscommerce side it does go through as a succesful order. Any thoughts? Quote rkoechel2004 Link to comment Share on other sites More sharing options...
♥Vger Posted March 14, 2006 Author Share Posted March 14, 2006 (edited) Why did you post all those hundreds of lines of code from the old module? I'm sorry, I just don't see why that was necessary. They have nothing to do with this one. The module you used previously was for Authorize Net SIM and not Authorize Net AIM (Advanced Integration Method). This module was pre-tested before release and worked fine, so please make sure that your account with Authorize Net is configured to use AIM and not SIM, that your site has SSL and that cURL is compiled into PHP. If you then still have problems then please repost and I will look into it. Vger Edited March 14, 2006 by Vger Quote Link to comment Share on other sites More sharing options...
♥Vger Posted March 15, 2006 Author Share Posted March 15, 2006 Just to update you. I have tried to replicate the problem you describe, but have been unable to do so. Vger Quote Link to comment Share on other sites More sharing options...
Guest Posted March 15, 2006 Share Posted March 15, 2006 Vger, Ive followed the instructions on the new Authorize.net AIM module. I installed/uploaded and setup up everything correctly. I have a valid Authorize.net account, a ssl cert working and php compiled with-curl. I installed the module and entered the information needed. When confirming order i get (TESTMODE) The merchant login ID or password is invalid or the account is inactive. - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance. I know my loginID/pwd are correct for I was using the default module before (is that SIM or AIM?) The only reason I installed this AIM module is because when I clicked confirm order on the other module it would *NOT* send me to a success page...it would just send me back to the login page, but a email confirmation was sent about the test order. Maybe you could give me some insight on that... As for the new module the only thing I can think of is that you list this as requirement #2 2. Your site must establish an https connection to Authorize Net my site is ssl and shows https, but does that mean it has a https connection to auth.net or do i have to setup that up somewhere else. I would really like to get this module working because it has CVV. Thanks for any help you can give Quote Link to comment Share on other sites More sharing options...
inbox Posted March 15, 2006 Share Posted March 15, 2006 first thanx alot for this but... it seems like i can't make it work i getting this error "- Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance." while I'm trying to process credit card. i try it in a different ways - in test mod or in production mod my authorize.net in AIM Quote Link to comment Share on other sites More sharing options...
rkoechel2004 Posted March 15, 2006 Share Posted March 15, 2006 Rhea- What do you have set for your Default field seperator and field encapsulation character in authorizenet? Thanks Ryan first thanx alot for this but... it seems like i can't make it work i getting this error "- Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance." while I'm trying to process credit card. i try it in a different ways - in test mod or in production mod my authorize.net in AIM Quote rkoechel2004 Link to comment Share on other sites More sharing options...
rkoechel2004 Posted March 15, 2006 Share Posted March 15, 2006 I found the solution to the problems submitted above. You need to change your default field seperator to a comma, and make sure your transaction version is 3.1 Thanks for this contribution -Ryan Rhea- What do you have set for your Default field seperator and field encapsulation character in authorizenet? Thanks Ryan Quote rkoechel2004 Link to comment Share on other sites More sharing options...
inbox Posted March 15, 2006 Share Posted March 15, 2006 I found the solution to the problems submitted above. You need to change your default field seperator to a comma, and make sure your transaction version is 3.1Thanks for this contribution -Ryan i did that and now i'm getting this error "|This transaction has been approved.| - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance." the card is valid Quote Link to comment Share on other sites More sharing options...
rkoechel2004 Posted March 15, 2006 Share Posted March 15, 2006 what do you have set as your field encapsulation character? -Ryan i did that and now i'm getting this error "|This transaction has been approved.| - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance." the card is valid Quote rkoechel2004 Link to comment Share on other sites More sharing options...
inbox Posted March 15, 2006 Share Posted March 15, 2006 what do you have set as your field encapsulation character? -Ryan comma (,) the things is i do see the transaction in authorize.net but in oscommerce when i try to go to checkout_success i'm getting back to checkout_payment with the error on the top Quote Link to comment Share on other sites More sharing options...
kidd6801 Posted March 15, 2006 Share Posted March 15, 2006 my phpinfo file shows php was compiled: Configure Command './configure' '--build=x86_64-redhat-linux' '--host=x86_64-redhat-linux' ... '--disable-rpath' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' ... I have a valid Authorize.net account I have an https connection to Authorize.net Authorize.net is set up for AIM. When I submit a credit card using this module I get 'Credit Card Error' it never even sends it to the pre cc processing verification form. The only thing that i didn't do from your instructions page was to add the java, in fact i removed the hyperlink from the cvv area on the checkout. Any other ideas what i might be doing wrong? Thanks in advance, KiDD Quote Link to comment Share on other sites More sharing options...
Guest Posted March 15, 2006 Share Posted March 15, 2006 Vger, Ive followed the instructions on the new Authorize.net AIM module. I installed/uploaded and setup up everything correctly. I have a valid Authorize.net account, a ssl cert working and php compiled with-curl. I installed the module and entered the information needed. When confirming order i get (TESTMODE) The merchant login ID or password is invalid or the account is inactive. - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance. I know my loginID/pwd are correct for I was using the default module before (is that SIM or AIM?) The only reason I installed this AIM module is because when I clicked confirm order on the other module it would *NOT* send me to a success page...it would just send me back to the login page, but a email confirmation was sent about the test order. Maybe you could give me some insight on that... As for the new module the only thing I can think of is that you list this as requirement #2 2. Your site must establish an https connection to Authorize Net my site is ssl and shows https, but does that mean it has a https connection to auth.net or do i have to setup that up somewhere else. I would really like to get this module working because it has CVV. Thanks for any help you can give OMG I got it to work !!!! only problem is when they click confirm order it doesnt take them to a successful order page, but back to the payment information page!!! dammit. how do i make it go to the successful order page after you click confirm order!?!?! ps. the new testing a.net server is https://certification.authorize.net/gateway/transact.dll Quote Link to comment Share on other sites More sharing options...
Guest Posted March 15, 2006 Share Posted March 15, 2006 my phpinfo file shows php was compiled: Configure Command './configure' '--build=x86_64-redhat-linux' '--host=x86_64-redhat-linux' ... '--disable-rpath' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' ... I have a valid Authorize.net account I have an https connection to Authorize.net Authorize.net is set up for AIM. When I submit a credit card using this module I get 'Credit Card Error' it never even sends it to the pre cc processing verification form. The only thing that i didn't do from your instructions page was to add the java, in fact i removed the hyperlink from the cvv area on the checkout. Any other ideas what i might be doing wrong? Thanks in advance, KiDD Go to your A.net settings Make sure Direct Response has Delimited Respone has YES Default Field Seperator is COMMA Field Encapsulator is Double QUOTE Receipt / Relay URLs should be to https://yoursite/blah/blah/checkout_process.php DOUBLE check your LOGIN/PWD why did you take out CVV. it helps BIGTIME agaisnt fraud. Quote Link to comment Share on other sites More sharing options...
♥Vger Posted March 16, 2006 Author Share Posted March 16, 2006 Whoa, after days of virtually no response they all come at once. I may end up regretting putting this module together! I'll try to answer them as best I can. 1. Default field seperator = comma (as some have found out) 2. Transaction version = 3.1 (this is AIM) 3. If you previously had an account it is probably set to SIM and you need to change this. 4. "Why did you take out CVV?" I didn't - but you do have to activate it in your account at Authorize Net. 5. "the new testing a.net server is https://certification." - only if you plan to apply for certification of the module, so that osCommerce can be added to the list of shopping carts displayed by Authorize Net. I don't plan to do this. 6. As it says in the Install file - if you wish to change your Authorize Net setting to Live and change your module setting to Live but to still run transactions against the Test server then you need to edit 'secure' to 'test' in the address in includes/modules/payment/authorizenet_aim.php 7. People on Windows servers may have problems with the path to cURL. There are several possible fixes for this general problem posted elsewhere in the forums, but you need to search for them. Vger Quote Link to comment Share on other sites More sharing options...
inbox Posted March 16, 2006 Share Posted March 16, 2006 Whoa, after days of virtually no response they all come at once. I may end up regretting putting this module together! I'll try to answer them as best I can. 1. Default field seperator = comma (as some have found out) 2. Transaction version = 3.1 (this is AIM) 3. If you previously had an account it is probably set to SIM and you need to change this. 4. "Why did you take out CVV?" I didn't - but you do have to activate it in your account at Authorize Net. 5. "the new testing a.net server is https://certification." - only if you plan to apply for certification of the module, so that osCommerce can be added to the list of shopping carts displayed by Authorize Net. I don't plan to do this. 6. As it says in the Install file - if you wish to change your Authorize Net setting to Live and change your module setting to Live but to still run transactions against the Test server then you need to edit 'secure' to 'test' in the address in includes/modules/payment/authorizenet_aim.php 7. People on Windows servers may have problems with the path to cURL. There are several possible fixes for this general problem posted elsewhere in the forums, but you need to search for them. Vger after i done all that i still have problem with this contrib. in checkout_confirmation after i type already the cc I'm trying to get to the checkout_success page to finish the purchase but I'm getting back to the payment page with the message on the top that the card is approval. by this case I'm getting an confirmation email and i can see the transaction in a.net Quote Link to comment Share on other sites More sharing options...
♥Vger Posted March 16, 2006 Author Share Posted March 16, 2006 Have you got SSL properly installed on your website, because checkout_process.php is defined as an SSL page in the module, and it is this page that sends people on to the checkout_success.php page. Vger Quote Link to comment Share on other sites More sharing options...
inbox Posted March 16, 2006 Share Posted March 16, 2006 Have you got SSL properly installed on your website, because checkout_process.php is defined as an SSL page in the module, and it is this page that sends people on to the checkout_success.php page. Vger yes i do i have SSL via godaddy the a.net module that come with OSC work fine Quote Link to comment Share on other sites More sharing options...
kidd6801 Posted March 16, 2006 Share Posted March 16, 2006 (edited) /* ##Go to your A.net settings ##Make sure Direct Response has ##Delimited Respone has YES ##Default Field Seperator is COMMA ##Field Encapsulator is Double QUOTE ##Receipt / Relay URLs should be to ##https://yoursite/blah/blah/checkout_process.php ##DOUBLE check your LOGIN/PWD */ Double checked everything here .. I had to change the seperator and the R/R urls ##why did you take out CVV. it helps BIGTIME agaisnt fraud. I didn't remove CVV, Just the explaination link. With these settings I am still getting the message Credit Card Error! on the CC input page. I know it has to be something on my end. Can you think of anything else I should try? KiDD Edited March 16, 2006 by kidd6801 Quote Link to comment Share on other sites More sharing options...
♥Vger Posted March 16, 2006 Author Share Posted March 16, 2006 On the Developer Test Account I used to set this module up I entered nothing on the "Response/Receipt URL's" page, because the Return URL is already defined in the module as checkout_process.php Don't forget that with this module - people stay on your website, they don't go to an Authorize Net page at all. Many of the settings in the Authorize Net interface are there to cover other connection methods. Under Direct Response Delimiter - try setting it to 'No'. I have just rechecked the settings and I initially had it set to 'Yes' with a comma delimiter and nothing for Field Encapsulation Character, but then reset it to 'No'. Sorry if my earlier post caused confusion. Vger Quote Link to comment Share on other sites More sharing options...
♥Vger Posted March 16, 2006 Author Share Posted March 16, 2006 the a.net module that come with OSC work fine Then use that module if you are happy with it. This module is for the Advanced Integration Method (AIM) and not the Simple Integration Method (SIM). It's my understanding that Authorise Net will discontinue SIM in the not too distant future. Vger Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.