fdesanto VIP
Total posts: 34
05 Nov 2015 09:34

Hi, in Joomla Global configuration if I set parameter "Force SSL" to "Entire Site", this happens:

_ Paypal Gateway not register payments

_ After Payment I get message "Redirect on not secure...."

_ Sometimes session is lost and user is logout (Offline and Paypal gateways)

After some investigation I have found a solution, in file /components/com_emerald/library/php/gateway.php I have replaces these 2 functions

    public function _get_notify_url($id)
    {
        $url = JURI::root().'index.php?option=com_emerald&task=plans.create&Itemid=1&processor=' . $this->type . '&em_id=' . $id;
        return $url;
    }

    public function _get_return_url($id)
    {
        $url = JURI::root().'index.php?option=com_emerald&task=payment.back&Itemid=1&processor=' . $this->type . '&em_id=' . $id;
        return $url;
    }

You use JRoute::_($url,FALSE,-1), but "-1" remove ssl, so in ssl sites you have another redirect and lost some parameter, still "-1" is not a valid value ( https://api.joomla.org/cms-3/classes/JRoute.html ), so you may have unexpected behavior. I recommend to not use jroute, sometimes it makes trouble, because it tries to force Itemid

Last Modified: 09 Nov 2015


Sergey
Total posts: 13,748
07 Nov 2015 14:17

I have to use JRoute because if you have 3dp SEF extension some of them may not work with URls like this and try to redirect user to correct corresponding SEF url and IPN parameters willbe lost. Also if you have multiple language and ther is no lang parameter in URL but it is required in parameters, then it might also make a URL reload.

The only way to make sure that URL will work correctly is to pass it through JRoute.

And -1 is common Joomla way to get site domain name.

Here is what I did in that file.

public function _get_notify_url($id)
{
    $app = JFactory::getApplication();
    $url = 'index.php?option=com_emerald&task=plans.create&Itemid=1&processor=' . $this->type . '&em_id=' . $id;
    $url = JRoute::_($url, FALSE, -1);
    if($app->getCfg('force_ssl')) 
    {
        $url = str_replace('http:', 'https:', $url);
    }
    return $url;
}

public function _get_return_url($id)
{
    $app = JFactory::getApplication();
    $url = 'index.php?option=com_emerald&task=payment.back&Itemid=1&processor=' . $this->type . '&em_id=' . $id;
    $url = JRoute::_($url, FALSE, -1);
    if($app->getCfg('force_ssl')) 
    {
        $url = str_replace('http:', 'https:', $url);
    }
    return $url;
}

fdesanto VIP
Total posts: 34
09 Nov 2015 15:42

Hi, with your code now works :)

Powered by Cobalt