Worldpay gateway added

Author Message

Tony Wood

Wednesday 04 February 2004 10:48:13 am

Hi,

I am glad you got the WorldPay extension working :)

The callback feature takes the content from your shop site and displays it through its own engine. This is to give the customer the sucessful or unsecessful message with a treansaction message.

Just to check that the extension is working

* Does the order appear in the Admin order screen? If it is sucessful it will do.

I am assuming that the order has been completed sucessfully, the problem you might be having is that you cannot include Javascript in the Worldpay screens. This is a secuirty precuation by Worldpay.

You will notice that in the callback.tpl the location of the css is set as local to the worldpay urls.
<link href="/i/0000/favicon.ico" rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="/i/0000/core.css" />
<link rel="stylesheet" type="text/css" href="/i/0000/troy.css" />
This is where 0000 is your worldpay account.

So you can include images etc in your site... but alas JavaScript is a nono.

Try your callback.tpl page without Javascript and see if the error occurs.

Let me know

--Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Starla Carpenter

Wednesday 04 February 2004 12:28:30 pm

The database doesn't seem to be getting updated with the info from the Worldpay site. There is no Javascript or much of anything else in the template I'm using.

Any other ideas?

Tony Wood

Wednesday 04 February 2004 1:05:15 pm

ok,

The first thing to check is theat your site can be accessed by the Worldpay site. i.e. it must be a public domain. If this is teaching you to suck eggs, I apologise :(

The next is to check that the Worldpay server is calling back to the correct page. I think this might be your problem as thear i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) in the message is Javascript so it must be getting it from somewhere.

After you are sure you are calling the right page, use the eZ publish HTTP variable routine to display all the values sent back to you by Worldpay as they enable you to test the system. This will elt you know what values are coming back to the Callback page. If you follow the commented PHP in callback.php you will see all the check that are carried out and if you enable debug you will be able to see exactly where the problem lies.

I hope this helps

--Tony

 

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Starla Carpenter

Wednesday 04 February 2004 7:56:10 pm

Sorry to be such a pain.

1) Yes, the site's public

2) Yes it's javascript, but it's not my javascript. I've done a global search on the string of text causing th error, and it's nowhere to be found. The worldpay module we're using is pretty much the clone of the one you posted except that I changed the event php to send the worldpay server info from the shop registration instead of the user info, but definitely no Javascript added anywhere.

I strongly believe that the error feedback is coming from the Worldpay side. Which if true means that it is next to impossible for me to debug what's going wrong. Argh! They're going to send me some logs tomorrow--it apparently takes 24 hours :(

3) I've actually copied the Callback URL out of the Worldpay configuration form into the URL address field, and it brings up the correct script (I added an echo at the top to make sure).

4) It only gives me the error when I tick the "Use callback response" option. But if I only tick Callback enabled and enter the URL, the WP database is still not getting updated, and yet I'm not getting any kind of error message from WorldPay. It just goes to the default thank you page.

Tony Wood

Thursday 05 February 2004 12:25:26 am

ok, sounds like a real mystery, I like those...

The first thing to do is to test locally and remove WorldPay site form the equation, waiting 24 hours for results sounds like working with Punch cards, we can't have that.

Here is a routine that you can run locally against your site. You are bascially recreating the WorldPay callback routine.
To make this work you need to view the source from http://mydomain.com/shop/checkout/ and take the values from it. You need to then copy these values and replace the ones in the code included here. When you run this routine it will enable you to see all the issues with your code site and checks (Make sure you turn debug on).

I'll pop this HTML in pubsvn if it helps.

Let me know

Tony

File: wpcheck.html

<!--
Title: Callback information display template
Description:  
Copyright: Copyright (c) Vision with Technology Ltd 1997-2004. All rights reserved
Company: Vision with Technology Ltd
Author: Tony Wood
Version: $Id: callback.tpl,v 1.6 2003/12/10 15:00:52 tony Exp $
Licence:

	This file may be distributed and/or modified under the terms of the
	"GNU General Public License" version 2 as published by the Free
	 Software Foundation
	
	This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
	THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
	PURPOSE.
	
	The "GNU General Public License" (GPL) is available at http://www.gnu.org/copyleft/gpl.html.
	
	Contact licence@visionwt.com if any conditions of this licencing isn't clear to you.

