LexikPayboxBundle
LexikPayboxBundle copied to clipboard
Configure bundle to use two accounts
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
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
https://github.com/lexik/LexikPayboxBundle/pull/91 pending.
@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
@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 ;)
@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
@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 :)