mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Disable vault setting if vaulting feature is not available in access token
This commit is contained in:
parent
e2cf37297a
commit
ccf357d790
6 changed files with 78 additions and 11 deletions
|
@ -99,6 +99,22 @@ class Token {
|
|||
return new Token( $json );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if vaulting is available in access token scope.
|
||||
*
|
||||
* @return bool Whether vaulting features are enabled or not.
|
||||
*/
|
||||
public function vaulting_available() {
|
||||
if ( strpos(
|
||||
$this->json->scope,
|
||||
'https://uri.paypal.com/services/vault/payment-tokens/readwrite'
|
||||
) !== false ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates whether a JSON object can be transformed to a Token object.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue