Author Topic: Worldpay issues  (Read 3678 times)

Offline dynorodney

  • Sr. Member
  • ****
  • Posts: 120
    • View Profile
Worldpay issues
« on: 15/April/2010, 05:23:23 PM »
Russell

I seem to have a problem with Worldpay

We operate the site from within a cms subdirectory

If I log in and make a payment on the invoice list screen (i.e. pay an invoice) and go through to the worldpay screen and then hit cancel I get a worldpay callback failure email because its trying to call /index.php rather than /cms/index.php - so i go and change the worldpay settings and put the callback as cms/index.php instead

However when I place an order with an order form  and then hit cancel I get worldpay telling me that its trying to open /cms/cms/index.php

(I might have those the wrong way round but you get the jist)

Is there a chance that in one of those places its just outputting the domain plus the callback url and in the other place its outputting the domain plus the joomla install directory plus the callback url ?

I'm chasing my tail here :-(

Thanks

Tony

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Worldpay issues
« Reply #1 on: 15/April/2010, 07:41:34 PM »
That's a bit odd, as the same code is called in both cases. You could amend the /administrator/components/com_nbill/admin.gateway/worldpay_junior/worldpay_junior.php file, and change line 148 from:

<input type="hidden" name="MC_callback" value="<?php echo str_replace("https://", "", str_replace("http://", "", nbf_cms::$interop->live_site)) . "/" . $worldpay_fields['callback_url']['g_value']; ?>" />

...to...

<input type="hidden" name="MC_callback" value="www.yourdomain.com/cms/index.php" />

ie. hardcode the URL instead of picking it up from the settings.

Offline dynorodney

  • Sr. Member
  • ****
  • Posts: 120
    • View Profile
Re: Worldpay issues
« Reply #2 on: 15/April/2010, 11:49:21 PM »
Russell

Thanks for pointing me in the direction of that file. Ive commented out the submit code so I could do a view source

in the order submission i got

<input type="hidden" name="MC_callback" value="www.domain.co.uk/index.php?option=com_nbill&action=gateway&task=worldpay_receipt&gateway=worldpay_junior" />

and in the invoice payment it has

<input type="hidden" name="MC_callback" value="www.domain.co.uk/cms/index.php?option=com_nbill&action=gateway&task=worldpay_receipt&gateway=worldpay_junior" />

But yes I can see its obviously going through the same code because its not submitting either of the forms when it was only commented in one place so I agree its obviously being used in both places but something is amiss

Ive echoed a html comment out and it would appear that when you go via the invoice payment screen

nbf_cms::$interop->live_site is reported as https://www.domain.co.uk/cms

and when it comes via the order page

nbf_cms::$interop->live_site is https://www.domain.co.uk

I can only assume that somewhere the value gets changed via the different paths to the same code ?

Thanks again

Tony



Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Worldpay issues
« Reply #3 on: 16/April/2010, 09:58:15 AM »
I just tested it myself on a site that is in a subfolder, and it correctly output the full URL for me. You can either hard-code the URL in the gateway file as I suggested, or if you would like me to look into why it is not working normally on your site, you can raise a support ticket.

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Worldpay issues
« Reply #4 on: 16/April/2010, 07:55:31 PM »
This is now fixed. For some reason the PHP dirname function was behaving inconsistently on your server. I have modified the code so that it no longer uses that function. Specifically, what I changed was in the file /administrator/components/com_nbill/framework/interop/nbill.interop.abstract.php, around line 357 where it said:

            $live_site .= str_replace("\\", "/", dirname($url_parts['path']));

...I changed it to:

            $live_site .= str_replace("\\", "/", $url_parts['path']);
            //Knock off trailing slash and anything that comes after it
            $live_site = substr($live_site, 0, strrpos($live_site, "/"));


This fix will be included in the next release.
« Last Edit: 18/April/2010, 01:46:48 PM by netshine »

Offline dynorodney

  • Sr. Member
  • ****
  • Posts: 120
    • View Profile
Re: Worldpay issues
« Reply #5 on: 19/April/2010, 01:59:00 PM »
Russell

Thanks for that - so it should work the same in both places now without my code kludge? and the index.php duplication  issue was caused as a  result of this but this is now resolved too?

Many thanks

Tony

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Worldpay issues
« Reply #6 on: 19/April/2010, 03:12:41 PM »
Yes and yes.

 

anything