Jump to content

JeremyT

Members
  • Content count

    23
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Jeremy Thompson
  1. JeremyT

    New UPS XML Shipping Module available

    I have encountered a problem with transit times not being returned for zip-codes which have multiple cities associated. One example zip-code is 38002. Anyone know how i can update the code to fix this? Thanks, Jeremy
  2. JeremyT

    New UPS XML Shipping Module available

    Here's my situation, we have certain items that are shipped in poster tubes. The dimensions of the product tube is 26x2.5x2.5, and we have a box we use for this item that is 29x7x7. It so happens this box will fit exactly 4 of these poster tubes with packing peanuts. The fact that the product is 26inches long you cannot use the box to hold the extra volume that is calculated. Do you have any suggestions that could be made to the algo to help in my situation?
  3. JeremyT

    New UPS XML Shipping Module available

    I have a question regarding the dimensional support. Dimensional support is installed on our website, and i have 1 box setup as a L: 30 H: 8 W: 8 inches, and some product with the following dimensions L:26 H: 2.5 W:2.5 but for whatever reason it takes 15 of these items before it splits the shipment into 2 boxes. Any thoughts? Thanks.
  4. JeremyT

    New UPS XML Shipping Module available

    Another thing i noticed in regards to the time in transit. For example today Wednesday April 1st, if you enter a zip-code in the USA that is two days away the following is returned: United Parcel Service UPS Ground, EDD April 03, 2009 $15.50 UPS 3 Day Select $31.14 UPS 2nd Day Air, EDD April 03, 2009 $38.63 UPS Next Day Air Saver, EDD April 02, 2009 $68.16 UPS Next Day Air, EDD April 02, 2009 $80.65 UPS Next Day Air Early A.M., EDD April 02, 2009 $120.38 Why is there no edd for ups 3-day select returned? Where can i look to determine the problem?
  5. JeremyT

    New UPS XML Shipping Module available

    I have just installed the UPS xml module and have a question. 1. Why can't the transit time and rates be calculated with just the zip-code, instead of needing city, state, and zip-code? Just a thought, i noticed other ups xml modules working with just the zip-code.
  6. Anyone notice this module does not work with zones? I have tried to only display the authorize.net module for zone "usa" and it appears no matter what country is in the customers account.
  7. JeremyT

    QBI Quickbooks Import

    I hate to keep bothering you, but i really want this module to work so i get the upgraded version. :) I cannot find anything anywhere near the text you said to search for. Heres the module: <?php /* $Id: itransact_split.php,v 1.18 2002/06/23 13:43:01 clescuyer Exp $ The Exchange Project - Community Made Shopping! http://www.theexchangeproject.org Copyright © 2000,2001 The Exchange Project Released under the GNU General Public License */ /* See README_catalog_itransact_split iTransact Payment Module itransact_split.php Author: TriciaB (info@barestyle.com) File resides in: catalog/includes/modules/payment/ This version is for TEP Preview Release 2.2 with mysql_catalog.sql version 1.116+. */ class itransact_split { var $code, $title, $description, $enabled; // class constructor function itransact_split() { $this->code = 'itransact_split'; $this->title = MODULE_PAYMENT_ITRANSACT_SPLIT_TEXT_TITLE; $this->description = MODULE_PAYMENT_ITRANSACT_SPLIT_TEXT_DESCRIPTION; $this->enabled = MODULE_PAYMENT_ITRANSACT_SPLIT_STATUS; } // class methods function javascript_validation() { return false; } function selection() { return false; } function confirmation() { global $checkout_form_action; $checkout_form_action = MODULE_PAYMENT_ITRANSACT_SPLIT_CHECKOUT_FORM_ACTION; } function process_button() { global $HTTP_POST_VARS, $total_tax, $shipping_cost, $total_cost, $customer_id, $products, $languages_id; $customer_query = tep_db_query("select customers_firstname, customers_lastname, customers_telephone, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); $customer = tep_db_fetch_array($customer_query); $address_book_query = tep_db_query("select entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_city, entry_postcode, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'"); $address_book = tep_db_fetch_array($address_book_query); $customers_country = tep_get_countries($address_book['entry_country_id']); $sig_rand_query = tep_db_query("select sig_rand_begun, auth_id, status from orders_itransact_auth where sesskey_begun = '" . tep_session_id() . "' and orders_id is NULL and status = 'begun' order by auth_id DESC limit 1"); $sig_rand = tep_db_fetch_array($sig_rand_query); $sig_rand_begun = $sig_rand['sig_rand_begun']; if (!$sig_rand_begun || $status == 'begun') { $sig_rand_begun = tep_create_random_value(16, 'digits'); tep_db_query("insert into orders_itransact_auth (customer_id, sig_rand_begun, gateway_id_begun, total_begun, sesskey_begun, status, datetime_begun) values ('" . $customer_id . "','" . $sig_rand_begun . "', '" . MODULE_PAYMENT_ITRANSACT_SPLIT_GATEWAY_ID . "', '" . (number_format($total_cost + $total_tax + $shipping_cost, 2)) . "', '" . tep_session_id() . "', 'begun', now())"); $auth_id_query = tep_db_query("select auth_id from orders_itransact_auth where sesskey_begun = '" . tep_session_id() . "' and orders_id is NULL and status = 'begun' order by auth_id DESC limit 1"); $auth_id = tep_db_fetch_array($auth_id_query); $auth_id = $auth_id['auth_id']; } else { tep_db_query("update orders_itransact_auth set customer_id = '" . $customer_id . "', total_begun = '" . (number_format($total_cost + $total_tax + $shipping_cost, 2)) . "', datetime_begun = now(), status = 'begun', gateway_id_begun = '" . MODULE_PAYMENT_ITRANSACT_SPLIT_GATEWAY_ID . "' where sig_rand_begun = '" . $sig_rand_begun . "'"); $auth_id = $sig_rand['auth_id']; } // setup passback variables $process_button_string = tep_draw_hidden_field(tep_session_name(), tep_session_id()) . tep_draw_hidden_field('passback[]', 'prod') . tep_draw_hidden_field('passback[]', 'vendor_id') . tep_draw_hidden_field('passback[]', tep_session_name()) . tep_draw_hidden_field('passback[]', 'sig_rand') . tep_draw_hidden_field('passback[]', 'auth_id') . tep_draw_hidden_field('sig_rand', $sig_rand_begun) . tep_draw_hidden_field('auth_id', $auth_id); // setup lookups $process_button_string .= tep_draw_hidden_field('lookup[]', 'xid') . tep_draw_hidden_field('lookup[]', 'authcode') . tep_draw_hidden_field('lookup[]', 'avs_response') . tep_draw_hidden_field('lookup[]', 'when') . tep_draw_hidden_field('lookup[]', 'total') . tep_draw_hidden_field('lookup[]', 'cc_last_four') . tep_draw_hidden_field('lookup[]', 'test_mode'); // setup tep variables for split form layout $process_button_string .= tep_draw_hidden_field('header_title', TITLE) . tep_draw_hidden_field('header_title_my_account', HEADER_TITLE_MY_ACCOUNT) . tep_draw_hidden_field('header_title_cart_contents', HEADER_TITLE_CART_CONTENTS) . tep_draw_hidden_field('header_title_checkout', HEADER_TITLE_CHECKOUT) . tep_draw_hidden_field('header_title_top', HEADER_TITLE_TOP) . tep_draw_hidden_field('header_title_catalog', HEADER_TITLE_CATALOG) . tep_draw_hidden_field('header_title_login', HEADER_TITLE_LOGIN) . tep_draw_hidden_field('header_accept_cards', MODULE_PAYMENT_ITRANSACT_SPLIT_CARDS) . tep_draw_hidden_field('header_accept_eft', MODULE_PAYMENT_ITRANSACT_SPLIT_EFT); /* Format description, cost, and quantity for each item. These are used in the email sent by iTransact, and are required to determine the transaction total. This uses global $products. */ for ($i=0; $i<sizeof($products); $i++) { $item_num = $i; $item_num++; $products_name = $products[$i]['name']; $products_price = $products[$i]['price']; $products_quantity = $products[$i]['quantity']; $products_options_name = $attributes_values[$i]['products_options_name']; $process_button_string .= tep_draw_hidden_field('item_' . $item_num . '_desc', $products_name) . tep_draw_hidden_field('item_' . $item_num . '_cost', $products_price) . tep_draw_hidden_field('item_' . $item_num . '_qty', $products_quantity); // Check for product attributes. If they exist, format them for each item. as above. if ($products[$i]['attributes']) { reset($products[$i]['attributes']); $num = 0; while (list($option, $value) = each($products[$i]['attributes'])) { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $attributes_for_itransact['name'][$i . $num] .= $attributes_values['products_options_name']; $attributes_for_itransact['value'][$i . $num] .= $attributes_values['products_options_values_name']; $num++; } } if ($attributes_for_itransact) { for ($num=0; $num<sizeof($attributes_for_itransact); $num++) { $item_num = $i; $item_num++; $attrib_name = $attributes_for_itransact['name']; $attrib_value = $attributes_for_itransact['value']; if ($attrib_value[$i . $num]) { $process_button_string .= tep_draw_hidden_field('item_' . $item_num . '_' . $attrib_name[$i . $num], $attrib_value[$i . $num]); } } } } if ($shipping_cost) { $process_button_string .= tep_draw_hidden_field('98_desc', 'Shipping') . tep_draw_hidden_field('98_cost', number_format($shipping_cost,2)) . tep_draw_hidden_field('98_qty', '1'); } if ($total_tax) { $process_button_string .= tep_draw_hidden_field('99_desc', 'Tax') . tep_draw_hidden_field('99_cost', number_format($total_tax,2)) . tep_draw_hidden_field('99_qty', '1'); } // setup merchant and customer variables $process_button_string .= tep_draw_hidden_field('vendor_id', MODULE_PAYMENT_ITRANSACT_SPLIT_GATEWAY_ID) . tep_draw_hidden_field('home_page', HTTP_SERVER) . tep_draw_hidden_field('ret_addr', MODULE_PAYMENT_ITRANSACT_RETURN_ADDRESS); if ( (MODULE_PAYMENT_ITRANSACT_RETURN_MODE == 'post') || (MODULE_PAYMENT_ITRANSACT_RETURN_MODE == 'redirect') ) { $process_button_string .= tep_draw_hidden_field('ret_mode', MODULE_PAYMENT_ITRANSACT_RETURN_MODE); } // This will be used for future versions. if (MODULE_PAYMENT_ITRANSACT_ON_ERROR == '1') { $process_button_string .= tep_draw_hidden_field('post_back_on_error', '1'); } $process_button_string .= tep_draw_hidden_field('email_text', $comments) . tep_draw_hidden_field('first_name', $address_book['entry_firstname']) . tep_draw_hidden_field('last_name', $address_book['entry_lastname']) . tep_draw_hidden_field('address', $address_book['entry_street_address']) . tep_draw_hidden_field('city', $address_book['entry_city']) . tep_draw_hidden_field('zip', $address_book['entry_postcode']) . tep_draw_hidden_field('country', $customers_country['countries_name']) . tep_draw_hidden_field('email', $customer['customers_email_address']) . tep_draw_hidden_field('phone', $customer['customers_telephone']); // Include the state. $state = tep_get_zone_code($address_book['entry_country_id'], $address_book['entry_zone_id'], ''); if (!$state) $state = $address_book['entry_state']; $process_button_string .= tep_draw_hidden_field('state', $state); // Create hidden inputs for card images on Split Form $process_button_string .= tep_draw_hidden_field('header_visa_image', MODULE_PAYMENT_ITRANSACT_SPLIT_VISAMC) . tep_draw_hidden_field('header_mc_image', MODULE_PAYMENT_ITRANSACT_SPLIT_VISAMC) . tep_draw_hidden_field('header_amex_image', MODULE_PAYMENT_ITRANSACT_SPLIT_AMEX) . tep_draw_hidden_field('header_disc_image', MODULE_PAYMENT_ITRANSACT_SPLIT_DISC) . tep_draw_hidden_field('header_diner_image', MODULE_PAYMENT_ITRANSACT_SPLIT_DINER); return $process_button_string; } /* FOR FUTURE USE There are three possible responses from iTransact for a transaction. This function will handle all three. However, there's no point right now to handle errors and dies. These are handled only if iTransact's service is being used "transparently" which requires a secure server of your own. Since this module is for the Split Form, a secure server isn't being used on my end, and all errors and dies will be handled by iTransact's secure server. 1. Success - This will include the authcode, since it is included above as a Lookup variable. 2. Error - This is basically a decline. The error message is reported. 3. Die - Something bad happened. (internal error) */ function before_process() { global $payment; if ( ($payment == $this->code) && (($HTTP_POST_VARS['die'] == '1') || ($HTTP_POST_VARS['err'])) ) { if ($HTTP_POST_VARS['die'] == '1') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_ITRANSACT_SPLIT_TEXT_DIE_MESSAGE), 'SSL', true, false)); } if ($HTTP_POST_VARS['err']) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($HTTP_POST_VARS['err']), 'SSL', true, false)); } } } function after_process() { global $HTTP_POST_VARS, $customer_id, $insert_id; // Update orders_itransact_auth. First, check to see if the order is a dup. This would happen if someone deliberately pressed the back button and reloaded the page, causing another transaction to go through iTransact. $find_dup_query = tep_db_query("select sig_rand_complete from orders_itransact_auth where sig_rand_complete = '" . $HTTP_POST_VARS['sig_rand'] . "' and sesskey_complete = '" . tep_session_id() . "' and auth_id = '" . $HTTP_POST_VARS['auth_id'] . "' and status = 'complete'"); if (tep_db_num_rows($find_dup_query) > 0) { tep_db_query("insert into orders_itransact_auth (customer_id, status, orders_id, gateway_id_complete, authcode, datetime_itransact_timestamp, total_complete, cc_last_four, xid, test_mode, avs_response, signature, sig_rand_complete, sesskey_complete) values ('" . $customer_id . "', 'duplicate', '" . $insert_id . "', '" . $HTTP_POST_VARS['vendor_id'] . "', '" . $HTTP_POST_VARS['authcode'] . "', '" . $HTTP_POST_VARS['when'] . "','" . $HTTP_POST_VARS['total'] . "', '" . $HTTP_POST_VARS['cc_last_four'] . "', '" . $HTTP_POST_VARS['xid'] . "', '" . $HTTP_POST_VARS['test_mode'] . "', '" . $HTTP_POST_VARS['avs_response'] . "', '" . $HTTP_POST_VARS['signature'] . "', '" . $HTTP_POST_VARS['sig_rand'] . "', '" . tep_session_id() . "' )"); } else { tep_db_query("update orders_itransact_auth set status = 'complete', orders_id = '" . $insert_id . "', gateway_id_complete = '" . $HTTP_POST_VARS['vendor_id'] . "', authcode = '" . $HTTP_POST_VARS['authcode'] . "', datetime_itransact_timestamp = '" . $HTTP_POST_VARS['when'] . "', total_complete = '" . $HTTP_POST_VARS['total'] . "', cc_last_four = '" . $HTTP_POST_VARS['cc_last_four'] . "', xid = '" . $HTTP_POST_VARS['xid'] . "', test_mode = '" . $HTTP_POST_VARS['test_mode'] . "', avs_response = '" . $HTTP_POST_VARS['avs_response'] . "', signature = '" . $HTTP_POST_VARS['signature'] . "', sesskey_complete = '" . tep_session_id() . "', sig_rand_complete = '" . $HTTP_POST_VARS['sig_rand'] . "' where auth_id = '" . $HTTP_POST_VARS['auth_id'] . "' and sig_rand_begun = '" . $HTTP_POST_VARS['sig_rand'] . "'"); } } function pre_confirmation_check() { return false; } function output_error() { return false; } function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_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, date_added) values ('Enable iTransact module', 'MODULE_PAYMENT_ITRANSACT_SPLIT_STATUS', '1', 'Enter 1 to accept iTransact payments using the secure Split Form?', '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 ('iTransact Gateway ID', 'MODULE_PAYMENT_ITRANSACT_SPLIT_GATEWAY_ID', '', 'Five-digit iTransact Gateway ID', '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 ('Credit Cards', 'MODULE_PAYMENT_ITRANSACT_SPLIT_CARDS', '0', 'Enter 1 if you are accepting credit card payments', '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 ('Checks/EFT', 'MODULE_PAYMENT_ITRANSACT_SPLIT_EFT', '0', 'Enter 1 if you are accepting checks/EFT payments', '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 ('Visa & Mastercard', 'MODULE_PAYMENT_ITRANSACT_SPLIT_VISAMC', '0', 'Enter 1 to display these images', '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 ('American Express', 'MODULE_PAYMENT_ITRANSACT_SPLIT_AMEX', '0', 'Enter 1 to display this image', '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 ('Discover', 'MODULE_PAYMENT_ITRANSACT_SPLIT_DISC', '0', 'Enter 1 to display this image', '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 ('Diners Club', 'MODULE_PAYMENT_ITRANSACT_SPLIT_DINER', '0', 'Enter 1 to display this image', '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 ('Use Split Form?', 'MODULE_PAYMENT_ITRANSACT_SPLIT_ON', '1', 'Enter 1 if using Split Form. This is used if you do NOT have your own secure server.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_STATUS'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_GATEWAY_ID'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_CARDS'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_EFT'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_VISAMC'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_AMEX'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_DISC'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_DINER'"); // tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ITRANSACT_SPLIT_ON'"); } function keys() { $keys = array('MODULE_PAYMENT_ITRANSACT_SPLIT_STATUS', 'MODULE_PAYMENT_ITRANSACT_SPLIT_GATEWAY_ID', 'MODULE_PAYMENT_ITRANSACT_SPLIT_CARDS', 'MODULE_PAYMENT_ITRANSACT_SPLIT_EFT', 'MODULE_PAYMENT_ITRANSACT_SPLIT_VISAMC', 'MODULE_PAYMENT_ITRANSACT_SPLIT_AMEX', 'MODULE_PAYMENT_ITRANSACT_SPLIT_DISC', 'MODULE_PAYMENT_ITRANSACT_SPLIT_DINER'); return $keys; } } ?>
  8. JeremyT

    QBI Quickbooks Import

    I made that change and now it says: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '. $card_text . $both_text . $eft_text . ' via iTransact' WHERE qbi_payosc_id=''' at line 1 UPDATE qbi_payosc SET qbi_payosc_text='Secure ' . $card_text . $both_text . $eft_text . ' via iTransact' WHERE qbi_payosc_id='' [TEP STOP]
  9. JeremyT

    QBI Quickbooks Import

    I need a little help. When i go under matches and choose payment i get the following error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '. $card_text . $both_text . $eft_text . ' via iTransact')' at line 1 INSERT INTO qbi_payosc (qbi_payosc_mod,language_id,qbi_payosc_text) VALUES ('itransact_split','1','Secure ' . $card_text . $both_text . $eft_text . ' via iTransact') [TEP STOP] Can you help me figure out the problem? Jeremy
  10. JeremyT

    Automatically send data feed to Froogle

    Hi, When I cut paste this: define('BOX_HEADING_FEEDERS', 'Feeder Systems'); define('BOX_FEEDERS_AMAZON', 'Amazon Marketplace'); define('BOX_FEEDERS_BIZRATE', 'Biz Rate'); define('BOX_FEEDERS_FROOGLE', 'Froogle'); define('BOX_FEEDERS_MYSIMON', 'MySimon'); define('BOX_FEEDERS_PRICE_GRABBER', 'Price Grabber'); define('BOX_FEEDERS_SHOPPING', 'Shopping.com'); define('BOX_FEEDERS_YAHOO', 'Yahoo'); define('BOX_FEEDERS_GOOGLE_BASE', 'Google Base'); into the admin/filenames.php and the admin/languages/english.php and then go to the store admin, under Feeder Systems it only shows Biz Rate, Froogle, and Yahoo. How can I make it show the others? Jeremy
  11. I need some help with HTC. I have a HEAD_TITLE_TAG_ALL, HEAD_DESC_TAG_ALL, HEAD_KEY_TAG_ALL specified but, on catagory pages it still displays the default titles, keywords, and meta tags even though i have added specific information for each. On the product page it displays the product title, kw, and desc, but the title has the global title added to the end. Can anyone shed some light on the problem? My langauge file is: <?php // /catalog/includes/languages/english/header_tags.php // WebMakers.com Added: Header Tags Generator v2.0 // Add META TAGS and Modify TITLE // // DEFINITIONS FOR /includes/languages/english/header_tags.php // Define your email address to appear on all pages define('HEAD_REPLY_TAG_ALL', STORE_OWNER_EMAIL_ADDRESS); // For all pages not defined or left blank, and for products not defined // These are included unless you set the toggle switch in each section below to OFF ( '0' ) // The HEAD_TITLE_TAG_ALL is included BEFORE the specific one for the page // The HEAD_DESC_TAG_ALL is included AFTER the specific one for the page // The HEAD_KEY_TAG_ALL is included BEFORE the specific one for the page define('HEAD_TITLE_TAG_ALL','Glow Necklaces - Body Lights - Glow Sticks - ' . STORE_NAME); define('HEAD_DESC_TAG_ALL','A wholesaler of glow necklaces, body lights, glow sticks, light sticks, glow bracelets.'); define('HEAD_KEY_TAG_ALL','body lights, glow necklaces, glow sticks, light sticks, blinking body lights, glow bracelets, glowsticks, flashing body lights, flashing pacifiers, magnetic body lights'); // DEFINE TAGS FOR INDIVIDUAL PAGES // default.php define('HTTA_DEFAULT_ON','1'); // Include HEAD_TITLE_TAG_ALL in Title define('HTKA_DEFAULT_ON','1'); // Include HEAD_KEY_TAG_ALL in Keywords define('HTDA_DEFAULT_ON','1'); // Include HEAD_DESC_TAG_ALL in Description define('HEAD_TITLE_TAG_DEFAULT',''); define('HEAD_DESC_TAG_DEFAULT',''); define('HEAD_KEY_TAG_DEFAULT',''); // product_info.php - if left blank in products_description table these values will be used define('HTTA_PRODUCT_INFO_ON','1'); define('HTKA_PRODUCT_INFO_ON','1'); define('HTDA_PRODUCT_INFO_ON','1'); define('HEAD_TITLE_TAG_PRODUCT_INFO',''); define('HEAD_DESC_TAG_PRODUCT_INFO',''); define('HEAD_KEY_TAG_PRODUCT_INFO',''); // products_new.php - whats_new define('HTTA_WHATS_NEW_ON','1'); define('HTKA_WHATS_NEW_ON','1'); define('HTDA_WHATS_NEW_ON','1'); define('HEAD_TITLE_TAG_WHATS_NEW','New Products'); define('HEAD_DESC_TAG_WHATS_NEW',''); define('HEAD_KEY_TAG_WHATS_NEW',''); // specials.php // If HEAD_KEY_TAG_SPECIALS is left blank, it will build the keywords from the products_names of all products on special define('HTTA_SPECIALS_ON','1'); define('HTKA_SPECIALS_ON','1'); define('HTDA_SPECIALS_ON','1'); define('HEAD_TITLE_TAG_SPECIALS','Specials'); define('HEAD_DESC_TAG_SPECIALS',''); define('HEAD_KEY_TAG_SPECIALS',''); // product_reviews_info.php and product_reviews.php - if left blank in products_description table these values will be used define('HTTA_PRODUCT_REVIEWS_INFO_ON','1'); define('HTKA_PRODUCT_REVIEWS_INFO_ON','1'); define('HTDA_PRODUCT_REVIEWS_INFO_ON','1'); define('HEAD_TITLE_TAG_PRODUCT_REVIEWS_INFO',''); define('HEAD_DESC_TAG_PRODUCT_REVIEWS_INFO',''); define('HEAD_KEY_TAG_PRODUCT_REVIEWS_INFO',''); ?>
  12. I am having problems passing the CVV2 number to our payment gateway usight. The cvv2 number sucessfully passes to the checkout confirmation screen, but then for some reason is not passed correctly to usight. Can somebody please look at my code and see what is wrong? <?php /* Brian Yarger <byarger@weens.net> osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ class usight { var $code, $title, $description, $enabled, $states; // class constructor function usight() { $this->code = 'usight'; $this->title = MODULE_PAYMENT_USIGHT_CURL_TEXT_TITLE; $this->description = MODULE_PAYMENT_USIGHT_CURL_TEXT_DESCRIPTION; $this->enabled = ((MODULE_PAYMENT_USIGHT_CURL_STATUS == 'True') ? true : false); $this->states = $this->_state_list(); } // class methods // this method returns the javascript that will validate the form entry function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.payment.usight_cc_owner.value;' . "\n" . ' var cc_number = document.payment.usight_cc_number.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } // this method returns the html that creates the input form 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))); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA == 'True') { $creditCardTypes[] = array('id' => 'VISA', 'text' => 'Visa'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD == 'True') { $creditCardTypes[] = array('id' => 'MASTERCARD', 'text' => 'MasterCard'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX == 'True') { $creditCardTypes[] = array('id' => 'AMEX', 'text' => 'American Express'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER == 'True') { $creditCardTypes[] = array('id' => 'DISCOVER', 'text' => 'Discover'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS == 'True') { $creditCardTypes[] = array('id' => 'DINERS', 'text' => 'Diners Club'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB == 'True') { $creditCardTypes[] = array('id' => 'JCB', 'text' => 'JCB'); } /*$selection = array('id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('usight_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE, 'field' => tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes)), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('usight_cc_number')), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_CVV, 'field' => tep_draw_input_field( 'usight_cc_cvv', '', 'size="4" maxlength="4"' ) ), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year))));*/ $selection = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_input_field('usight_cc_owner') . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes) . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_input_field('usight_cc_number') . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_CVV . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_input_field('usight_cc_cvv') . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' / ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year) . '</td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $selection; } // this method is called before the data is sent to the credit card processor // here you can do any field validation that you need to do // we also set the global variables here from the form values function pre_confirmation_check() { global $HTTP_POST_VARS; include(DIR_WS_CLASSES . 'cc_validation.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['usight_cc_number'], $HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_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 = sprintf(TEXT_CCVAL_ERROR_INVALID_NUMBER, $cc_validation->cc_number); break; } if ( ($result == false) || ($result < 1) ) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } // check the type the user said the card was, versus the type that cc_validation // says it is. //print_r($HTTP_POST_VARS); //print_r($cc_validation); if (($cc_validation->cc_type == 'Visa' && $HTTP_POST_VARS['usight_cc_type'] != 'VISA') || ($cc_validation->cc_type == 'Master Card' && $HTTP_POST_VARS['usight_cc_type'] != 'MASTERCARD') || ($cc_validation->cc_type == 'American Express' && $HTTP_POST_VARS['usight_cc_type'] != 'AMEX') || ($cc_validation->cc_type == 'Diners Club' && $HTTP_POST_VARS['usight_cc_type'] != 'DINERS') || ($cc_validation->cc_type == 'Discover' && $HTTP_POST_VARS['usight_cc_type'] != 'DISCOVER') || ($cc_validation->cc_type == 'JCB' && $HTTP_POST_VARS['usight_cc_type'] != 'JCB')) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_WRONG_TYPE) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year']; //echo $payment_error_return; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } $this->cc_card_owner = $HTTP_POST_VARS['usight_cc_owner']; $this->cc_card_type = $HTTP_POST_VARS['usight_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['usight_cc_cvv']; /*global $payment, $HTTP_POST_VARS; include(DIR_WS_FUNCTIONS . 'ccval.php'); $cc_val = OnlyNumericSolution($HTTP_POST_VARS['usight_cc_number']); $cc_val = CCValidationSolution($cc_val); echo $cc_val; if ($cc_val == '1') $cc_val = ValidateExpiry($HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_cc_expires_year']); if ($cc_val != '1') { $payment_error_return = 'payment_error=' . $payment . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year'] . '&cc_val=' . urlencode($cc_val); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); }*/ } // this method returns the data for the confirmation page function confirmation() { /*global $HTTP_POST_VARS; $confirmation = array('title' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['usight_cc_owner']), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE, 'field' => $HTTP_POST_VARS['usight_cc_type']), array('title' => MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_TEXT_CREDIT_CARD_CVV, 'field' => $_POST['usight_cc_cvv'] ), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year']))))); return $confirmation;*/ global $HTTP_POST_VARS, $CardName, $CardNumber; $confirmation_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' ' . $HTTP_POST_VARS['usight_cc_owner'] . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' ' . $HTTP_POST_VARS['usight_cc_type'] . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' ' . substr($HTTP_POST_VARS['usight_cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['usight_cc_number']) - 8)) . substr($HTTP_POST_VARS['usight_cc_number'], -4) . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_CVV . ' ' . $HTTP_POST_VARS['usight_cc_cvv'] . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' ' . strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year'])) . ' </td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $confirmation_string; } function output_error() { global $HTTP_GET_VARS; $output_error_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> <font color="#FF0000"><b>' . $HTTP_GET_VARS['error'] . '</b></font><br> ' . stripslashes(urldecode($HTTP_GET_VARS['cc_val'])) . ' </td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $output_error_string; } // this method performs the authorization by sending the data to the processor, and getting the result function process_button() { global $HTTP_SERVER_VARS, $order, $customer_id; $process_button_string = tep_draw_hidden_field('login', ((MODULE_PAYMENT_USIGHT_CURL_TESTMODE == 'Production') ? MODULE_PAYMENT_USIGHT_CURL_LOGIN : 'testgateway')) . tep_draw_hidden_field('firstname', $order->customer['firstname']) . tep_draw_hidden_field('lastname', $order->customer['lastname']) . tep_draw_hidden_field('amount', $order->info['total']) . tep_draw_hidden_field('cardtype', $this->cc_card_type) . tep_draw_hidden_field('cardnum', $this->cc_card_number) . tep_draw_hidden_field('cc_v', $this->cc_cvv ) . tep_draw_hidden_field('expmonth', $this->cc_expiry_month) . tep_draw_hidden_field('expyear', $this->cc_expiry_year) . tep_draw_hidden_field('cardname', $this->cc_card_owner) . tep_draw_hidden_field('address', $order->customer['street_address']) . tep_draw_hidden_field('city', $order->customer['city']) . // usight expects 2 digit capilalized state codes tep_draw_hidden_field('state', $this->states[strtoupper($order->customer['state'])]) . tep_draw_hidden_field('zip', $order->customer['postcode']) . tep_draw_hidden_field('country', $order->customer['country']['title']) . tep_draw_hidden_field('phone', $order->customer['telephone']) . // a blank email address will suppress the customer email tep_draw_hidden_field('email', ((MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER == 'True') ? $order->customer['email_address']: '')) . // I would like to get the order number here // but it isn't available under after this code // executes. So, we'll put the date in there // so that we have something to reference. If // we get more than one order per second we // have problems, but I guess that would be // a pretty good problem to have :) tep_draw_hidden_field('invoiceno', date('Ymdhis')) . tep_draw_hidden_field('description', 'Order Submitted from IP: ' . $HTTP_SERVER_VARS['REMOTE_ADDR'] . "\n" . $products_list); $process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id()); return $process_button_string; } // this method gets called after the processing is done but before the app server // accepts the result. It is used to check for errors. function before_process() { global $HTTP_POST_VARS; $path_to_curl = '/usr/bin/curl'; $url = 'https://gateway.usight.com/postauth.secure'; $urlstring = 'GWUsername=' . rawurlencode($HTTP_POST_VARS['login']) . '&GWBillingFirstName=' . rawurlencode($HTTP_POST_VARS['firstname']) . '&GWBillingLastName=' . rawurlencode($HTTP_POST_VARS['lastname']) . '&GWAmount=' . rawurlencode($HTTP_POST_VARS['amount']) . '&GWCardNumber=' . rawurlencode($HTTP_POST_VARS['cardnum']) . '&GWCardExpMonth=' . rawurlencode($HTTP_POST_VARS['expmonth']) . '&GWCardExpYear=' . rawurlencode($HTTP_POST_VARS['expyear']) . '&GWNameOnCard=' . rawurlencode($HTTP_POST_VARS['cardname']) . '&GWBillingAddress=' . rawurlencode($HTTP_POST_VARS['address']) . '&GWBillingCity=' . rawurlencode($HTTP_POST_VARS['city']) . '&GWBillingState=' . rawurlencode($HTTP_POST_VARS['state']) . '&GWBillingZip=' . rawurlencode($HTTP_POST_VARS['zip']) . '&GWBillingCountry=' . rawurlencode($HTTP_POST_VARS['country']) . '&Phone=' . rawurlencode($HTTP_POST_VARS['phone']) . '&Email=' . rawurlencode($HTTP_POST_VARS['email']) . '&CVV2=' . rawurlencode($HTTP_POST_VARS['cc_v']) . '&custno=' . rawurlencode($HTTP_POST_VARS['custno']) . '&InvoiceNo=' . rawurlencode($HTTP_POST_VARS['invoiceno']) . '&Description=' . rawurlencode($HTTP_POST_VARS['description']); /* exec("$path_to_curl -f -m 60 -s --cacert '/etc/curl/curl-ca-bundle.crt' -e '$url' -d '" . $urlstring . "' --url '".$url."'", $ret_arr, $ret_code); // echo ("$path_to_curl -f -m 60 -s -E /etc/curl/curl-ca-bundle.crt -e '$url' -d '" . $urlstring . "' --url '".$url."'"); // exec("$path_to_curl --url", $ret_arr, $ret_code); //exec('pwd', $ret_arr, $ret_code); // echo $path_to_curl . ' -d "' . $urlstring . '"'; // echo "$path_to_curl -f -m 60 -s -e $url -d '" . $urlstring . "' --url '".$url."'<br>"; // die; //echo "$path_to_curl -f -m 60 -s -e $url -d '".$urlstring."' --url '".$url."'";die; */ $ch = curl_init('https://gateway.usight.com/postauth.secure'); curl_setopt($ch, CURLOPT_HEADER, 0); //-H curl_setopt($ch, CURLOPT_POST, 1); //-d curl_setopt($ch, CURLOPT_POSTFIELDS, $urlstring); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); // $codes = split("&", $ret_arr[0]); $codes = split("&", $data); $returnCodes = array(); foreach($codes as $code) { list ($header, $value) = split('=', $code); $returnCodes[$header] = $value; } if ($returnCodes['ResponseCode'] != "0") { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . ($returnCodes['ResponseMessage']) . '<BR>' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE), 'SSL', true, false)); } if (MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS == 'True') { if (strpos(MODULE_PAYMENT_USIGHT_CURL_AVS_CODES, $returnCodes['AVSResponse']) === false) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . $returnCodes['AVSResponse'] . '<br>' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE_AVS), 'SSL', true, false)); } } # AuthCode is in AuthCode, TransactionID is in TransactionID } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_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 Usight Module', 'MODULE_PAYMENT_USIGHT_CURL_STATUS', 'True', 'Do you want to accept Usight 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_USIGHT_CURL_LOGIN', '', 'The login username used for the Usight 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_USIGHT_CURL_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 ('Customer Notifications', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'False', 'Should Usight 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 ('Check AVS', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'False', 'Should Usight checks the AVS response?', '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 ('Valid AVS Codes', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'A,W,Y,Z', 'Comma separated list of valid AVS Codes from https://gateway.usight.com/avs.jsp', '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 ('Accept Visa', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'True', 'Should we accept Visa?', '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 ('Accept Mastercard', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'True', 'Should we accept Mastercard?', '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 ('Accept American Express', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'False', 'Should we accept American Express?', '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 ('Accept Discover', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'False', 'Should we accept Discover?', '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 ('Accept Diners Club', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'False', 'Should we accept Diners Club?', '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 ('Accept JCB', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB', 'False', 'Should we accept JCB?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_USIGHT_CURL_STATUS', 'MODULE_PAYMENT_USIGHT_CURL_LOGIN', 'MODULE_PAYMENT_USIGHT_CURL_TESTMODE', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB'); } // this internal method returns an array keyed by state name, with a value of state code function _state_list() { $list = array('ALABAMA' => 'AL' , 'ALASKA' => 'AK' , 'AMERICAN SAMOA' => 'AS' , 'ARIZONA' => 'AZ' , 'ARKANSAS' => 'AR' , 'CALIFORNIA' => 'CA' , 'COLORADO' => 'CO' , 'CONNECTICUT' => 'CT' , 'DELAWARE' => 'DE' , 'DISTRICT OF COLUMBIA' => 'DC' , 'FEDERATED STATES OF MICRONESIA' => 'FM' , 'FLORIDA' => 'FL' , 'GEORGIA' => 'GA' , 'GUAM' => 'GU' , 'HAWAII' => 'HI' , 'IDAHO' => 'ID' , 'ILLINOIS' => 'IL' , 'INDIANA' => 'IN' , 'IOWA' => 'IA' , 'KANSAS' => 'KS' , 'KENTUCKY' => 'KY' , 'LOUISIANA' => 'LA' , 'MAINE' => 'ME' , 'MARSHALL ISLANDS' => 'MH' , 'MARYLAND' => 'MD' , 'MASSACHUSETTS' => 'MA' , 'MICHIGAN' => 'MI' , 'MINNESOTA' => 'MN' , 'MISSISSIPPI' => 'MS' , 'MISSOURI' => 'MO' , 'MONTANA' => 'MT' , 'NEBRASKA' => 'NE' , 'NEVADA' => 'NV' , 'NEW HAMPSHIRE' => 'NH' , 'NEW JERSEY' => 'NJ' , 'NEW MEXICO' => 'NM' , 'NEW YORK' => 'NY' , 'NORTH CAROLINA' => 'NC' , 'NORTH DAKOTA' => 'ND' , 'NORTHERN MARIANA ISLANDS' => 'MP' , 'OHIO' => 'OH' , 'OKLAHOMA' => 'OK' , 'OREGON' => 'OR' , 'PALAU' => 'PW' , 'PENNSYLVANIA' => 'PA' , 'PUERTO RICO' => 'PR' , 'RHODE ISLAND' => 'RI' , 'SOUTH CAROLINA' => 'SC' , 'SOUTH DAKOTA' => 'SD' , 'TENNESSEE' => 'TN' , 'TEXAS' => 'TX' , 'UTAH' => 'UT' , 'VERMONT' => 'VT' , 'VIRGIN ISLANDS' => 'VI' , 'VIRGINIA' => 'VA' , 'WASHINGTON' => 'WA' , 'WEST VIRGINIA' => 'WV' , 'WISCONSIN' => 'WI' , 'WYOMING' => 'WY' , 'ALBERTA' => 'AB' , 'BRITISH COLUMBIA' => 'BC' , 'MANITOBA' => 'MB' , 'NEW BRUNSWICK' => 'NB' , 'NEWFOUNDLAND AND LABRADOR' => 'NL' , 'NORTHWEST TERRITORIES' => 'NT' , 'NOVA SCOTIA' => 'NS' , 'NUNAVUT' => 'NU' , 'ONTARIO' => 'ON' , 'PRINCE EDWARD ISLAND' => 'PE' , 'QUEBEC' => 'QC' , 'SASKATCHEWAN' => 'SK' , 'YUKON' => 'YT' , 'ARMED FORCES AFRICA' => 'AE' , 'ARMED FORCES EUROPE' => 'AE' , 'ARMED FORCES CANADA' => 'AE' , 'ARMED FORCES MIDDLE EAST' => 'AE' , 'ARMED FORCES AMERICAS' => 'AA' , 'ARMED FORCES PACIFIC' => 'AP'); return $list; } } ?>
  13. Hello, We are having a problem with the usight payment module. Orders below $1000.00 dollars process just fine. However, when you try to place an order over $999.99, the following error is returned: Invalid+fields%3A+GWAmount Our version of oscommerce is July, 2002. Any help is welcomed. Thank you. The usight module installed in our store: <?php /* Brian Yarger <byarger@weens.net> osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ class usight { var $code, $title, $description, $enabled, $states; // class constructor function usight() { $this->code = 'usight'; $this->title = MODULE_PAYMENT_USIGHT_CURL_TEXT_TITLE; $this->description = MODULE_PAYMENT_USIGHT_CURL_TEXT_DESCRIPTION; $this->enabled = ((MODULE_PAYMENT_USIGHT_CURL_STATUS == 'True') ? true : false); $this->states = $this->_state_list(); } // class methods // this method returns the javascript that will validate the form entry function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.payment.usight_cc_owner.value;' . "\n" . ' var cc_number = document.payment.usight_cc_number.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } // this method returns the html that creates the input form 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))); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA == 'True') { $creditCardTypes[] = array('id' => 'VISA', 'text' => 'Visa'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD == 'True') { $creditCardTypes[] = array('id' => 'MASTERCARD', 'text' => 'MasterCard'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX == 'True') { $creditCardTypes[] = array('id' => 'AMEX', 'text' => 'American Express'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER == 'True') { $creditCardTypes[] = array('id' => 'DISCOVER', 'text' => 'Discover'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS == 'True') { $creditCardTypes[] = array('id' => 'DINERS', 'text' => 'Diners Club'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB == 'True') { $creditCardTypes[] = array('id' => 'JCB', 'text' => 'JCB'); } /*$selection = array('id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('usight_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE, 'field' => tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes)), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('usight_cc_number')), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year))));*/ $selection = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_input_field('usight_cc_owner') . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes) . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_input_field('usight_cc_number') . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' / ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year) . '</td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $selection; } // this method is called before the data is sent to the credit card processor // here you can do any field validation that you need to do // we also set the global variables here from the form values function pre_confirmation_check() { global $HTTP_POST_VARS; include(DIR_WS_CLASSES . 'cc_validation.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['usight_cc_number'], $HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_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 = sprintf(TEXT_CCVAL_ERROR_INVALID_NUMBER, $cc_validation->cc_number); break; } if ( ($result == false) || ($result < 1) ) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } // check the type the user said the card was, versus the type that cc_validation // says it is. //print_r($HTTP_POST_VARS); //print_r($cc_validation); if (($cc_validation->cc_type == 'Visa' && $HTTP_POST_VARS['usight_cc_type'] != 'VISA') || ($cc_validation->cc_type == 'Master Card' && $HTTP_POST_VARS['usight_cc_type'] != 'MASTERCARD') || ($cc_validation->cc_type == 'American Express' && $HTTP_POST_VARS['usight_cc_type'] != 'AMEX') || ($cc_validation->cc_type == 'Diners Club' && $HTTP_POST_VARS['usight_cc_type'] != 'DINERS') || ($cc_validation->cc_type == 'Discover' && $HTTP_POST_VARS['usight_cc_type'] != 'DISCOVER') || ($cc_validation->cc_type == 'JCB' && $HTTP_POST_VARS['usight_cc_type'] != 'JCB')) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_WRONG_TYPE) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year']; //echo $payment_error_return; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } $this->cc_card_owner = $HTTP_POST_VARS['usight_cc_owner']; $this->cc_card_type = $HTTP_POST_VARS['usight_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; /*global $payment, $HTTP_POST_VARS; include(DIR_WS_FUNCTIONS . 'ccval.php'); $cc_val = OnlyNumericSolution($HTTP_POST_VARS['usight_cc_number']); $cc_val = CCValidationSolution($cc_val); echo $cc_val; if ($cc_val == '1') $cc_val = ValidateExpiry($HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_cc_expires_year']); if ($cc_val != '1') { $payment_error_return = 'payment_error=' . $payment . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year'] . '&cc_val=' . urlencode($cc_val); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); }*/ } // this method returns the data for the confirmation page function confirmation() { /*global $HTTP_POST_VARS; $confirmation = array('title' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['usight_cc_owner']), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE, 'field' => $HTTP_POST_VARS['usight_cc_type']), array('title' => MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year']))))); return $confirmation;*/ global $HTTP_POST_VARS, $CardName, $CardNumber; $confirmation_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' ' . $HTTP_POST_VARS['usight_cc_owner'] . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' ' . $HTTP_POST_VARS['usight_cc_type'] . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' ' . substr($HTTP_POST_VARS['usight_cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['usight_cc_number']) - 8)) . substr($HTTP_POST_VARS['usight_cc_number'], -4) . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' ' . strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year'])) . ' </td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $confirmation_string; } function output_error() { global $HTTP_GET_VARS; $output_error_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> <font color="#FF0000"><b>' . $HTTP_GET_VARS['error'] . '</b></font><br> ' . stripslashes(urldecode($HTTP_GET_VARS['cc_val'])) . ' </td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $output_error_string; } // this method performs the authorization by sending the data to the processor, and getting the result function process_button() { global $HTTP_SERVER_VARS, $order, $customer_id; $process_button_string = tep_draw_hidden_field('login', ((MODULE_PAYMENT_USIGHT_CURL_TESTMODE == 'Production') ? MODULE_PAYMENT_USIGHT_CURL_LOGIN : 'testgateway')) . tep_draw_hidden_field('firstname', $order->customer['firstname']) . tep_draw_hidden_field('lastname', $order->customer['lastname']) . tep_draw_hidden_field('amount', number_format($order->info['total'], 2)) . tep_draw_hidden_field('cardtype', $this->cc_card_type) . tep_draw_hidden_field('cardnum', $this->cc_card_number) . tep_draw_hidden_field('expmonth', $this->cc_expiry_month) . tep_draw_hidden_field('expyear', $this->cc_expiry_year) . tep_draw_hidden_field('cardname', $this->cc_card_owner) . tep_draw_hidden_field('address', $order->customer['street_address']) . tep_draw_hidden_field('city', $order->customer['city']) . // usight expects 2 digit capilalized state codes tep_draw_hidden_field('state', $this->states[strtoupper($order->customer['state'])]) . tep_draw_hidden_field('zip', $order->customer['postcode']) . tep_draw_hidden_field('country', $order->customer['country']['title']) . tep_draw_hidden_field('phone', $order->customer['telephone']) . // a blank email address will suppress the customer email tep_draw_hidden_field('email', ((MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER == 'True') ? $order->customer['email_address']: '')) . // I would like to get the order number here // but it isn't available under after this code // executes. So, we'll put the date in there // so that we have something to reference. If // we get more than one order per second we // have problems, but I guess that would be // a pretty good problem to have :) tep_draw_hidden_field('invoiceno', date('Ymdhis')) . tep_draw_hidden_field('description', 'Order Submitted from IP: ' . $HTTP_SERVER_VARS['REMOTE_ADDR'] . "\n" . $products_list); $process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id()); return $process_button_string; } // this method gets called after the processing is done but before the app server // accepts the result. It is used to check for errors. function before_process() { global $HTTP_POST_VARS; $path_to_curl = 'curl'; $url = 'https://gateway.usight.com/postauth.secure'; $urlstring = 'GWUsername=' . rawurlencode($HTTP_POST_VARS['login']) . '&GWBillingFirstName=' . rawurlencode($HTTP_POST_VARS['firstname']) . '&GWBillingLastName=' . rawurlencode($HTTP_POST_VARS['lastname']) . '&GWAmount=' . rawurlencode($HTTP_POST_VARS['amount']) . '&GWCardNumber=' . rawurlencode($HTTP_POST_VARS['cardnum']) . '&GWCardExpMonth=' . rawurlencode($HTTP_POST_VARS['expmonth']) . '&GWCardExpYear=' . rawurlencode($HTTP_POST_VARS['expyear']) . '&GWNameOnCard=' . rawurlencode($HTTP_POST_VARS['cardname']) . '&GWBillingAddress=' . rawurlencode($HTTP_POST_VARS['address']) . '&GWBillingCity=' . rawurlencode($HTTP_POST_VARS['city']) . '&GWBillingState=' . rawurlencode($HTTP_POST_VARS['state']) . '&GWBillingZip=' . rawurlencode($HTTP_POST_VARS['zip']) . '&GWBillingCountry=' . rawurlencode($HTTP_POST_VARS['country']) . '&Phone=' . rawurlencode($HTTP_POST_VARS['phone']) . '&Email=' . rawurlencode($HTTP_POST_VARS['email']) . '&custno=' . rawurlencode($HTTP_POST_VARS['custno']) . '&InvoiceNo=' . rawurlencode($HTTP_POST_VARS['invoiceno']) . '&Description=' . rawurlencode($HTTP_POST_VARS['description']); exec("$path_to_curl -f -m 60 -s -e $url -d '" . $urlstring . "' --url '".$url."'", $ret_arr, $ret_code); //echo "$path_to_curl -f -m 60 -s -e $url -d '".$urlstring."' --url '".$url."'";die; /*$ch = curl_init('https://gateway.usight.com/postauth.secure'); curl_setopt($ch, CURLOPT_HEADER, 0); -H curl_setopt($ch, CURLOPT_POST, 1); -d curl_setopt($ch, CURLOPT_POSTFIELDS, $urlstring); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); */ $codes = split("&", $ret_arr[0]); $returnCodes = array(); foreach($codes as $code) { list ($header, $value) = split('=', $code); $returnCodes[$header] = $value; } if ($returnCodes['ResponseCode'] != "0") { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($returnCodes['ResponseMessage']) . '<BR>' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE), 'SSL', true, false)); } if (MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS == 'True') { if (strpos(MODULE_PAYMENT_USIGHT_CURL_AVS_CODES, $returnCodes['AVSResponse']) === false) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE_AVS), 'SSL', true, false)); } } # AuthCode is in AuthCode, TransactionID is in TransactionID } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_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 Usight Module', 'MODULE_PAYMENT_USIGHT_CURL_STATUS', 'True', 'Do you want to accept Usight 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_USIGHT_CURL_LOGIN', '', 'The login username used for the Usight 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_USIGHT_CURL_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 ('Customer Notifications', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'False', 'Should Usight 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 ('Check AVS', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'False', 'Should Usight checks the AVS response?', '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 ('Valid AVS Codes', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'A,W,Y,Z', 'Comma separated list of valid AVS Codes from https://gateway.usight.com/avs.jsp', '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 ('Accept Visa', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'True', 'Should we accept Visa?', '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 ('Accept Mastercard', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'True', 'Should we accept Mastercard?', '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 ('Accept American Express', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'False', 'Should we accept American Express?', '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 ('Accept Discover', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'False', 'Should we accept Discover?', '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 ('Accept Diners Club', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'False', 'Should we accept Diners Club?', '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 ('Accept JCB', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB', 'False', 'Should we accept JCB?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_USIGHT_CURL_STATUS', 'MODULE_PAYMENT_USIGHT_CURL_LOGIN', 'MODULE_PAYMENT_USIGHT_CURL_TESTMODE', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB'); } // this internal method returns an array keyed by state name, with a value of state code function _state_list() { $list = array('ALABAMA' => 'AL' , 'ALASKA' => 'AK' , 'AMERICAN SAMOA' => 'AS' , 'ARIZONA' => 'AZ' , 'ARKANSAS' => 'AR' , 'CALIFORNIA' => 'CA' , 'COLORADO' => 'CO' , 'CONNECTICUT' => 'CT' , 'DELAWARE' => 'DE' , 'DISTRICT OF COLUMBIA' => 'DC' , 'FEDERATED STATES OF MICRONESIA' => 'FM' , 'FLORIDA' => 'FL' , 'GEORGIA' => 'GA' , 'GUAM' => 'GU' , 'HAWAII' => 'HI' , 'IDAHO' => 'ID' , 'ILLINOIS' => 'IL' , 'INDIANA' => 'IN' , 'IOWA' => 'IA' , 'KANSAS' => 'KS' , 'KENTUCKY' => 'KY' , 'LOUISIANA' => 'LA' , 'MAINE' => 'ME' , 'MARSHALL ISLANDS' => 'MH' , 'MARYLAND' => 'MD' , 'MASSACHUSETTS' => 'MA' , 'MICHIGAN' => 'MI' , 'MINNESOTA' => 'MN' , 'MISSISSIPPI' => 'MS' , 'MISSOURI' => 'MO' , 'MONTANA' => 'MT' , 'NEBRASKA' => 'NE' , 'NEVADA' => 'NV' , 'NEW HAMPSHIRE' => 'NH' , 'NEW JERSEY' => 'NJ' , 'NEW MEXICO' => 'NM' , 'NEW YORK' => 'NY' , 'NORTH CAROLINA' => 'NC' , 'NORTH DAKOTA' => 'ND' , 'NORTHERN MARIANA ISLANDS' => 'MP' , 'OHIO' => 'OH' , 'OKLAHOMA' => 'OK' , 'OREGON' => 'OR' , 'PALAU' => 'PW' , 'PENNSYLVANIA' => 'PA' , 'PUERTO RICO' => 'PR' , 'RHODE ISLAND' => 'RI' , 'SOUTH CAROLINA' => 'SC' , 'SOUTH DAKOTA' => 'SD' , 'TENNESSEE' => 'TN' , 'TEXAS' => 'TX' , 'UTAH' => 'UT' , 'VERMONT' => 'VT' , 'VIRGIN ISLANDS' => 'VI' , 'VIRGINIA' => 'VA' , 'WASHINGTON' => 'WA' , 'WEST VIRGINIA' => 'WV' , 'WISCONSIN' => 'WI' , 'WYOMING' => 'WY' , 'ARMED FORCES AFRICA' => 'AE' , 'ARMED FORCES EUROPE' => 'AE' , 'ARMED FORCES CANADA' => 'AE' , 'ARMED FORCES MIDDLE EAST' => 'AE' , 'ARMED FORCES AMERICAS' => 'AA' , 'ARMED FORCES PACIFIC' => 'AP'); return $list; } } ?>
  14. JeremyT

    Usight Payment Gateway Problem

    Hello, I am trying to install the payment module contribution for usight gateway. We had to modify the module to work with our older version of oscommerce preview 2.1 release snapshot 2002/06/18. The module installs with no errors. However, when you press confirm order on the checkout confirmation screen the module goes back to checkout payment and displays "The has been an error processing your credit card. Please try again." It seems like the module is never actually posting to the gateway. Any help is appreciated. The changes we made to the original contribution are in bold: <?php /* Brian Yarger <byarger@weens.net> osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ class usight { var $code, $title, $description, $enabled, $states; // class constructor function usight() { $this->code = 'usight'; $this->title = MODULE_PAYMENT_USIGHT_CURL_TEXT_TITLE; $this->description = MODULE_PAYMENT_USIGHT_CURL_TEXT_DESCRIPTION; $this->enabled = ((MODULE_PAYMENT_USIGHT_CURL_STATUS == 'True') ? true : false); $this->states = $this->_state_list(); } // class methods // this method returns the javascript that will validate the form entry function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.payment.usight_cc_owner.value;' . "\n" . ' var cc_number = document.payment.usight_cc_number.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } // this method returns the html that creates the input form 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))); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA == 'True') { $creditCardTypes[] = array('id' => 'VISA', 'text' => 'Visa'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD == 'True') { $creditCardTypes[] = array('id' => 'MASTERCARD', 'text' => 'MasterCard'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX == 'True') { $creditCardTypes[] = array('id' => 'AMEX', 'text' => 'American Express'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER == 'True') { $creditCardTypes[] = array('id' => 'DISCOVER', 'text' => 'Discover'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS == 'True') { $creditCardTypes[] = array('id' => 'DINERS', 'text' => 'Diners Club'); } if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB == 'True') { $creditCardTypes[] = array('id' => 'JCB', 'text' => 'JCB'); } /*$selection = array('id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('usight_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE, 'field' => tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes)), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('usight_cc_number')), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year))));*/ $selection = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_input_field('usight_cc_owner') . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes) . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_input_field('usight_cc_number') . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' </td>' . "\n" . ' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' / ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year) . '</td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $selection; } // this method is called before the data is sent to the credit card processor // here you can do any field validation that you need to do // we also set the global variables here from the form values function pre_confirmation_check() { global $HTTP_POST_VARS; include(DIR_WS_CLASSES . 'cc_validation.php'); $cc_validation = new cc_validation(); $result = $cc_validation->validate($HTTP_POST_VARS['usight_cc_number'], $HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_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 = sprintf(TEXT_CCVAL_ERROR_INVALID_NUMBER, $cc_validation->cc_number); break; } if ( ($result == false) || ($result < 1) ) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } // check the type the user said the card was, versus the type that cc_validation // says it is. //print_r($HTTP_POST_VARS); //print_r($cc_validation); if (($cc_validation->cc_type == 'Visa' && $HTTP_POST_VARS['usight_cc_type'] != 'VISA') || ($cc_validation->cc_type == 'Master Card' && $HTTP_POST_VARS['usight_cc_type'] != 'MASTERCARD') || ($cc_validation->cc_type == 'American Express' && $HTTP_POST_VARS['usight_cc_type'] != 'AMEX') || ($cc_validation->cc_type == 'Diners Club' && $HTTP_POST_VARS['usight_cc_type'] != 'DINERS') || ($cc_validation->cc_type == 'Discover' && $HTTP_POST_VARS['usight_cc_type'] != 'DISCOVER') || ($cc_validation->cc_type == 'JCB' && $HTTP_POST_VARS['usight_cc_type'] != 'JCB')) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_WRONG_TYPE) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year']; //echo $payment_error_return; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } $this->cc_card_owner = $HTTP_POST_VARS['usight_cc_owner']; $this->cc_card_type = $HTTP_POST_VARS['usight_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; /*global $payment, $HTTP_POST_VARS; include(DIR_WS_FUNCTIONS . 'ccval.php'); $cc_val = OnlyNumericSolution($HTTP_POST_VARS['usight_cc_number']); $cc_val = CCValidationSolution($cc_val); echo $cc_val; if ($cc_val == '1') $cc_val = ValidateExpiry($HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_cc_expires_year']); if ($cc_val != '1') { $payment_error_return = 'payment_error=' . $payment . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year'] . '&cc_val=' . urlencode($cc_val); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); }*/ } // this method returns the data for the confirmation page function confirmation() { /*global $HTTP_POST_VARS; $confirmation = array('title' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['usight_cc_owner']), array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE, 'field' => $HTTP_POST_VARS['usight_cc_type']), array('title' => MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year']))))); return $confirmation;*/ global $HTTP_POST_VARS, $CardName, $CardNumber; $confirmation_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' ' . $HTTP_POST_VARS['usight_cc_owner'] . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' ' . $HTTP_POST_VARS['usight_cc_type'] . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' ' . substr($HTTP_POST_VARS['usight_cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['usight_cc_number']) - 8)) . substr($HTTP_POST_VARS['usight_cc_number'], -4) . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' ' . strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year'])) . ' </td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $confirmation_string; } function output_error() { global $HTTP_GET_VARS; $output_error_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" . ' <tr>' . "\n" . ' <td class="main"> <font color="#FF0000"><b>' . $HTTP_GET_VARS['error'] . '</b></font><br> ' . stripslashes(urldecode($HTTP_GET_VARS['cc_val'])) . ' </td>' . "\n" . ' </tr>' . "\n" . '</table>' . "\n"; return $output_error_string; } // this method performs the authorization by sending the data to the processor, and getting the result function process_button() { global $HTTP_SERVER_VARS, $order, $customer_id; $process_button_string = tep_draw_hidden_field('login', ((MODULE_PAYMENT_USIGHT_CURL_TESTMODE == 'Production') ? MODULE_PAYMENT_USIGHT_CURL_LOGIN : 'testgateway')) . tep_draw_hidden_field('firstname', $order->billing['firstname']) . tep_draw_hidden_field('lastname', $order->billing['lastname']) . tep_draw_hidden_field('amount', number_format($order->info['total'], 2)) . tep_draw_hidden_field('cardtype', $this->cc_card_type) . tep_draw_hidden_field('cardnum', $this->cc_card_number) . tep_draw_hidden_field('expmonth', $this->cc_expiry_month) . tep_draw_hidden_field('expyear', $this->cc_expiry_year) . tep_draw_hidden_field('cardname', $this->cc_card_owner) . tep_draw_hidden_field('address', $order->billing['street_address']) . tep_draw_hidden_field('city', $order->billing['city']) . // usight expects 2 digit capilalized state codes tep_draw_hidden_field('state', $this->states[strtoupper($order->billing['state'])]) . tep_draw_hidden_field('zip', $order->billing['postcode']) . tep_draw_hidden_field('country', $order->billing['country']['title']) . tep_draw_hidden_field('phone', $order->customer['telephone']) . // a blank email address will suppress the customer email tep_draw_hidden_field('email', ((MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER == 'True') ? $order->customer['email_address']: '')) . // I would like to get the order number here // but it isn't available under after this code // executes. So, we'll put the date in there // so that we have something to reference. If // we get more than one order per second we // have problems, but I guess that would be // a pretty good problem to have :) tep_draw_hidden_field('invoiceno', date('Ymdhis')) . tep_draw_hidden_field('description', 'Order Submitted from IP: ' . $HTTP_SERVER_VARS['REMOTE_ADDR'] . "\n" . $products_list); $process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id()); return $process_button_string; } // this method gets called after the processing is done but before the app server // accepts the result. It is used to check for errors. function before_process() { global $HTTP_POST_VARS; $path_to_curl = '/etc/curl'; $url = 'https://gateway.usight.com/postauth.secure'; $urlstring = 'GWUsername=' . rawurlencode($HTTP_POST_VARS['login']) . '&GWBillingFirstName=' . rawurlencode($HTTP_POST_VARS['firstname']) . '&GWBillingLastName=' . rawurlencode($HTTP_POST_VARS['lastname']) . '&GWAmount=' . rawurlencode($HTTP_POST_VARS['amount']) . '&GWCardNumber=' . rawurlencode($HTTP_POST_VARS['cardnum']) . '&GWCardExpMonth=' . rawurlencode($HTTP_POST_VARS['expmonth']) . '&GWCardExpYear=' . rawurlencode($HTTP_POST_VARS['expyear']) . '&GWNameOnCard=' . rawurlencode($HTTP_POST_VARS['cardname']) . '&GWBillingAddress=' . rawurlencode($HTTP_POST_VARS['address']) . '&GWBillingCity=' . rawurlencode($HTTP_POST_VARS['city']) . '&GWBillingState=' . rawurlencode($HTTP_POST_VARS['state']) . '&GWBillingZip=' . rawurlencode($HTTP_POST_VARS['zip']) . '&GWBillingCountry=' . rawurlencode($HTTP_POST_VARS['country']) . '&Phone=' . rawurlencode($HTTP_POST_VARS['phone']) . '&Email=' . rawurlencode($HTTP_POST_VARS['email']) . '&custno=' . rawurlencode($HTTP_POST_VARS['custno']) . '&InvoiceNo=' . rawurlencode($HTTP_POST_VARS['invoiceno']) . '&Description=' . rawurlencode($HTTP_POST_VARS['description']); exec("$path_to_curl -f -m 60 -s -e $url -d '".$params."' --url '".$url."'", $ret_arr, $ret_code); /*$ch = curl_init('https://gateway.usight.com/postauth.secure'); curl_setopt($ch, CURLOPT_HEADER, 0); -H curl_setopt($ch, CURLOPT_POST, 1); -d curl_setopt($ch, CURLOPT_POSTFIELDS, $urlstring); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); */ $codes = split("&", $ret_arr); foreach($codes as $code) { list ($header, $value) = split('=', $code); $returnCodes[$header] = $value; } if ($returnCodes['ResponseCode'] != "0") { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($returnCodes['ResponseMessage']) . '<BR>' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE), 'SSL', true, false)); } if (MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS == 'True') { if (strpos(MODULE_PAYMENT_USIGHT_CURL_AVS_CODES, $returnCodes['AVSResponse']) === false) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE_AVS), 'SSL', true, false)); } } # AuthCode is in AuthCode, TransactionID is in TransactionID } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_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 Usight Module', 'MODULE_PAYMENT_USIGHT_CURL_STATUS', 'True', 'Do you want to accept Usight 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_USIGHT_CURL_LOGIN', '', 'The login username used for the Usight 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_USIGHT_CURL_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 ('Customer Notifications', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'False', 'Should Usight 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 ('Check AVS', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'False', 'Should Usight checks the AVS response?', '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 ('Valid AVS Codes', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'A,W,Y,Z', 'Comma separated list of valid AVS Codes from https://gateway.usight.com/avs.jsp', '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 ('Accept Visa', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'True', 'Should we accept Visa?', '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 ('Accept Mastercard', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'True', 'Should we accept Mastercard?', '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 ('Accept American Express', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'False', 'Should we accept American Express?', '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 ('Accept Discover', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'False', 'Should we accept Discover?', '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 ('Accept Diners Club', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'False', 'Should we accept Diners Club?', '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 ('Accept JCB', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB', 'False', 'Should we accept JCB?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_USIGHT_CURL_STATUS', 'MODULE_PAYMENT_USIGHT_CURL_LOGIN', 'MODULE_PAYMENT_USIGHT_CURL_TESTMODE', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB'); } // this internal method returns an array keyed by state name, with a value of state code function _state_list() { $list = array('ALABAMA' => 'AL' , 'ALASKA' => 'AK' , 'AMERICAN SAMOA' => 'AS' , 'ARIZONA' => 'AZ' , 'ARKANSAS' => 'AR' , 'CALIFORNIA' => 'CA' , 'COLORADO' => 'CO' , 'CONNECTICUT' => 'CT' , 'DELAWARE' => 'DE' , 'DISTRICT OF COLUMBIA' => 'DC' , 'FEDERATED STATES OF MICRONESIA' => 'FM' , 'FLORIDA' => 'FL' , 'GEORGIA' => 'GA' , 'GUAM' => 'GU' , 'HAWAII' => 'HI' , 'IDAHO' => 'ID' , 'ILLINOIS' => 'IL' , 'INDIANA' => 'IN' , 'IOWA' => 'IA' , 'KANSAS' => 'KS' , 'KENTUCKY' => 'KY' , 'LOUISIANA' => 'LA' , 'MAINE' => 'ME' , 'MARSHALL ISLANDS' => 'MH' , 'MARYLAND' => 'MD' , 'MASSACHUSETTS' => 'MA' , 'MICHIGAN' => 'MI' , 'MINNESOTA' => 'MN' , 'MISSOURI' => 'MS' , 'MONTANA' => 'MT' , 'NEBRASKA' => 'NE' , 'NEVADA' => 'NV' , 'NEW HAMPSHIRE' => 'NH' , 'NEW JERSEY' => 'NJ' , 'NEW MEXICO' => 'NM' , 'NEW YORK' => 'NY' , 'NORTH CAROLINA' => 'NC' , 'NORTH DAKOTA' => 'ND' , 'NORTHERN MARIANA ISLANDS' => 'MP' , 'OHIO' => 'OH' , 'OKLAHOMA' => 'OK' , 'OREGON' => 'OR' , 'PALAU' => 'PW' , 'PENNSYLVANIA' => 'PA' , 'PUERTO RICO' => 'PR' , 'RHODE ISLAND' => 'RI' , 'SOUTH CAROLINA' => 'SC' , 'SOUTH DAKOTA' => 'SD' , 'TENNESSEE' => 'TN' , 'TEXAS' => 'TX' , 'UTAH' => 'UT' , 'VERMONT' => 'VT' , 'VIRGIN ISLANDS' => 'VI' , 'VIRGINIA' => 'VA' , 'WASHINGTON' => 'WA' , 'WEST VIRGINIA' => 'WV' , 'WISCONSIN' => 'WI' , 'WYOMING' => 'WY' , 'ARMED FORCES AFRICA' => 'AE' , 'ARMED FORCES EUROPE' => 'AE' , 'ARMED FORCES CANADA' => 'AE' , 'ARMED FORCES MIDDLE EAST' => 'AE' , 'ARMED FORCES AMERICAS' => 'AA' , 'ARMED FORCES PACIFIC' => 'AP'); return $list; } } ?>
×