/* * 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 type of payment method. */ export const EmployeePaymentDetailsListPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", } as const; /** * The type of payment method. */ export type EmployeePaymentDetailsListPaymentMethod = ClosedEnum< typeof EmployeePaymentDetailsListPaymentMethod >; export const SplitBy = { Amount: "Amount", Percentage: "Percentage", } as const; export type SplitBy = ClosedEnum; export type Splits = { /** * The UUID of the bank account. */ bankAccountUuid?: string | undefined; /** * The name of the bank account. */ name?: string | undefined; /** * An obfuscated version of the account number which can be used for display purposes. */ hiddenAccountNumber?: string | undefined; /** * Ciphertext containing the full bank account number, which must be decrypted using a key provided by Gusto. Only visible with the `employee_payment_methods:read:account_number` scope. */ encryptedAccountNumber?: string | null | undefined; /** * The routing number of the bank account. */ routingNumber?: string | undefined; /** * The bank account type (e.g., "Checking" or "Savings"). */ accountType?: string | undefined; /** * The order of priority for each payment split, with priority 1 being the first bank account paid. Priority must be unique and sequential. */ priority?: number | undefined; /** * If `split_by` is 'Amount', this is in cents (e.g., 500 for $5.00) and exactly one account must have a `split_amount` of `null` to capture the remainder. If `split_by` is 'Percentage', this is the percentage value (e.g., 60 for 60%). */ splitAmount?: number | null | undefined; }; export type EmployeePaymentDetailsList = { /** * The UUID of the employee. */ employeeUuid?: string | undefined; /** * The legal first name of the employee. */ firstName?: string | undefined; /** * The last name of the employee. */ lastName?: string | undefined; /** * The type of payment method. */ paymentMethod?: EmployeePaymentDetailsListPaymentMethod | undefined; /** * How the payment is split. This field is applicable when `payment_method` is "Direct Deposit". If `split_by` is Percentage, then the split amounts must add up to exactly 100. If `split_by` is Amount, the last split amount must be `null` to capture the remainder. */ splitBy?: SplitBy | null | undefined; /** * An array of payment splits. This field is applicable when `payment_method` is "Direct Deposit". */ splits?: Array | null | undefined; }; /** @internal */ export const EmployeePaymentDetailsListPaymentMethod$inboundSchema: z.ZodNativeEnum = z .nativeEnum(EmployeePaymentDetailsListPaymentMethod); /** @internal */ export const SplitBy$inboundSchema: z.ZodNativeEnum = z .nativeEnum(SplitBy); /** @internal */ export const Splits$inboundSchema: z.ZodType = z .object({ bank_account_uuid: z.string().optional(), name: z.string().optional(), hidden_account_number: z.string().optional(), encrypted_account_number: z.nullable(z.string()).optional(), routing_number: z.string().optional(), account_type: z.string().optional(), priority: z.number().int().optional(), split_amount: z.nullable(z.number()).optional(), }).transform((v) => { return remap$(v, { "bank_account_uuid": "bankAccountUuid", "hidden_account_number": "hiddenAccountNumber", "encrypted_account_number": "encryptedAccountNumber", "routing_number": "routingNumber", "account_type": "accountType", "split_amount": "splitAmount", }); }); export function splitsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Splits$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Splits' from JSON`, ); } /** @internal */ export const EmployeePaymentDetailsList$inboundSchema: z.ZodType< EmployeePaymentDetailsList, z.ZodTypeDef, unknown > = z.object({ employee_uuid: z.string().optional(), first_name: z.string().optional(), last_name: z.string().optional(), payment_method: EmployeePaymentDetailsListPaymentMethod$inboundSchema .optional(), split_by: z.nullable(SplitBy$inboundSchema).optional(), splits: z.nullable(z.array(z.lazy(() => Splits$inboundSchema))).optional(), }).transform((v) => { return remap$(v, { "employee_uuid": "employeeUuid", "first_name": "firstName", "last_name": "lastName", "payment_method": "paymentMethod", "split_by": "splitBy", }); }); export function employeePaymentDetailsListFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeePaymentDetailsList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeePaymentDetailsList' from JSON`, ); }