/* * 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 { EmployeePaymentMethod, EmployeePaymentMethod$inboundSchema, } from "../components/employeepaymentmethod.js"; import { HTTPMetadata, HTTPMetadata$inboundSchema, } from "../components/httpmetadata.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 PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion = { 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 PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion = ClosedEnum< typeof PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion >; /** * The payment method type. If type is Check, split_by and splits do not need to be populated. If type is Direct Deposit, split_by and splits are required. */ export const Type = { Check: "Check", DirectDeposit: "Direct Deposit", } as const; /** * The payment method type. If type is Check, split_by and splits do not need to be populated. If type is Direct Deposit, split_by and splits are required. */ export type Type = ClosedEnum; export const SplitBy = { Percentage: "Percentage", Amount: "Amount", } as const; export type SplitBy = ClosedEnum; export type Splits = { /** * The bank account UUID. */ uuid?: string | undefined; /** * The bank account name. */ name?: string | undefined; /** * Order of priority for each payment split; priority 1 is the first account paid. Must be unique and sequential. */ priority?: number | undefined; /** * If split_by is Amount, value is in cents (e.g., 500 for $5.00) and exactly one account must have null to capture the remainder. If split_by is Percentage, value is the percentage (e.g., 60 for 60%). */ splitAmount?: number | null | undefined; }; export type PutV1EmployeesEmployeeIdPaymentMethodRequestBody = { /** * The current version of the object. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/versioning#object-layer) for information on how to use this field. */ version: string; /** * The payment method type. If type is Check, split_by and splits do not need to be populated. If type is Direct Deposit, split_by and splits are required. */ type: Type; /** * How the payment will be split. If Percentage, split amounts must add up to exactly 100. If Amount, values are in cents and the last split amount must be null to capture the remainder. */ splitBy?: SplitBy | null | undefined; /** * Array of payment splits. Required when type is Direct Deposit. */ splits?: Array | null | undefined; }; export type PutV1EmployeesEmployeeIdPaymentMethodRequest = { /** * 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?: | PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion | undefined; /** * The UUID of the employee */ employeeId: string; requestBody: PutV1EmployeesEmployeeIdPaymentMethodRequestBody; }; export type PutV1EmployeesEmployeeIdPaymentMethodResponse = { httpMeta: HTTPMetadata; /** * Successful */ employeePaymentMethod?: EmployeePaymentMethod | undefined; }; /** @internal */ export const PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion$outboundSchema: z.ZodNativeEnum< typeof PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion > = z.nativeEnum(PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion); /** @internal */ export const Type$outboundSchema: z.ZodNativeEnum = z.nativeEnum( Type, ); /** @internal */ export const SplitBy$outboundSchema: z.ZodNativeEnum = z .nativeEnum(SplitBy); /** @internal */ export type Splits$Outbound = { uuid?: string | undefined; name?: string | undefined; priority?: number | undefined; split_amount?: number | null | undefined; }; /** @internal */ export const Splits$outboundSchema: z.ZodType< Splits$Outbound, z.ZodTypeDef, Splits > = z.object({ uuid: z.string().optional(), name: z.string().optional(), priority: z.number().int().optional(), splitAmount: z.nullable(z.number()).optional(), }).transform((v) => { return remap$(v, { splitAmount: "split_amount", }); }); export function splitsToJSON(splits: Splits): string { return JSON.stringify(Splits$outboundSchema.parse(splits)); } /** @internal */ export type PutV1EmployeesEmployeeIdPaymentMethodRequestBody$Outbound = { version: string; type: string; split_by?: string | null | undefined; splits?: Array | null | undefined; }; /** @internal */ export const PutV1EmployeesEmployeeIdPaymentMethodRequestBody$outboundSchema: z.ZodType< PutV1EmployeesEmployeeIdPaymentMethodRequestBody$Outbound, z.ZodTypeDef, PutV1EmployeesEmployeeIdPaymentMethodRequestBody > = z.object({ version: z.string(), type: Type$outboundSchema, splitBy: z.nullable(SplitBy$outboundSchema).optional(), splits: z.nullable(z.array(z.lazy(() => Splits$outboundSchema))).optional(), }).transform((v) => { return remap$(v, { splitBy: "split_by", }); }); export function putV1EmployeesEmployeeIdPaymentMethodRequestBodyToJSON( putV1EmployeesEmployeeIdPaymentMethodRequestBody: PutV1EmployeesEmployeeIdPaymentMethodRequestBody, ): string { return JSON.stringify( PutV1EmployeesEmployeeIdPaymentMethodRequestBody$outboundSchema.parse( putV1EmployeesEmployeeIdPaymentMethodRequestBody, ), ); } /** @internal */ export type PutV1EmployeesEmployeeIdPaymentMethodRequest$Outbound = { "X-Gusto-API-Version": string; employee_id: string; RequestBody: PutV1EmployeesEmployeeIdPaymentMethodRequestBody$Outbound; }; /** @internal */ export const PutV1EmployeesEmployeeIdPaymentMethodRequest$outboundSchema: z.ZodType< PutV1EmployeesEmployeeIdPaymentMethodRequest$Outbound, z.ZodTypeDef, PutV1EmployeesEmployeeIdPaymentMethodRequest > = z.object({ xGustoAPIVersion: PutV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion$outboundSchema .default("2025-06-15"), employeeId: z.string(), requestBody: z.lazy(() => PutV1EmployeesEmployeeIdPaymentMethodRequestBody$outboundSchema ), }).transform((v) => { return remap$(v, { xGustoAPIVersion: "X-Gusto-API-Version", employeeId: "employee_id", requestBody: "RequestBody", }); }); export function putV1EmployeesEmployeeIdPaymentMethodRequestToJSON( putV1EmployeesEmployeeIdPaymentMethodRequest: PutV1EmployeesEmployeeIdPaymentMethodRequest, ): string { return JSON.stringify( PutV1EmployeesEmployeeIdPaymentMethodRequest$outboundSchema.parse( putV1EmployeesEmployeeIdPaymentMethodRequest, ), ); } /** @internal */ export const PutV1EmployeesEmployeeIdPaymentMethodResponse$inboundSchema: z.ZodType< PutV1EmployeesEmployeeIdPaymentMethodResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: HTTPMetadata$inboundSchema, "Employee-Payment-Method": EmployeePaymentMethod$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Employee-Payment-Method": "employeePaymentMethod", }); }); export function putV1EmployeesEmployeeIdPaymentMethodResponseFromJSON( jsonString: string, ): SafeParseResult< PutV1EmployeesEmployeeIdPaymentMethodResponse, SDKValidationError > { return safeParse( jsonString, (x) => PutV1EmployeesEmployeeIdPaymentMethodResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PutV1EmployeesEmployeeIdPaymentMethodResponse' from JSON`, ); }