LexikPayboxBundle icon indicating copy to clipboard operation
LexikPayboxBundle copied to clipboard

Configure bundle to use two accounts

Open sarramegnag opened this issue 7 years ago • 6 comments

Greetings,

I successfully used your bundle to implement payment features for my website but I will face soon an issue where I have to configure two different Paybox accounts. In my case, I will have to redirect the user to an account to pay books, and another account to pay courses. But it looks like your bundle only handle one account.

I was thinking about implementing this as they did in CsaGuzzleBundle to use multiple guzzle clients. Something like this :

lexik_paybox:
    accounts:
        books:
            parameters:
                production: false        # Switches between Paybox test and production servers (preprod-tpe <> tpe)
                site:        '9999998'   # Site number provided by the bank
                rank:        '98'        # Rank number provided by the bank
                login:       '999999998' # Customer's login provided by Paybox
                hmac:
                    key: 'FEDCBA...43210' # Key used to compute the hmac hash, provided by Paybox
        courses:
            parameters:
                production: false        # Switches between Paybox test and production servers (preprod-tpe <> tpe)
                site:        '9999999'   # Site number provided by the bank
                rank:        '99'        # Rank number provided by the bank
                login:       '999999999' # Customer's login provided by Paybox
                hmac:
                    key: '01234...BCDEF' # Key used to compute the hmac hash, provided by Paybox

Any chance you would have any tips to implement this ? I will gracefully offer a pull request when finished ;)

[EDIT] Related to https://github.com/lexik/LexikPayboxBundle/issues/34

Regards,

Guillaume SARRAMEGNA

sarramegnag avatar Oct 02 '17 12:10 sarramegnag

Hi @SarramegnaG

that's an interesting feature, there is a lot of reading in order to achieve that :

How to Create Friendly Configuration for a Bundle https://symfony.com/doc/current/bundles/configuration.html

How to Load Service Configuration inside a Bundle https://symfony.com/doc/current/bundles/extension.html

If you have time, i'd be happy to review your PR but bear in mind that this bundle has been written to be used by only one paybox account so there may be a lot of work ! :)

Good luck, James

acidjames avatar Oct 04 '17 13:10 acidjames

https://github.com/lexik/LexikPayboxBundle/pull/91 pending.

sarramegnag avatar Nov 20 '17 15:11 sarramegnag

@SarramegnaG many thanks for your work

As you said in your PR, this is inducing lots of breaking changes in the code. I'll have to contact Lexik to create a new tag for this version (i don't have admin privileges), we can't ship this in the master branch as many users rely on this bundle.

Please be patient then, Cheers, James

acidjames avatar Nov 20 '17 21:11 acidjames

@SarramegnaG Salut Guillaume, juste pour info, je change actuellement de taf avec déménagement etc, donc encore merci pour ton PR, je vais essayer de trouver du temps libre courant 1er semestre 2018 pour merger tout ça, patience encore ;)

acidjames avatar Dec 16 '17 13:12 acidjames

@SarramegnaG je ne t'oublie pas. Je viens de commencer mon nouveau poste et j'ai changé de ville... bref, j'ai prévu de m'y atteler bientôt ! bises

acidjames avatar Mar 11 '18 19:03 acidjames

@sarramegnag Bonjour Guillaume,

Merci pour cette PR, j'utilise le "multicompte" depuis plusieurs années :) Je suis en train de mettre à jour mon projet vers SF 5.2 et j'ai un soucis ...

Appeler le service avec ça ne fonctionne plus : $this->container->get('lexik_paybox.request_handler.'.$account)

J'ai cette erreur : The "lexik_paybox.request_handler.test" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

Je comprends l'erreur mais je ne sais pas comment injecter le service, en prenant en compte le fameux "$account". Est-ce possible ?

Merci beaucoup :)

PS : désolé, j'ai reposté ma question en te mentionnant, au cas où le premier serait passé inaperçu :)

clem983 avatar May 15 '21 21:05 clem983