Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Worldpay support III


scottymcloo

Recommended Posts

  • Replies 281
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 weeks later...

Im having some problems with worldpay v4.0 version '1.5, the mod seemed to work fine untill worldpay sends the customer back to the shop, you then get the below error, any ideas

'includes/languages/english/FILENAME_WPCALLBACK' (include_path='.:/usr/local/nf/lib/php') in /mnt/web_h/d29/s38/b01ddafb/www/shop/nfoscomm/catalog/wpcallback.php on line 29

Link to comment
Share on other sites

  • 3 weeks later...

Hello World,

 

Well, I've installed Worldpay v4.0 v1.7 as per installation guide. I'm pretty sure I've checked all the steps in the install.txt file. Things went well, until callback. I've scanned the threads, and all to no avail. I've experimented and experimented, but still I get the following...

 

====================================================

1062 - Duplicate entry '37a9b673de0f6f24e9295b59e833f622' for key 1

 

insert into sessions values ('37a9b673de0f6f24e9295b59e833f622?language=en', '1083161710', 'cart|O:12:\"shoppingcart\":4:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"USD\";navigation|O:17:\"navigationhistory\":2:{s:4:\"path\";a:1:{i:0;a:4:{s:4:\"page\";s:14:\"wpcallback.php\";s:4:\"mode\";s:6:\"NONSSL\";s:3:\"get\";a:1:{s:6:\"osCsid\";s:44:\"37a9b673de0f6f24e9295b59e833f622?language=en\";}s:4:\"post\";a:0:{}}}s:8:\"snapshot\";a:0:{}}autologon_link|s:164:\"http://www.moonfishgroup.com/TESTCommerce/wpcallback.php?osCsid=37a9b673de0f6f24e9295b59e833f622%3Flanguage%3Den&osCsid=37a9b673de0f6f24e9295b59e833f622?language=en\";autologon_executed|s:4:\"true\";')

 

[TEP STOP]

 

1062 - Duplicate entry '37a9b673de0f6f24e9295b59e833f622' for key 1

 

insert into sessions values ('37a9b673de0f6f24e9295b59e833f622?language=en', '1083161710', 'cart|O:12:\"shoppingcart\":4:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"USD\";navigation|O:17:\"navigationhistory\":2:{s:4:\"path\";a:1:{i:0;a:4:{s:4:\"page\";s:14:\"wpcallback.php\";s:4:\"mode\";s:6:\"NONSSL\";s:3:\"get\";a:1:{s:6:\"osCsid\";s:44:\"37a9b673de0f6f24e9295b59e833f622?language=en\";}s:4:\"post\";a:0:{}}}s:8:\"snapshot\";a:0:{}}autologon_link|s:164:\"http://www.moonfishgroup.com/TESTCommerce/wpcallback.php?osCsid=37a9b673de0f6f24e9295b59e833f622%3Flanguage%3Den&osCsid=37a9b673de0f6f24e9295b59e833f622?language=en\";autologon_executed|s:4:\"true\";')

 

[TEP STOP]

 

 

Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

====================================================

 

Now I know, from reading through this and other threads, that this message is an old friend, but all the fixits recommended thus far haven't worked.

 

Here's what's 'different' about my installation:

 

i. No SSL on osCommerce side

ii. All sessions = false

 

...and here's what I've found out: If I manually enter the following...

 

http://moonfishgroup.com/TESTCommerce/wpca...3Flanguage%3Den

 

...then I get the nasty sessions message. But if I remove the "%3Flanguage%3Den" at the end of the callback string, then all is sweetness and light...

 

http://moonfishgroup.com/TESTCommerce/wpca...9295b59e833f622

 

Any ideas? I'm guessing WorldPay is sending back the language=en as part of the callback, and this is 'fooling' osCommerce into reloading the session? Er, I really don't know what I'm talking about, but I guess I've given someone smarter than me enough clues...

 

Ric

Link to comment
Share on other sites

Im having some problems with worldpay v4.0 version '1.5, the mod seemed to work fine untill worldpay sends the customer back to the shop, you then get the below error, any ideas

'includes/languages/english/FILENAME_WPCALLBACK' (include_path='.:/usr/local/nf/lib/php') in /mnt/web_h/d29/s38/b01ddafb/www/shop/nfoscomm/catalog/wpcallback.php on line 29

FILENAME_WPCALLBACK would indicate that this variable hasn't been defined somewhere.. Check for references to it in the pages your using (the PHP source) and see if it's missing/not defined somewhere?

Link to comment
Share on other sites

ii. All sessions = false

 

heh..that might be your problem. What do you mean by that?

 

Basically yes, your problem is that OSC is trying to create a new session when the user comes back from Worldpay. It shouldn't need to because the user should have a cookie set telling OSC 'here's my session ID'.

 

So what this usually boils down to is having the cookie domain/path/web addresses that the cookie is valid from set wrong. You can check it in the OSC admin (I suggest set the path to yourdomain/) but also check the actual contents of the cookie and see if it's slightly wrong?

 

Hope this helps.

Link to comment
Share on other sites

are you sure that you havn't edited the files at all??

 

your problem is this.

 

Its not the addition of the language variable this should be there but the osCid shouldn't (well not there anyway) i'll explain

 

