Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SECPay 2.2 error


Drew

Recommended Posts

Can anyone using SECPay 2.2 help me out? The card used is authorised ok by SECPay, but when returning to my site, the customer is told that there was an error with their card and that they should try again.

 

I have run it in Always Successful and Production modes - both with the same outcome.

 

Any ideas pleeeeeeease?

 

Andrew.

Link to comment
Share on other sites

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Sounds like your host has disabled reverse lookups.

 

If you download the lastest CVS I have updated the module to use the hash key system.

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Link to comment
Share on other sites

I think I found the updated SECPay module: secpay.php,v 1.37 2004/03/26 18:33:59 - is that the one?

 

After replacing the existing module with this one I tried an order, but was presented with "Fatal error: Call to a member function on a non-object in /home/trevors/public_html/catalog/includes/modules/payment/secpay.php on line 84 "

 

at the bottom of the screen. Any ideas on what's going on here?

 

Thanks in advance.

Link to comment
Share on other sites

  • 3 weeks later...

Hi Nigel,

 

We're still trying to sort it out. Mark has sent me various versions of the secpay.php file, and we're still trying to get one to work - he's very patient!

 

I found the one you're asking about at:

 

http://cvs.oscommerce.com/viewcvs.cgi/cata...odules/payment/

 

Are you having similar problems?

 

Andrew.

Link to comment
Share on other sites

Hi Drew,

Yes it's exactly the same, I've tried a couple of different versions, with no luck. What did you enter in the 'digest key' field? in the secpay.php file it says to look for help on the secpay site, but I can't find much info on it.

I'm installing this on a live site and my client is understandably getting a bit frustrated, having set-up a secpay account and now not able to use it.

 

If you come up with a solution be sure to post it here :-)

 

Thanks

 

Nigel

Link to comment
Share on other sites

Hi Andrew

 

I have setup a clean ms-2 and the updated module works without a hitch... Note I am using the default Secpay test passwords.

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Link to comment
Share on other sites

Hi Sparky,

I'm having the same problem as Andrew, I did a fresh install on a different domain on the same server (using Fantastico) and the problem's still there. I'm going to try installing manually to see if that makes a difference.

 

Regards

 

Nigel

Link to comment
Share on other sites

Mark - does your server allow reverse look-ups? As you know, I'm trying to see find out if that's the case on mine, and if it can be taken off. What about yours, Nigel? Do you know if that's the way your server is set up.

 

I know what you mean about the client getting a bit anxious about being able to use SECpay since they've paid for it.

 

Anyway, my head's spinning now with all this, so I'm giving up for tonight. Let's all keep each other posted tomorrow.

 

Andrew

Link to comment
Share on other sites

The new secpay module doesnt use reverse lookups :)

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Link to comment
Share on other sites

Hi Andrew,

I've tried a clean install of MS2 with no luck, I still get the following error

 

Fatal error: Call to a member function on a non-object in /home/user/public_html/catalog/includes/modules/payment/secpay.php on line 84

 

I'm guessing it's some sort of a server problem as Mark's clean install is working ok.

I have another server, in a totally different data centre, with a different set-up. I'm going to try a clean install on this tomorrow to see if it works.

 

My current server is set-up to allow reverse dns look-up, but the original secpay.php won't work on it, (processes payment but gives card error on OSC) so I'm thinking there might be another problem which is not directly related to Marks' modification, but to be honest I really don't know. :blink:

 

I'm wondering if running PHP in safe mode could cause this problem ?

 

Nigel

Link to comment
Share on other sites

Right....let's see where we are now on this.

 

Do I need to download the os2.2 MS2 Zip and use the extracted secpay.php from there?

 

The SECpay account was changed to use the Digest and Remote keys - do I need to ask them to now take this off?

 

Do I then need to make an appointment with a psychiatrist if it still doesn't work?

 

Andrew.

Link to comment
Share on other sites

The module I have on my demo store is an updated on which removed the reverse lookup functionality.

 

As I dont have a full secpay account I am unable to test. I have fully tested it with the default secpay account and didnt experience problems.

 

I suspect there is a problem where the remote password being used to create the digest is different from the one on the secpay system which is why the error message is displayed :(

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Link to comment
Share on other sites

Hi Guys,

 

Just to keep you up to date - I'm still waiting for SECPay tech support to remove the need for digest/remote key from my bloke's account, then I'll give it another try through Mark's setup.

 

Andrew

Link to comment
Share on other sites

Hi Andrew,

Just out of interest does the module work for you if you use 'secpay' as the user id and digest key? I've tried and it won't work for me.

 

Regards

 

Nigel

Link to comment
Share on other sites

Hi Nigel,

 

Nope it didn't work for me.

 

Progress, though. I asked SECpay to remove the requirement for the digest/remote keys from the account I'm using, then used the setup on Mark's server with our merchant id....hey presto - it worked. I've emailed Mark to see if he'll send me the exact same module that is sitting on his server for me to upload to mine. We'll be a bit nearer finding the root cause of all this then.....I hope. Who knows - it might even work. Here's hoping.

 

Cheerie

 

Andrew

Link to comment
Share on other sites

Here's the latest:

 

Mark emailed me the very same secpay.php that's running on his server with no problems. Tried it on mine, and it still produces the 'keys don't match' error. I'm very confused now as this one doesn't even use the key function apparently. Any ideas where we go from here, guys? :blink:

Link to comment
Share on other sites

  • 1 month later...

Did you guys ever get this issue solved? I'm setting up a secpay site and I seem to be having the same issue with the default module.

Link to comment
Share on other sites

Hi evisions

We did get this sorted.

 

It's going back a few weeks and I've had loads of issues since this, but remembering all the trouble I had with this, I'll happily help you out.

Can you find out, and let me know what version of OSC and secpay.php you're using? After alot of work we solved this problem pretty quickly so please don't worry it will be sorted :-)

 

Nigel

Link to comment
Share on other sites

I have just come across this issue as well, wondering if anyone can help.

I'm running OSC v2.2-MS2 and secpay.php is v1.31

I've left the merchant ID as secpay and have the Transaction Mode set to Always Successful, on submitting a transaction I get bounced back to the Payment Information screen with a message saying Credit Card Error! at the top although I get a confirmation email from Secpay telling me the transaction status is okay.

Link to comment
Share on other sites

Hi, below is a copy of a message sent to me from Andrew who kindly helped me out with this problem.

 

Mark has solved the problem on my bloke's site. It appears that SECPay doesn't like spaces in the store name that is set up in the general store configuration area. If your store name has more than one word with any spaces try putting a '-' in between and see what happens.

 

Post back if this helps. I was using secpay version 1.32.2.7 2004/03/26 I've posted the code for this version below so you can copy it and use it.

 

<?php
/*
$Id: secpay.php,v 1.32.2.7 2004/03/26 16:56:45 sparky Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright ? 2003 osCommerce

Released under the GNU General Public License
*/

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

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

$this->code = 'secpay';
$this->title = MODULE_PAYMENT_SECPAY_TEXT_TITLE;
$this->description = MODULE_PAYMENT_SECPAY_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_SECPAY_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_SECPAY_STATUS == 'True') ? true : false);

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

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

$this->form_action_url = 'https://www.secpay.com/java-bin/ValCard';
}

// class methods
function update_status() {
global $order;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SECPAY_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_SECPAY_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() {
return false;
}

function selection() {
return array('id' => $this->code,
'module' => $this->title);
}

function pre_confirmation_check() {
return false;
}

function confirmation() {
return false;
}

function process_button() {
global $order, $currencies, $currency;

switch (MODULE_PAYMENT_SECPAY_CURRENCY) {
case 'Default Currency':
$sec_currency = DEFAULT_CURRENCY;
break;
case 'Any Currency':
default:
$sec_currency = $currency;
break;
}

switch (MODULE_PAYMENT_SECPAY_TEST_STATUS) {
case 'Always Fail':
$test_status = 'false';
break;
case 'Production':
$test_status = 'live';
break;
case 'Always Successful':
default:
$test_status = 'true';
break;
}

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
$order_details .= 'prod=' . $order->products[$i]['name'] . ',item_amout=' . number_format($order->products[$i]['final_price'] * $currencies->get_value($sec_currency), $currencies->currencies[$sec_currency]['decimal_places'], '.', '') . 'x' . $order->products[$i]['qty'] . ';';
}

$order_details .= 'TAX=' . number_format($order->info['tax'] * $currencies->get_value($sec_currency), $currencies->currencies[$sec_currency]['decimal_places'], '.', '') . ';';
$order_details .= 'SHIPPING=' . number_format($order->info['shipping_cost'] * $currencies->get_value($sec_currency), $currencies->currencies[$sec_currency]['decimal_places'], '.', '') . ';';

$trans_id = STORE_NAME . date('Ymdhis');
$digest = md5($trans_id . number_format($order->info['total'] * $currencies->get_value($sec_currency), $currencies->currencies[$sec_currency]['decimal_places'], '.', '') . MODULE_PAYMENT_SECPAY_REMOTE_PASSWORD);

$process_button_string = tep_draw_hidden_field('merchant', MODULE_PAYMENT_SECPAY_MERCHANT_ID) .
tep_draw_hidden_field('trans_id', $trans_id) .
tep_draw_hidden_field('amount', number_format($order->info['total'] * $currencies->get_value($sec_currency), $currencies->currencies[$sec_currency]['decimal_places'], '.', '')) .
tep_draw_hidden_field('bill_name', $order->billing['firstname'] . ' ' . $order->billing['lastname']) .
tep_draw_hidden_field('bill_addr_1', $order->billing['street_address']) .
tep_draw_hidden_field('bill_addr_2', $order->billing['suburb']) .
tep_draw_hidden_field('bill_city', $order->billing['city']) .
tep_draw_hidden_field('bill_state', $order->billing['state']) .
tep_draw_hidden_field('bill_post_code', $order->billing['postcode']) .
tep_draw_hidden_field('bill_country', $order->billing['country']['title']) .
tep_draw_hidden_field('bill_tel', $order->customer['telephone']) .
tep_draw_hidden_field('bill_email', $order->customer['email_address']) .
tep_draw_hidden_field('ship_name', $order->delivery['firstname'] . ' ' . $order->delivery['lastname']) .
tep_draw_hidden_field('ship_addr_1', $order->delivery['street_address']) .
tep_draw_hidden_field('ship_addr_2', $order->delivery['suburb']) .
tep_draw_hidden_field('ship_city', $order->delivery['city']) .
tep_draw_hidden_field('ship_state', $order->delivery['state']) .
tep_draw_hidden_field('ship_post_code', $order->delivery['postcode']) .
tep_draw_hidden_field('ship_country', $order->delivery['country']['title']) .
tep_draw_hidden_field('currency', $sec_currency) .
tep_draw_hidden_field('order', $order_details) .
tep_draw_hidden_field('digest', $digest) .
tep_draw_hidden_field('callback', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false) . ';' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL', false)) .
tep_draw_hidden_field('backcallback', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', false)) .
tep_draw_hidden_field(tep_session_name(), tep_session_id()) .
tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_flds=' . tep_session_name());

return $process_button_string;
}

function before_process() {

if (PHP_VERSION < 4.1) {
global $_GET;
}

if ($_GET['valid'] == 'true') {
list($REQUEST_URI) = split("hash=", $_SERVER['REQUEST_URI']);
if ($_GET['hash'] != MD5($REQUEST_URI . MODULE_PAYMENT_SECPAY_DIGEST_KEY)) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $HTTP_POST_VARS[tep_session_name()] . '&payment_error=' . $this->code, 'SSL', false, false));
}
} else {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $HTTP_POST_VARS[tep_session_name()] . '&payment_error=' . $this->code, 'SSL', false, false));
}
}

