/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { payrollsCalculate } from "../funcs/payrollsCalculate.js"; import { payrollsCalculateGrossUp } from "../funcs/payrollsCalculateGrossUp.js"; import { payrollsCancel } from "../funcs/payrollsCancel.js"; import { payrollsCreateOffCycle } from "../funcs/payrollsCreateOffCycle.js"; import { payrollsDelete } from "../funcs/payrollsDelete.js"; import { payrollsGeneratePrintableChecks } from "../funcs/payrollsGeneratePrintableChecks.js"; import { payrollsGet } from "../funcs/payrollsGet.js"; import { payrollsGetApprovedReversals } from "../funcs/payrollsGetApprovedReversals.js"; import { payrollsGetBlockers } from "../funcs/payrollsGetBlockers.js"; import { payrollsGetPayStub } from "../funcs/payrollsGetPayStub.js"; import { payrollsGetPayStubs } from "../funcs/payrollsGetPayStubs.js"; import { payrollsGetReceipt } from "../funcs/payrollsGetReceipt.js"; import { payrollsGetV1CompaniesCompanyIdPayrollsIdPartnerDisbursements } from "../funcs/payrollsGetV1CompaniesCompanyIdPayrollsIdPartnerDisbursements.js"; import { payrollsList } from "../funcs/payrollsList.js"; import { payrollsPatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursements } from "../funcs/payrollsPatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursements.js"; import { payrollsPrepare } from "../funcs/payrollsPrepare.js"; import { payrollsSkip } from "../funcs/payrollsSkip.js"; import { payrollsSubmit } from "../funcs/payrollsSubmit.js"; import { payrollsUpdate } from "../funcs/payrollsUpdate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { DeleteV1CompaniesCompanyIdPayrollsRequest, DeleteV1CompaniesCompanyIdPayrollsResponse, } from "../models/operations/deletev1companiescompanyidpayrolls.js"; import { GetV1CompaniesCompanyIdPayrollReversalsRequest, GetV1CompaniesCompanyIdPayrollReversalsResponse, } from "../models/operations/getv1companiescompanyidpayrollreversals.js"; import { GetV1CompaniesCompanyIdPayrollsRequest, GetV1CompaniesCompanyIdPayrollsResponse, } from "../models/operations/getv1companiescompanyidpayrolls.js"; import { GetV1CompaniesCompanyIdPayrollsIdPartnerDisbursementsRequest, GetV1CompaniesCompanyIdPayrollsIdPartnerDisbursementsResponse, } from "../models/operations/getv1companiescompanyidpayrollsidpartnerdisbursements.js"; import { GetV1CompaniesCompanyIdPayrollsPayrollIdRequest, GetV1CompaniesCompanyIdPayrollsPayrollIdResponse, } from "../models/operations/getv1companiescompanyidpayrollspayrollid.js"; import { GetV1CompaniesPayrollBlockersCompanyUuidRequest, GetV1CompaniesPayrollBlockersCompanyUuidResponse, } from "../models/operations/getv1companiespayrollblockerscompanyuuid.js"; import { GetV1EmployeesEmployeeUuidPayStubsRequest, GetV1EmployeesEmployeeUuidPayStubsResponse, } from "../models/operations/getv1employeesemployeeuuidpaystubs.js"; import { GetV1PaymentReceiptsPayrollsPayrollUuidRequest, GetV1PaymentReceiptsPayrollsPayrollUuidResponse, } from "../models/operations/getv1paymentreceiptspayrollspayrolluuid.js"; import { GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubResponse, } from "../models/operations/getv1payrollspayrolluuidemployeesemployeeuuidpaystub.js"; import { PatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursementsRequest, PatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursementsResponse, } from "../models/operations/patchv1companiescompanyidpayrollsidpartnerdisbursements.js"; import { PostCompaniesPayrollSkipCompanyUuidRequest, PostCompaniesPayrollSkipCompanyUuidResponse, } from "../models/operations/postcompaniespayrollskipcompanyuuid.js"; import { PostPayrollsGrossUpPayrollUuidRequest, PostPayrollsGrossUpPayrollUuidResponse, } from "../models/operations/postpayrollsgrossuppayrolluuid.js"; import { PostV1CompaniesCompanyIdPayrollsRequest, PostV1CompaniesCompanyIdPayrollsResponse, } from "../models/operations/postv1companiescompanyidpayrolls.js"; import { PostV1PayrollsPayrollUuidGeneratedDocumentsPrintablePayrollChecksRequest, PostV1PayrollsPayrollUuidGeneratedDocumentsPrintablePayrollChecksResponse, } from "../models/operations/postv1payrollspayrolluuidgenerateddocumentsprintablepayrollchecks.js"; import { PutApiV1CompaniesCompanyIdPayrollsPayrollIdCancelRequest, PutApiV1CompaniesCompanyIdPayrollsPayrollIdCancelResponse, } from "../models/operations/putapiv1companiescompanyidpayrollspayrollidcancel.js"; import { PutV1CompaniesCompanyIdPayrollsRequest, PutV1CompaniesCompanyIdPayrollsResponse, } from "../models/operations/putv1companiescompanyidpayrolls.js"; import { PutV1CompaniesCompanyIdPayrollsPayrollIdCalculateRequest, PutV1CompaniesCompanyIdPayrollsPayrollIdCalculateResponse, } from "../models/operations/putv1companiescompanyidpayrollspayrollidcalculate.js"; import { PutV1CompaniesCompanyIdPayrollsPayrollIdPrepareRequest, PutV1CompaniesCompanyIdPayrollsPayrollIdPrepareResponse, } from "../models/operations/putv1companiescompanyidpayrollspayrollidprepare.js"; import { PutV1CompaniesCompanyIdPayrollsPayrollIdSubmitRequest, PutV1CompaniesCompanyIdPayrollsPayrollIdSubmitResponse, } from "../models/operations/putv1companiescompanyidpayrollspayrollidsubmit.js"; import { unwrapAsync } from "../types/fp.js"; export class Payrolls extends ClientSDK { /** * Get all payrolls for a company * * @remarks * Returns a list of payrolls for a company. You can change the payrolls returned by updating the processing_status, payroll_types, start_date, & end_date params. * * By default, will return processed, regular payrolls for the past 6 months. * * Notes: * * Dollar amounts are returned as string representations of numeric decimals, are represented to the cent. * * end_date can be at most 3 months in the future and start_date and end_date can't be more than 1 year apart. * * Results are paginated. Maximum page size is 100 payrolls per request; the default page size is 25. * * scope: `payrolls:read` */ async list( request: GetV1CompaniesCompanyIdPayrollsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsList( this, request, options, )); } /** * Create an off-cycle payroll * * @remarks * Creates a new, unprocessed, off-cycle payroll. * * ## `off_cycle_reason` * By default: * - External benefits and deductions will be included when the `off_cycle_reason` is set to `Correction`. * - All benefits and deductions are blocked when the `off_cycle_reason` is set to `Bonus`. * * These elections can be overridden with the `skip_regular_deductions` boolean. * * scope: `payrolls:run` */ async createOffCycle( request: PostV1CompaniesCompanyIdPayrollsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsCreateOffCycle( this, request, options, )); } /** * Get approved payroll reversals * * @remarks * Returns all approved Payroll Reversals for a Company. * * scope: `payrolls:read` */ async getApprovedReversals( request: GetV1CompaniesCompanyIdPayrollReversalsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsGetApprovedReversals( this, request, options, )); } /** * Get a single payroll * * @remarks * Returns a payroll. If payroll is calculated or processed, will return employee_compensations and totals. * * Results are paginated, with a maximum page size of 100 employee_compensations. * * Notes: * * Hour and dollar amounts are returned as string representations of numeric decimals. * * Hours are represented to the thousands place; dollar amounts are represented to the cent. * * Every eligible compensation is returned for each employee. If no data has yet be inserted for a given field, it defaults to "0.00" (for fixed amounts) or "0.000" (for hours ). * * When include parameter with benefits value is passed, employee_benefits:read scope is required to return benefits * * Benefits containing PHI are only visible with the `employee_benefits:read:phi` scope * * scope: `payrolls:read` */ async get( request: GetV1CompaniesCompanyIdPayrollsPayrollIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsGet( this, request, options, )); } /** * Update a payroll by ID * * @remarks * This endpoint allows you to update information for one or more employees for a specific **unprocessed** payroll. You can think of the **unprocessed** * payroll object as a template of fields that you can update. You cannot modify the structure of the payroll object through this endpoint, only values * of the fields included in the payroll. If you do not include specific employee compensations, fixed/hourly compensations, or deductions in your request body, they * will not be removed from the payroll. A maximum of 100 employee_compensations can be updated at a time. Only the employee compensation objects that were * inputted will be returned. * * scope: `payrolls:write` */ async update( request: PutV1CompaniesCompanyIdPayrollsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsUpdate( this, request, options, )); } /** * Delete a payroll * * @remarks * This endpoint allows you to delete an **unprocessed** payroll. * * By default the payroll and associated data is deleted synchronously. To request an asynchronous delete, use the `async=true` query parameter. In both cases validation of ability to delete will be performed and an Unprocessable Entity error will be returned if the payroll is not able to be deleted. A successful synchronous delete will return `204/No Content`. When a payroll has been enqueued for asynchronous deletion, `202/Accepted` will be returned. * * scope: `payrolls:run` */ async delete( request: DeleteV1CompaniesCompanyIdPayrollsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsDelete( this, request, options, )); } /** * Prepare a payroll for update * * @remarks * Prepares an unprocessed payroll for update, including: adding or removing eligible employees from the payroll, * and updating `check_date`, `payroll_deadline`, and `payroll_status_meta` dates and times. * * Use this endpoint before calling [PUT /v1/companies/{company_id}/payrolls/{payroll_id}](ref:put-v1-companies-company_id-payrolls). * * ### Notes * * * Nullifies `calculated_at` and `totals` if the payroll was previously calculated * * Returns the `version` parameter required for [updating the payroll](ref:put-v1-companies-company_id-payrolls) * * `employees:read` scope is required to include employee compensations data in the response. * * Results are paginated, with a maximum page size of 100 employee compensations. * * scope: `payrolls:write employees:read` */ async prepare( request: PutV1CompaniesCompanyIdPayrollsPayrollIdPrepareRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsPrepare( this, request, options, )); } /** * Get a single payroll receipt * * @remarks * Returns a payroll receipt. * * Notes: * * Hour and dollar amounts are returned as string representations of numeric decimals. * * Dollar amounts are represented to the cent. * * If no data has yet be inserted for a given field, it defaults to "0.00" (for fixed amounts). * * scope: `payrolls:read` */ async getReceipt( request: GetV1PaymentReceiptsPayrollsPayrollUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsGetReceipt( this, request, options, )); } /** * Get all payroll blockers for a company * * @remarks * Returns a list of reasons that prevent the company from running payrolls. See the [Payroll Blockers guide](doc:payroll-blockers) for a complete list of reasons. The list is empty if there are no payroll blockers. * * scope: `payrolls:run` */ async getBlockers( request: GetV1CompaniesPayrollBlockersCompanyUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsGetBlockers( this, request, options, )); } /** * Skip a payroll * * @remarks * Submits a $0 payroll for employees associated with the pay schedule to skip payroll. This submission is asynchronous and a successful request responds with a 202 HTTP status. Upon success, the payroll is transitioned to the `processed` state. * * If the company is blocked from running payroll due to issues like incomplete setup, missing information or other compliance issues, the response will be 422 Unprocessable Entity with a categorization of the blockers as described in the error responses. * * scope: `payrolls:run` */ async skip( request: PostCompaniesPayrollSkipCompanyUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsSkip( this, request, options, )); } /** * Calculate gross up for a payroll * * @remarks * Calculates gross up earnings for an employee's payroll, given net earnings. This endpoint is only applicable to off-cycle unprocessed payrolls. * * The gross up amount must then be mapped to the corresponding fixed compensation earning type to get the correct payroll amount. For example, for bonus off-cycles, the gross up amount should be set with the Bonus earning type in the payroll `fixed_compensations` field. * * scope: `payrolls:run` */ async calculateGrossUp( request: PostPayrollsGrossUpPayrollUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsCalculateGrossUp( this, request, options, )); } /** * Calculate a payroll * * @remarks * Performs calculations for taxes, benefits, and deductions for an unprocessed payroll. The calculated payroll details provide a preview of the actual values that will be used when the payroll is run. * * This calculation is asynchronous and a successful request responds with a 202 HTTP status. To view the details of the calculated payroll, use the GET /v1/companies/{company_id}/payrolls/{payroll_id} endpoint with *include=taxes,benefits,deductions* params. * * If the company is blocked from running payroll due to issues like incomplete setup, missing information or other compliance issues, the response will be 422 Unprocessable Entity with a categorization of the blockers as described in the error responses. * * scope: `payrolls:run` */ async calculate( request: PutV1CompaniesCompanyIdPayrollsPayrollIdCalculateRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsCalculate( this, request, options, )); } /** * Submit payroll * * @remarks * Submits an unprocessed payroll to be calculated and run. This submission is asynchronous and a successful request responds with a 202 HTTP status. Upon success, transitions the payroll to the `processed` state. * * You should poll to ensure that payroll is processed successfully, as async errors only occur after async processing is complete. * * If the company is blocked from running payroll due to issues like incomplete setup, missing information or other compliance issues, the response will be 422 Unprocessable Entity with a categorization of the blockers as described in the error responses. * * scope: `payrolls:run` */ async submit( request: PutV1CompaniesCompanyIdPayrollsPayrollIdSubmitRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsSubmit( this, request, options, )); } /** * Cancel a payroll * * @remarks * Transitions a `processed` payroll back to the `unprocessed` state. A payroll can be canceled if it meets both criteria: * * - `processed` is `true` * - Current time is earlier than 4pm PT on the `payroll_deadline` * * scope: `payrolls:run` */ async cancel( request: PutApiV1CompaniesCompanyIdPayrollsPayrollIdCancelRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsCancel( this, request, options, )); } /** * Get an employee pay stub (pdf) * * @remarks * Get an employee's pay stub for the specified payroll. By default, an application/pdf response will be returned. No other content types are currently supported, but may be supported in the future. * * scope: `pay_stubs:read` */ async getPayStub( request: GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsGetPayStub( this, request, options, )); } /** * Get an employee's pay stubs * * @remarks * Get an employee's pay stubs. * * Results are returned in reverse chronological order (newest first). * * scope: `pay_stubs:read` */ async getPayStubs( request: GetV1EmployeesEmployeeUuidPayStubsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollsGetPayStubs( this, request, options, )); } /** * Generate printable payroll checks (pdf) * * @remarks * This endpoint initiates the generation of employee checks for the payroll specified by payroll_uuid. A generation status and corresponding request_uuid will be returned. Use the generated document GET endpoint with document_type: `printable_payroll_checks` and request_uuid to poll the check generation process and retrieve the generated check URL upon completion. * * scope: `generated_documents:write` */ async generatePrintableChecks( request: PostV1PayrollsPayrollUuidGeneratedDocumentsPrintablePayrollChecksRequest, options?: RequestOptions, ): Promise< PostV1PayrollsPayrollUuidGeneratedDocumentsPrintablePayrollChecksResponse > { return unwrapAsync(payrollsGeneratePrintableChecks( this, request, options, )); } /** * Get partner disbursements for a payroll * * @remarks * Get partner disbursements for a specific payroll. * * scope: `partner_disbursements:read` */ async getV1CompaniesCompanyIdPayrollsIdPartnerDisbursements( request: GetV1CompaniesCompanyIdPayrollsIdPartnerDisbursementsRequest, options?: RequestOptions, ): Promise { return unwrapAsync( payrollsGetV1CompaniesCompanyIdPayrollsIdPartnerDisbursements( this, request, options, ), ); } /** * Update partner disbursements for a payroll * * @remarks * Update partner disbursements for a specific payroll. * * scope: `partner_disbursements:write` */ async patchV1CompaniesCompanyIdPayrollsIdPartnerDisbursements( request: PatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursementsRequest, options?: RequestOptions, ): Promise { return unwrapAsync( payrollsPatchV1CompaniesCompanyIdPayrollsIdPartnerDisbursements( this, request, options, ), ); } }