lexik / LexikPayboxBundle

LexikPayboxBundle eases the implementation of the Paybox payment system
MIT License
40 stars 47 forks source link

Default value of public key #30

Closed hisem closed 9 years ago

hisem commented 10 years ago

Hi,

Commit 152eade00c525e0c90ae63a193588fc9cb662db6 gives the public_key parameter a null value in Paybox/System/Base/Response.php 's verifySignature function. The default value set in the extension didn't work for me. I had to patch this by putting the default value back in the Configuration so my transactions would verify the signature correctly.

ibasaw commented 10 years ago

+1 don't work

Warning: fopen(): Filename cannot be empty in /home/www/symfony/vendor/lexik/paybox-bundle/Lexik/Bundle/PayboxBundle/Paybox/System/Base/Response.php on line 134

soullivaneuh commented 10 years ago

Same problem here.

Well, what is exactly this public key ? Found nothing in the paybox doc about that...

nykopol commented 10 years ago

The public key is a key that is required to check the authenticity of the response from paybox.
@ibasaw The error you have look like the public_key is not correctly defined. If you don't set it's value in your config.yml it should work. If you don't, it's maybe an error.

ibasaw commented 10 years ago

@nykopol : i had enter it in my config.yml, but it doesn't seem to load it

i place it in my config folder: and it work

I also modify the code in response.php to verify the sign: without this i always got a KO: signature is invalid

nykopol commented 10 years ago

@ibasaw if you entered the public_key parameter in your config.yml, the error show that the path was not good. Just by removing it, it should work.

Can you make a PR for your modifications on response.php please ?

ibasaw commented 10 years ago

@nykopol Here the file: https://github.com/ibasaw/LexikPayboxBundle/blob/master/Paybox/System/Base/Response.php (maybe this isn't the good way to do it, but it works !)

My fork is functionnal, signature is OK

nykopol commented 10 years ago

Can you post an example of URL IPN notified by Paybox please ?

ibasaw commented 10 years ago

/payment-ipn/1400242395?montant=3990&ref=1|xxx@xxx|4e0251eb2abe5e4fc06ebbf062be315f|0|4&autorisation=XXXXXX&trans=8319576&abonnement=0&paiement=CARTE&carte=CB&idtrans=4363710&erreur=00000&validite=1412&IP=FRA&BIN6=111122&digest=5B434C778490889697170E225029F56AFF19CA47&Sign=JA4bdhZbgoOz8pKGcFZSQE6pbpcaA6KyZUpoqfeS0GrKiNf47b3Hj2GWF1%2FpU93L2By0W8vjjJsWWkgWIGSbZUn6K0cITokr%2FLj379pXNraUENBtubtQSD4%2FNTb5S1DDAgB1ExXmSrFxpgcfR9U8P47XTYW3fvOk4oUrTJCm2Ns%3D

LouTerrailloune commented 10 years ago

Better fix, add this to your config.xml:

lexik_paybox:
    parameters:
        ... other parameters ...
        public_key: "%kernel.root_dir%/../vendor/lexik/paybox-bundle/Lexik/Bundle/PayboxBundle/Resources/config/paybox_public_key.pem"
ibasaw commented 10 years ago

@LouTerrailloune

got already this one in my config, i put the key in my app folder because without this, i got an error

nykopol commented 10 years ago

PR #39 should fix this issue

Olineuve commented 9 years ago

As explained in https://github.com/lexik/LexikPayboxBundle/pull/39 the "public_key" is directly set in the bundle's configuration. The tested and then added to the "lexik_paybox.parameters". I also removed "lexik_paybox.public_key" that wasn't used.