you have 
wpcallback.php?osCsid=37a9b673de0f6f24e9295b59e833f622?language=en

and it should be
wpcallback.php?language=en

 

then there is another seperate variable MC_oscsid for you session id

 

It wouldn't really matter putting the session id there as well but the '?' before 'language' is hard coded so the format is wrong (e.g. callback?s=session?l=language - when it should be callback?s=session&l=language (notice the difference between & and ? b4 language))

 

have you changed anything in any of the worlpay files? perticualy includes/modules/payment/worldpay.php ??

 

Let us know

 

Strange one !!

 

Sam

Edited by Nimmit
Link to comment
Share on other sites

Hi Sam,

 

Thanks for the fast reply.

 

Here's the full content of .../includes/modules/payment/worldpay.php. I'm very sure I didn't change anything, but perhaps you might spot something anyway?

 

I should add that I've been testing this by choosing 'cancel' within Worldpay, because I got sick of typing in credit card details time and again.

 

Meanwhile, I see what you mean about the syntax of the & and ?. Methinks the second ? is at the root of all this. If you need to see the contents of the other files, let me know.

 

Ric

 

========================================================

<?php

/*

$Id: worldpay.php,v MS1a 2003/04/06 21:30

Author : Graeme Conkie ([email protected])

Title: WorldPay Payment Callback Module V4.0 Version 1.6

 

Revisions:

 

Paulz added minor changes to enable control of 'Payment Zone' added function update_status

Version MS1a Cleaned up code, moved static English to language file to allow for bi-lingual use,

Now posting language code to WP, Redirect on failure now to Checkout Payment,

Reduced re-direct time to 8 seconds, added MD5, made callback dynamic

NOTE: YOU MUST CHANGE THE CALLBACK URL IN WP ADMIN TO <wpdisplay item="MC_callback">

Version 1.4 Removes boxes to prevent users from clicking away before update,

Fixes currency for Yen,

Redirects to Checkout_Process after 10 seconds or click by user

Version 1.3 Fixes problem with Multi Currency

Version 1.2 Added Sort Order and Default order status to work with snapshots after 14 Jan 2003

Version 1.1 Added Worldpay Pre-Authorisation ability

Version 1.0 Initial Payment Module

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003

Released under the GNU General Public License

*/

 

class worldpay {

var $code, $title, $description, $enabled;

 

// class constructor

function worldpay() {

global $order;

$this->code = 'worldpay';

$this->title = MODULE_PAYMENT_WORLDPAY_TEXT_TITLE;

$this->description = MODULE_PAYMENT_WORLDPAY_TEXT_DESCRIPTION;

$this->sort_order = MODULE_PAYMENT_WORLDPAY_SORT_ORDER;

$this->enabled = ((MODULE_PAYMENT_WORLDPAY_STATUS == 'True') ? true : false);

 

if ((int)MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID;

}

 

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

 

$this->form_action_url = 'https://select.worldpay.com/wcc/purchase';

 

}

 

// class methods

function update_status() {

global $order;

 

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_WORLDPAY_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_WORLDPAY_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;

}

 

}

}

 

// class methods

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

// Ian-san: Need to declare language_id global here 6/4/2003:

global $HTTP_POST_VARS, $languages_id, $shipping_cost, $total_cost, $shipping_selected, $shipping_method, $currencies, $currency, $customer_id , $order;

$worldpay_url = tep_session_name() . '=' . tep_session_id();

 

// Multi Currency - Graeme Conkie ver 1.3 - Set up variable

// Added decimal point code - contributed by Ian Davidson (Feb 08,2003) - For Yen currency

$OrderAmt = number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', '') ;

 

// Multi Currency - ver 1.3

$process_button_string =

tep_draw_hidden_field('instId', MODULE_PAYMENT_WORLDPAY_ID) .

tep_draw_hidden_field('currency', $currency) .

tep_draw_hidden_field('desc', 'Purchase from '.STORE_NAME) .

 

// Send URL and session name - contributed by Nick Vermeulen 08 Feb, 2003

tep_draw_hidden_field('cartId', $worldpay_url ) .

 

// Assign Multi Currency Variable to Amount

tep_draw_hidden_field('amount', $OrderAmt) ;

 

// Pre Auth Mod 3/1/2002 - Graeme Conkie

if (MODULE_PAYMENT_WORLDPAY_USEPREAUTH == 'True') $process_button_string .= tep_draw_hidden_field('authMode', MODULE_PAYMENT_WORLDPAY_PREAUTH);

 

// Ian-san: Create callback and language links here 6/4/2003:

$callback_url = tep_href_link(FILENAME_WPCALLBACK);

// $callback_url = tep_href_link(FILENAME_WPCALLBACK, '', (ENABLE_SSL ? 'SSL' : 'NONSSL'), true);

$worldpay_callback = explode('http://', $callback_url);

$language_code_raw = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id ='$languages_id'");

$language_code_array = tep_db_fetch_array($language_code_raw);

$language_code = $language_code_array['code'];

 

$address = htmlspecialchars($order->customer['street_address'] . "\n" . $order->customer['suburb'] . "\n" . $order->customer['city'] . "\n" . $order->customer['state'], ENT_QUOTES);

$process_button_string .=

