isotope / core

Core repository of Isotope eCommerce, an eCommerce extension for Contao Open Source CMS
https://isotopeecommerce.org
135 stars 107 forks source link

Postsale and SIPS auto_response_url #1888

Open chibko opened 6 years ago

chibko commented 6 years ago

Hello, I have tried to make a payment module for "Société Général" based on ATOS SIPS. The auto_response_url (http://xxxx/sytem/modules/isotope/postsale.php&mod=pay&id=5 does not work… Nothing happens, order is not in the backend, no logs and nothing in the isotope_postsale.log and i have a 303 statut code in apache logs When the script is called in a browser, it's ok.

After hours of trying to make it works, i have found what happens : In the initialize.php file when the script is called by the bank server, the $response return a Symfony\Component\HttpFoundation\RedirectResponse and not a InitializeControllerResponse !

I have tried to make a custom initialize.php in my modules, but can't make it work, so i have modify the initialize.php in /system like this :

use Contao\ManagerBundle\ContaoManager\Plugin as ManagerBundlePlugin;
use Contao\CoreBundle\Response\InitializeControllerResponse;
use Contao\ManagerBundle\HttpKernel\ContaoKernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;

if (!defined('TL_SCRIPT')) {
    die('Your script is not compatible with Contao 4.');
}
/** @var Composer\Autoload\ClassLoader */
$loader = require __DIR__.'/../vendor/autoload.php';
ManagerBundlePlugin::autoloadModules(__DIR__.'/modules');

$request = Request::create('/_contao/initialize', 'GET', [], $_COOKIE, [], $_SERVER);
$request->attributes->set('_scope', ('BE' === TL_MODE ? 'backend' : 'frontend'));

ContaoKernel::setProjectDir(dirname(__DIR__));
$kernel = new ContaoKernel('prod', false);
$response = $kernel->handle($request);

error_log('Type response : '.get_class($response));

// Send the response if not generated by the InitializeController
if ((!$response instanceof InitializeControllerResponse) && (!$response instanceof RedirectResponse)) {
    $response->send();
    $kernel->terminate($request, $response);
    exit;
}

I know it's the bad way to do this… If you have any idea to make it clear :)

Hope it helps others with ATOS SIPS payment.

aschempp commented 6 years ago

Did you find out where the RedirectResponse is coming from? And what the redirect URL is?