Set Server Authentication automatic when the service is called#8
Set Server Authentication automatic when the service is called#8redjanym wants to merge 2 commits intowemakecustom:masterfrom redjanym:master
Conversation
|
Hello, Thank you for your contribution. If you take a look at StripeBundle/Service/StripeService.php Line 14 in 4b34ecd self::setApiKey($secretKey); is called in the constructor.
I think it would be better if the API Key was provided through the constructor as an argument. |
Resources/config/services.yml
Outdated
| arguments: [%wmc_stripe.api_publishable_key%] | ||
| tags: | ||
| - { name: twig.extension } | ||
| - { name: twig.extension } No newline at end of file |
There was a problem hiding this comment.
Please restore the empty line at the end of this file.
|
Hi, I'm sorry for the delay since my last answer. I didn't see your second commit. I just looked at the code itself, and I am having some issues with your modifications: Symfony creates its services the first time they are requested. Which means, your modification would work kind-of OK if the Stripe service is injected as a dependency in another service. However, in a Controller (using the base Controller class), the service will never get created and the API Key will never get populated, unless the service is called explicitly (and then nothing is done with it). This seems to me like a weird pattern. Do you think something in particular should be added in the documentation? If the service was used afterward as a Factory or a Facade for the resources, I wouldn't mind integrating the authentification step to service definition, but as it stands, it seems weird. What do you think? |
No description provided.