From 4c18d9c575bc17b30e616b130474747116746c9b Mon Sep 17 00:00:00 2001 From: Johan Desmyter Date: Wed, 26 Mar 2014 16:19:28 +0300 Subject: [PATCH] add validation options and documentation for this options --- DependencyInjection/Configuration.php | 9 +++++++ DependencyInjection/LexikPayboxExtension.php | 6 +++++ README.md | 26 ++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 98f9ffa..2d51f10 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -85,6 +85,15 @@ public function getConfigTreeBuilder() ->scalarNode('key')->isRequired()->end() ->end() ->end() + ->enumNode('validation_by') + ->values(array('url_ipn', 'pbx_retour')) + ->cannotBeEmpty() + ->defaultValue('url_ipn') + ->info("Define the method for IPN validation. Select 'pbx_retour' only if you use 'PBX_REPONSE_A' option.") + ->end() + ->scalarNode('pbx_retour') + ->info("PBX_RETOUR option for validation by 'pbx_retour'") + ->end() ->end() ->end() diff --git a/DependencyInjection/LexikPayboxExtension.php b/DependencyInjection/LexikPayboxExtension.php index 2fdc7da..8caa01c 100644 --- a/DependencyInjection/LexikPayboxExtension.php +++ b/DependencyInjection/LexikPayboxExtension.php @@ -33,6 +33,12 @@ public function load(array $configs, ContainerBuilder $container) $config['parameters']['public_key'] = __DIR__ . '/../Resources/config/paybox_public_key.pem'; } + if('pbx_retour' == $config['parameters']['validation_by'] && (!isset($config['parameters']['pbx_retour']) || !$config['parameters']['pbx_retour'])){ + throw new \InvalidArgumentException( + 'The "pbx_retour" option must be set for validation_by "pbx_retour"' + ); + } + $container->setParameter('lexik_paybox.public_key', $config['parameters']['public_key']); } } diff --git a/README.md b/README.md index 5ab7a9e..d7a314a 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ lexik_paybox: - '826' # GBP - '840' # USD - '978' # EUR + validation_by: url_ipn ``` The routing collection must be set in your routing.yml @@ -218,4 +219,29 @@ To toggle in production, you just need to specify 'prod' in parameter of the get Resources --------- +Validation respons IPN +---------------------- + +For security, the status returned by PBX_EFFECTUE, PBX_REFUSE, PBX_ANNULE and PBX_ATTENTE, should +not be trusted as it can by altered by malicous user. You must instead use IPN notification. +IPN notification is send directly from Paybox server to the URL you specified either in PBX_REPONDRE_A +option or in Paybox interface. + +If you use PBX_REPONDRE_A option you must specify in your config.yml the following parameters : + +```yml +lexik_paybox: + parameters: + validation_by: pbx_retour + pbx_retour: Mt:M;Ref:R;Auto:A;Erreur:E # report the PBX_RETOUR option you defined +``` + +If you don't use PBX_REPONDRE_A you can the defaults parameters : + +```yml +lexik_paybox: + parameters: + validation_by: url_ipn +``` + All transactions parameters are available in the [official documentation](http://www1.paybox.com/telechargement_focus.aspx?cat=3).