/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The subtotals for the payroll. */ export type Totals = { /** * The total company debit for the payroll. */ companyDebit?: string | undefined; /** * The total company net pay for the payroll. */ netPayDebit?: string | undefined; /** * The total child support debit for the payroll. */ childSupportDebit?: string | undefined; /** * The total reimbursements for the payroll. */ reimbursementDebit?: string | undefined; /** * The total tax debit for the payroll. */ taxDebit?: string | undefined; }; export type Taxes = { /** * The amount paid for this tax. */ name?: string | undefined; /** * The total amount paid by both employer and employee for this tax. */ amount?: string | undefined; }; /** * The employee's compensation payment method. */ export const PayrollReceiptPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", } as const; /** * The employee's compensation payment method. */ export type PayrollReceiptPaymentMethod = ClosedEnum< typeof PayrollReceiptPaymentMethod >; export type PayrollReceiptEmployeeCompensations = { /** * The UUID of the employee. */ employeeUuid?: string | undefined; /** * The first name of the employee. */ employeeFirstName?: string | undefined; /** * The last name of the employee. */ employeeLastName?: string | undefined; /** * The employee's compensation payment method. */ paymentMethod?: PayrollReceiptPaymentMethod | undefined; /** * The employee's net pay. Net pay paid by check is available for reference but is not included in the `["totals"]["net_pay_debit"]` amount. */ netPay?: string | undefined; /** * The total of employer and employee taxes for the pay period. */ totalTax?: string | undefined; /** * The total garnishments for the pay period. */ totalGarnishments?: string | undefined; /** * The total child support garnishment for the pay period. */ childSupportGarnishment?: string | undefined; /** * The total reimbursement for the pay period. */ totalReimbursement?: string | undefined; }; /** * The licensed payroll processor */ export type Licensee = { /** * Always the fixed string "Gusto, Zenpayroll Inc." */ name?: string | undefined; /** * Always the fixed string "525 20th St" */ address?: string | undefined; /** * Always the fixed string "San Francisco" */ city?: string | undefined; /** * Always the fixed string "CA" */ state?: string | undefined; /** * Always the fixed string "94107" */ postalCode?: string | undefined; /** * Always the fixed string "4157778888" */ phoneNumber?: string | undefined; }; export type PayrollReceipt = { /** * A unique identifier of the payroll receipt. */ payrollUuid?: string | undefined; /** * A unique identifier of the company for the payroll. */ companyUuid?: string | undefined; /** * The name of the company by whom the payroll was paid */ nameOfSender?: string | undefined; /** * Always the fixed string "Payroll Recipients" */ nameOfRecipient?: string | undefined; /** * Always the fixed string "Payroll recipients include the employees listed below plus the tax agencies for the taxes listed below." */ recipientNotice?: string | undefined; /** * The debit or funding date for the payroll */ debitDate?: string | undefined; /** * Always the fixed string "ZenPayroll, Inc., dba Gusto is a licensed money transmitter. For more about Gusto’s licenses and your state-specific rights to request information, submit complaints, dispute errors, or cancel transactions, visit our license page." */ license?: string | undefined; /** * URL for the license information for the licensed payroll processor. Always the fixed string "https://gusto.com/about/licenses" */ licenseUri?: string | undefined; rightToRefund?: string | undefined; liabilityOfLicensee?: string | undefined; /** * The subtotals for the payroll. */ totals?: Totals | undefined; /** * An array of totaled employer and employee taxes for the pay period. */ taxes?: Array | undefined; /** * An array of employee compensations and withholdings for this payroll */ employeeCompensations?: | Array | undefined; /** * The licensed payroll processor */ licensee?: Licensee | undefined; }; /** @internal */ export const Totals$inboundSchema: z.ZodType = z .object({ company_debit: z.string().optional(), net_pay_debit: z.string().optional(), child_support_debit: z.string().optional(), reimbursement_debit: z.string().optional(), tax_debit: z.string().optional(), }).transform((v) => { return remap$(v, { "company_debit": "companyDebit", "net_pay_debit": "netPayDebit", "child_support_debit": "childSupportDebit", "reimbursement_debit": "reimbursementDebit", "tax_debit": "taxDebit", }); }); export function totalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Totals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Totals' from JSON`, ); } /** @internal */ export const Taxes$inboundSchema: z.ZodType = z .object({ name: z.string().optional(), amount: z.string().optional(), }); export function taxesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Taxes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Taxes' from JSON`, ); } /** @internal */ export const PayrollReceiptPaymentMethod$inboundSchema: z.ZodNativeEnum< typeof PayrollReceiptPaymentMethod > = z.nativeEnum(PayrollReceiptPaymentMethod); /** @internal */ export const PayrollReceiptEmployeeCompensations$inboundSchema: z.ZodType< PayrollReceiptEmployeeCompensations, z.ZodTypeDef, unknown > = z.object({ employee_uuid: z.string().optional(), employee_first_name: z.string().optional(), employee_last_name: z.string().optional(), payment_method: PayrollReceiptPaymentMethod$inboundSchema.optional(), net_pay: z.string().optional(), total_tax: z.string().optional(), total_garnishments: z.string().optional(), child_support_garnishment: z.string().optional(), total_reimbursement: z.string().optional(), }).transform((v) => { return remap$(v, { "employee_uuid": "employeeUuid", "employee_first_name": "employeeFirstName", "employee_last_name": "employeeLastName", "payment_method": "paymentMethod", "net_pay": "netPay", "total_tax": "totalTax", "total_garnishments": "totalGarnishments", "child_support_garnishment": "childSupportGarnishment", "total_reimbursement": "totalReimbursement", }); }); export function payrollReceiptEmployeeCompensationsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayrollReceiptEmployeeCompensations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayrollReceiptEmployeeCompensations' from JSON`, ); } /** @internal */ export const Licensee$inboundSchema: z.ZodType< Licensee, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), address: z.string().optional(), city: z.string().optional(), state: z.string().optional(), postal_code: z.string().optional(), phone_number: z.string().optional(), }).transform((v) => { return remap$(v, { "postal_code": "postalCode", "phone_number": "phoneNumber", }); }); export function licenseeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Licensee$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Licensee' from JSON`, ); } /** @internal */ export const PayrollReceipt$inboundSchema: z.ZodType< PayrollReceipt, z.ZodTypeDef, unknown > = z.object({ payroll_uuid: z.string().optional(), company_uuid: z.string().optional(), name_of_sender: z.string().optional(), name_of_recipient: z.string().optional(), recipient_notice: z.string().optional(), debit_date: z.string().optional(), license: z.string().optional(), license_uri: z.string().optional(), right_to_refund: z.string().optional(), liability_of_licensee: z.string().optional(), totals: z.lazy(() => Totals$inboundSchema).optional(), taxes: z.array(z.lazy(() => Taxes$inboundSchema)).optional(), employee_compensations: z.array( z.lazy(() => PayrollReceiptEmployeeCompensations$inboundSchema), ).optional(), licensee: z.lazy(() => Licensee$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "payroll_uuid": "payrollUuid", "company_uuid": "companyUuid", "name_of_sender": "nameOfSender", "name_of_recipient": "nameOfRecipient", "recipient_notice": "recipientNotice", "debit_date": "debitDate", "license_uri": "licenseUri", "right_to_refund": "rightToRefund", "liability_of_licensee": "liabilityOfLicensee", "employee_compensations": "employeeCompensations", }); }); export function payrollReceiptFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayrollReceipt$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayrollReceipt' from JSON`, ); }