-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PayrollUK - get employees #874
Comments
I believe the issue is related to the fact that the payroll_version is set to version 1.0 in the config_defaults in XeroPHP\Application which is currently PayrollAU. PayrollUK and PayrollNZ are version 2.0. Setting the payroll_version via the setConfig results in errors in XeroPHP/Remote/Response.php on line 276 |
What's the error you get with version 2? I believe some APIs must use JSON now, so potentially that's related? Apologies, I've never actually used the Payroll APIs, or had a version to test with, so am a little in the dark. |
Setting config to the following indeed pulls the employees in as json format
We are running on PHP 8.1 and in Response it fails in parseBody when it gets to findElementErrors. I suspect that it processes $this->parseJSON() but the break should take it out of the foreach loop but in PHP8.1 it only takes it out of the switch statement. I added a quick hack (see below) and data is now correctly returned.
In addition I had to add the endDate field to the Employee class and it's respective get/set functions, but now it works until I do an upgrade which means I'd loose my changes. |
I've set the scope of the authorisation and assure my Xero login has access to payroll as admin (without it I was getting permission denied), but now I get 'Not a UK Customer' exception. The API explorer correctly returns all active employees.
Using this method:
$query = new \XeroPHP\Remote\Query($session);
$query->from('XeroPHP\Models\PayrollUK\Employee');
return $query->execute();
Alternatively using this method:
$xero->load(Employee::class)->execute();
Both version return the same exception. Any pointers as to what I am doing wrong?
The text was updated successfully, but these errors were encountered: