lexik / LexikPayboxBundle

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

Issue with paybox test parameters (with solution) #21

Closed acidjames closed 10 years ago

acidjames commented 10 years ago

Hi all,

I'm using sf2.4 and i've been trying to make this bundle work with the paybox test parameters.

So, if you want to test your environment, here are the parameters i've been using :

app/config/config_dev.yml

lexik_paybox:
    parameters:
        # Site number provided by the bank
        site:  '1999888'
        # Rank number provided by the bank
        rank:  '32'
        # Customer's login provided by Paybox
        login: '2'
        hmac:
            # Key used to compute the hmac hash, provided by Paybox
            key: '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'

YourBundle/Controller/DefaultController.php or whatever

public function callAction()
{
    $paybox = $this->get('lexik_paybox.request_handler');
    $paybox->setParameters(array(
        'PBX_CMD'          => 'CMD'.time(),
        'PBX_DEVISE'       => '978',
        'PBX_PORTEUR'      => 'test@paybox.com',
        'PBX_RETOUR'       => 'Mt:M;Ref:R;Auto:A;Erreur:E',
        'PBX_TOTAL'        => '1000',
        'PBX_TYPEPAIEMENT' => 'CARTE',
        'PBX_TYPECARTE'    => 'CB',
        'PBX_EFFECTUE'     => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), true),
        'PBX_REFUSE'       => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'denied'), true),
        'PBX_ANNULE'       => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'canceled'), true),
        'PBX_RUF1'         => 'POST',
        'PBX_REPONDRE_A'   => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), true),
    ));

    return $this->render(
        'LexikPayboxBundle:Sample:index.html.twig',
        array(
            'url'  => $paybox->getUrl(),
            'form' => $paybox->getForm()->createView(),
        )
    );
}

For some reason, the bundle documentation uses : 'PBX_TYPECARTE' => 'CB,VISA,EUROCARD_MASTERCARD',

Leads to this error :

Erreur de protection. Nous regrettons de ne pouvoir donner une suite favorable à votre demande de paiement.

But it doesn't work with the paybox test parameters, so i've changed the line to : 'PBX_TYPECARTE' => 'CB',

This works. If you comment this line, you'll be prompted with a batch of payment methods (debit card, paypal, etc)

Olineuve commented 10 years ago

I noticed the same problem with the value "EUROCARD_MASTERCARD" in "PBX_TYPECARTE" parameters that trigger an error. It seems that the credentials of the test account have changed.

Removing this parameter trigger the display of an additional step where you have to choose your card type. This is the normal behavior as explained in the Paybox's documentation.

Olineuve commented 10 years ago

I called Paybox's support and it actually where a change in this parameter's value. It's no more possible to have multiple values comma separated in it.

To allow all cards types the value is now : 'PBX_TYPECARTE' => 'CB'

And it is still possible to limit allowed cards type to visa or mastercard with : 'PBX_TYPECARTE' => 'VISA' 'PBX_TYPECARTE' => 'EUROCARD_MASTERCARD'