-->

<html>
<head>
  <title>Worldpay Checker</title>
</head>
<body>

<form name="worldpayForm" action="http://url.to.my.domain.com/worldpay/callback" method=POST>

<p>
This screen should complete the callback workflow.<br>
</p>

<input type=hidden name="instId" value="9999">
<input type=hidden name="cartId" value="1">

<input type=hidden name="amount" value="9.99">
<input type=hidden name="currency" value="GBP">
<input type=hidden name="desc" value="Order number: 1">
<input type=hidden name="testMode" value="0">
<input type=hidden name="name" value="test test">
<input type=hidden name="address" value="test,,,">
<input type=hidden name="postcode" value="">
<input type=hidden name="country" value="GB">
<input type=hidden name="tel" value="">
<input type=hidden name="email" value="nospam@visionwt.com">

<input type="hidden" name="fixContact">
<input type="hidden" name="lang" value="en">

<input type=hidden name="M_email" value="nospam@visionwt.com">
<input type=hidden name="M_PHPSESSID" value="555rrc54442a048b6152444d38d8b">
<input type=hidden name="M_USERID" value="19">

<input type=hidden name="M_ORDERCREATED" value="1067446530">

<input type=hidden name="authCurrency" value="GBP">
<input type=hidden name="callbackPW" value="mypassword">
<input type=hidden name="rawAuthCode" value="A">

<div class="buttonblock">
<input type="submit" name="Test" value="Test" />
</div>

</form> 
  
</body>
</html>

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Starla Carpenter

Thursday 05 February 2004 6:24:29 am

I went to sleep last night thinking "where could it get javascript? where could it get javascri...?" and woke up knowing where. It's in the mainpagelayout.tpl file (an ad thing) which is NOT being used by the callback page.

What's the deal with that? Is Ezpublish automatically processing the main template file, even if it's being overridden?

I'll replace the mainpagelayout with something benign first, then after I get worldpay working correctly, try to get the javascript functionality back. I'll keep you posted :)

Tony Wood

Thursday 05 February 2004 10:08:07 am

Hi,

the template used by callback.tpl is defined in callback.php

$Result = array();
$Result['pagelayout'] = 'wp_pagelayout.tpl';
$Result['content'] =& $tpl->fetch( "design:callback.tpl" );
return true;

We define it here specifically for this reason :) So you can have a page without Javacsript and locally accessed images.

Hope this helps

--tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Starla Carpenter

Thursday 05 February 2004 2:05:08 pm

This seems to be the deal: if any sort of error is returned, ezpublish defaults to the main site template. So if you have any javascript in your site pagelayout.tpl or any templates it includes, you're burnt.

I replaced the pagelayout with a nonjs version, debugged it, and got it to work. Then I put my javascript back in and it was fine. Thanks heaps for your warning against javascript.

So new problem now: I got it to work by giving anonymous user full privileges. Once I turned those off, I get a "no permission" screen on callback. If I go back to the home page, the user's still logged in, and if I enter the callback script URL direction it's fine. What's going on? the worldpay site says something about session info being lost, during the transaction -- do I need to somehow reinstate the session?

Tony Wood

Friday 06 February 2004 12:37:47 am

Hi,

You do not need to reinstate the session this session issue is already handled by callback.php, you will notice that the Worldpay extension gets passed the Session ID.

As for permissions, anonymous should not have full permissions all you need is to add

Give anonymous access to the worlpday module
worldpay * *

This will give the WorldPay servers access to call it.

--tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Starla Carpenter

Friday 06 February 2004 7:10:28 pm

Thanks a lot.

I'm almost there, sorry for all the trouble. Here's a strange one for you. I have my database open in one window and my site in the other. I send it off to worldpay. Before I submit my credit card info, I update my database and see the new entry in worldpaydb. A few seconds later, I update and the new record is GONE. Meanwhile, the transaction finishes and returns me to callback. I've got Debug enabled, and am dumping the info from the worldpaydb object to screen and it's getting the record fine. I suppose I can recreate the worldpaydb record, but WHY is it losing it??

