diff --git a/src/XeroFactory.php b/src/XeroFactory.php index 0d45b07..77590c8 100644 --- a/src/XeroFactory.php +++ b/src/XeroFactory.php @@ -17,6 +17,11 @@ class XeroFactory */ protected $application; + /** + * @var \Calcinai\OAuth2\Client\XeroTenant[] + */ + protected $tenants = []; + /** * Setup */ @@ -37,6 +42,7 @@ public function setupApplication() $config->XeroRefreshToken = $refresh; } + $this->tenants = $provider->getTenants($newAccessToken); $config->write(); } @@ -74,4 +80,16 @@ public function getRedirectUri() 'connectXero' ); } + + /** + * @return \Calcinai\OAuth2\Client\XeroTenant[] + */ + public function getTenants() + { + if (!$this->application) { + $this->setupApplication(); + } + + return $this->tenants; + } }