function after_process() {
return false;
}

function get_error() {
if (PHP_VERSION < 4.1) {
global $_GET;
}

if (isset($_GET['message']) && (strlen($_GET['message']) > 0)) {
$error = stripslashes(urldecode($_GET['message']));
} else {
$error = MODULE_PAYMENT_SECPAY_TEXT_ERROR_MESSAGE;
}

return array('title' => MODULE_PAYMENT_SECPAY_TEXT_ERROR,
'error' => $error);
}

function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_SECPAY_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 SECpay Module', 'MODULE_PAYMENT_SECPAY_STATUS', 'True', 'Do you want to accept SECPay 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, date_added) values ('Merchant ID', 'MODULE_PAYMENT_SECPAY_MERCHANT_ID', 'secpay', 'Merchant ID to use for the SECPay service', '6', '2', 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 Currency', 'MODULE_PAYMENT_SECPAY_CURRENCY', 'Any Currency', 'The currency to use for credit card transactions', '6', '3', 'tep_cfg_select_option(array(\'Any Currency\', \'Default Currency\'), ', 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_SECPAY_TEST_STATUS', 'Always Successful', 'Transaction mode to use for the SECPay service', '6', '4', 'tep_cfg_select_option(array(\'Always Successful\', \'Always Fail\', \'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_SECPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', 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_SECPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_SECPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '7', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Digest Key', 'MODULE_PAYMENT_SECPAY_DIGEST_KEY', 'secpay', 'Key to use for the digest functionality', '6', '8', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Digest Key', 'MODULE_PAYMENT_SECPAY_REMOTE_PASSWORD', 'secpay', 'Key to use for the remote password functionality', '6', '8', now())");
}

function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
return array('MODULE_PAYMENT_SECPAY_STATUS', 'MODULE_PAYMENT_SECPAY_MERCHANT_ID', 'MODULE_PAYMENT_SECPAY_CURRENCY', 'MODULE_PAYMENT_SECPAY_TEST_STATUS', 'MODULE_PAYMENT_SECPAY_ZONE', 'MODULE_PAYMENT_SECPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_SECPAY_SORT_ORDER', 'MODULE_PAYMENT_SECPAY_DIGEST_KEY', 'MODULE_PAYMENT_SECPAY_REMOTE_PASSWORD');
}
}
?>

Regards

 

Nigel

Link to comment
Share on other sites

Hi Nigel,

 

Many thanks for a quick response, feels like we're closer but not quite there yet. I first changed the store name and put in hyphens but that just gave me the same result as before, I then used the version of secpay.php from here and now, when transferring to secpay I get the error message;

Digests do not match : possible fraud attempt.

I'm having a poke about but since this bit is all new to me it's not making a lot of sense, hoping someone can enlighten me!

 

Much obliged.

 

Regards,

 

Stash

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...