Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seemless secpay module


pillhead

Recommended Posts

Posted

Is there no way that secpay can be intergrated into oScommerce properly, without that silly green screen comming up asking you to enter your card details.

 

 

Something like the securepay module (which I didnt realise was a different compnay!).

 

 

 

Cheers

  • 4 weeks later...
Posted

I?m looking for the same thing...my customers keep running away when that "Silly green screen" comes up

 

Please let us know if there is anything out there that we can use and if not please can someone maybe help us make one!

 

Simon

:D

  • 1 month later...
Posted

Secpay will allow you to amend their standard template in anyway you wish. Once done your version can be uploaded to their secure server along with your images and away you go.

Take a look at the thei technical FAQs https://www.secpay.com/tech.html theres an answer in there (question 3).

  • 3 weeks later...
Posted

I am currently having a few probs linking to this template. Got the site working perfectly with the green screen, but I don't want it, obviously.

So I tried linking to the template as they suggest from secpay.php and repalcing the

 

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

 

with this

 

$this->form_action_url = 'https://www.secpay.com/users/myname/mytemplate.htm';

 

 

What you get is the blank template with all the $variables appearing in all the form fields.

 

Also it is not sending the correct digest key info or anything else for that matter.

 

 

Secpay suggest that you have to include lines like:

 

<input type="hidden" name="template" value="http:www.secpay.com/users/myname/mytemplate.htm

 

But where? I have no idea.

 

Anyone?

Have a good time . . . all the time. That's my philosophy on life, Marty

Posted

The concept is very simple you know, if you look at there standard form it actually has an extra value that it sends to say "process this order" instead of displaying the form.

 

 

So if you make the form on your computer and then make a script to generate the correct values, you could send payment details directly form your server.

 

 

 

I altered my mates secpay script to include the checking of the the hash string that you can store which implements a great security measure to match that of reverse ip lookups which no longer work on secpay servers.

 

 

My next job will be to invent this seemless module, then I think I will release it.

 

 

 

 

 

But I have my new record label to attend to atm, which is taking up so much of my time ;p

Posted

Thanks for the reply,

 

Think I better dust down my PHP Tome out then and turn to page one.

The MD5 Digest key thing is working already with the default page generated by Secpay as you can set this in the modified Secpay contribution and on your secpay account.

Their form seems to be using a java applet or something to retrieve the values.

Way over my head.

If you say its a matter of coming up with a simple script to pass values to the form then I better get reading.

Funny, I've been running round in circles with this for ages while my record label festers on a remote corner of the internet.

 

I'll let you know if I get anywhere

 

Thanks

Have a good time . . . all the time. That's my philosophy on life, Marty

Posted

I emailed tech support at Secpay who gave this response

 

"The 'template' field (like the 'mandatory parameters')

is part of a form hosted on your server which POSTs to

https://www.secpay.com/java-bin/ValCard on our servers.

 

The template you upload is not meant to be referenced directly (this is why you

see all the ${variable_name} variables in cleartext when doing so. When the form

hosted on your server makes the POST request to

https://www.secpay.com/java-bin/ValCard, one of the hidden input fields in that

form is 'template'. This instructs our software to take the template found at

the location specified and filter our the variables with actual values."

 

This makes things slightly easier and suggests that all you need to access your template is to put

 

input type="hidden" name="template" value="http://www.secpay.com/users/??????/mytemplate.html"

 

on secpay.php somewhere.

 

I've tried this but I get errors so will look into it further. Anyone got anywhere with this?

Have a good time . . . all the time. That's my philosophy on life, Marty

  • 2 weeks later...
Posted

OK I give up where the hell do I add

 

<input type="hidden" name="template" value="http:www.secpay.com/users/myname/mytemplate.htm>

 

in this page?

 

Rahish

Have a good time . . . all the time. That's my philosophy on life, Marty

  • 2 weeks later...
Posted

SECPay support full customisation of the card input screen. To do this, you will need to take our template, modify it, and then request a login to upload this to our secure server along with any images that you reference within the form.

 

All images and external javascript/css must be referenced with a full URL in the format

https://www.secpay.com/users/[sECPay merchant id]/[asset name]

 

The template itself must be referenced as

http://www.secpay.com/users/[sECPay merchant id]/[template name]

 

You can get a copy of the template from

http://www.secpay.com/users/template.html

 

If you view the source and save it locally to your PC you will then be able to edit it.

 

It will be your resposibility to ensure that the template works, and that you take care not to corrupt any of our extensions which are referenced as form fields or select lists. (Boilerplate extensions are less critical).

 

You may find that loading the template into html editors such as Frontpage and Dreamweaver may corrupt the extensions, so care should be taken.

 

It is also your responsibility to update the form with any future enhancements which we may make from time to time.

 

Then in the secpay.php module, add the template variable and hidden field:

 

$sec_template = 'http://www.secpay.com/users/##USERNAME##/template.html';
  
tep_draw_hidden_field(tep_session_name(), tep_session_id()) .
// INTRODUCTION OF NEW FIELD 'TEMPLATE'
tep_draw_hidden_field('template', $sec_template) .
tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_flds=' . tep_session_name());

 

Hope this help,

 

SECPay

Posted

I have seen reference to a direct version of the secpay system which handles the transaction in the background.

 

I intend to take a look at that next month to see if we can have it so the customer never leaves osCommerce to process the payment at secpay.

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)

