Function to check if tracking is enabled

This commit is contained in:
Narek Zakarian 2022-08-16 16:18:39 +04:00
parent 8ce45012f1
commit 36d86aaba5

View file

@ -140,4 +140,24 @@ class Token {
}
return true;
}
/**
* Checks if tracking is available in access token scope.
*
* @return bool Whether tracking features are enabled or not.
*/
public function is_tracking_available(): bool {
if ( ! isset( $this->json->scope ) ) {
return false;
}
if ( strpos(
$this->json->scope,
'https://uri.paypal.com/services/shipping/trackers/readwrite'
) !== false ) {
return true;
}
return false;
}
}