tep_draw_hidden_field('testMode', MODULE_PAYMENT_WORLDPAY_MODE) .

tep_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) .

tep_draw_hidden_field('address', $address) .

tep_draw_hidden_field('postcode', $order->customer['postcode']) .

tep_draw_hidden_field('country', $order->customer['country']['iso_code_2']) .

tep_draw_hidden_field('tel', $order->customer['telephone']) .

tep_draw_hidden_field('myvar', 'Y') .

tep_draw_hidden_field('fax', $order->customer['fax']) .

tep_draw_hidden_field('email', $order->customer['email_address']) .

 

// Ian-san: Added dynamic callback and languages link here 6/4/2003:

tep_draw_hidden_field('lang', $language_code) .

tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code) .

tep_draw_hidden_field('MC_oscsid', $oscSid);

 

// Ian-san: Added MD5 here 6/4/2003:

if (MODULE_PAYMENT_WORLDPAY_USEMD5 == '1') {

$md5_signature_fields = 'amount:language:email';

$md5_signature = MODULE_PAYMENT_WORLDPAY_MD5KEY . ':' . (number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', '')) . ':' . $language_code . ':' . $order->customer['email_address'];

$md5_signature_md5 = md5($md5_signature);

 

$process_button_string .= tep_draw_hidden_field('signatureFields', $md5_signature_fields ) .

tep_draw_hidden_field('signature',$md5_signature_md5);

}

return $process_button_string ;

}

 

function before_process() {

global $HTTP_POST_VARS;

}

 

function after_process() {

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_WORLDPAY_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 WorldPay Module', 'MODULE_PAYMENT_WORLDPAY_STATUS', 'True', 'Do you want to accept WorldPay 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 ('Worldpay Installation ID', 'MODULE_PAYMENT_WORLDPAY_ID', '00000', 'Your WorldPay Select Junior ID', '6', '2', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Mode', 'MODULE_PAYMENT_WORLDPAY_MODE', '100', 'The mode you are working in (100 = Test Mode Accept, 101 = Test Mode Decline, 0 = Live', '6', '5', now())");

 

// Ian-san: Added MD5 here 6/4/2003:

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Use MD5', 'MODULE_PAYMENT_WORLDPAY_USEMD5', '0', 'Use MD5 encyption for transactions? (1 = Yes, 0 = No)', '6', '4', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('MD5 secret key', 'MODULE_PAYMENT_WORLDPAY_MD5KEY', '', 'MD5 secret key. Must also be entered into Worldpay installation config', '6', '5', now())");

 

// Pre Auth Mod - Graeme Conkie 13/1/2003

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_WORLDPAY_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, date_added) values ('Use Pre-Authorisation?', 'MODULE_PAYMENT_WORLDPAY_USEPREAUTH', 'False', 'Do you want to pre-authorise payments? Default=False. You need to request this from WorldPay before using it.', '6', '3', '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, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Pre-Auth', 'MODULE_PAYMENT_WORLDPAY_PREAUTH', 'A', 'The mode you are working in (A = Pay Now, E = Pre Auth). Ignored if Use PreAuth is False.', '6', '4', now())");

// Paulz zone control 04/04/2004

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_WORLDPAY_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())");

// Ian-san: Added MD5 here 6/4/2003:

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_WORLDPAY_USEMD5'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_WORLDPAY_MD5KEY'");

}

 

function remove() {

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

}

 

function keys() {

return array('MODULE_PAYMENT_WORLDPAY_STATUS', 'MODULE_PAYMENT_WORLDPAY_ID','MODULE_PAYMENT_WORLDPAY_MODE','MODULE_PAYMENT_WORLDPAY_USEPREAUTH','MODULE_PAYMENT_WORLDPAY_PREAUTH','MODULE_PAYMENT_WORLDPAY_ZONE','MODULE_PAYMENT_WORLDPAY_SORT_ORDER','MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID');

}

}

?>

 

========================================================

Link to comment
Share on other sites

Hi All,

 

Firstly, a big thank you to Mr Nimmit (Sam) for taking such a close interest in my problems. The good news is that it's now working nicely. Here's what I found out...

 

Unless I'm crazy (I am) any Worldpay callbacks returning to an osC SSL session will figure out the original calling session (and associated osC order) simply by daisychaining the SSLs. All is well with osC SSL to WorldPay SSL and back to osC SSL. However, with regards to osC NONSSL to WorldPay SSL and back to osC NONSSL, there was a bug in the code. I actually used v1.5 to sort this one out, but I reckon it's also in v1.7.

// Nimmit: Duplicate entry problem fix 18/2/04
? ? ?if(ENABLE_SSL){
? ? ? ?if(HTTP_SERVER != HTTPS_SERVER){
? ?// if servers are different use the https one to create the callback url
? ? ? ? ?$callback_url = tep_href_link(FILENAME_WPCALLBACK,'','SSL',false);
? ? ? ? ?$worldpay_callback = explode('https://', $callback_url);
? ? ? ?}
? ? ? ?else{
? ?// otherwise use the http
? ? ? ? ?$callback_url = tep_href_link(FILENAME_WPCALLBACK);
? ? ? ? ?$worldpay_callback = explode('http://', $callback_url);
? ? ? ?} ? 
? ? ?}
? else{
? ? $callback_url = tep_href_link(FILENAME_WPCALLBACK);
? ? ? ?$worldpay_callback = explode('http://', $callback_url);

(...snip...)

// Ian-san: Added dynamic callback and languages link here 6/4/2003:
? ? ? ?tep_draw_hidden_field('lang', $language_code) .
? ? ? ?tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code) .
? ? ? ?tep_draw_hidden_field('MC_oscsid', $oscSid);

