mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Function to check if tracking is enabled
This commit is contained in:
parent
8ce45012f1
commit
36d86aaba5
1 changed files with 20 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue