Disable vault setting if vaulting feature is not available in access token

This commit is contained in:
dinamiko 2021-04-29 17:40:41 +02:00
parent e2cf37297a
commit ccf357d790
6 changed files with 78 additions and 11 deletions

View file

@ -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.
*