BexioApiClient.Payroll (bexio_api_client v2.0.0)

Copy Markdown

Bexio API for the payroll part of the API (the /4.0/payroll endpoints).

Summary

Functions

Create an employee.

Create an absence for an employee.

Delete an absence of an employee.

Download the paystub PDF for an employee for a given month.

Fetch a single employee on a specific date.

Fetch a single absence of an employee.

Fetch the absences of an employee for a given business year.

Fetch a list of all active employees.

Update an employee.

Update an existing absence of an employee.

Types

api_error_type()

@type api_error_type() :: BexioApiClient.Helpers.api_error_type()

Functions

create_employee(req, employee)

@spec create_employee(
  req :: Req.Request.t(),
  employee :: BexioApiClient.Payroll.Employee.t()
) ::
  {:ok, BexioApiClient.Payroll.Employee.t()} | api_error_type()

Create an employee.

The nation (nationality) should be in ISO Alpha-2 format; the special values '11' mean 'unknown' and '22' mean 'stateless'.

create_employee_absence(req, employee_id, absence)

@spec create_employee_absence(
  req :: Req.Request.t(),
  employee_id :: String.t(),
  absence :: BexioApiClient.Payroll.Absence.t()
) :: {:ok, BexioApiClient.Payroll.Absence.t()} | api_error_type()

Create an absence for an employee.

Currently supported reasons: Injury, Sickness, MaternityLeave, MilitaryLeave, Vacation, InterruptionOfWork (new reasons might be added by bexio in the future).

delete_employee_absence(req, employee_id, absence_id)

@spec delete_employee_absence(
  req :: Req.Request.t(),
  employee_id :: String.t(),
  absence_id :: String.t()
) :: {:ok, true} | api_error_type()

Delete an absence of an employee.

download_paystub_pdf(req, employee_id, year, month)

@spec download_paystub_pdf(
  req :: Req.Request.t(),
  employee_id :: String.t(),
  year :: integer(),
  month :: integer()
) :: {:ok, {String.t(), any()}} | api_error_type()

Download the paystub PDF for an employee for a given month.

Returns the PDF file contents together with the response's content type.

fetch_employee(req, employee_id, date)

@spec fetch_employee(
  req :: Req.Request.t(),
  employee_id :: String.t(),
  date :: Date.t()
) ::
  {:ok, BexioApiClient.Payroll.Employee.t()} | api_error_type()

Fetch a single employee on a specific date.

The date is the date of the employee's state that is retrieved.

fetch_employee_absence(req, employee_id, absence_id)

@spec fetch_employee_absence(
  req :: Req.Request.t(),
  employee_id :: String.t(),
  absence_id :: String.t()
) :: {:ok, BexioApiClient.Payroll.Absence.t()} | api_error_type()

Fetch a single absence of an employee.

fetch_employee_absences(req, employee_id, business_year)

@spec fetch_employee_absences(
  req :: Req.Request.t(),
  employee_id :: String.t(),
  business_year :: integer()
) :: {:ok, [BexioApiClient.Payroll.Absence.t()]} | api_error_type()

Fetch the absences of an employee for a given business year.

fetch_employees(req)

@spec fetch_employees(req :: Req.Request.t()) ::
  {:ok, [BexioApiClient.Payroll.Employee.t()]} | api_error_type()

Fetch a list of all active employees.

update_employee(req, employee)

@spec update_employee(
  req :: Req.Request.t(),
  employee :: BexioApiClient.Payroll.Employee.t()
) ::
  {:ok, true} | api_error_type()

Update an employee.

update_employee_absence(req, employee_id, absence)

@spec update_employee_absence(
  req :: Req.Request.t(),
  employee_id :: String.t(),
  absence :: BexioApiClient.Payroll.Absence.t()
) :: {:ok, true} | api_error_type()

Update an existing absence of an employee.

Unlike when creating an absence, all fields of the absence are required by the API.