/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { HTTPMetadata, HTTPMetadata$inboundSchema, } from "../components/httpmetadata.js"; import { PayrollUnprocessed, PayrollUnprocessed$inboundSchema, } from "../components/payroll.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ export const PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion = { TwoThousandAndTwentyFiveMinus06Minus15: "2025-06-15", } as const; /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ export type PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion = ClosedEnum< typeof PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion >; /** * An off cycle payroll reason. Select one from the following list. */ export const OffCycleReason = { Bonus: "Bonus", Correction: "Correction", Adhoc: "Adhoc", DismissedEmployee: "Dismissed employee", TransitionFromOldPaySchedule: "Transition from old pay schedule", } as const; /** * An off cycle payroll reason. Select one from the following list. */ export type OffCycleReason = ClosedEnum; /** * The payment schedule tax rate the payroll is based on. */ export const WithholdingPayPeriod = { EveryWeek: "Every week", EveryOtherWeek: "Every other week", TwicePerMonth: "Twice per month", Monthly: "Monthly", Quarterly: "Quarterly", Semiannually: "Semiannually", Annually: "Annually", } as const; /** * The payment schedule tax rate the payroll is based on. */ export type WithholdingPayPeriod = ClosedEnum; export type PostV1CompaniesCompanyIdPayrollsRequestBody = { /** * Whether it is an off cycle payroll. */ offCycle: boolean; /** * An off cycle payroll reason. Select one from the following list. */ offCycleReason: OffCycleReason; /** * Pay period start date. */ startDate: RFCDate; /** * Pay period end date. */ endDate: RFCDate; /** * A pay schedule is required for transition from old pay schedule payroll to identify the matching transition pay period. */ payScheduleUuid?: string | undefined; /** * A list of employee uuids to include on the payroll. */ employeeUuids?: Array | null | undefined; /** * Payment date. */ checkDate?: RFCDate | undefined; /** * The payment schedule tax rate the payroll is based on. */ withholdingPayPeriod?: WithholdingPayPeriod | undefined; /** * Block regular deductions and contributions for this payroll. */ skipRegularDeductions?: boolean | undefined; /** * Enable taxes to be withheld at the IRS's required rate of 22% for federal income taxes. State income taxes will be taxed at the state's supplemental tax rate. Otherwise, we'll sum the entirety of the employee's wages and withhold taxes on the entire amount at the rate for regular wages. */ fixedWithholdingRate?: boolean | undefined; /** * When true, all employees in the payroll will be paid by check and the check date can be set to today or any future business day (rather than requiring ACH lead time). Payment methods cannot be changed on check-only payrolls. */ isCheckOnlyPayroll?: boolean | undefined; }; export type PostV1CompaniesCompanyIdPayrollsRequest = { /** * Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used. */ xGustoAPIVersion?: | PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion | undefined; /** * The UUID of the company */ companyId: string; requestBody?: PostV1CompaniesCompanyIdPayrollsRequestBody | undefined; }; export type PostV1CompaniesCompanyIdPayrollsResponse = { httpMeta: HTTPMetadata; /** * Successful */ payrollUnprocessed?: PayrollUnprocessed | undefined; }; /** @internal */ export const PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum< typeof PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion > = z.nativeEnum(PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion); /** @internal */ export const OffCycleReason$outboundSchema: z.ZodNativeEnum< typeof OffCycleReason > = z.nativeEnum(OffCycleReason); /** @internal */ export const WithholdingPayPeriod$outboundSchema: z.ZodNativeEnum< typeof WithholdingPayPeriod > = z.nativeEnum(WithholdingPayPeriod); /** @internal */ export type PostV1CompaniesCompanyIdPayrollsRequestBody$Outbound = { off_cycle: boolean; off_cycle_reason: string; start_date: string; end_date: string; pay_schedule_uuid?: string | undefined; employee_uuids?: Array | null | undefined; check_date?: string | undefined; withholding_pay_period?: string | undefined; skip_regular_deductions?: boolean | undefined; fixed_withholding_rate?: boolean | undefined; is_check_only_payroll?: boolean | undefined; }; /** @internal */ export const PostV1CompaniesCompanyIdPayrollsRequestBody$outboundSchema: z.ZodType< PostV1CompaniesCompanyIdPayrollsRequestBody$Outbound, z.ZodTypeDef, PostV1CompaniesCompanyIdPayrollsRequestBody > = z.object({ offCycle: z.boolean(), offCycleReason: OffCycleReason$outboundSchema, startDate: z.instanceof(RFCDate).transform(v => v.toString()), endDate: z.instanceof(RFCDate).transform(v => v.toString()), payScheduleUuid: z.string().optional(), employeeUuids: z.nullable(z.array(z.string())).optional(), checkDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), withholdingPayPeriod: WithholdingPayPeriod$outboundSchema.optional(), skipRegularDeductions: z.boolean().optional(), fixedWithholdingRate: z.boolean().optional(), isCheckOnlyPayroll: z.boolean().optional(), }).transform((v) => { return remap$(v, { offCycle: "off_cycle", offCycleReason: "off_cycle_reason", startDate: "start_date", endDate: "end_date", payScheduleUuid: "pay_schedule_uuid", employeeUuids: "employee_uuids", checkDate: "check_date", withholdingPayPeriod: "withholding_pay_period", skipRegularDeductions: "skip_regular_deductions", fixedWithholdingRate: "fixed_withholding_rate", isCheckOnlyPayroll: "is_check_only_payroll", }); }); export function postV1CompaniesCompanyIdPayrollsRequestBodyToJSON( postV1CompaniesCompanyIdPayrollsRequestBody: PostV1CompaniesCompanyIdPayrollsRequestBody, ): string { return JSON.stringify( PostV1CompaniesCompanyIdPayrollsRequestBody$outboundSchema.parse( postV1CompaniesCompanyIdPayrollsRequestBody, ), ); } /** @internal */ export type PostV1CompaniesCompanyIdPayrollsRequest$Outbound = { "X-Gusto-API-Version": string; company_id: string; RequestBody?: | PostV1CompaniesCompanyIdPayrollsRequestBody$Outbound | undefined; }; /** @internal */ export const PostV1CompaniesCompanyIdPayrollsRequest$outboundSchema: z.ZodType< PostV1CompaniesCompanyIdPayrollsRequest$Outbound, z.ZodTypeDef, PostV1CompaniesCompanyIdPayrollsRequest > = z.object({ xGustoAPIVersion: PostV1CompaniesCompanyIdPayrollsHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), companyId: z.string(), requestBody: z.lazy(() => PostV1CompaniesCompanyIdPayrollsRequestBody$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", companyId: "company_id", requestBody: "RequestBody", }); }); export function postV1CompaniesCompanyIdPayrollsRequestToJSON( postV1CompaniesCompanyIdPayrollsRequest: PostV1CompaniesCompanyIdPayrollsRequest, ): string { return JSON.stringify( PostV1CompaniesCompanyIdPayrollsRequest$outboundSchema.parse( postV1CompaniesCompanyIdPayrollsRequest, ), ); } /** @internal */ export const PostV1CompaniesCompanyIdPayrollsResponse$inboundSchema: z.ZodType< PostV1CompaniesCompanyIdPayrollsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Payroll-Unprocessed": PayrollUnprocessed$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Payroll-Unprocessed": "payrollUnprocessed", }); }); export function postV1CompaniesCompanyIdPayrollsResponseFromJSON( jsonString: string, ): SafeParseResult< PostV1CompaniesCompanyIdPayrollsResponse, SDKValidationError > { return safeParse( jsonString, (x) => PostV1CompaniesCompanyIdPayrollsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV1CompaniesCompanyIdPayrollsResponse' from JSON`, ); }