What's happening is that a osC NONSSL session (my circumstances) was sending WorldPay the following callback string:

$callback_url = tep_href_link(FILENAME_WPCALLBACK);
$worldpay_callback = explode('http://', $callback_url);

...plus...

tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code) .

...so WorldPay is returning something like...

http://website.com/catalog/wpcallback.php?osCsid=37a9b6732?language=en

And there's the problem, as I was advised by that clever Mr Nimmit. The two question marks are a buggah's muddle. The second ? is not interpreted as the end of the session id, so the whole id has "?language=en" appended to the end of it. Not surprisingly, osC can't find the session. So, being a demon hacker, I just changed the "?" to a "&" and all worked fine...

tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '&language=' . $language_code) .

...which gave me...

http://website.com/catalog/wpcallback.php?osCsid=37a9b6732&language=en

...and all was sweetness and light.

 

A word of warning: I'm guessing the bug is resolved for NONSSL osC sessions, but the amendment above would mess up an SSL session. Maybe Mr Nimmit can check it out?

 

Anyways, I'm a happy bunny, and all's well in Moonfish land.

 

Take care, Ric

Edited by ric_capucho
Link to comment
Share on other sites

Ric

 

You are 100% correct with the problem but not, I think, the cause.

 

The earlier code:

 

$callback_url = tep_href_link(FILENAME_WPCALLBACK);
$worldpay_callback = explode('http://', $callback_url);

 

and this part:

 

$worldpay_callback[1]

 

 

Should not carry the oscSid into the callback string. The fact that it does, is probably (I am just guessing) due to a problem with cookies on your installation / browser. For most users, the oscSid will not be present in a link at this point.

 

The second issue is that if you do change the ? to an & for a user who does not have this problem, you will probably get the reverse error. ie and & where it shouldnt be.

 

Until it is resolved, the easiest option is just to delete the whole language part from the string ( . '?language=' . $language_code) if you are not using a multi-language installation.

Ian-san

Flawlessnet

Link to comment
Share on other sites

Hi Ian-san,

 

I think I've seen that name somewhere... but I'm not quite sure where. :-)

 

Ok, I can delete the language string, but I'll need that later as I will in fact have a multi-language installation.

 

However, how does WorldPay/osC retain my osCid for a NONSSL session? I thought I'd need that to tie my Worldpay SSL session to my osC NONSSL session? When I tried the alternative (no osCid or language), then when I returned to osC, (from either a cancel or a buy), the 'buyer' is logged out, and no meaningful WorldPay message returned.

 

With regards to cookies, I tried this on two separate PCs, and both had the same problem. I'm now a bit worried that I picked two 'unusual' cookie PCs.

 

Ric

Link to comment
Share on other sites

Hi Ian-san,

 

I think I've seen that name somewhere... but I'm not quite sure where. :-)

 

Ok, I can delete the language string, but I'll need that later as I will in fact have a multi-language installation.

 

However, how does WorldPay/osC retain my osCid for a NONSSL session?  I thought I'd need that to tie my Worldpay SSL session to my osC NONSSL session?  When I tried the alternative (no osCid or language), then when I returned to osC, (from either a cancel or a buy), the 'buyer' is logged out, and no meaningful WorldPay message returned.

 

With regards to cookies, I tried this on two separate PCs, and both had the same problem.  I'm now a bit worried that I picked two 'unusual' cookie PCs.

 

Ric

Ric

 

Taking the second point first: When you first enter your store you will probably see the SID in the url string. For most users / stores this will disappear on the second click in the store as it is replaced by the cookie.

 

However, if you do not allow cookies on your browser, you will continue to see the SID in all urls throughout your store.

 

The WP mod uses tep_href_link to construct the WP string. If cookies are not allowed, the SID will also be present in this string and passed through to WP at this point.

 

The mod also adds the SID with this code:

 

 tep_draw_hidden_field('MC_oscsid', $oscSid);

 

as well, so two SIDs would be present in the string which is what you are experiencing.

 

What is probably required is an improvement to replace the:

 

$worldpay_callback = explode('http://', $callback_url);

 

 

along the lines of:

 

        $string_new = str_replace("http://","",$callback_url);
       $file = strtolower(strrchr($string_new,"/"));
       $worldpay_callback = str_replace($file,"",$file_new);

 

and later to replace:

 

tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code)

 

with

 

tep_draw_hidden_field('MC_callback', $worldpay_callback . '?language=' . $language_code)

 

or similar ...

Ian-san

Flawlessnet

Link to comment
Share on other sites

hey guys,

 

previously I had the session errors aswell, but just as you mentioned this was fixed when I went through the cookies configuration. :)

 

anyway, now when it is almost working, I get another error.

 

when returning to the store after payment has been processed, the customer is again redirected to the payment page. so the order isnt placed, but the payment is processed.

 