Thanks in advance.
-Starla

Tony Wood

Saturday 07 February 2004 2:30:18 am

Hi Starla,

It looks like we are almost there :)

The records stored in the worldpay db are for transaction use only. So the system is designed to remove them when a payment transaction has completed sucessfully. The reason why the record in the Worldpay db is deleted is because a full transaction has occured.
The idea is to extend the worldpay module to include reporting for failed transaction i.e. the ones left in the worldpay db. There is no need to to store this data beyond that as eZ publish has all the order information you need in it workings. So you can view order information using the admin orders screen. Of course feel free to write some reporting modules and we can add them the the GPL worldpay module. We are working on a couple of commerce sites at the moment using this module so may well extend it beyond it oringial brief for the the ealry eZ 3 commerce sites we did.

I hope this helps

--Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Eirik Alfstad Johansen

Monday 09 February 2004 7:23:11 am

Hi Tony,

One additional question:

Is the installation ID in worldpay.ini.append.php ever used? As far as I can tell, the only instID used is the one ine the eventtype template.

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Tony Wood

Monday 09 February 2004 7:40:32 am

Yes the Installation ID is checked in
if ( $http->hasVariable( "instId" ) )
{
$inst_id =& $http->variable( "instId" );
return true;
}
else
{
// This is not a call from worldpay
eZDebug::writeDebug( "Worldpay", "This installation ID does not match" );
return false;
}

It ensures you are paying the money into the right WorldPay account, this is useful when you have more than one installation and you copy code around. Your right though the Installation ID should not be hard coded, Ill add it to the todo list.

Also, we will be releasing an update to the WorldPay module that enables it to work with multiple currencies rather than the signle hardcoded one at the moment. This has been tested and has gone live so will get posted to SVN soon.
Another module on our todo list is a generic RIPE country code module, to make life a little easier...

--tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Starla Carpenter

Monday 09 February 2004 12:46:48 pm

Tony,

I understand -- it would be a nice feature. If I develop an error reporting functionality, I'll let you know.

Thanks again for all of your help :)

Best regards,
-Starla

Eirik Alfstad Johansen

Friday 13 August 2004 4:08:37 am

Hi Paul,

I'm working on a paynet extension which too will be triggered at shop | checkout | before since the after trigger doesn't work as we've discussed earlier.

However, this results in the basket not being cleared and the order not being stored which I supposed happens during the checkout process.

How did you get around this problem?

Thanks in advance !

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Tony Wood

Friday 13 August 2004 4:13:13 am

Hi,

To clear basket you need to add this

[ShopSettings]
# Whether to clear the basket on checkout or not
# if disabled the basket will be cleared after the checkout is complete
ClearBasketOnCheckout=enabled

I think this is fixed in 3.5 but that's a ways off

--tony
http://www.visionwt.com

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Eirik Alfstad Johansen

Friday 13 August 2004 4:26:47 am

Hi Tony,

Thanks for the tip. I''ve actually already done that. But how did you get the order stored (and the order confirmation email sent out)?

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Tony Wood

Friday 13 August 2004 4:58:34 am

I used a new table in the db to store the order.. Check out the code in pubsvn.ez.no. It is all there...

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Bo Vejgaard

Wednesday 06 October 2004 4:59:56 am

Hi,

I have the same problem as described above, that i can't see the event/worldpay event i my dropdown, when i try to create a workflow. I have tried and tested the three reasons you have described to this problem, but i still cant make it work.
Do you have any suggestions as to what might be the problem? I am currently using eZ 3.4.1.

Sincerely

Bo Henriksen

Scott Blundell

Monday 01 November 2004 9:32:28 am

Possible Bug?

On the Worldpay 'bounce' template (event_worldpay.tpl) Javascript is used to automatically post the order data to the WorldPay site.

As the Javascript loads before the form, then it is possible, particularly on a slow connection, that not all the form information will have loaded before the script posts the form. This can mean partial information being sent to and received from WorldPay, which can cause problems in the callback script.

Regards

Scott Blundell

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.