lexik / LexikPayboxBundle

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

payment.ERROR: Signature is invalid. #7

Open soullivaneuh opened 11 years ago

soullivaneuh commented 11 years ago

I used fake paybox's card in dev env, and I have a invalid signature :

[2013-01-16 17:05:32] request.INFO: Matched route "lexik_paybox_ipn" (parameters: "_controller": "Lexik\Bundle\PayboxBundle\Controller\DefaultController::ipnAction", "time": "1358352320", "_route": "lexik_paybox_ipn") [] []
[2013-01-16 17:05:32] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2013-01-16 17:05:32] payment.INFO: New IPN call. [] []
[2013-01-16 17:05:32] payment.INFO: amount=8252 [] []
[2013-01-16 17:05:32] payment.INFO: cmd=FR201301000001-1358352320 [] []
[2013-01-16 17:05:32] payment.INFO: auto=XXXXXX [] []
[2013-01-16 17:05:32] payment.INFO: trans=4353761 [] []
[2013-01-16 17:05:32] payment.INFO: type=CARTE [] []
[2013-01-16 17:05:32] payment.INFO: card=CB,VISA,EUROCARD_MASTERCARD [] []
[2013-01-16 17:05:32] payment.INFO: error=00000 [] []
[2013-01-16 17:05:32] payment.INFO: country=FRA [] []
[2013-01-16 17:05:32] payment.INFO: Sign=JDg9jvoFcM+i3JDOA6qy9Q6Gx6kFsyc+tymWVSTc7fYkNcwlKqF7SUdvBz6awxsD2tYuqkPtZjtdvTtYJm5mlnJdbrzPn3ixdjD7weTOxkJOcbUqqpmig3LDz2bpKajLFvE9Ut/+MRoemmSawpC3m2sQ2uFGkMtmFGCYfYQzzag= [] []
[2013-01-16 17:05:32] payment.INFO: amount=8252&cmd=FR201301000001-1358352320&auto=XXXXXX&trans=4353761&type=CARTE&card=CB%2CVISA%2CEUROCARD_MASTERCARD&error=00000&country=FRA [] []
[2013-01-16 17:05:32] payment.INFO: JDg9jvoFcM+i3JDOA6qy9Q6Gx6kFsyc+tymWVSTc7fYkNcwlKqF7SUdvBz6awxsD2tYuqkPtZjtdvTtYJm5mlnJdbrzPn3ixdjD7weTOxkJOcbUqqpmig3LDz2bpKajLFvE9Ut/+MRoemmSawpC3m2sQ2uFGkMtmFGCYfYQzzag= [] []
[2013-01-16 17:05:32] payment.ERROR: Signature is invalid. [] []

Here, my paybox form action :

    /**
     * @Route("/paybox")
     * @Template()
     */
    public function payboxAction()
    {
        $ref = $this->getRequest()->get('ref');
        /* @var $invoice Invoice */
        $invoice = $this->getDoctrine()->getRepository('SLLHMainBundle:Invoice')->findOneBy(array('ref' => $ref));

        /* @var $paybox PayboxRequest */
        $paybox = $this->get('lexik_paybox.request_handler');

        $paybox->setParameters(array(
            'PBX_CMD'           => $invoice->getRef().'-'.time(),
            'PBX_DEVISE'        => '978',
            'PBX_PORTEUR'       => 'test@test.net',
            'PBX_RETOUR'        => 'amount:M;cmd:R;auto:A;trans:T;type:P;card:C;countrycard:Y;error:E;country:I',
            'PBX_TOTAL'         => $invoice->getBalance() * 100,
            'PBX_TYPEPAIEMENT'  => 'CARTE',
            'PBX_TYPECARTE'     => 'CB,VISA,EUROCARD_MASTERCARD',
            'PBX_EFFECTUE'      => $this->generateUrl('sllh_front_payment_paybox_return', array('status' => 'success'), true),
            'PBX_REFUSE'        => $this->generateUrl('sllh_front_payment_paybox_return', array('status' => 'denied'), true),
            'PBX_ANNULE'        => $this->generateUrl('sllh_front_payment_paybox_return', array('status' => 'canceled'), true),
            'PBX_RUF1'          => 'POST',
            'PBX_REPONDRE_A'    => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), true),
        ));

        $env = $this->container->getParameter('kernel.environment');

        return array(
            'invoice'   => $invoice,
            'url'       => $paybox->getUrl(),
            'form'      => $paybox->getForm()->createView(),
        );
    }

Did you already have thir error ? How did you fix it ?

Thanks for help.

fjouatte commented 9 years ago

So I wrote a mail to Paybox support and I finally get an answer ...

The following platforms (pre-production and production) (https://preprod-tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi and https://tpeweb1.paybox.com/cgi/MYchoix_pagepaiement.cgi) urlencode the ref param.

BUT the main production platform (https://tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi) DOES NOT. They say that the program managing IPN calls is not the same version but it will be updated soon ...

Hope this can help.

ibasaw commented 9 years ago

@fjouatte : ok, thank you for this detail