Posted

Thanks,

 

This looks more promising, I pasted the code into secpay.php but I am still getting a couple of error codes. Looks like I should be creating some extra code in the file though I know not what

 

 

Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /catalog/includes/modules/payment/secpay.php on line 18

 

Fatal error: Cannot instantiate non-existent class: secpay in /catalog/includes/classes/payment.php on line 41

Have a good time . . . all the time. That's my philosophy on life, Marty

  • 1 month later...
Posted

Ok I've got rid of

 

Fatal error: Cannot instantiate non-existent class: secpay in /catalog/includes/classes/payment.php on line 41

 

in the errors dialog by adding $sec_template to the class defining part at the start of secpay.php

 

But I am still getting the first error.

 

 

According to PHP.net it is down to a missing ; or ' or , or" or etc

 

 

Help

 

 

I'll let you know if I stumble across this needle in a haysack

Have a good time . . . all the time. That's my philosophy on life, Marty

Posted

Please can someone tell me where I am going wrong.

 

 

<?php

/*

$Id: secpay.php,v 1.31 2003/01/29 19:57:15 hpdl 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;

 

 

 

 

 

// This section references the template supplied by seemless secpay module posting

 

$sec_template = 'http://www.secpay.com/users/********/******.html';

 

tep_draw_hidden_field(tep_session_name(), tep_session_id()) .

// INTRODUCTION OF NEW FIELD 'TEMPLATE'

tep_draw_hidden_field('template', $sec_template) .

tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_flds=' . tep_session_name());

 

 

 

 

 

// 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;

}

 

 

$process_button_string = tep_draw_hidden_field('merchant', MODULE_PAYMENT_SECPAY_MERCHANT_ID) .

tep_draw_hidden_field('trans_id', STORE_NAME . date('Ymdhis')) .

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('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(tep_session_name(), tep_session_id()) .

tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_post=true,cb_flds=' . tep_session_name());

 

return $process_button_string;

}

 

function before_process() {

global $HTTP_POST_VARS;

 

if ($HTTP_POST_VARS['valid'] == 'true') {

if ($remote_host = getenv('REMOTE_HOST')) {

if ($remote_host != 'secpay.com') {

$remote_host = gethostbyaddr($remote_host);

}

if ($remote_host != 'secpay.com') {

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() {

global $HTTP_GET_VARS;

 

if (isset($HTTP_GET_VARS['message']) && (strlen($HTTP_GET_VARS['message']) > 0)) {

$error = stripslashes(urldecode($HTTP_GET_VARS['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', '0', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_SECPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_SECPAY_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_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');

}

}

 

?>

Have a good time . . . all the time. That's my philosophy on life, Marty

  • 2 months later...
Posted

I think, finally I am getting somewhere. I have managed to reference the user template on my site but I have to make sure I am not seeing things.

 

 

I will report back when I have got a bit further with it.

 

 

Mike

Have a good time . . . all the time. That's my philosophy on life, Marty

  • 3 weeks later...
Posted

OK, I think I,ve got it.

 

got this to work by much trial and error. I am sure there are other ways you can do this but it works for me.

 

 

Follow these instructions and put the relevant bits of code in includes/modules/payment/secpay.php

 

 

 

 

 

 

Secpay code for accessing the Secpay user template

I don't think it matters where you add this code

but I placed it just above the line where it says $process_button_string =

 

 

 

//*********Correct variable setup *********

$sec_template = $HTTP_GET_VARS['sec_template']; //couldn't get this to work with $HTTP_POST_VARS

 

$sec_template = 'http://www.secpay.com/users/*******/name_of_your_template.html';

 

 

 

then towards the end of the process button part just before

tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_post=true,cb_flds=' . tep_session_name());

 

add this code

 

 

 

 

//******Introduction of new field template*******

tep_draw_hidden_field('template', $sec_template) .

 

 

 

to test that you are using your own version of the page as opposed to the default secpay one

 

add some hidden input fields below the $process_button_string like this:

 

 

 

//user defined hidden input fields (based on variable names defined in secpay template

tep_draw_hidden_field('bgcolor', $bgcolor=ffffff) .

tep_draw_hidden_field('font_color', $fontcolor=000000) .

 

 

 

 

 

then do a test transaction to see if it works

 

 

 

Hope this helps

Have a good time . . . all the time. That's my philosophy on life, Marty

  • 2 years later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...