mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
vaulting does only apply to loggedin users
This commit is contained in:
parent
241a5e170d
commit
077d97d8f7
1 changed files with 5 additions and 2 deletions
|
@ -291,7 +291,7 @@ class SmartButton implements SmartButtonInterface
|
||||||
'integration-date' => date('Y-m-d'),
|
'integration-date' => date('Y-m-d'),
|
||||||
'components' => implode(',', $this->components()),
|
'components' => implode(',', $this->components()),
|
||||||
//ToDo: Probably only needed, when DCC
|
//ToDo: Probably only needed, when DCC
|
||||||
'vault' => $this->dccIsEnabled() ? 'true' : 'false',
|
'vault' => is_user_logged_in() ? 'true' : 'false',
|
||||||
'commit' => is_checkout() ? 'true' : 'false',
|
'commit' => is_checkout() ? 'true' : 'false',
|
||||||
'intent' => ($this->settings->has('intent')) ? $this->settings->get('intent') : 'capture',
|
'intent' => ($this->settings->has('intent')) ? $this->settings->get('intent') : 'capture',
|
||||||
];
|
];
|
||||||
|
@ -317,7 +317,10 @@ class SmartButton implements SmartButtonInterface
|
||||||
'data-partner-attribution-id' => $this->bnCodeForContext($this->context()),
|
'data-partner-attribution-id' => $this->bnCodeForContext($this->context()),
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$clientToken = $this->identityToken->generate();
|
if (! is_user_logged_in()) {
|
||||||
|
return $attributes;
|
||||||
|
}
|
||||||
|
$clientToken = $this->identityToken->generateForCustomer((int) get_current_user_id());
|
||||||
$attributes['data-client-token'] = $clientToken->token();
|
$attributes['data-client-token'] = $clientToken->token();
|
||||||
return $attributes;
|
return $attributes;
|
||||||
} catch (RuntimeException $exception) {
|
} catch (RuntimeException $exception) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue