Snowman Posted June 13, 2003 Share Posted June 13, 2003 This module is designed for use with ESEC/Securepay in Australia, (not related to Securepay USA) and has been coded for MS2 release of oscommerce 2.2. You need to ensure you have AUD set as a currency in your admin as ESEC/Securepay requires transactions in AUD. Current ESEC Customers please not that you will need to contact ESEC/Securepay and ask them to swap you over to the Securepay gateway as opposed to the ESEC one as this module will not work on the old ESEC gateway. Also note its very hard to get a straight answer out of ESEC/Securepay as ESEC was taken over by Securepay and there is still confusion :( DOWNLOAD HERE Quote Link to comment Share on other sites More sharing options...
Snowman Posted December 24, 2003 Author Share Posted December 24, 2003 Updated version of this module. This new version introduces the CVV number and an order Identifier created by a combination of the store name and the date in Ymdhis format. enjoy :) Quote Link to comment Share on other sites More sharing options...
TB Posted February 27, 2004 Share Posted February 27, 2004 I'm receiving the same 'Invalid Transaction Amount' error as this post: http://www.oscommerce.com/forums/index.php?showtopic=77003 Anyone have ideas on how to correct the problem? Thanks, Tony Quote "The price of success is perseverance. The price of failure comes much cheaper." Link to comment Share on other sites More sharing options...
Snowman Posted February 27, 2004 Author Share Posted February 27, 2004 Tony Find this line: (approx line 160) in securepay.php tep_draw_hidden_field('amount', number_format((($order->info['total'] * $currencies->currencies['AUD']['value'])*100), 0, '', '')) . and change it to: tep_draw_hidden_field('amount', number_format(($order->info['total']*100), 0, '', '')) . and try it. (note that this wont convert other currenices into AUD for processing however) Quote Link to comment Share on other sites More sharing options...
TB Posted February 27, 2004 Share Posted February 27, 2004 Steve, Thanks for your prompt response. I was looking at that line and wondering what there was I could do to correct it. What's the problem with it? Does it include the dollar sign or decimal as part of the conversion or something? It's not a big deal for myself at the minute and probably won't be for a little while, though it'd be good to work it out so it functions with multi-currency. Thanks, Tony Quote "The price of success is perseverance. The price of failure comes much cheaper." Link to comment Share on other sites More sharing options...
TB Posted February 28, 2004 Share Posted February 28, 2004 Just curious also how I go about testing the transactions with the test card details as per the SecurePay website here: http://www.esecpayments.com.au/index.jsp?id=ssldevel There are three test cards which they use: testsuccess - Always successfully processed and authorised testfailure - Always successfully processed and refused testtimeout - Never responds and the transaction will time out The only problem is that the osCommerce (I'm using MS2) ccvalidation and credit card number conversion script (I'm assuming there's a script to ensure there's no text in the card number) doesn't let the above test cards go through. Any help would be great as this is the last step I've got before taking credit cards online. Thanks so much for your help, Tony Quote "The price of success is perseverance. The price of failure comes much cheaper." Link to comment Share on other sites More sharing options...
TB Posted February 28, 2004 Share Posted February 28, 2004 Found the answer. There are two test cards numbers 4242424242424242 or 4444333322221111 with any expiry date. (You need to take into account that osCommerce does expiy date validations so it will need to be in the future to be accepted by osCommerce, though any date will go through eSec / SecurePay.) If you would like an 'Approved' response, pass a total amount ending with either 00 or 08. If you would like a 'Denied' response, pass through any other amount... i.e. 01 or 02. To make this clearer. If you pass through a total shopping cart amount of $108.08, you will get an accepted response as it ends with 08. So on and so forth. You may want to make shipping charges nil for ease of testing as you will only need to focus on setting the product price. I've tested the above with the modifications posted by Steve and it works great. Hope this helps, Tony Quote "The price of success is perseverance. The price of failure comes much cheaper." Link to comment Share on other sites More sharing options...
Raven_FCF Posted August 15, 2004 Share Posted August 15, 2004 hi all. thnx for this contribution snowman. after uploading the modules i went to the admin panel Payment Modules and found that i am getting a strange error at the top of the page. also, securepay does not show up in my list. Parse error: parse error, expecting `')'' in /usr/home/blank/public_html/shop/includes/modules/payment/securepay.php on line 150 any help is appreciated. - Raven Quote Link to comment Share on other sites More sharing options...
Guest Posted August 21, 2004 Share Posted August 21, 2004 Am gettining the exact same error as Raven_FCF .. have you, or anyone else found a solution to .. Parse error: parse error, expecting `')'' in /usr/home/blank/public_html/shop/includes/modules/payment/securepay.php on line 150 Quote Link to comment Share on other sites More sharing options...
TB Posted August 21, 2004 Share Posted August 21, 2004 G'day all! It's been a while since I've mucked around with the osCommerce code, though I've had my SecurePay module working for a while now. Here's a copy of my includes\modules\payment\securepay.php file. Please let me know how you go with it. I'm pretty busy lately, so if it works I might not be able to upload it. If it does work, can someone please add it to the package and re-submit it to the existing contribution. Hope this helps... Tony Note: I have the "Unallowed Payment" module installed. The few lines of code referring to shouldn't cause any problems, though if you find it does or you just don't want it in there for whatever reason, comment out line 25. Also note that I've commented out line 164 as the currency conversion aspect was causing problems for me when I was installing the module. The module works fine, though only processes AUD. Cards from other countries can still be processed fine, since the issue isn't with processing overseas cards, it's to do with other than AUD pricing on your site. <?php /* $Id: esec/securepay.php,v 1.2 2003/12/24 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class securepay { var $code, $title, $description, $enabled, $states; // class constructor function securepay() { global $order; $this->code = 'securepay'; $this->title = MODULE_PAYMENT_SECUREPAY_TEXT_TITLE; $this->description = MODULE_PAYMENT_SECUREPAY_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_SECUREPAY_SORT_ORDER; /* Unallowed Payment - BOF */ if (tep_get_payment_unallowed($this->code)) /* Unallowed Payment - EOF */ $this->enabled = ((MODULE_PAYMENT_SECUREPAY_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->form_action_url = ((MODULE_PAYMENT_SECUREPAY_TESTMODE == 'Test') ? 'http://test.securepay.com.au/securepay/payments/process2.asp' : 'https://www.securepay.com.au/securepay/payments/process2.asp'); } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SECUREPAY_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_SECUREPAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.checkout_payment.securepay_cc_owner.value;' . "\n" . ' var cc_number = document.checkout_payment.securepay_cc_number.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_SECUREPAY_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_SECUREPAY_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } function selection() { global $order; for ($i=1; $i<13; $i++) { $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); } $today = getdate(); for ($i=$today['year']; $i < $today['year']+10; $i++) { $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i))); } $selection = array('id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('securepay_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('securepay_cc_number')), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_CVV, 'field' => tep_draw_input_field('securepay_cvv', '', 'size=3 maxlength=3')), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('securepay_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('securepay_cc_expires_year', $expires_year)))); return $selection; } 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['securepay_cc_number'], $HTTP_POST_VARS['securepay_cc_expires_month'], $HTTP_POST_VARS['securepay_cc_expires_year']); $error = ''; switch ($result) { case -1: $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4)); break; case -2: case -3: case -4: $error = TEXT_CCVAL_ERROR_INVALID_DATE; break; case false: $error = TEXT_CCVAL_ERROR_INVALID_NUMBER; break; } if ( ($result == false) || ($result < 1) ) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&securepay_cc_owner=' . urlencode($HTTP_POST_VARS['securepay_cc_owner']) . '&securepay_cc_type=' . urlencode($HTTP_POST_VARS['securepay_cc_type']) . '&securepay_cc_expires_month=' . $HTTP_POST_VARS['securepay_cc_expires_month'] . '&securepay_cc_expires_year=' . $HTTP_POST_VARS['securepay_cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } $this->cc_card_owner = $HTTP_POST_VARS['securepay_cc_owner']; $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['securepay_cvv']; } function confirmation() { global $HTTP_POST_VARS; $confirmation = array('title' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['securepay_cc_owner']), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_TYPE, 'field' => $HTTP_POST_VARS['securepay_cc_type']), array('title' => MODULE_PAYMENT_SECUREPAY_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_SECUREPAY_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['securepay_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['securepay_cc_expires_year']))), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_CVV, 'field' => $HTTP_POST_VARS['securepay_cvv']))); return $confirmation; } function process_button() { global $HTTP_SERVER_VARS, $order, $customer_id; $process_button_string = tep_draw_hidden_field('merchantid', MODULE_PAYMENT_SECUREPAY_MERCHANT_ID) . tep_draw_hidden_field('amount', number_format(($order->info['total']*100), 0, '', '')) . // tep_draw_hidden_field('amount', number_format((($order->info['total'] * $currencies->currencies['AUD']['value'])*100), 0, '', '')) . tep_draw_hidden_field('ponum', STORE_NAME . date('Ymdhis')) . tep_draw_hidden_field('creditCard1', $this->cc_card_number) . tep_draw_hidden_field('exdate1', $this->cc_expiry_month) . tep_draw_hidden_field('cvvno', $this->cc_cvv) . tep_draw_hidden_field('exdate2', substr($this->cc_expiry_year, -2)) . tep_draw_hidden_field('success_page', tep_href_link(FILENAME_CHECKOUT_PROCESS, tep_session_name() . "=" . tep_session_id() . '&ponum=', 'SSL', false)) . tep_draw_hidden_field('failure_page', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&' . tep_session_name() . "=" . tep_session_id() . '&ponum=', 'SSL', false)); $process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id()); return $process_button_string; } function before_process() { return false; } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $msg = ""; if (stripslashes(urldecode($HTTP_GET_VARS['response_text'])) != "") $msg = stripslashes(urldecode($HTTP_GET_VARS['response_text'])); else if (stripslashes(urldecode($HTTP_GET_VARS['error'])) != "") $msg = stripslashes(urldecode($HTTP_GET_VARS['error'])); $error = array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_ERROR, 'error' => $msg); return $error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_SECUREPAY_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 SecurePay/ESEC Module', 'MODULE_PAYMENT_SECUREPAY_STATUS', 'True', 'Do you want to accept SecurePay/ESEC payments?', '6', '1', '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, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_SECUREPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_SECUREPAY_MERCHANT_ID', 'sec0001', 'The merchant id used for the SecurePay 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_SECUREPAY_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, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_SECUREPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_SECUREPAY_STATUS', 'MODULE_PAYMENT_SECUREPAY_ZONE', 'MODULE_PAYMENT_SECUREPAY_MERCHANT_ID', 'MODULE_PAYMENT_SECUREPAY_TESTMODE', 'MODULE_PAYMENT_SECUREPAY_SORT_ORDER', 'MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID'); } } ?> Quote "The price of success is perseverance. The price of failure comes much cheaper." Link to comment Share on other sites More sharing options...
Guest Posted August 22, 2004 Share Posted August 22, 2004 Yep .. after a bit of reformatting (around line 215 as cut & pasted) .. and commenting out line 25 .. it all worked .. Thanks !!! Quote Link to comment Share on other sites More sharing options...
mafiouso Posted August 31, 2004 Share Posted August 31, 2004 hi i had teh same problem? i dunno why i tryied to follow you your posts. but im not the best with PHP. i got it to work to the point of payment choice: SecurePay/ESEC Credit Card Owner: Credit Card Number: MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_CVV Credit Card Expiry Date: thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted August 31, 2004 Share Posted August 31, 2004 Note .. I spoke to securepay directly yestertoday, and they did inform me there is an issue with the OSC contrib (Securepay does know about OsCommerce) .. they will email you out a "securepay" version of it .. Call them on their regular sales number as listed on their site. Quote Link to comment Share on other sites More sharing options...
irontap Posted January 31, 2006 Share Posted January 31, 2006 does anyone know what i have to modify, if anything to get this to work with the US version of SecurePay? j Quote Link to comment Share on other sites More sharing options...
maddogpom Posted March 3, 2007 Share Posted March 3, 2007 Good day All :) Just read through the posts on this subject. As im having issues here too. have tried all 3 esec/securepay modules with no success as yet. getting closer im using this module and have edited the the amount as was getting invalid amount after doing that edit I now get this error.. Credit Card Error! Reserved Error Here is my securepay.php any help would be great thanks. <?php /* $Id: esec/securepay.php,v 1.1 2003/06/13 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ class securepay { var $code, $title, $description, $enabled, $states; // class constructor function securepay() { global $order; $this->code = 'securepay'; $this->title = MODULE_PAYMENT_SECUREPAY_TEXT_TITLE; $this->description = MODULE_PAYMENT_SECUREPAY_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_SECUREPAY_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_SECUREPAY_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->form_action_url = ((MODULE_PAYMENT_SECUREPAY_TESTMODE == 'Test') ? 'http://test.securepay.com.au/securepay/payments/process2.asp' : 'https://www.securepay.com.au/securepay/payments/process2.asp'); } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SECUREPAY_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_SECUREPAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { $js = ' if (payment_value == "' . $this->code . '") {' . "\n" . ' var cc_owner = document.checkout_payment.securepay_cc_owner.value;' . "\n" . ' var cc_number = document.checkout_payment.securepay_cc_number.value;' . "\n" . ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" . ' error_message = error_message + "' . MODULE_PAYMENT_SECUREPAY_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_SECUREPAY_TEXT_JS_CC_NUMBER . '";' . "\n" . ' error = 1;' . "\n" . ' }' . "\n" . ' }' . "\n"; return $js; } function selection() { global $order; for ($i=1; $i<13; $i++) { $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); } $today = getdate(); for ($i=$today['year']; $i < $today['year']+10; $i++) { $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i))); } $selection = array('id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('securepay_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('securepay_cc_number')), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('securepay_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('securepay_cc_expires_year', $expires_year)))); return $selection; } 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['securepay_cc_number'], $HTTP_POST_VARS['securepay_cc_expires_month'], $HTTP_POST_VARS['securepay_cc_expires_year']); $error = ''; switch ($result) { case -1: $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4)); break; case -2: case -3: case -4: $error = TEXT_CCVAL_ERROR_INVALID_DATE; break; case false: $error = TEXT_CCVAL_ERROR_INVALID_NUMBER; break; } if ( ($result == false) || ($result < 1) ) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&securepay_cc_owner=' . urlencode($HTTP_POST_VARS['securepay_cc_owner']) . '&securepay_cc_type=' . urlencode($HTTP_POST_VARS['securepay_cc_type']) . '&securepay_cc_expires_month=' . $HTTP_POST_VARS['securepay_cc_expires_month'] . '&securepay_cc_expires_year=' . $HTTP_POST_VARS['securepay_cc_expires_year']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } $this->cc_card_owner = $HTTP_POST_VARS['securepay_cc_owner']; $this->cc_card_number = $cc_validation->cc_number; $this->cc_expiry_month = $cc_validation->cc_expiry_month; $this->cc_expiry_year = $cc_validation->cc_expiry_year; } function confirmation() { global $HTTP_POST_VARS; $confirmation = array('title' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_CREDIT_CARD_OWNER, 'field' => $HTTP_POST_VARS['securepay_cc_owner']), array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_TYPE, 'field' => $HTTP_POST_VARS['securepay_cc_type']), array('title' => MODULE_PAYMENT_SECUREPAY_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_SECUREPAY_TEXT_CREDIT_CARD_EXPIRES, 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['securepay_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['securepay_cc_expires_year']))))); return $confirmation; } function process_button() { global $HTTP_SERVER_VARS, $order, $customer_id; $process_button_string = tep_draw_hidden_field('merchantid', MODULE_PAYMENT_SECUREPAY_MERCHANT_ID) . tep_draw_hidden_field('amount', number_format(($order->info['total']*100), 0, '', '')) . tep_draw_hidden_field('ponum', date('Ymdhis')) . tep_draw_hidden_field('creditCard1', $this->cc_card_number) . tep_draw_hidden_field('exdate1', $this->cc_expiry_month) . tep_draw_hidden_field('exdate2', substr($this->cc_expiry_year, -2)) . tep_draw_hidden_field('success_page', tep_href_link(FILENAME_CHECKOUT_PROCESS, 'ponum=' . date('Ymdhis'), 'SSL', false)) . tep_draw_hidden_field('failure_page', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&ponum=', 'SSL', false)); $process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id()); return $process_button_string; } function before_process() { return false; } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $msg = ""; if (stripslashes(urldecode($HTTP_GET_VARS['response_text'])) != "") $msg = stripslashes(urldecode($HTTP_GET_VARS['response_text'])); else if (stripslashes(urldecode($HTTP_GET_VARS['error'])) != "") $msg = stripslashes(urldecode($HTTP_GET_VARS['error'])); $error = array('title' => MODULE_PAYMENT_SECUREPAY_TEXT_ERROR, 'error' => $msg); return $error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_SECUREPAY_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 SecurePay/ESEC Module', 'MODULE_PAYMENT_SECUREPAY_STATUS', 'True', 'Do you want to accept SecurePay/ESEC payments?', '6', '1', '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, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_SECUREPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_SECUREPAY_MERCHANT_ID', 'sec0001', 'The merchant id used for the SecurePay 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_SECUREPAY_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, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_SECUREPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_SECUREPAY_STATUS', 'MODULE_PAYMENT_SECUREPAY_ZONE', 'MODULE_PAYMENT_SECUREPAY_MERCHANT_ID', 'MODULE_PAYMENT_SECUREPAY_TESTMODE', 'MODULE_PAYMENT_SECUREPAY_SORT_ORDER', 'MODULE_PAYMENT_SECUREPAY_ORDER_STATUS_ID'); } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.