XeroAPI/xero-node

Adding Employee Details and Allocating Timesheets with UK Payroll API

ibmmt opened this issue · 3 comments

ibmmt commented

I'm trying to add employee details through an API and allocate timesheets for employees using UK payroll. However, I encountered a couple of issues that I need assistance with.

Case 1: Issue with Payroll Calendar ID
While creating an employee, I set the payrollCalendarID, but it seems that the employee is being created with a null value for the payrollCalendarID. I'm not sure why this is happening and would appreciate any guidance on how to resolve it.

Case 2: Error when Adding Salary and Wage
I attempted to add salary and wage details for an employee using the following code snippet:

const response = await xero.payrollUKApi.createEmployeeSalaryAndWage(
  xeroTenantId,
  employeeId,
  {
    earningsRateID: earningsRateID, // I obtained the earnings Rate ID from the server
    numberOfUnitsPerWeek: 0,
    ratePerUnit: 14,
    numberOfUnitsPerDay: 12,
    effectiveFrom: "2023-01-01",
    annualSalary: 10000,
    status: "Active",
    paymentType: "Hourly",
  }
);

However, I received the following error:

"invalidFields":[{"name":"_default","reason":"Please add a salary & wage."}]}, "salaryAndWages":null

I'm using version 4.33.0 of the Xero API.

I would greatly appreciate any help or insights on how to resolve these issues. Thank you in advance!


PETOSS-298

Thanks for raising an issue, a ticket has been created to track your request

Creating a employee fills the personal details section of the employee record. To add details of the payroll calendar, start date etc you need to make a separate call to add an employment record.

The salary and wage call is failing because it is mixing hourly pay and a salary. If you are adding the payment type as hourly, you need to send the annualsalary value as null or 0.00.