| @@ -2,6 +2,8 @@ | |||
| namespace Biukop; | |||
| use \XeroPHP\Application\PrivateApplication; | |||
| use \XeroPHP\Remote\Exception\RateLimitExceededException; | |||
| class Xero { | |||
| private $xero; | |||
| private $clientgroup="48646f3d-cf5e-4fea-8c8b-5812bd540e1b"; | |||
| @@ -70,8 +72,13 @@ class Xero { | |||
| //sync users to wordpress system | |||
| //does not work for too many users or employees | |||
| public function sync_users(){ | |||
| $this->sync_clients(); | |||
| $this->sync_employees(); | |||
| try{ | |||
| $this->sync_clients(); | |||
| $this->sync_employees(); | |||
| }catch(RateLimitExceededException $e){ | |||
| $msg= "Xero API rate limit exceeded, please try again later, existing sync within 600 seconds will by passed automatically\n"; | |||
| $this->logConsole($msg); | |||
| } | |||
| } | |||
| private function sync_clients(){ | |||
| $contacts = $this->getClients($this->clientgroup); | |||