any ideas on this?

 

also, where do I edit the looks of the return page?

 

couldn?t seem to find it earlier in the thread.

Link to comment
Share on other sites

  • 2 weeks later...

I done a few test orders 1.7 seems to work fine, not sure about the security holes.

I thing I have noticed is that it sends the cookie details has the order number.

Basically you get the cookie code has the order id in worldpay.

Does anyone know if this can be changed to reflect the actual order number?

Link to comment
Share on other sites

  • 1 month later...

Ok guys, I'm starting to come to my wits end with this WorldPay module. I'm really not sure what's going wrong so any help would be very much appreciated. I'm running the latest 2.2OSC and the new 1.7 WP Module.

 

Problem: Orders are going through perfectly fine but the database is not logging the order and thus do not get added to the admin section and the email that user/me receives contains no order details.

 

Reason: I image this has something to do with the callback, though in the admin section of my site https://<wpdisplay item="MC_callback"> has been entered and all the other checkboxes are correct. I have installed just like the installation guide states.

 

In the installation guide there is the following:

 

ps. I found that orders were not appearing in my admin screen once payment had been received.  I found this was nothing to do with the payment module but that 3 rows were missing from the order_status table.

INSERT INTO orders_status VALUES (1, 1, 'Pending');

INSERT INTO orders_status VALUES (2, 1, 'Processing');

INSERT INTO orders_status VALUES (3, 1, 'Delivered');

 

Where exactly do I find the order status table? I dont follow these instuctions 100%

 

Like I said, any help is much appreciated. This is my first OSCommerce site (actually, my first site full stop) so appologies if this has been answered before. If needed, I can post up the contents of any of the .php files if needed. And if its any help, my site is www.nilfix.co.uk

Link to comment
Share on other sites

The order_status table is in the database, so use whatever you used to create the database in the first place? Often this is phpmyadmin.

 

The way this module works is that the Callback page is what puts the order into your system, so that has to be working properly or you'll take payment without receiving the order. The Callback page is called by Worldpay after an attempted transaction.

 

This is as opposed to e.g. putting the order into the system and then assigning it a 'paid' status after coming back from Worldpay - which might be better - but it doesn't work that way.

 

You need to track through the PHP and find out exactly where you're going wrong,. view source etc. Took me a bit of work before I got it all together myself.

 

Adam

Link to comment
Share on other sites

Thanks for the reply. Now bear with me here, though its my understanding that the order_status table has absolutely nothing to do with the callback php file does it?

 

The page does not return to my site once a payment has successfully been made, and so therefore I am guessing that's where the problem is. I'll therefore post up the callback.php and see if it makes sense to anyone. I've looked over it myself though to tell you the truth, it's greek to me!

 

<?php

/*

  $Id: wpcallback.php,v MS1a 2003/04/06 21:30

  Author :  Graeme Conkie ([email protected])

  Title: WorldPay Payment Callback Module V4.0 Version 1.4

 

  Revisions:

Version MS1a Cleaned up code, moved static English to language file to allow for bi-lingual use,

        Now posting language code to WP, Redirect on failure now to Checkout Payment,

  Reduced re-direct time to 8 seconds, added MD5, made callback dynamic

  NOTE: YOU MUST CHANGE THE CALLBACK URL IN WP ADMIN TO <wpdisplay item="MC_callback">

Version 1.4 Removes boxes to prevent users from clicking away before update,

  Fixes currency for Yen,

  Redirects to Checkout_Process after 10 seconds or click by user

Version 1.3 Fixes problem with Multi Currency

Version 1.2 Added Sort Order and Default order status to work with snapshots after 14 Jan 2003

Version 1.1 Added Worldpay Pre-Authorisation ability

Version 1.0 Initial Payment Module

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003

  Released under the GNU General Public License

*/

 

  require('includes/application_top.php');

 

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_WPCALLBACK);

 

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_WPCALLBACK, '', 'NONSSL'));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE .' ' . NAVBAR_TITLE; ?></title>

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

  <tr>

    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php

// Next line Removed for version 1.4 and above

// require(DIR_WS_INCLUDES . 'column_left.php');

// Delete next line if using column

echo tep_draw_separator('pixel_trans.gif', '100%', '10');

?>

<!-- left_navigation_eof //-->

    </table></td>

<!-- body_text //-->

    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

      <tr>

        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

          <tr>

            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

            <td align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_payment.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

          </tr>

        </table></td>

      </tr>

      <tr>

        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

      </tr>

<?php // Success

if(isset($transStatus) && $transStatus == "Y") { 

  $url = tep_href_link(FILENAME_CHECKOUT_PROCESS, $cartId, 'NONSSL', false);

  echo "<meta http-equiv='Refresh' content='5; Url=\"$url\"'>";

?>

<tr><td class="pageHeading" width="100%" colspan="2">

<center><?php echo WP_TEXT_SUCCESS; ?></center></td></tr>

    <tr>

      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '50'); ?></td>

    </tr><tr><td align="center" colspan="2"><table border="2" bordercolor="#FF0000" width="80%" cellspacing="0" cellpadding="2">

<tr><td class="main"><center><?php echo WP_TEXT_HEADING; ?></center><br><br>

  <?php echo '<WPDISPLAY ITEM=banner>'; ?><br><br></td></tr>

</td></tr></table>

    <tr>

      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '50'); ?></td>

    </tr>

<tr><td class="pageHeading" width="100%" colspan="2">

<center><h3><?php echo WP_TEXT_SUCCESS_WAIT; ?></h3></center></td></tr>

<tr align="right"><td><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?><td></tr>

    <tr>

      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '50'); ?></td>

    </tr>

<?php // Failure

} else {

  $url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, $cartId, 'NONSSL', false);

  echo "<meta http-equiv='Refresh' content='5; Url=\"$url\"'>";

?>

<tr><td class="pageHeading" width="100%" colspan="2">

<center><?php echo WP_TEXT_FAILURE; ?></center></td></tr>

    <tr>

      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '50'); ?></td>

    </tr><tr><td align="center" colspan="2"><table border="2" bordercolor="#FF0000" width="80%" cellspacing="0" cellpadding="2">

<tr><td class="main"><center><?php echo WP_TEXT_HEADING; ?></center><br><br>

  <?php echo '<WPDISPLAY ITEM=banner>'; ?><br><br></td></tr>

</td></tr></table>

    <tr>

      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '50'); ?></td>

    </tr>

<tr><td class="pageHeading" width="100%" colspan="2">

<center><h3><?php echo WP_TEXT_FAILURE_WAIT; ?></h3></center></td></tr>

<tr align="right"><td><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', false) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?><td></tr>

    <tr>

      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '50'); ?></td>

    </tr>

<?php

}

?>

    </table></td>

<!-- body_text_eof //-->

    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php

// Next line Removed for version 1.4

// require(DIR_WS_INCLUDES . 'column_right.php');

// Delete next line if using column

echo tep_draw_separator('pixel_trans.gif', '100%', '10');

?>

<!-- right_navigation_eof //-->

    </table></td>

  </tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php

// Next line Optional for version 1.4 or above

  require(DIR_WS_INCLUDES . 'footer.php');

?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

As I have said before, I am using a secure server on my side for the checkout and I've yet to edit any of the contents above from the original file. Again, any help at all is appreciated as this is the only obstacle left before I go live.

Link to comment
Share on other sites

The order_status table is in the database, so use whatever you used to create the database in the first place? Often this is phpmyadmin.

 

I am using phpmyadmin, though I am a bit confused as to how I add the

 

INSERT INTO orders_status VALUES (1, 1, 'Pending');

INSERT INTO orders_status VALUES (2, 1, 'Processing');

INSERT INTO orders_status VALUES (3, 1, 'Delivered');

 

into my database. Is this done via the SQL section or the Insert section? Also, I have order_status_ID as a field here, is that what is being changed here? Again, sorry if these are obvious questions, but I'm starting to feel very lost.

 

 

EDIT: Ok, just ran a query and found that these were already in the order_status table so it must be the callback.php that's going to pot at some point.

Edited by Samuel_D
Link to comment
Share on other sites

  • 5 weeks later...

Hi

 

I?m also using SSL and had the same problem managed to get a step further by editing the includes/modules/payment/worldpay.php as below..

 

original code

// Ian-san: Create callback and language links here 6/4/2003:
     $callback_url = tep_href_link(FILENAME_WPCALLBACK);
     // $callback_url = tep_href_link(FILENAME_WPCALLBACK, '', (ENABLE_SSL ? 'SSL' : 'NONSSL'), true);
     $worldpay_callback = explode('http://', $callback_url);

 

edited code

// Ian-san: Create callback and language links here 6/4/2003:
     // $callback_url = tep_href_link(FILENAME_WPCALLBACK);
     $callback_url = tep_href_link(FILENAME_WPCALLBACK, '', (ENABLE_SSL ? 'SSL' : 'NONSSL'), true);
     $worldpay_callback = explode('https://', $callback_url);

 

You can see I enabled the SSL callback_url line, disabled the original callback_url line and replaced http with https on the worldpay_callback line. This was the only way I could generate the callback feed:-

<input type="hidden" name="MC_callback" value="secure.clients-site.co.uk/catalog/wpcallback.php?osCsid=db8a6e94991c573be5533ce608ad93ba?language=en">

 

Hope this helps

 

My problems are trying to get it to work through STS and the

