-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dinamic username & password parameters #57
Comments
I have done it, finally i modify TokenAuthenticationStrategy.php file, from JMSPaymentPaypalBundle, function authenticate, adding posible external modification of auth params:
From my controller, now add USER, PWD and SIGNATURE in checkout_params and it work. It is ok? any suggest? Thanks |
Finally I did:
And now, i can add ilimited accounts and select from controller, less intrusive code, too it is back compatible. Suggest? Thanks! |
Hi, I had to do the same thing in my project, I created a class named EditableTokenAuthenticationStrategy in my application witch extends TokenAuthenticationStrategy and implements setter methods: class EditableTokenAuthenticationStrategy extends TokenAuthenticationStrategy
{
/**
* @param string $username
*/
public function setUsername($username)
{
$this->username = $username;
}
/**
* @param string $password
*/
public function setPassword($password)
{
$this->password = $password;
}
/**
* @param string $signature
*/
public function setSignature($signature)
{
$this->signature = $signature;
}
} Then I overrode the container parameter: <parameter key="payment.paypal.authentication_strategy.token.class">Foo\PaymentBundle\Paypal\Client\Authentication\EditableTokenAuthenticationStrategy</parameter> Finally in your controller you can do something like this: $this->get('payment.paypal.authentication_strategy.token')
->setUsername($username)
->setPassword($password)
->setSignature($signature); I hope it will help. I think we should create a TokenAuthenticationStrategyProvider who, by default, create a token from the container parameters and can be overrode in an application by something else. |
So the Configuration should be: jms_payment_paypal:
username: your api username (not your account username)
password: your api password (not your account password)
signature: your api signature
debug: true/false # when true, connect to PayPal sandbox; uses kernel debug value when not specified or jms_payment_paypal:
authentication_strategy:
provider: your token provider I will not have time to implement it now but it's an easy improvement to make |
Ohhh, good solution, thanks, it is perfect, yes, i will not have time now, and my know... are not enoght for it (i think), Thanks anyway, regards |
@ClementGautier I know it's been a while but I it would be useful to have your solution in the documentation. Would you be available to create a PR? |
@regularjack Hi, (and sorry for the delay). I've no time at the moment to contribute but you can probably just copy / paste my answer in the doc ;) I don't mind being mentioned on it so be pleased to use it as it was your own work. |
@ClementGautier I'm not shire, where I should do this: $this->get('payment.paypal.authentication_strategy.token') Before build paypal form? |
Hello,
I need use dinamic username & password for paymentplugin,
Where can i do it?
Thanks!!
The text was updated successfully, but these errors were encountered: