mirror of
https://github.com/quentin-g-dev/afup.git
synced 2026-03-25 01:32:08 +01:00
* modification pour utiliser Symfony pour le retour après le paiement de la cotisation ref #942 * fix erreur après tests * fix cs * change review
60 lines
1.8 KiB
PHP
60 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace AppBundle\Command;
|
|
|
|
use function GuzzleHttp\Psr7\parse_query;
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
class DevCallBackPayboxCotisationCommand extends ContainerAwareCommand
|
|
{
|
|
/**
|
|
* @see Command
|
|
*/
|
|
protected function configure()
|
|
{
|
|
$help = <<<EOF
|
|
Cette commande simplifie l'appel au callback de paybox.
|
|
Il faut dans le container l'appeller avec un argument comme celui-ci "https://localhost:9206/association/paybox-redirect?total=3000&cmd=C2020-150120200752-0-770-GALLO-DCB&autorisation=XXXXXX&transaction=587904761&status=00000"
|
|
Il correspond à l'URL de la page de retour de paiement.
|
|
EOF;
|
|
|
|
$this
|
|
->setName('dev:callback-paybox-cotisation')
|
|
->addArgument('url_paiement_effectue')
|
|
->setHelp($help)
|
|
;
|
|
}
|
|
|
|
/**
|
|
* @see Command
|
|
*/
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$parsedUrl = parse_url($input->getArgument('url_paiement_effectue'));
|
|
|
|
$query = $parsedUrl['query'];
|
|
|
|
$params = parse_query($query);
|
|
|
|
$callBackParameters = [
|
|
'total' => $params['total'],
|
|
'cmd' => $params['cmd'],
|
|
'autorisation' => $params['autorisation'],
|
|
'transaction' => $params['transaction'],
|
|
'status' => $params['status'],
|
|
];
|
|
|
|
|
|
$url = 'https://apachephp:80/association/paybox-callback?' . http_build_query($callBackParameters);
|
|
|
|
$curl = curl_init($url);
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
|
curl_exec($curl);
|
|
|
|
$output->writeln("Appel au callback de paiement de cotisation effectué");
|
|
}
|
|
}
|