Duplicate entry 'db8a6e94991c573be5533ce608ad93ba' for key 1 insert into sessions values ('db8a6e94991c573be5533ce608ad93ba?language=en', '1091793780'

 

I'm off to try some of the fixes mentioned in this thread for the Duplicate entry issue but I could really do with a hand sorting the STS, wpcallback.php conflict if any one has any clues.

 

Cheers

Graham

Link to comment
Share on other sites

Hi there

 

Got the Duplicate entry session problem solved by allowing all cookies from the clients site. Wonder if 'Force Cookie Use' in Sessions osC admin should be set 'true' I had it set at false!

 

Also noticed that my worldpay.php does not generate the

 

<input type="hidden" name="MC_oscsid">

 

from the worldpay.php call

 

[/code]tep_draw_hidden_field('MC_oscsid', $oscSid);

 

but this doesn't seem to matter as the order still gets processed when working with STS in both normal and template displays enabled!

 

Still need to resolve the STS template display issue for the site to work well and look good. I've made to many changes to go back to the normal osC display. Would really appreciate some pointers on this one.

 

Cheers

Graham

Link to comment
Share on other sites

Hi Again

 

Got the STS Templates Worldpay issue sorted by switching STS templates off when wpcallback.php is fed back - to do this I duplicated and edited an existing code in sts_display_output.php and added it back, so the added code reads

 

 if (strpos($scriptname, "wpcallback") !== false) {
$display_normal_output = 1;
$display_template_output = 0;
}

 

this simply changes the display back to normal mode for the wpcallback.php callback script, lets it do its business and continues back to the sts templates when returned to checkout_success.php. So now I'm a very happy chappy who only has to edit the look of wpcallback.php and not the other 90 odd pages.

 

This is a great forum and a great script keep up the good work.

 

Cheers

Graham

Link to comment
Share on other sites

  • 3 weeks later...

By removing the language code i managed to fix the problem

 

[TEP STOP] 1062 - Duplicate Entry  '45yg4455yhg6' for key 1

 

...when returning to osc from worldpay.

 

 

However it still leaves me with the problem as described in a previous post in this thread. After returning to osc from worldpay, it displays the "success" page and then re-directs me to the login page.

 

So the transaction is successful, (receive email) but it doesn't log the order in the admin.

 

 

here's my details:

 

oscommerce 2.2 ms2

non SSL

worldpay contrib = 4 v1.7

cookies path in config file = define('HTTP_COOKIE_DOMAIN', 'http://myshop.co.uk');

cookies option in admin = force cookie use "true"

 

 

any ideas please?

Link to comment
Share on other sites

  • 3 weeks later...

:blink: Hi All

 

Having problems with worldpay payment module. I have OSCommerce 2.2-MS2 and have installed worldpay V4.0 - V1.8. It seems that the Call Back feature is not working with this installation and I've gone through this support forum and tried a few suggestions from others experiencing the same problem but my problem is still not solved.

 

Can you help? I personally don't think I'm missing something or even done the installation incorrectly. Gone over it several times and installed to the letter.

 

Here is the wpcallback.php from catalog/includes/modules/payment/

 

<?php
/*
 $Id: worldpay.php,v MS1a 2003/04/06 21:30
 Author : Graeme Conkie ([email protected])
 Title: WorldPay Payment Callback Module V4.0 Version 1.6

 Revisions:
 
Paulz added minor changes to enable control of 'Payment Zone' added function update_status
Version MS1a Cleaned up code, moved static English to language file to allow for bi-lingual use,
       Now posting language code to WP, Redirect on failure now to Checkout Payment,
Reduced re-direct time to 8 seconds, added MD5, made callback dynamic
NOTE: YOU MUST CHANGE THE CALLBACK URL IN WP ADMIN TO <wpdisplay item="MC_callback">
Version 1.4 Removes boxes to prevent users from clicking away before update,
Fixes currency for Yen,
Redirects to Checkout_Process after 10 seconds or click by user
Version 1.3 Fixes problem with Multi Currency
Version 1.2 Added Sort Order and Default order status to work with snapshots after 14 Jan 2003
Version 1.1 Added Worldpay Pre-Authorisation ability
Version 1.0 Initial Payment Module

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

 Copyright (c) 2003
 Released under the GNU General Public License
*/

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

// class constructor
   function worldpay() {
   global $order;
     $this->code = 'worldpay';
     $this->title = MODULE_PAYMENT_WORLDPAY_TEXT_TITLE;
     $this->description = MODULE_PAYMENT_WORLDPAY_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_PAYMENT_WORLDPAY_SORT_ORDER;
     $this->enabled = ((MODULE_PAYMENT_WORLDPAY_STATUS == 'True') ? true : false);

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

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

     $this->form_action_url = 'https://select.worldpay.com/wcc/purchase';

     }

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

     if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_WORLDPAY_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_WORLDPAY_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;
       }

     }
     }

