Skip to content

Commit

Permalink
add validation options and documentation for this options
Browse files Browse the repository at this point in the history
  • Loading branch information
nykopol committed Mar 26, 2014
1 parent 4f9f6bf commit 4c18d9c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
6 changes: 6 additions & 0 deletions DependencyInjection/LexikPayboxExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).

0 comments on commit 4c18d9c

Please sign in to comment.