// class methods
     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() {
// Ian-san: Need to declare language_id global here 6/4/2003:
     global $HTTP_POST_VARS, $languages_id, $shipping_cost, $total_cost, $shipping_selected, $shipping_method, $currencies, $currency, $customer_id , $order;
     $worldpay_url = tep_session_name() . '=' . tep_session_id();

// Multi Currency - Graeme Conkie ver 1.3 - Set up variable
// Added decimal point code - contributed by Ian Davidson (Feb 08,2003) - For Yen currency
     $OrderAmt = number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', '');

// Multi Currency - ver 1.3
     $process_button_string =
     tep_draw_hidden_field('instId', MODULE_PAYMENT_WORLDPAY_ID) .
     tep_draw_hidden_field('currency', $currency) .
     tep_draw_hidden_field('desc', 'Purchase from '.STORE_NAME) .

// Send URL and session name - contributed by Nick Vermeulen 08 Feb, 2003
     tep_draw_hidden_field('cartId', $worldpay_url ) .

// Assign Multi Currency Variable to Amount
     tep_draw_hidden_field('amount', $OrderAmt);

// Pre Auth Mod 3/1/2002 - Graeme Conkie
     if (MODULE_PAYMENT_WORLDPAY_USEPREAUTH == 'True') $process_button_string .= tep_draw_hidden_field('authMode', MODULE_PAYMENT_WORLDPAY_PREAUTH);

// Ian-san: Create callback and language links here 6/4/2003:
     $callback_url = tep_href_link(FILENAME_WPCALLBACK);
   //  $callback_url = tep_href_link(FILENAME_WPCALLBACK, '', (ENABLE_SSL ? 'SSL' : 'NONSSL'), true);
     $worldpay_callback = explode('http://', $callback_url);
     $language_code_raw = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id ='$languages_id'");
     $language_code_array = tep_db_fetch_array($language_code_raw);
     $language_code = $language_code_array['code'];

     $address = htmlspecialchars($order->customer['street_address'] . "\n" . $order->customer['suburb'] . "\n" . $order->customer['city'] . "\n" . $order->customer['state'], ENT_QUOTES);
     $process_button_string .=
       tep_draw_hidden_field('testMode', MODULE_PAYMENT_WORLDPAY_MODE) .
       tep_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) .
       tep_draw_hidden_field('address', $address) .
       tep_draw_hidden_field('postcode', $order->customer['postcode']) .
       tep_draw_hidden_field('country', $order->customer['country']['iso_code_2']) .
       tep_draw_hidden_field('tel', $order->customer['telephone']) .
       tep_draw_hidden_field('myvar', 'Y') .
       tep_draw_hidden_field('fax', $order->customer['fax']) .
       tep_draw_hidden_field('email', $order->customer['email_address']) .

// Ian-san: Added dynamic callback and languages link here 6/4/2003:
       tep_draw_hidden_field('lang', $language_code) .
       tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code) .
       tep_draw_hidden_field('MC_oscsid', $oscSid);

// Ian-san: Added MD5 here 6/4/2003:
     if (MODULE_PAYMENT_WORLDPAY_USEMD5 == '1') {
       $md5_signature_fields = 'amount:language:email';
       $md5_signature = MODULE_PAYMENT_WORLDPAY_MD5KEY . ':' . (number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', '')) . ':' . $language_code . ':' . $order->customer['email_address'];
       $md5_signature_md5 = md5($md5_signature);

       $process_button_string .= tep_draw_hidden_field('signatureFields', $md5_signature_fields ) .
                                 tep_draw_hidden_field('signature',$md5_signature_md5);
     }
       return $process_button_string;
     }

     function before_process() {
       global $HTTP_POST_VARS;
     }

     function after_process() {
       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_WORLDPAY_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 WorldPay Module', 'MODULE_PAYMENT_WORLDPAY_STATUS', 'True', 'Do you want to accept WorldPay 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 ('Worldpay Installation ID', 'MODULE_PAYMENT_WORLDPAY_ID', '00000', 'Your WorldPay Select Junior ID', '6', '2', now())");
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Mode', 'MODULE_PAYMENT_WORLDPAY_MODE', '100', 'The mode you are working in (100 = Test Mode Accept, 101 = Test Mode Decline, 0 = Live', '6', '5', now())");

// Ian-san: Added MD5 here 6/4/2003:
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Use MD5', 'MODULE_PAYMENT_WORLDPAY_USEMD5', '0', 'Use MD5 encyption for transactions? (1 = Yes, 0 = No)', '6', '4', now())");
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('MD5 secret key', 'MODULE_PAYMENT_WORLDPAY_MD5KEY', '', 'MD5 secret key. Must also be entered into Worldpay installation config', '6', '5', now())");

// Pre Auth Mod - Graeme Conkie 13/1/2003
       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_WORLDPAY_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, date_added) values ('Use Pre-Authorisation?', 'MODULE_PAYMENT_WORLDPAY_USEPREAUTH', 'False', 'Do you want to pre-authorise payments? Default=False. You need to request this from WorldPay before using it.', '6', '3', '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, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Pre-Auth', 'MODULE_PAYMENT_WORLDPAY_PREAUTH', 'A', 'The mode you are working in (A = Pay Now, E = Pre Auth). Ignored if Use PreAuth is False.', '6', '4', now())");
// Paulz zone control 04/04/2004        
       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_WORLDPAY_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())");
// Ian-san: Added MD5 here 6/4/2003:
       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_WORLDPAY_USEMD5'");
       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_WORLDPAY_MD5KEY'");
     }

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

     function keys() {
       return array('MODULE_PAYMENT_WORLDPAY_STATUS', 'MODULE_PAYMENT_WORLDPAY_ID','MODULE_PAYMENT_WORLDPAY_MODE','MODULE_PAYMENT_WORLDPAY_USEPREAUTH','MODULE_PAYMENT_WORLDPAY_PREAUTH','MODULE_PAYMENT_WORLDPAY_ZONE','MODULE_PAYMENT_WORLDPAY_SORT_ORDER','MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID');
     }
   }
?>

Link to comment
Share on other sites

Just for reference I've now sorted them problem out. :D It was not worldpay module but another contribution I installed.

 

If you have the 'down for maintenance' contribution installed and you need to test your worldpay you'll have to disable 'down for maintenance' as obviously this will stop all ip addresses accessing the site fully, except for that of yours.

 

A stupid :angry: mistake, took me a while to work it out but got it in the end. :blink:

 

This may be useful to others.

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...